target_id = 'pb_backupbuddy_status'; // importbuddy_status or pb_backupbuddy_status
		if( jQuery( '#' + target_id ).length == 0 ) { // No status box yet so suppress.
			return;
		}
		jQuery( '#' + target_id ).append( "\n" + message );
		textareaelem = document.getElementById( target_id );
		textareaelem.scrollTop = textareaelem.scrollHeight;
	}
	
	function backupbuddy_hourpad(n) { return ("0" + n).slice(-2); }
</script>
<?php 
$success = false;
global $pb_backupbuddy_js_status;
$pb_backupbuddy_js_status = true;
echo pb_backupbuddy::status_box('Restoring . . .');
echo '<div id="pb_backupbuddy_working" style="width: 100px;"><br><center><img src="' . pb_backupbuddy::plugin_url() . '/images/working.gif" title="Working... Please wait as this may take a moment..."></center></div>';
pb_backupbuddy::set_status_serial('restore');
global $wp_version;
pb_backupbuddy::status('details', 'BackupBuddy v' . pb_backupbuddy::settings('version') . ' using WordPress v' . $wp_version . ' on ' . PHP_OS . '.');
$archive_file = pb_backupbuddy::_GET('archive');
// archive to extract from.
require pb_backupbuddy::plugin_path() . '/classes/_restoreFiles.php';
$result = backupbuddy_restore_files::restore(backupbuddy_core::getBackupDirectory() . $archive_file, $files, $finalPath = ABSPATH);
echo '<script type="text/javascript">jQuery("#pb_backupbuddy_working").hide();</script>';
pb_backupbuddy::flush();
if (false === $result) {
} else {
}
pb_backupbuddy::$ui->ajax_footer();
pb_backupbuddy::$ui->ajax_footer();
Exemplo n.º 2
0
    public function restore_file_restore()
    {
        $files = pb_backupbuddy::_GET('files');
        // file to extract.
        $files_array = explode(',', $files);
        $files = array();
        foreach ($files_array as $file) {
            if (substr($file, -1) == '/') {
                // If directory then add wildcard.
                $file = $file . '*';
            }
            $files[$file] = $file;
        }
        unset($files_array);
        pb_backupbuddy::$ui->ajax_header(true, false);
        // js, no padding
        ?>
		
		<script type="text/javascript">
			function pb_status_append( status_string ) {
				target_id = 'pb_backupbuddy_status'; // importbuddy_status or pb_backupbuddy_status
				if( jQuery( '#' + target_id ).length == 0 ) { // No status box yet so suppress.
					return;
				}
				jQuery( '#' + target_id ).append( "\n" + status_string );
				textareaelem = document.getElementById( target_id );
				textareaelem.scrollTop = textareaelem.scrollHeight;
			}
		</script>
		<?php 
        $success = false;
        global $pb_backupbuddy_js_status;
        $pb_backupbuddy_js_status = true;
        echo pb_backupbuddy::status_box('Restoring . . .');
        echo '<div id="pb_backupbuddy_working" style="width: 100px;"><br><center><img src="' . pb_backupbuddy::plugin_url() . '/images/working.gif" title="Working... Please wait as this may take a moment..."></center></div>';
        pb_backupbuddy::set_status_serial('restore');
        global $wp_version;
        pb_backupbuddy::status('details', 'BackupBuddy v' . pb_backupbuddy::settings('version') . ' using WordPress v' . $wp_version . ' on ' . PHP_OS . '.');
        $archive_file = pb_backupbuddy::_GET('archive');
        // archive to extract from.
        require pb_backupbuddy::plugin_path() . '/classes/_restoreFiles.php';
        $result = backupbuddy_restore_files::restore(backupbuddy_core::getBackupDirectory() . $archive_file, $files, $finalPath = ABSPATH);
        echo '<script type="text/javascript">jQuery("#pb_backupbuddy_working").hide();</script>';
        pb_backupbuddy::flush();
        if (false === $result) {
        } else {
        }
        pb_backupbuddy::$ui->ajax_footer();
        pb_backupbuddy::$ui->ajax_footer();
        die;
    }
Exemplo n.º 3
0
	jQuery( '#pb_backupbuddy_undourl' ).parent('#message').slideDown();
}
</script>

<style>
	#pb_backupbuddy_status_wrap {
		display: none;
		margin-bottom: 10px;
	}
</style>



<?php 
echo '<div id="pb_backupbuddy_status_wrap">';
echo pb_backupbuddy::status_box('Starting deployment process . . .');
echo '</div>';
global $wp_version;
pb_backupbuddy::status('details', 'BackupBuddy v' . pb_backupbuddy::settings('version') . ' using WordPress v' . $wp_version . ' on ' . PHP_OS . '.');
?>


