‰PNG  IHDR 3 ( S°Âr 7iCCPsRGB IEC61966-2.1 xœ–wTSهϽ7½P’Š”ÐkhRH ½H‘.*1 JÀ "6DTpDQ‘¦2(à€£C‘±"Š…Q±ëDÔqp–Id­ß¼yïÍ›ß÷~kŸ½ÏÝgï}Öº üƒÂLX € ¡Xáçň‹g` ð l àp³³BøF™|ØŒl™ø½º ùû*Ó?ŒÁ ÿŸ”¹Y"1 P˜ŒçòøÙ\É8=Wœ%·Oɘ¶4MÎ0JÎ"Y‚2V“sò,[|ö™e9ó2„<ËsÎâeðäÜ'ã9¾Œ‘`çø¹2¾&cƒtI†@Æoä±|N6 (’Ü.æsSdl-c’(2‚-ãy àHÉ_ðÒ/XÌÏËÅÎÌZ.$§ˆ&\S†“‹áÏÏMç‹ÅÌ07#â1Ø™Yár fÏüYym²";Ø8980m-m¾(Ô]ü›’÷v–^„îDøÃöW~™ °¦eµÙú‡mi ]ëP»ý‡Í`/ в¾u}qº|^RÄâ,g+«ÜÜ\KŸk)/èïúŸC_|ÏR¾Ýïåaxó“8’t1C^7nfz¦DÄÈÎâpù 柇øþuü$¾ˆ/”ED˦L L–µ[Ȉ™B†@øŸšøÃþ¤Ù¹–‰ÚøЖX¥!@~ (* {d+Ðï} ÆGù͋љ˜ûÏ‚þ}W¸LþÈ$ŽcGD2¸QÎìšüZ4 E@ê@èÀ¶À¸ àA(ˆq`1à‚D €µ ”‚­`'¨u 4ƒ6ptcà48.Ë`ÜR0ž€)ð Ì@„…ÈR‡t CȲ…XäCP”%CBH@ë R¨ª†ê¡fè[è(tº C· Qhúz#0 ¦ÁZ°l³`O8Ž„ÁÉð28.‚·À•p|î„O×àX ?§€:¢‹0ÂFB‘x$ !«¤i@ڐ¤¹ŠH‘§È[EE1PL” Ê…⢖¡V¡6£ªQP¨>ÔUÔ(j õMFk¢ÍÑÎè t,:‹.FW ›Ðè³èô8úƒ¡cŒ1ŽL&³³³ÓŽ9…ÆŒa¦±X¬:ÖëŠ År°bl1¶ {{{;Ž}ƒ#âtp¶8_\¡8áú"ãEy‹.,ÖXœ¾øøÅ%œ%Gщ1‰-‰ï9¡œÎôÒ€¥µK§¸lî.îžoo’ïÊ/çO$¹&•'=JvMÞž<™âžR‘òTÀT ž§ú§Ö¥¾N MÛŸö)=&½=—‘˜qTH¦ û2µ3ó2‡³Ì³Š³¤Ëœ—í\6% 5eCÙ‹²»Å4ÙÏÔ€ÄD²^2šã–S“ó&7:÷Hžrž0o`¹ÙòMË'ò}ó¿^ZÁ]Ñ[ [°¶`t¥çÊúUЪ¥«zWë¯.Z=¾Æóµ„µik(´.,/|¹.f]O‘VÑš¢±õ~ë[‹ŠEÅ76¸l¨ÛˆÚ(Ø8¸iMKx%K­K+Jßoæn¾ø•ÍW•_}Ú’´e°Ì¡lÏVÌVáÖëÛÜ·(W.Ï/Û²½scGÉŽ—;—ì¼PaWQ·‹°K²KZ\Ù]ePµµê}uJõHWM{­fí¦Ú×»y»¯ìñØÓV§UWZ÷n¯`ïÍz¿úΣ†Š}˜}9û6F7öÍúº¹I£©´éÃ~á~遈}ÍŽÍÍ-š-e­p«¤uò`ÂÁËßxÓÝÆl«o§·—‡$‡›øíõÃA‡{°Ž´}gø]mµ£¤ê\Þ9Õ•Ò%íŽë>x´·Ç¥§ã{Ëï÷Ó=Vs\åx٠‰¢ŸN柜>•uêééäÓc½Kz=s­/¼oðlÐÙóç|ϝé÷ì?yÞõü± ÎŽ^d]ìºäp©sÀ~ ãû:;‡‡º/;]îž7|âŠû•ÓW½¯ž»píÒÈü‘áëQ×oÞH¸!½É»ùèVú­ç·snÏÜYs}·äžÒ½Šûš÷~4ý±]ê =>ê=:ð`Áƒ;cܱ'?eÿô~¼è!ùaÅ„ÎDó#ÛGÇ&}'/?^øxüIÖ“™§Å?+ÿ\ûÌäÙw¿xü20;5þ\ôüÓ¯›_¨¿ØÿÒîeïtØôýW¯f^—¼Qsà-ëmÿ»˜w3¹ï±ï+?˜~èùôñî§ŒOŸ~÷„óûpf* pHYs  Ê&ó? ÉIDATxœí™mh[UÇo’Û·´iWi`×b;Ym­`p Œ¬­n¢8Dh7ýà‡²‰ƒ9Q?t²f-(¢›:?±(Žiˆ:W¦‚m†…Vi‰ö…®±)KÚ4ñwºÜr“Ü›·¶YÊú‡'çí9ç>ÿsžsÎsoäp8, ŒŽŽÔÖÖv †ç)>€äK·>äòòòr¯,Ë¿¥ÒA?@`g]]‹lÓFZ—&J&“é‰P(ôªÑh<“¬ƒì÷ûwüL~ûÆÛ—LxK„<ú"‘¢ ‘³RîY„ހ̗ ëé7{<‹6­÷ø|¾»HÿÑSd ³gÏÚÀþIh«œ-C²-2¹ŠÛ’ÌUä;ää²-î·ˆiDžBŒ:z7'2ŽØ"’28¢“ˆ`þ˜˜ø¡¦¦ÆŸ ™KCCCO[­Ö%Qà’íånú…ìŽXE>Ê]ðR&9@ù+ BóÁ`Ж——wUÕ÷C’#©’áÞy$Tª®®Å®G’’ᡯ+D Ç™•>y'Fõ1ÔyÚV+8J¿ÁÈÉ>£û‰šÈ »ùùN‹ÅÒ!º¥JH…Lð™¤d`<΃c«4TÇungFÝõØŠÒÒÒëÁeY2›t°?)™âââ}$Õu¬Ê^ Õ½^ï¶²²²9¥ÂétšÚÚÚöhè>ŠØÕxÀnV2S"–¤d0ü¾ÿ«óýððp^}}ýêžÑŒÙufÉG =* ò6õ÷jèîaúfffNVVVú ò0D>[‘¤r T²‰/ BÒÍwœD!Ek~~þ†zYQ‹¤’ ¯¨¨8*\ "åé­‡tî™Ò4tSu±×…ˆÀmyin l‘ÉUl‘ÉU2^)ó"«XZZšçBÖmdÞGNdÍ¢Ìq¥¤¤dFd¸Ä \âq©ÜÓÓs²««ËLþ%Đm SÄ_„Iϱ¯æææÄE]Èv»]Äì/³„Ÿ‹žVéf<•±PDŒZÉ"‚vî\ôx<ŽªªªJ¡ÒCZV ÉA’Džþ ¹_ç!"Ì¿ ùÞ©©©1‡ÃˆLÈ*º»»---“šžž···/‹¼xù‚HT;nv,! ÛÍfs£ÎsÜøê1Vð åÊC §!Šï¾6ÌÎΖ–——Ÿ&û¤V{™¢¢¢ýR¼‹‰§.—Ëu^™1Hµ1CÙú*6KDv“ë)Å‘aYÕ¯¸bv?fµNp’LCD­w7IÇúÙ»f£ÈD޼}‘â¯äãR¿C$®'{æk\M¼|åÊÅ;eÇŸø&€K= ‰ ‰¾¸sy]£ý+Ô»áf¦ lî"³¸¸8922²«¡¡aQý•E¬äiô&#„nÕß"bÂûÝn÷›Qd8¿'!’ÖHúhpp°¿©©©‘üe•(G´ú„iPJ~â1œá>ÒWs‹pø5Ü݉—ŒY­Öõñ÷Èw5÷zŒ¥¿ßïÀà·ÈŒi "J!W6oBÆüMrˆ©•ÕWŠü÷ʪ‰h圢·)È(0™L? Xm6Û‹9EÕ^m(Ȧ"#ÐÜÜ,öÚYŸÏ÷9{ÜÞÙÙ¹‹òŸ¢íº›|¬– IEND®B`‚ AnonSec Shell
AnonSec Shell
Server IP : 20.73.19.71  /  Your IP : 10.112.20.21
Web Server : nginx/1.15.12
System : Linux a10deea3d6b7 6.8.0-1044-azure #50~22.04.1-Ubuntu SMP Wed Dec 3 15:13:22 UTC 2025 x86_64
User :  ( 1000)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/html/wp-content/plugins/backupbuddy/classes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /var/www/html/wp-content/plugins/backupbuddy/classes/_integrityCheck.php
<?php
$serial = self::get_serial_from_file( $file );
pb_backupbuddy::status( 'details', 'Started backup_integrity_check() function for `' . $serial . '` for file `' . $file . '`.' );

// User selected to rescan a file.
if ( pb_backupbuddy::_GET( 'reset_integrity' ) == $serial ) {
	pb_backupbuddy::alert( 'Rescanning backup integrity for backup file `' . basename( $file ) . '`' );
	pb_backupbuddy::flush();
}

$createdFileOptions = false;
if ( ! file_exists( backupbuddy_core::getLogDirectory() . 'fileoptions/' . $serial . '.txt' ) ) { // No fileoptions so get some minimal information from DAT file within zip.
	require_once( pb_backupbuddy::plugin_path() . '/lib/zipbuddy/zipbuddy.php' );
	if ( ! isset( pb_backupbuddy::$classes['zipbuddy'] ) ) {
		pb_backupbuddy::$classes['zipbuddy'] = new pluginbuddy_zipbuddy( backupbuddy_core::getLogDirectory() . 'fileoptions/' );
	}
	
	if ( pb_backupbuddy::$classes['zipbuddy']->file_exists( $file, 'wp-content/uploads/backupbuddy_temp/' . $serial . '/backupbuddy_dat.php' ) === true ) { // Post 2.0 full backup
		$backup_type = 'full';
		$pass = true;
	}
	if ( pb_backupbuddy::$classes['zipbuddy']->file_exists( $file, 'wp-content/uploads/temp_' . $serial . '/backupbuddy_dat.php' ) === true ) { // Pre 2.0 full backup
		$backup_type = 'full';
		$pass = true;
	}
	if ( pb_backupbuddy::$classes['zipbuddy']->file_exists( $file, 'backupbuddy_dat.php' ) === true ) { // DB backup
		$backup_type = 'db';
		$pass = true;
	}
	
	$backup_dat = self::getDatArrayFromZip( $file );
	/*
	echo 'DAT:<pre>';
	print_r( $backup_dat );
	echo '</pre>';
	*/
	$options = $backup_dat; //['profile'];
	
	
	$createdFileOptions = true;
}

$options = array_merge(
	array(
		'skip_database_dump' => '0',
	),
	(array)$options
);

$scan_notes = array();


// Get backup fileoptions.
if ( $fileoptions != '' ) {
	$backup_options = &$fileoptions;
	$backup_options_options = &$backup_options->options;
} else { //if ( file_exists( backupbuddy_core::getLogDirectory() . 'fileoptions/' . $serial . '.txt' ) ) {
	require_once( pb_backupbuddy::plugin_path() . '/classes/fileoptions.php' );
	pb_backupbuddy::status( 'details', 'Fileoptions instance #44.' );
	$backup_options = new pb_backupbuddy_fileoptions( backupbuddy_core::getLogDirectory() . 'fileoptions/' . $serial . '.txt', $read_only = false, $ignore_lock = false, $create_file = true ); // Will create file to hold integrity data if nothing exists.
	if ( true !== ( $result = $backup_options->is_ok() ) ) {
		pb_backupbuddy::status( 'error', __('Fatal Error #9034 C. Unable to access fileoptions data.', 'it-l10n-backupbuddy' ) . ' Error on file `' . backupbuddy_core::getLogDirectory() . 'fileoptions/' . $serial . '.txt' . '`: ' . $result );
		pb_backupbuddy::status( 'haltScript', '' ); // Halt JS on page.
		return false;
	}
	if ( ! is_array( $backup_options->options ) ) {
		$backup_options->options = array();
	}
	$backup_options_options = &$backup_options->options;
}

// We did not have a fileoptions file so we are rebuilding portions of it using information found in the DAT file.
if ( true === $createdFileOptions ) {
	if ( isset( $options['breakout_tables'] ) ) {
		$backup_options_options['breakout_tables'] = $options['breakout_tables'];
	}
	if ( isset( $options['tables_sizes'] ) ) {
		$backup_options_options['table_sizes'] = $options['tables_sizes'];
	}
	if ( isset( $options['backup_type'] ) ) {
		$backup_options_options['type'] = $options['backup_type'];
	}
	if ( isset( $options['force_single_db_file'] ) ) {
		$backup_options_options['force_single_db_file'] = $options['force_single_db_file'];
	}
	
	if ( isset( $options['profile'] ) ) {
		$options = $options['profile'];
	} else {
		$options = array();
	}
}

if ( isset( $backup_options_options['profile'] ) ) {
	$options = $backup_options_options['profile'];
	$options = array_merge( pb_backupbuddy::settings( 'profile_defaults' ), $options );
}

$options = array_merge(
	array(
		'skip_database_dump' => '0',
	),
	(array)$options
);

// If breakout tables set in options but not fileoptions then copy over. eg from DAT file.
/*
if ( ! isset( $backup_options_options['breakout_tables'] ) && isset( $options['breakout_tables'] ) ) {
	$backup_options_options['breakout_tables'] = $options['breakout_tables'];
}
*/

// Return if cached.
if ( isset( $backup_options_options['integrity'] ) && ( count( $backup_options_options['integrity'] ) > 0 ) && ( pb_backupbuddy::_GET( 'reset_integrity' ) != $serial ) ) { // Already have integrity data and NOT resetting this one.
	pb_backupbuddy::status( 'details', 'Integrity data for backup `' . $serial . '` is cached; not scanning again.' );
	return $backup_options_options['integrity'];
} elseif ( pb_backupbuddy::_GET( 'reset_integrity' ) == $serial ) { // Resetting this one.
	pb_backupbuddy::status( 'details', 'Resetting backup integrity stats for backup with serial `' . $serial . '`.' );
}  else { // No integrity data; not resetting. Just keep going...
}

// Integrity check disabled. Skip.
if ( ( ( pb_backupbuddy::$options['profiles'][0]['integrity_check'] == '0' ) ) && ( pb_backupbuddy::_GET( 'reset_integrity' ) == '' ) && ( isset( $options['integrity_check'] ) ) && ( $options['integrity_check'] == '0' ) ) { // Integrity checking disabled. Allows run if manually rescanning on backups page.
	pb_backupbuddy::status( 'details', 'Integrity check disabled. Skipping scan.' );
	$file_stats = @stat( $file );
	if ( $file_stats === false ) { // stat failure.
		pb_backupbuddy::status( 'error', 'Error #4539774. Unable to get file details ( via stat() ) for file `' . $file . '`. The file may be corrupt, too large for the server, or been deleted unexpectedly. Check that the file exists and can be accessed.' );
		$file_size = 0;
		$file_modified = 0;
	} else { // stat success.
		$file_size = $file_stats['size'];
		$file_modified = $file_stats['mtime'];
	}
	unset( $file_stats );

	$integrity = array(
		'status'				=>		'Unknown (check disabled)',
		'tests'					=>		array(),
		'scan_time'				=>		0,
		'detected_type'			=>		'unknown',
		'size'					=>		$file_size,
		'modified'				=>		$file_modified,
		'file'					=>		basename( $file ),
		'comment'				=>		false,
	);
	$backup_options_options['integrity'] = array_merge( pb_backupbuddy::settings( 'backups_integrity_defaults' ), $integrity );
	$backup_options->save();

	return $backup_options_options['integrity'];
}


//***** BEGIN CALCULATING STATUS DETAILS.


$backup_type = '';


if ( !isset( pb_backupbuddy::$classes['zipbuddy'] ) ) {
	require_once( pb_backupbuddy::plugin_path() . '/lib/zipbuddy/zipbuddy.php' );
	pb_backupbuddy::$classes['zipbuddy'] = new pluginbuddy_zipbuddy( backupbuddy_core::getBackupDirectory() );
}

$previous_status_serial = pb_backupbuddy::get_status_serial(); // Store current status serial setting to reset back later.
if ( true !== $skipLogRedirect ) {
	pb_backupbuddy::status( 'details', 'Redirecting status logging temporarily.' );
	pb_backupbuddy::set_status_serial( 'zipbuddy_test' ); // Redirect logging output to a certain log file.
}

// Look for comment.
pb_backupbuddy::status( 'details', 'Verifying comment in zip archive.' );
$raw_comment = pb_backupbuddy::$classes['zipbuddy']->get_comment( $file );
$comment = backupbuddy_core::normalize_comment_data( $raw_comment );
$comment = $comment['note'];


$tests = array();
pb_backupbuddy::status( 'details', 'NOTE: It is normal to see several "File not found" messages in the next several log lines.' );


if ( ! isset( $options['type'] ) || ( isset( $options['type'] ) && ( ( 'db' == $options['type'] || 'full' == $options['type'] ) ) ) ) {
	// Check for DAT file.
	$pass = false;
	pb_backupbuddy::status( 'details', 'Verifying DAT file in zip archive.' );
	if ( pb_backupbuddy::$classes['zipbuddy']->file_exists( $file, 'wp-content/uploads/backupbuddy_temp/' . $serial . '/backupbuddy_dat.php' ) === true ) { // Post 2.0 full backup
		$backup_type = 'full';
		$pass = true;
	}
	if ( pb_backupbuddy::$classes['zipbuddy']->file_exists( $file, 'wp-content/uploads/temp_' . $serial . '/backupbuddy_dat.php' ) === true ) { // Pre 2.0 full backup
		$backup_type = 'full';
		$pass = true;
	}
	if ( pb_backupbuddy::$classes['zipbuddy']->file_exists( $file, 'backupbuddy_dat.php' ) === true ) { // DB backup
		$backup_type = 'db';
		$pass = true;
	}
	$tests[] = array(
		'test'		=>	'BackupBuddy data file',
		'pass'		=>	$pass,
	);
}

if ( isset( $options['type'] ) && ( ( 'files' == $options['type'] ) || ( 'media' == $options['type'] ) || ( 'themes' == $options['type'] ) || ( 'plugins' == $options['type'] ) ) ) {
	$files = pb_backupbuddy::$classes['zipbuddy']->get_file_list( $file );
	$count = count( $files );
	if ( is_array( $files ) && ( $count > 0 ) ) {
		$pass = true;
	} else {
		$pass = false;
	}
	$tests[] = array(
		'test'		=>	'Basic file list scan (' . $count . ' files found inside) - <a target="_top" href="' . admin_url('admin.php') . '?page=pb_backupbuddy_backup&zip_viewer=' . basename( $file ). '&value=' . basename( $file ) . '&bub_rand=' . rand( 100, 999 ) . '">Browse Files</a>', // rand is because some hosts block URLs with a .zip at the end of the url.
		'pass'		=>	$pass,
		'fileCount'	=>	$count,
	);
}


if ( isset( $options['type'] ) && ( ( 'files' == $options['type'] ) || ( 'themes' == $options['type'] ) || ( 'plugins' == $options['type'] ) || ( 'media' == $options['type'] ) ) ) {
	pb_backupbuddy::status( 'details', 'Files, themes, plugins or media backup type so skipping scan of database files in backup as it is not applicable.' );
} else { // Non-files only backup so check for DB.
	// Check for DB .sql file.
	$pass = false;
	$db_test_note = '';
	pb_backupbuddy::status( 'details', 'Verifying database SQL file in zip archive.' );
	
	
	
	if ( isset( $backup_options_options['table_sizes'] ) && ( count( $backup_options_options['table_sizes'] ) > 0 ) ) { // BB v5.0+. && ( $backup_options_options['data_version'] >= 1 )
		// Look for missing SQL files.
		$pass = true;
		
		if ( ! isset( $backup_options_options['force_single_db_file'] ) ) {
			$backup_options_options['force_single_db_file'] = false;
		} else {
			if ( true === $backup_options_options['force_single_db_file'] ) {
				pb_backupbuddy::status( 'details', 'Forcing to a single db_1.sql file WAS enabled for this backup. Only db_1.sql files will be checked for.' );
			} else {
				pb_backupbuddy::status( 'details', 'Forcing to a single db_1.sql file was NOT enabled for this backup.' );
			}
		}
		
		pb_backupbuddy::status( 'details', 'BackupBuddy v5.0+ format database detected.' );
		if ( 'db' == $backup_type ) { // DB.
			pb_backupbuddy::status( 'details', 'Database-only type backup.' );
			if ( pb_backupbuddy::$classes['zipbuddy']->file_exists( $file, 'db_1.sql' ) === true ) { // Commandline based.
				pb_backupbuddy::status( 'details', 'Command line based database dump type.' );
				if ( isset( $backup_options_options['breakout_tables'] ) && ( count( $backup_options_options['breakout_tables'] ) > 0 ) && ( true !== $backup_options_options['force_single_db_file'] ) ) { // Verify broken out table SQL files exist.
					pb_backupbuddy::status( 'details', 'Some tables were broken out. Checking for them (' . implode(',', $backup_options_options['breakout_tables'] ) . '). (DB type)' );
					foreach( $backup_options_options['breakout_tables'] as $tableName ) {
						$databaseFile = $tableName . '.sql';
						if ( ! pb_backupbuddy::$classes['zipbuddy']->file_exists( $file, $databaseFile ) ) {
							pb_backupbuddy::status( 'error', 'Missing database file `' . $databaseFile . '` in backup. Err 3849474b.' );
							$pass = false;
							break;
						}
					}
				}
			} else { // PHP-based.
				pb_backupbuddy::status( 'details', 'PHP based database dump type.' );
				foreach( $backup_options_options['table_sizes'] as $tableName => $tableSize ) {
					$databaseFile = $tableName . '.sql';
					if ( ! pb_backupbuddy::$classes['zipbuddy']->file_exists( $file, $databaseFile ) ) {
						pb_backupbuddy::status( 'error', 'Missing database file `' . $databaseFile . '` in backup. Err 383783.' );
						$pass = false;
						break;
					} else {
						$backup_type = 'db';
					}
				}
			}
		} elseif ( ( 'files' == $backup_type ) || ( 'themes' == $backup_type ) || ( 'plugins' == $backup_type ) || ( 'media' == $backup_type ) ) {

			// test nothing here.
			$pass = true;

		} else { // Full / MS / Export.
			pb_backupbuddy::status( 'details', 'Not database-only type backup.' );
			if ( pb_backupbuddy::$classes['zipbuddy']->file_exists( $file, 'wp-content/uploads/backupbuddy_temp/' . $serial . '/db_1.sql' ) === true ) { // Commandline based.
				pb_backupbuddy::status( 'details', 'Command line based database dump type.' );
				if ( isset( $backup_options_options['breakout_tables'] ) && ( count( $backup_options_options['breakout_tables'] ) > 0 ) && ( true !== $backup_options_options['force_single_db_file'] ) ) { // Verify broken out table SQL files exist.
					pb_backupbuddy::status( 'details', 'Some tables were broken out. Checking for them (' . implode(',', $backup_options_options['breakout_tables'] ) . '). (DB type)' );
					foreach( $backup_options_options['breakout_tables'] as $tableName ) {
						$databaseFile = 'wp-content/uploads/backupbuddy_temp/' . $serial . '/' . $tableName . '.sql';
						if ( ! pb_backupbuddy::$classes['zipbuddy']->file_exists( $file, $databaseFile ) ) {
							pb_backupbuddy::status( 'error', 'Missing database file `' . $databaseFile . '` in backup. Err 3849474c.' );
							$pass = false;
							break;
						}
					}
				}
			} else { // PHP-based.
				pb_backupbuddy::status( 'details', 'PHP based database dump type.' );
				foreach( $backup_options_options['table_sizes'] as $tableName => $tableSize ) {
					$databaseFile = 'wp-content/uploads/backupbuddy_temp/' . $serial . '/' . $tableName . '.sql';
					if ( ! pb_backupbuddy::$classes['zipbuddy']->file_exists( $file, $databaseFile ) ) {
						pb_backupbuddy::status( 'error', 'Missing database file `' . $databaseFile . '` in backup. Backup type: `' . $backup_options_options['type'] . '`. Err 358383.' );
						$pass = false;
						break;
					} else {
						$backup_type = 'full';
					}
				}
			}
		}
		
		$db_test_note = 's (' . count( $backup_options_options['table_sizes'] ) . ' tables)';
		
	} elseif ( pb_backupbuddy::$classes['zipbuddy']->file_exists( $file, 'wp-content/uploads/backupbuddy_temp/' . $serial . '/db_1.sql' ) === true ) { // post 2.0 full backup.
		$backup_type = 'full';
		$pass = true;
		if ( isset( $backup_options_options['breakout_tables'] ) && ( count( $backup_options_options['breakout_tables'] ) > 0 ) ) { // Verify broken out table SQL files exist.
			pb_backupbuddy::status( 'details', 'Some tables were broken out. Checking for them (' . implode(',', $backup_options_options['breakout_tables'] ) . '). (full type)' );
			foreach( $backup_options_options['breakout_tables'] as $tableName ) {
				$databaseFile = 'wp-content/uploads/backupbuddy_temp/' . $serial . '/' . $tableName . '.sql';
				if ( ! pb_backupbuddy::$classes['zipbuddy']->file_exists( $file, $databaseFile ) ) {
					pb_backupbuddy::status( 'error', 'Missing database file `' . $databaseFile . '` in backup. Err 3849474.' );
					$pass = false;
					break;
				}
			}
		}
	} elseif ( pb_backupbuddy::$classes['zipbuddy']->file_exists( $file, 'db_1.sql' ) === true ) { // db only backup 2.0+. 5.0+ can have this if breaking out tables only partially or forcing to single file.
		$backup_type = 'db';
		$pass = true;
		if ( isset( $backup_options_options['breakout_tables'] ) && ( count( $backup_options_options['breakout_tables'] ) > 0 ) ) { // Verify broken out table SQL files exist.
			pb_backupbuddy::status( 'details', 'Some tables were broken out. Checking for them (' . implode(',', $backup_options_options['breakout_tables'] ) . '). (db type)' );
			foreach( $backup_options_options['breakout_tables'] as $tableName ) {
				$databaseFile = $tableName . '.sql';
				if ( ! pb_backupbuddy::$classes['zipbuddy']->file_exists( $file, $databaseFile ) ) {
					pb_backupbuddy::status( 'error', 'Missing database file `' . $databaseFile . '` in backup. Err 3847583.' );
					$pass = false;
					break;
				}
			}
		}
	} elseif ( pb_backupbuddy::$classes['zipbuddy']->file_exists( $file, 'wp-content/uploads/temp_' . $serial . '/db.sql' ) === true ) { // pre 2.0 full backup
		$backup_type = 'full';
		$pass = true;
	} elseif ( pb_backupbuddy::$classes['zipbuddy']->file_exists( $file, 'db.sql' ) === true ) { // db only backup pre-2.0.
		$backup_type = 'db';
		$pass = true;
	}
	
	 if ( true !== $pass ) {
		//if ( count( $backup_options_options['table_sizes'] ) > 0 ) {
			
		//}
	}
	
	if ( '1' == $options['skip_database_dump'] ) {
		if ( false === $pass ) {
			pb_backupbuddy::status( 'warning', 'WARNING: Database .SQL does NOT exist because database dump was set to be skipped based on settings. Use with caution. The database was NOT backed up.' );
		} else { // DB dump set to be skipped but was found. Just in case...
			pb_backupbuddy::status( 'warning', 'Warning #58458749. Database dump was set to be skip _BUT_ database file WAS found?' );
		}
		$pass = true;
		$db_test_note = ' <span class="pb_label pb_label-warning">' . __( 'Database skipped', 'it-l10n-backupbuddy' ) . '</span>';
		$scan_notes[] = '<span class="pb_label pb_label-warning">' . __( 'Database skipped', 'it-l10n-backupbuddy' ) . '</span>';
	}
	$tests[] = array(
		'test'		=>	'Database SQL file' . $db_test_note,
		'pass'		=>	$pass,
	);
}



// Use filename to determine backup type if detectable as it is more authoritive than the above guesses.
if ( false !== stristr( $file, '-db-' ) ) {
	$backup_type = 'db';
} elseif ( false !== stristr( $file, '-full-' ) ) {
	$backup_type = 'full';
} elseif ( false !== stristr( $file, '-files-' ) ) {
	$backup_type ='files';
} elseif ( false !== stristr( $file, '-themes-' ) ) {
	$backup_type ='themes';
} elseif ( false !== stristr( $file, '-plugins-' ) ) {
	$backup_type ='plugins';
} elseif ( false !== stristr( $file, '-media-' ) ) {
	$backup_type ='media';
} elseif ( false !== stristr( $file, '-export-' ) ) {
	$backup_type ='export';
} else {
	// Filename determination was not conclusive. Leave as-is based on deduced backup type determined earlier.
}



// Check for wp-config.php file if full backup.
if ( 'full' == $backup_type ) {
	$pass = false;
	pb_backupbuddy::status( 'details', 'Verifying WordPress wp-config.php configuration file in zip archive.' );
	if ( pb_backupbuddy::$classes['zipbuddy']->file_exists( $file, 'wp-config.php' ) === true ) {
		$pass = true;
	}
	if ( pb_backupbuddy::$classes['zipbuddy']->file_exists( $file, 'wp-content/uploads/backupbuddy_temp/' . $serial . '/wp-config.php' ) === true ) {
		$pass = true;
	}
	if ( false === $pass ) {
		if ( isset( $options['excludes'] ) ) {
			if ( false !== stristr( $options['excludes'], 'wp-config.' ) ) {
				pb_backupbuddy::status( 'warning', 'Warning: An exclusion containing wp-config.php was found. Exclusions: `' . str_replace(array("\r", "\r\n", "\n"), '; ', $options['excludes'] ) . '`.' );
			}
		}
	}
	$tests[] = array(
		'test'		=>	'WordPress wp-config.php file (full backups only)',
		'pass'		=>	$pass,
	);
} // end if full backup.


// Get zip scan log details.
pb_backupbuddy::status( 'details', 'Retrieving zip scan log.' );
$temp_details = pb_backupbuddy::get_status( 'zipbuddy_test' ); // Get zipbuddy scan log.
$scan_log = array();
foreach( $temp_details as $temp_detail ) {
	$scan_log[] = json_decode( $temp_detail )->{ 'data' };
}
if ( true !== $skipLogRedirect ) {
	pb_backupbuddy::set_status_serial( $previous_status_serial ); // Stop redirecting log to a specific file & set back to what it was prior.
	pb_backupbuddy::status( 'details', 'Stopped temporary redirection of status logging.' );
}

pb_backupbuddy::status( 'details', 'Calculating integrity scan status,' );

// Check for any failed tests.
$is_ok = true;
$integrity_description = '';
foreach( $tests as $test ) {
	if ( $test['pass'] !== true ) {
		$is_ok = false;
		$error = 'Error #389434. Integrity test FAILED. Test: `' . $test['test']. '`. ';
		pb_backupbuddy::status( 'error', $error );
		$integrity_description .= $error;
	}
}


if ( true === $is_ok ) {
	$integrity_status = 'Pass';
} else {
	$integrity_status = 'Fail';
}
pb_backupbuddy::status( 'details', 'Status: `' . $integrity_status . '`. Description: `' . $integrity_description . '`.' );


//***** END CALCULATING STATUS DETAILS.


// Get file information from file system.
pb_backupbuddy::status( 'details', 'Getting file details such as size, timestamp, etc.' );
$file_stats = @stat( $file );
if ( $file_stats === false ) { // stat failure.
	pb_backupbuddy::status( 'error', 'Error #4539774b. Unable to get file details ( via stat() ) for file `' . $file . '`. The file may be corrupt, too large for the server, or been deleted unexpectedly. Check that the file exists and can be accessed.' );
	$file_size = 0;
	$file_modified = 0;
} else { // stat success.
	$file_size = $file_stats['size'];
	$file_modified = $file_stats['mtime']; // Created time.
}
unset( $file_stats );


// Compile array of results for saving into data structure.
$integrity = array(
	'is_ok'					=>		$is_ok,						// bool
	'tests'					=>		$tests,						// Array of tests.
	'scan_time'				=>		time(),
	'scan_log'				=>		$scan_log,
	'scan_notes'			=>		$scan_notes,				// Misc text to display next to status.
	'detected_type'			=>		$backup_type,
	'size'					=>		$file_size,
	'modified'				=>		$file_modified,				// Actually created time now.
	'file'					=>		basename( $file ),
	'comment'				=>		$comment,					// boolean false if no comment. string if comment.
);

$integrity = array_merge( pb_backupbuddy::settings( 'backups_integrity_defaults' ), $integrity );
if ( is_array( $backup_options_options ) ) {
	pb_backupbuddy::status( 'details', 'Saving backup file integrity check details.' );
	$backup_options_options['integrity'] = $integrity;
	$backup_options->save();
}

return $integrity;

Anon7 - 2022
AnonSec Team