public/wordpress/wp-content/plugins/backupbuddy/classes/restore.php
/**
	 *	migrateWpConfig()
	 *
	 *	@return		true on success, new wp config file content on failure.
	 */
migrateWpConfig()
@return         true on success, new wp config file content on failure.
migrateWpConfig () @return true on success new wp config file content on failure .
function migrateWpConfig() {
		if ( 'deploy' == $this->_state['type'] ) {
			pb_backupbuddy::status( 'details', 'Skipping wp-config.php migration due to being Deployment.' );
			return true;
		}
		if ( isset( $this->_state['dat']['wp-config_in_parent'] ) ) {
			if ( $this->_state['dat']['wp-config_in_parent'] === true ) { 
				pb_backupbuddy::status( 'details', 'DAT file indicates wp-config.php was previously in the parent directory. Copying into site root.' );
				$config_source = ABSPATH . 'wp-content/uploads/backupbuddy_temp/' . $this->_state['serial'] . '/wp-config.php';
				$result = copy( $config_source, ABSPATH . 'wp-config.php' );
				if ( $result === true ) {
					pb_backupbuddy::status( 'message', 'wp-config.php file was restored to the root of the site `' . ABSPATH . 'wp-config.php`. It was previously in the parent directory of the source site. You may move it manually to the parent directory.' );
				} else {
					pb_backupbuddy::status( 'error', 'Unable to move wp-config.php file from temporary location `' . $config_source . '` to root.' );
				}
			} else { 
				pb_backupbuddy::status( 'details', 'DAT file indicates wp-config.php was previously in the normal location.' );
			}
		} else { 
			pb_backupbuddy::status( 'details', 'Backup pre-v3.0 so wp-config.php must be in normal location.' );
		}
		if ( 'files' == $this->_state['dat']['backup_type'] ) {
			pb_backupbuddy::status( 'details', 'Skipping update of Database Settings and URLs in wp-config.php as this is a Files Only Backup.' );
			$migrateResult = true;
		} else {
			pb_backupbuddy::status( 'details', 'Updating Database Settings and URLs in wp-config.php as this is not a Files Only Backup.' );
			$migrateResult = $this->_migrateWpConfigGruntwork();
		}
		return $migrateResult;
	}
function migrateWpConfig ( ) { if ( 'deploy' == $ this -> _state [ 'type' ] ) { pb_backupbuddy :: status ( 'details' , 'Skipping wp-config.php migration due to being Deployment.' ) ; return true ; } if ( isset ( $ this -> _state [ 'dat' ] [ 'wp-config_in_parent' ] ) ) { if ( $ this -> _state [ 'dat' ] [ 'wp-config_in_parent' ] === true ) { pb_backupbuddy :: status ( 'details' , 'DAT file indicates wp-config.php was previously in the parent directory. Copying into site root.' ) ; $ config_source = ABSPATH . 'wp-content/uploads/backupbuddy_temp/' . $ this -> _state [ 'serial' ] . '/wp-config.php' ; $ result = copy ( $ config_source , ABSPATH . 'wp-config.php' ) ; if ( $ result === true ) { pb_backupbuddy :: status ( 'message' , 'wp-config.php file was restored to the root of the site `' . ABSPATH . 'wp-config.php`. It was previously in the parent directory of the source site. You may move it manually to the parent directory.' ) ; } else { pb_backupbuddy :: status ( 'error' , 'Unable to move wp-config.php file from temporary location `' . $ config_source . '` to root.' ) ; } } else { pb_backupbuddy :: status ( 'details' , 'DAT file indicates wp-config.php was previously in the normal location.' ) ; } } else { pb_backupbuddy :: status ( 'details' , 'Backup pre-v3.0 so wp-config.php must be in normal location.' ) ; } if ( 'files' == $ this -> _state [ 'dat' ] [ 'backup_type' ] ) { pb_backupbuddy :: status ( 'details' , 'Skipping update of Database Settings and URLs in wp-config.php as this is a Files Only Backup.' ) ; $ migrateResult = true ; } else { pb_backupbuddy :: status ( 'details' , 'Updating Database Settings and URLs in wp-config.php as this is not a Files Only Backup.' ) ; $ migrateResult = $ this -> _migrateWpConfigGruntwork ( ) ; } return $ migrateResult ; }
migrateWpConfig()
      @return         true on success, new wp config file content on failure.
migrateWpConfig () @return true on success new wp config file content on failure .
// wp-config.php used to be in parent. Must copy from temp dir to root. // wp-config.php was in normal location on source site. Nothing to do. // Pre 3.0 backup