<script type="text/javascript">
	function pb_status_append( status_string ) {
		//console.log( status_string );
		target_id = 'pb_backupbuddy_status'; // importbuddy_status or pb_backupbuddy_status
		if( jQuery( '#' + target_id ).length == 0 ) { // No status box yet so suppress.
			return;
		}
		jQuery( '#' + target_id ).append( "\n" + status_string );
		textareaelem = document.getElementById( target_id );
Exemplo n.º 4
0
    $pb_backupbuddy_js_status = true;
    ?>
	<script type="text/javascript">
			function pb_status_append( status_string ) {
				target_id = 'pb_backupbuddy_status'; // importbuddy_status or pb_backupbuddy_status
				if( jQuery( '#' + target_id ).length == 0 ) { // No status box yet so suppress.
					return;
				}
				jQuery( '#' + target_id ).append( "\n" + status_string );
				textareaelem = document.getElementById( target_id );
				textareaelem.scrollTop = textareaelem.scrollHeight;
			}
		</script>
	<?php 
    echo '<div style="width: 98%;">';
    echo pb_backupbuddy::status_box('Mass replacing in database powered by BackupBuddy v' . PB_BB_VERSION . '...');
    echo '</div>';
    echo '<div id="pb_importbuddy_working"><img src="' . pb_backupbuddy::plugin_url() . '/images/loading_large.gif" title="Working... Please wait as this may take a moment..."></div>';
    pb_backupbuddy::flush();
    //echo '<div id="pb_backupbuddy_replace_working"><img src="' . pb_backupbuddy::plugin_url() . '/images/loading_large.gif" title="Working... Please wait as this may take a moment..."></div>';
    // Instantiate database replacement class.
    require_once pb_backupbuddy::plugin_path() . '/lib/dbreplace/dbreplace.php';
    $dbreplace = new pluginbuddy_dbreplace();
    // Set up variables by getting POST data.
    $needle = mysql_real_escape_string(pb_backupbuddy::_POST('needle'));
    if ($needle == '') {
        echo '<b>Error #4456582. Missing needle. You must enter text to search for.';
        echo '<br><a href="' . pb_backupbuddy::page_url() . '&parent_config=' . htmlentities(pb_backupbuddy::_GET('parent_config')) . '" class="button secondary-button">&larr; ' . __('back', 'it-l10n-backupbuddy') . '</a>';
        return;
    }
    $replacement = mysql_real_escape_string(pb_backupbuddy::_POST('replacement'));
Exemplo n.º 5
0
    public function restore_file_restore()
    {
        $success = false;
        pb_backupbuddy::$ui->ajax_header(true, false);
        // js, no padding
        ?>
		<script type="text/javascript">
			function pb_status_append( status_string ) {
				target_id = 'pb_backupbuddy_status'; // importbuddy_status or pb_backupbuddy_status
				if( jQuery( '#' + target_id ).length == 0 ) { // No status box yet so suppress.
					return;
				}
				jQuery( '#' + target_id ).append( "\n" + status_string );
				textareaelem = document.getElementById( target_id );
				textareaelem.scrollTop = textareaelem.scrollHeight;
			}
		</script>
		<?php 
        global $pb_backupbuddy_js_status;
        $pb_backupbuddy_js_status = true;
        echo pb_backupbuddy::status_box('Restoring . . .');
        echo '<div id="pb_backupbuddy_working" style="width: 100px;"><br><center><img src="' . pb_backupbuddy::plugin_url() . '/images/working.gif" title="Working... Please wait as this may take a moment..."></center></div>';
        pb_backupbuddy::set_status_serial('restore');
        global $wp_version;
        pb_backupbuddy::status('details', 'BackupBuddy v' . pb_backupbuddy::settings('version') . ' using WordPress v' . $wp_version . ' on ' . PHP_OS . '.');
        $archive_file = pb_backupbuddy::_GET('archive');
        // archive to extract from.
        $files = pb_backupbuddy::_GET('files');
        // file to extract.
        $files_array = explode(',', $files);
        $files = array();
        foreach ($files_array as $file) {
            if (substr($file, -1) == '/') {
                // If directory then add wildcard.
                $file = $file . '*';
            }
            $files[$file] = $file;
        }
        unset($files_array);
        $serial = backupbuddy_core::get_serial_from_file($archive_file);
        // serial of archive.
        foreach ($files as $file) {
            $file = str_replace('*', '', $file);
            // Remove any wildcard.
            if (file_exists(ABSPATH . $file) && is_dir(ABSPATH . $file)) {
                if (($file_count = @scandir(ABSPATH . $file)) && count($file_count) > 2) {
                    pb_backupbuddy::status('error', __('Error #9036. The destination directory being restored already exists and is NOT empty. The directory will not be restored to prevent inadvertently losing files within the existing directory. Delete existing directory first if you wish to proceed or restore individual files.', 'it-l10n-backupbuddy') . ' Existing directory: `' . ABSPATH . $file . '`.');
                    echo '<script type="text/javascript">jQuery("#pb_backupbuddy_working").hide();</script>';
                    pb_backupbuddy::flush();
                    pb_backupbuddy::$ui->ajax_footer();
                    die;
                }
            }
        }
        require_once pb_backupbuddy::plugin_path() . '/lib/zipbuddy/zipbuddy.php';
        $zipbuddy = new pluginbuddy_zipbuddy(backupbuddy_core::getBackupDirectory());
        // Calculate temp directory & lock it down.
        $temp_dir = get_temp_dir();
        $destination = $temp_dir . 'backupbuddy-' . $serial;
        if (!file_exists($destination) && false === mkdir($destination, 0777, true)) {
            $error = 'Error #458485945: Unable to create temporary location.';
            pb_backupbuddy::status('error', $error);
            echo '<script type="text/javascript">jQuery("#pb_backupbuddy_working").hide();</script>';
            pb_backupbuddy::flush();
            pb_backupbuddy::$ui->ajax_footer();
            die;
        }
        // If temp directory is within webroot then lock it down.
        $temp_dir = str_replace('\\', '/', $temp_dir);
        // Normalize for Windows.
        $temp_dir = rtrim($temp_dir, '/\\') . '/';
        // Enforce single trailing slash.
        if (FALSE !== stristr($temp_dir, ABSPATH)) {
            // Temp dir is within webroot.
            pb_backupbuddy::anti_directory_browsing($destination);
        }
        unset($temp_dir);
        pb_backupbuddy::status('details', 'Extracting into temporary directory "' . $destination . '".');
        pb_backupbuddy::status('details', 'Files to extract: `' . htmlentities(pb_backupbuddy::_GET('files')) . '`.');
        // Make sure temp subdirectories exist.
        /*
        foreach( $files as $file => $null ) {
        	mkdir( $destination . '/' . basename( $file ), 0777, true );
        }
        */
        pb_backupbuddy::flush();
        $extract_success = true;
        $extract_result = $zipbuddy->extract(backupbuddy_core::getBackupDirectory() . $archive_file, $destination, $files);
        if (false === $extract_result) {
            // failed.
            pb_backupbuddy::status('error', 'Error #584984458b. Unable to extract.');
            $extract_success = false;
        } else {
            // success.
            // Verify all files/directories to be extracted exist in temp destination directory. If any missing then delete everything and bail out.
            foreach ($files as &$file) {
                $file = str_replace('*', '', $file);
                // Remove any wildcard.
                if (!file_exists($destination . '/' . $file)) {
                    // Cleanup.
                    foreach ($files as $file) {
                        @trigger_error('');
                        // Clear out last error.
                        @unlink($destination . '/' . $file);
                        $last_error = error_get_last();
                        if (is_array($last_error)) {
                            pb_backupbuddy::status('error', $last_error['message'] . ' File: `' . $last_error['file'] . '`. Line: `' . $last_error['line'] . '`.');
                        }
                    }
                    pb_backupbuddy::status('error', 'Error #854783474. One or more expected files / directories missing.');
                    $extract_success = false;
                    break;
                }
            }
            unset($file);
        }
        if (true === $extract_success) {
            // Made it this far so files all exist. Move them all.
            foreach ($files as $file) {
                @trigger_error('');
                // Clear out last error.
                if (false === @rename($destination . '/' . $file, ABSPATH . $file)) {
                    $last_error = error_get_last();
                    if (is_array($last_error)) {
                        //print_r( $last_error );
                        pb_backupbuddy::status('error', $last_error['message'] . ' File: `' . $last_error['file'] . '`. Line: `' . $last_error['line'] . '`.');
                    }
                    $error = 'Error #9035. Unable to move restored file `' . $destination . '/' . $file . '` to `' . ABSPATH . $file . '`. Verify permissions on destination location & that the destination directory/file does not already exist.';
                    pb_backupbuddy::status('error', $error);
                } else {
                    $details = 'Moved `' . $destination . '/' . $file . '` to `' . ABSPATH . $file . '`.<br>';
                    pb_backupbuddy::status('details', $details);
                    $success = true;
                }
            }
        }
        // end extract succeeded.
        // Try to cleanup.
        if (file_exists($destination)) {
            if (false === pb_backupbuddy::$filesystem->unlink_recursive($destination)) {
                pb_backupbuddy::status('details', 'Unable to delete temporary holding directory `' . $destination . '`.');
            } else {
                pb_backupbuddy::status('details', 'Cleaned up temporary files.');
            }
        }
        if (true === $success) {
            pb_backupbuddy::status('message', 'Restore completed successfully.');
        }
        echo '<script type="text/javascript">jQuery("#pb_backupbuddy_working").hide();</script>';
        pb_backupbuddy::flush();
        pb_backupbuddy::$ui->ajax_footer();
        die;
    }
Exemplo n.º 6
0
}
</script>

