public/wordpress/wp-content/plugins/backupbuddy/classes/restore.php
/* troubleScan()
	 *
	 * Scans for potential problems and provided informative warnings.
	 *
	 * @return array Array of text warnings to display to user.
	 *
	 */
troubleScan()
Scans for potential problems and provided informative warnings.

@return array Array of text warnings to display to user.
troubleScan () Scans for potential problems and provided informative warnings . @return array Array of text warnings to display to user .
function troubleScan() {
		$trouble = array();
		if ( file_exists( ABSPATH . '.maintenance' ) ) {
			$trouble[] = '.maintenance file found in WordPress root. The site may not be accessible unless this file is deleted.';
		}
		if ( file_exists( ABSPATH . 'index.htm' ) ) {
			$trouble[] = 'index.htm file found in WordPress root. This may prevent WordPress from loading on some servers. Solution: Delete the file.';
		}
		l
		if ( file_exists( ABSPATH . 'index.html' ) ) {
			$trouble[] = 'index.html file found in WordPress root. This may prevent WordPress from loading on some servers. Solution: Delete the file.';
		}
		if ( ! file_exists( ABSPATH . 'wp-config.php' ) ) {
			$trouble[] = 'Warning only: wp-config.php file not found WordPress root. <i>If this is a database-only restore you should restore a full backup.</i>';
		} else {  exists so check for unchanged URLs not updated due to provenance unknown.
			if ( 'files' == $this->_state['dat']['backup_type'] ) {
				pb_backupbuddy::status( 'details', 'Skipping URL scan for wp-config.php as this is a Files Only restore.' );
			} else {
				pb_backupbuddy::status( 'details', 'Checking wp-config.php file for unchanged URLs.' );
				$config_contents = @file_get_contents( ABSPATH . 'wp-config.php' );
				if ( false === $config_contents ) { 
					pb_backupbuddy::status( 'error', 'Unable to open wp-config.php for checking though it exists. Verify permissions.' );
				} else { 
					$new_content_url = '';
					if ( isset( $this->_state['dat']['wp_content_url'] ) ) {
						$new_content_url = str_replace( trim( $this->_state['dat']['siteurl'], '\\/' ), trim( $this->_state['siteurl'], '/' ), $this->_state['dat']['wp_content_url'] );
					}
					preg_match_all( '#\bhttps?://[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/))#', $config_contents, $matches );
					$matches = $matches[0];
					foreach( $matches as $match ) {
						if ( false !== stristr( $match, 'api.wordpress.org' ) ) {
							continue;
						}
						if ( false !== stristr( $match, 'codex.wordpress.org' ) ) {
							continue;
						}
						if ( $match == $new_content_url ) { 
							continue;
						}
						$trouble[] = 'A URL found in one or more locations in wp-config.php was not migrated as it was either not recognized or in an unrecognized location in the file: "' . htmlentities( $match ) . '" (this may not be a problem!).';
					}
					if ( false !== stristr( $config_contents, 'COOKIE_DOMAIN' ) ) { 
						$trouble[] = 'Cookie domain set in wp-config.php file and has not been updated. You may need to manualy update this.';
					}
				}
			}
		}
		if ( ! file_exists( ABSPATH . '.htaccess' ) ) {
			$trouble[] = 'Warning only: .htaccess file not found in WordPress root. This is used for permalinks on servers which support it. If needed or URLs result in a 404 you may regenerate this file by logging into the wp-admin & navigating to Settings: Permalinks and clicking "Save".';
		} else { 
			$contents = @file_get_contents( ABSPATH . '.htaccess' );
			if ( strstr( $contents, 'AddHandler' ) ) {
				$trouble[] = 'Warning: An AddHandler directive has been found in your .htaccess file. This could result in WordPress and PHP not running properly if configured improperly, especially when migrating to a new server. If you encounter problems such as an Internal Server Error or Error 500, try removing this line from your .htaccess file. Solution: Delete this AddHandler line from the .htaccess file. <a target="_blank" href="http://ithemes.com/codex/page/BackupBuddy:_Frequent_Support_Issues#.htaccess_404_.2F_Addhandler_Warning">Click here for more information & help.</a>';
			}
		}
		if ( file_exists( ABSPATH . 'php.ini' ) ) {
			$trouble[] = 'A php.ini file was restored in the import process in the site root. This may cause problems with site functionality if imported to a different server as configuration options often differ between servers, possibly resulting in degraded performance or unexpected behavior.';
		}
		if ( count( $trouble ) > 0 ) {
		} else {
			pb_backupbuddy::status( 'details', 'No potential problems detected.' );
		}
		return $trouble;
	}
function troubleScan ( ) { $ trouble = array ( ) ; if ( file_exists ( ABSPATH . '.maintenance' ) ) { $ trouble [ ] = '.maintenance file found in WordPress root. The site may not be accessible unless this file is deleted.' ; } if ( file_exists ( ABSPATH . 'index.htm' ) ) { $ trouble [ ] = 'index.htm file found in WordPress root. This may prevent WordPress from loading on some servers. Solution: Delete the file.' ; } if ( file_exists ( ABSPATH . 'index.html' ) ) { $ trouble [ ] = 'index.html file found in WordPress root. This may prevent WordPress from loading on some servers. Solution: Delete the file.' ; } if ( ! file_exists ( ABSPATH . 'wp-config.php' ) ) { $ trouble [ ] = 'Warning only: wp-config.php file not found WordPress root. <i>If this is a database-only restore you should restore a full backup.</i>' ; } else { if ( 'files' == $ this -> _state [ 'dat' ] [ 'backup_type' ] ) { pb_backupbuddy :: status ( 'details' , 'Skipping URL scan for wp-config.php as this is a Files Only restore.' ) ; } else { pb_backupbuddy :: status ( 'details' , 'Checking wp-config.php file for unchanged URLs.' ) ; $ config_contents = @ file_get_contents ( ABSPATH . 'wp-config.php' ) ; if ( false === $ config_contents ) { pb_backupbuddy :: status ( 'error' , 'Unable to open wp-config.php for checking though it exists. Verify permissions.' ) ; } else { $ new_content_url = '' ; if ( isset ( $ this -> _state [ 'dat' ] [ 'wp_content_url' ] ) ) { $ new_content_url = str_replace ( trim ( $ this -> _state [ 'dat' ] [ 'siteurl' ] , '\\/' ) , trim ( $ this -> _state [ 'siteurl' ] , '/' ) , $ this -> _state [ 'dat' ] [ 'wp_content_url' ] ) ; } preg_match_all ( '#\bhttps?://[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/))#' , $ config_contents , $ matches ) ; $ matches = $ matches [ 0 ] ; foreach ( $ matches as $ match ) { if ( false !== stristr ( $ match , 'api.wordpress.org' ) ) { continue ; } if ( false !== stristr ( $ match , 'codex.wordpress.org' ) ) { continue ; } if ( $ match == $ new_content_url ) { continue ; } $ trouble [ ] = 'A URL found in one or more locations in wp-config.php was not migrated as it was either not recognized or in an unrecognized location in the file: "' . htmlentities ( $ match ) . '" (this may not be a problem!).' ; } if ( false !== stristr ( $ config_contents , 'COOKIE_DOMAIN' ) ) { $ trouble [ ] = 'Cookie domain set in wp-config.php file and has not been updated. You may need to manualy update this.' ; } } } } if ( ! file_exists ( ABSPATH . '.htaccess' ) ) { $ trouble [ ] = 'Warning only: .htaccess file not found in WordPress root. This is used for permalinks on servers which support it. If needed or URLs result in a 404 you may regenerate this file by logging into the wp-admin & navigating to Settings: Permalinks and clicking "Save".' ; } else { $ contents = @ file_get_contents ( ABSPATH . '.htaccess' ) ; if ( strstr ( $ contents , 'AddHandler' ) ) { $ trouble [ ] = 'Warning: An AddHandler directive has been found in your .htaccess file. This could result in WordPress and PHP not running properly if configured improperly, especially when migrating to a new server. If you encounter problems such as an Internal Server Error or Error 500, try removing this line from your .htaccess file. Solution: Delete this AddHandler line from the .htaccess file. <a target="_blank" href="http://ithemes.com/codex/page/BackupBuddy:_Frequent_Support_Issues#.htaccess_404_.2F_Addhandler_Warning">Click here for more information & help.</a>' ; } } if ( file_exists ( ABSPATH . 'php.ini' ) ) { $ trouble [ ] = 'A php.ini file was restored in the import process in the site root. This may cause problems with site functionality if imported to a different server as configuration options often differ between servers, possibly resulting in degraded performance or unexpected behavior.' ; } if ( count ( $ trouble ) > 0 ) { } else { pb_backupbuddy :: status ( 'details' , 'No potential problems detected.' ) ; } return $ trouble ; }
troubleScan()
 Scans for potential problems and provided informative warnings.
troubleScan () Scans for potential problems and provided informative warnings .
// .maintenance // index.htm // index.html // wp-config.php // wp-config.php exists so check for unchanged URLs not updated due to provenance unknown. // Unable to open. // Able to open. // Ignore new WP_CONTENT_URL define that was updated. // Found cookie domain. // .htaccess // Exists, check if AddHandler inside. // php.ini //pb_backupbuddy::status( 'warning', 'Potential problems that may need your attention: ' . implode( '; ', $trouble ) );