<style>
	#pb_backupbuddy_status_wrap {
		display: none;
		margin-bottom: 10px;
	}
</style>



<?php 
global $wp_version;
echo '<div id="pb_backupbuddy_status_wrap">';
echo pb_backupbuddy::status_box('Starting rollback process with BackupBuddy v' . pb_backupbuddy::settings('version') . ' using WordPress v' . $wp_version . ' on ' . PHP_OS . '...');
echo '</div>';
pb_backupbuddy::status('details', 'BackupBuddy v' . pb_backupbuddy::settings('version') . ' using WordPress v' . $wp_version . ' on ' . PHP_OS . '.');
?>


<script type="text/javascript">
	var statusBox; // Make global.
	var backupbuddy_errors_encountered = 0; // number of errors sent via log.
	
	rollback_loadRestoreEvents();
	
	function backupbuddy_hourpad(n) { return ("0" + n).slice(-2); }
	
	function pb_status_append( json ) {
		if( 'undefined' === typeof statusBox ) { // No status box yet so may need to create it.
    global $pb_backupbuddy_js_status;
    $pb_backupbuddy_js_status = true;
    ?>
	<script type="text/javascript">
			function pb_status_append( status_string ) {
				target_id = 'pb_backupbuddy_status'; // importbuddy_status or pb_backupbuddy_status
				if( jQuery( '#' + target_id ).length == 0 ) { // No status box yet so suppress.
					return;
				}
				jQuery( '#' + target_id ).append( "\n" + status_string );
				textareaelem = document.getElementById( target_id );
				textareaelem.scrollTop = textareaelem.scrollHeight;
			}
		</script>
	<?php 
    echo pb_backupbuddy::status_box('Mass replacing in database with Server Tools from BackupBuddy v' . pb_backupbuddy::settings('version') . '...');
    //echo '<div id="pb_backupbuddy_replace_working"><img src="' . pb_backupbuddy::plugin_url() . '/images/loading_large.gif" title="Working... Please wait as this may take a moment..."></div>';
    // Instantiate database replacement class.
    require_once pb_backupbuddy::plugin_path() . '/lib/dbreplace/dbreplace.php';
    $dbreplace = new pluginbuddy_dbreplace();
    // Set up variables by getting POST data.
    $needle = backupbuddy_core::dbEscape(pb_backupbuddy::_POST('needle'));
    if ($needle == '') {
        echo '<b>Error #4456582. Missing needle. You must enter text to search for.';
        echo '<br><a href="' . pb_backupbuddy::page_url() . '&tab=1#database_replace" class="button secondary-button">&larr; ' . __('back', 'it-l10n-backupbuddy') . '</a>';
        return;
    }
    $replacement = backupbuddy_core::dbEscape(pb_backupbuddy::_POST('replacement'));
    pb_backupbuddy::status('message', 'Replacing `' . $needle . '` with `' . $replacement . '`.');
    /*
    if ( pb_backupbuddy::_POST( 'maybe_serialized' ) == 'true' ) {
Exemplo n.º 8
0
	jQuery( '#pb_backupbuddy_undourl' ).parent('#message').slideDown();
}
</script>

<style>
	#pb_backupbuddy_status_wrap {
		display: none;
		margin-bottom: 10px;
	}
</style>



<?php 
echo '<div id="pb_backupbuddy_status_wrap">';
echo pb_backupbuddy::status_box('Starting rollback process . . .');
echo '</div>';
global $wp_version;
pb_backupbuddy::status('details', 'BackupBuddy v' . pb_backupbuddy::settings('version') . ' using WordPress v' . $wp_version . ' on ' . PHP_OS . '.');
?>


<script type="text/javascript">
	function pb_status_append( status_string ) {
		target_id = 'pb_backupbuddy_status'; // importbuddy_status or pb_backupbuddy_status
		if( jQuery( '#' + target_id ).length == 0 ) { // No status box yet so suppress.
			return;
		}
		jQuery( '#' + target_id ).append( "\n" + status_string );
		textareaelem = document.getElementById( target_id );
		textareaelem.scrollTop = textareaelem.scrollHeight;