public function run($arguments)
 {
     $arguments = Ithemes_Sync_Functions::merge_defaults($arguments, $this->default_arguments);
     $profile = $arguments['profile'];
     if ('db' == $profile) {
         // db profile is always index 1.
         $profile = '1';
     } elseif ('full' == $profile) {
         // full profile is always index 2.
         $profile = '2';
     }
     if (is_numeric($profile)) {
         if (isset(pb_backupbuddy::$options['profiles'][$profile])) {
             $profileArray = pb_backupbuddy::$options['profiles'][$profile];
         } else {
             return array('api' => '0', 'status' => 'error', 'message' => 'Error #2332904: Invalid profile ID `' . htmlentities($profile) . '`. Profile with this number was not found. Try deactivating then reactivating the plugin. If this fails please reset the plugin Settings back to Defaults from the Settings page.');
         }
     } else {
         return array('api' => '0', 'status' => 'error', 'message' => 'Error #85489548955. Invalid profile ID not numeric: `' . htmlentities($profile) . '`.');
     }
     require_once pb_backupbuddy::plugin_path() . '/classes/backup.php';
     pb_backupbuddy::$classes['backup'] = new pb_backupbuddy_backup();
     // Set serial ahead of time so can be used by AJAX before backup procedure actually begins.
     $serial = pb_backupbuddy::random_string(10);
     $profileArray['backup_mode'] = '2';
     // Force modern mode when running under sync.
     // Run the backup!
     if (pb_backupbuddy::$classes['backup']->start_backup_process($profileArray, 'manual', array(), array(), 'it-sync', $serial, array()) !== true) {
         return array('api' => '0', 'status' => 'error', 'message' => 'Error #435832: Backup failed. See BackupBuddy log for details.');
     }
     return array('api' => '0', 'status' => 'ok', 'message' => 'Backup initiated successfully.');
 }
Esempio n. 2
0
File: 1.php Progetto: verbazend/AWFA
/**
 *	get_archives_list()
 *
 *	Returns an array of backup archive zip filenames found.
 *
 *	@return		array		Array of .zip filenames; path NOT included.
 */
function get_archives_list() {
	if ( !isset( pb_backupbuddy::$classes['zipbuddy'] ) ) {
		require_once( pb_backupbuddy::plugin_path() . '/lib/zipbuddy/zipbuddy.php' );
		pb_backupbuddy::$classes['zipbuddy'] = new pluginbuddy_zipbuddy( ABSPATH );
	}
	
	// List backup files in this directory.
	$backup_archives_glob = glob( ABSPATH . 'backup*.zip' );
	if ( !is_array( $backup_archives_glob ) || empty( $backup_archives_glob ) ) { // On failure glob() returns false or an empty array depending on server settings so normalize here.
		$backup_archives_glob = array();
	}
	foreach( $backup_archives_glob as $backup_archive ) {
		$comment = pb_backupbuddy::$classes['zipbuddy']->get_comment( $backup_archive );
		if ( $comment === false ) {
			$comment = '';
		}
		
		$this_archive = array(
			'file'		=>		basename( $backup_archive ),
			'comment'	=>		$comment,
		);
		$backup_archives[] = $this_archive;
	}
	unset( $backup_archives_glob );
	
	
	return $backup_archives;
}
Esempio n. 3
0
function backupbuddy_register_sync_verbs($api)
{
    $verbs = array('backupbuddy-run-backup' => 'Ithemes_Sync_Verb_Backupbuddy_Run_Backup', 'backupbuddy-list-profiles' => 'Ithemes_Sync_Verb_Backupbuddy_List_Profiles', 'backupbuddy-list-schedules' => 'Ithemes_Sync_Verb_Backupbuddy_List_Schedules', 'backupbuddy-list-destinations' => 'Ithemes_Sync_Verb_Backupbuddy_List_Destinations', 'backupbuddy-get-overview' => 'Ithemes_Sync_Verb_Backupbuddy_Get_Overview', 'backupbuddy-get-latestBackupProcess' => 'Ithemes_Sync_Verb_Backupbuddy_Get_LatestBackupProcess', 'backupbuddy-get-everything' => 'Ithemes_Sync_Verb_Backupbuddy_Get_Everything', 'backupbuddy-get-importbuddy' => 'Ithemes_Sync_Verb_Backupbuddy_Get_Importbuddy');
    foreach ($verbs as $name => $class) {
        $api->register($name, $class, pb_backupbuddy::plugin_path() . "/classes/ithemes-sync/{$name}.php");
    }
}
Esempio n. 4
0
 function upgrader_instantiate($plugin_slug)
 {
     $args = array('parent' => $this, 'remote_url' => 'http://updater2.ithemes.com/index.php', 'version' => pb_backupbuddy::settings('version'), 'plugin_slug' => pb_backupbuddy::settings('slug'), 'plugin_path' => plugin_basename(pb_backupbuddy::plugin_path() . '/' . pb_backupbuddy::settings('init')), 'plugin_url' => pb_backupbuddy::plugin_url(), 'product' => pb_backupbuddy::settings('slug'), 'time' => 43200, 'return_format' => 'json', 'method' => 'POST', 'upgrade_action' => 'check');
     // Instantiate object of latest updater (by namespace) and apply to this plugin's pluginbuddy class (in this namespace).
     //$class_name = $plugin_namespace . "\\updater";
     $target_plugin_class_name = 'pb_' . $plugin_slug . '_updater';
     $this_plugin_class_name = 'pb_' . $this->_slug;
     //$this_plugin_class_name::$_updater = new $target_plugin_class_name( $args );
     pb_backupbuddy::$_updater = new $target_plugin_class_name($args);
 }
 public function run($arguments)
 {
     $arguments = Ithemes_Sync_Functions::merge_defaults($arguments, $this->default_arguments);
     require_once pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php';
     if (true === ($results = pb_backupbuddy_destinations::test($settings))) {
         return array('api' => '0', 'status' => 'ok', 'message' => 'Supported destinations retrieved.');
     } else {
         return array('api' => '0', 'status' => 'error', 'message' => $results);
     }
 }
 public function run($arguments)
 {
     $arguments = Ithemes_Sync_Functions::merge_defaults($arguments, $this->default_arguments);
     require_once pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php';
     $response = pb_backupbuddy_destinations::delete($arguments['id'], true);
     if (true === $response) {
         return array('api' => '0', 'status' => 'ok', 'message' => 'Destination deleted.');
     } else {
         return array('api' => '0', 'status' => 'error', 'message' => 'Error #384783783: Failure deleting destination.');
     }
 }
 public function run($arguments)
 {
     $arguments = Ithemes_Sync_Functions::merge_defaults($arguments, $this->default_arguments);
     if (!class_exists('backupbuddy_core')) {
         require_once pb_backupbuddy::plugin_path() . '/classes/core.php';
     }
     $overview = backupbuddy_api0::getOverview();
     // If archive file is set but actual file does not exist then clear out value.
     if (isset($overview['lastBackupStats']['archiveFile']) && !file_exists($overview['lastBackupStats']['archiveFile'])) {
         $overview['lastBackupStats']['archiveFile'] = '';
     }
     return array('version' => '4', 'status' => 'ok', 'message' => 'Overview retrieved successfully.', 'overview' => $overview);
 }
Esempio n. 8
0
function backupbuddy_register_sync_verbs($api)
{
    $verbs = array('backupbuddy-run-backup' => 'Ithemes_Sync_Verb_Backupbuddy_Run_Backup', 'backupbuddy-list-profiles' => 'Ithemes_Sync_Verb_Backupbuddy_List_Profiles', 'backupbuddy-list-schedules' => 'Ithemes_Sync_Verb_Backupbuddy_List_Schedules', 'backupbuddy-get-overview' => 'Ithemes_Sync_Verb_Backupbuddy_Get_Overview');
    foreach ($verbs as $name => $class) {
        $api->register($name, $class, pb_backupbuddy::plugin_path() . "/classes/ithemes-sync/{$name}.php");
    }
    //For testing:
    /*
    require_once( pb_backupbuddy::plugin_path() . "/classes/ithemes-sync/backupbuddy-get-overview.php" );
    $apple = new Ithemes_Sync_Verb_Backupbuddy_Get_Overview;
    error_log( $apple->run( array() ), true );
    */
}
Esempio n. 9
0
 function process_scheduled_backup($cron_id)
 {
     if (!isset(pb_backupbuddy::$options)) {
         $this->load();
     }
     pb_backupbuddy::status('details', 'cron_process_scheduled_backup: ' . $cron_id);
     if (!isset(pb_backupbuddy::$classes['core'])) {
         require_once pb_backupbuddy::plugin_path() . '/classes/core.php';
         pb_backupbuddy::$classes['core'] = new pb_backupbuddy_core();
     }
     $preflight_message = '';
     $preflight_checks = pb_backupbuddy::$classes['core']->preflight_check();
     foreach ($preflight_checks as $preflight_check) {
         if ($preflight_check['success'] !== true) {
             pb_backupbuddy::status('warning', $preflight_check['message']);
         }
     }
     if (is_array(pb_backupbuddy::$options['schedules'][$cron_id])) {
         // If schedule is disabled then just return. Bail out!
         if (isset(pb_backupbuddy::$options['schedules'][$cron_id]['on_off']) && pb_backupbuddy::$options['schedules'][$cron_id]['on_off'] == '0') {
             pb_backupbuddy::status('message', 'Schedule `' . $cron_id . '` NOT run due to being disabled based on this schedule\'s settings.');
             return;
         }
         pb_backupbuddy::$options['schedules'][$cron_id]['last_run'] = time();
         // update last run time.
         pb_backupbuddy::save();
         if (!isset(pb_backupbuddy::$classes['backup'])) {
             require_once pb_backupbuddy::plugin_path() . '/classes/backup.php';
             pb_backupbuddy::$classes['backup'] = new pb_backupbuddy_backup();
         }
         // If any remote destinations are set then add these to the steps to perform after the backup.
         $post_backup_steps = array();
         $destinations = explode('|', pb_backupbuddy::$options['schedules'][$cron_id]['remote_destinations']);
         foreach ($destinations as $destination) {
             if (isset($destination) && $destination != '') {
                 array_push($post_backup_steps, array('function' => 'send_remote_destination', 'args' => array($destination), 'start_time' => 0, 'finish_time' => 0, 'attempts' => 0));
             }
         }
         if (pb_backupbuddy::$options['schedules'][$cron_id]['delete_after'] == '1') {
             array_push($post_backup_steps, array('function' => 'post_remote_delete', 'args' => array(), 'start_time' => 0, 'finish_time' => 0, 'attempts' => 0));
         }
         if (pb_backupbuddy::$classes['backup']->start_backup_process(pb_backupbuddy::$options['schedules'][$cron_id]['type'], 'scheduled', array(), $post_backup_steps, pb_backupbuddy::$options['schedules'][$cron_id]['title']) !== true) {
             error_log('FAILURE #4455484589 IN BACKUPBUDDY.');
             echo __('Error #4564658344443: Backup failure', 'it-l10n-backupbuddy');
             echo pb_backupbuddy::$classes['backup']->get_errors();
         }
     }
     pb_backupbuddy::status('details', 'Finished cron_process_scheduled_backup.');
 }
Esempio n. 10
0
 /**
  * Factory
  *
  * @param string $method Signature method
  *
  * @return HTTP_OAuth_Signature_Common Signature instance
  */
 public static function factory($method)
 {
     $method = str_replace('-', '_', $method);
     $class = 'HTTP_OAuth_Signature_' . $method;
     $file = str_replace('_', '/', $class) . '.php';
     include_once pb_backupbuddy::plugin_path() . '/destinations/dropbox/lib/dropbuddy/pear_includes/' . $file;
     if (class_exists($class) === false) {
         throw new InvalidArgumentException('No such signature class');
     }
     $instance = new $class();
     if (!$instance instanceof HTTP_OAuth_Signature_Common) {
         throw new InvalidArgumentException('Signature class does not extend HTTP_OAuth_Signature_Common');
     }
     return $instance;
 }
Esempio n. 11
0
 public function __construct($force_methods = array())
 {
     pb_backupbuddy::status('details', 'textreplacebuddy: Loading textreplacebuddy library.');
     // Handles command line execution.
     require_once pb_backupbuddy::plugin_path() . '/lib/commandbuddy/commandbuddy.php';
     $this->_commandbuddy = new pb_backupbuddy_commandbuddy();
     // Set mechanism for dumping / restoring.
     if (count($force_methods) > 0) {
         // Mechanism forced. Overriding automatic check.
         pb_backupbuddy::status('message', 'textreplacebuddy: Settings overriding automatic detection of available database dump methods. Using forced override methods: `' . implode(',', $force_methods) . '`.');
         $this->_methods = $force_methods;
     } else {
         // No method defined; auto-detect the best.
         $this->_methods = $this->available_textreplace_methods();
     }
     pb_backupbuddy::status('message', 'textreplacebuddy: Detected text replacement methods: `' . implode(',', $this->_methods) . '`.');
 }
Esempio n. 12
0
 private function _connect($settings)
 {
     if (true === self::$_isConnected) {
         // Already connected.
         return $settings;
     }
     set_include_path(pb_backupbuddy::plugin_path() . '/destinations/gdrive/' . PATH_SEPARATOR . get_include_path());
     require_once pb_backupbuddy::plugin_path() . '/destinations/gdrive/Google/Client.php';
     require_once pb_backupbuddy::plugin_path() . '/destinations/gdrive/Google/Http/MediaFileUpload.php';
     require_once pb_backupbuddy::plugin_path() . '/destinations/gdrive/Google/Service/Drive.php';
     $client_id = $settings['client_id'];
     $client_secret = $settings['client_secret'];
     $redirect_uri = 'urn:ietf:wg:oauth:2.0:oob';
     self::$_client = new Google_Client();
     self::$_client->setClientId($client_id);
     self::$_client->setClientSecret($client_secret);
     self::$_client->setRedirectUri($redirect_uri);
     self::$_client->setAccessType('offline');
     // Required so that Google will use the refresh token.
     self::$_client->addScope("https://www.googleapis.com/auth/drive");
     self::$_drive = new Google_Service_Drive(self::$_client);
     self::$_client->setAccessToken($settings['tokens']);
     /*
     try {
     	$result = self::$_client->authenticate(); //  $auth_code 
     } catch (Exception $e) {
     	pb_backupbuddy::alert( 'Error Authenticating: ' . $e->getMessage() . ' Please go back, check codes, and try again.' );
     	return false;
     }
     */
     // Update tokens in settings.
     $oldAccessTokens = json_decode($settings['tokens']['refreshToken'], true);
     $newAccessToken = self::$_client->getAccessToken();
     //print_r( $newAccessToken );
     /*
     $accessTokens = json_decode( $newAccessToken, true );
     $accessTokens['refreshToken'] = $oldAccessTokens['refreshToken'];
     $settings['tokens'] = json_encode( $settings['tokens'] ); // Re-encode in JSON
     
     
     self::$_client->setAccessToken( $settings['tokens'] );
     */
     $settings['tokens'] = $newAccessToken;
     self::$_isConnected = true;
     return $settings;
 }
Esempio n. 13
0
 public function backupbuddy()
 {
     $function = str_replace(array('/', '\\'), '', pb_backupbuddy::_GET('function'));
     if ('' == $function) {
         $function = str_replace(array('/', '\\'), '', pb_backupbuddy::_POST('function'));
     }
     $file = pb_backupbuddy::plugin_path() . '/controllers/ajax/' . $function . '.php';
     if (!file_exists($file)) {
         die('0');
     }
     pb_backupbuddy::load();
     //pb_backupbuddy::$ui->ajax_header();
     require_once 'ajax/' . $function . '.php';
     //pb_backupbuddy::$ui->ajax_footer();
     //die();
     die;
 }
Esempio n. 14
0
 function process_rackspace_copy($rs_backup, $rs_username, $rs_api_key, $rs_container, $rs_server)
 {
     pb_backupbuddy::set_greedy_script_limits();
     require_once pb_backupbuddy::plugin_path() . '/lib/rackspace/cloudfiles.php';
     $auth = new CF_Authentication($rs_username, $rs_api_key, NULL, $rs_server);
     $auth->authenticate();
     $conn = new CF_Connection($auth);
     // Set container
     $container = $conn->get_container($rs_container);
     // Get file from Rackspace
     $rsfile = $container->get_object($rs_backup);
     $destination_file = ABSPATH . 'wp-content/uploads/backupbuddy_backups/' . $rs_backup;
     if (file_exists($destination_file)) {
         $destination_file = str_replace('backup-', 'backup_copy_' . pb_backupbuddy::random_string(5) . '-', $destination_file);
     }
     $fso = fopen(ABSPATH . 'wp-content/uploads/backupbuddy_backups/' . $rs_backup, 'w');
     $rsfile->stream($fso);
     fclose($fso);
 }
 public function run($arguments)
 {
     $arguments = Ithemes_Sync_Functions::merge_defaults($arguments, $this->default_arguments);
     if ('' == $arguments['password']) {
         // no password send in arguments.
         if (!isset(pb_backupbuddy::$options)) {
             pb_backupbuddy::load();
         }
         if ('' == pb_backupbuddy::$options['importbuddy_pass_hash']) {
             // no default password is set on Settings page.
             return array('api' => '0', 'status' => 'error', 'message' => 'No ImportBuddy password was entered and no default has been set on the Settings page.');
         } else {
             // Use default.
             $importbuddy_pass_hash = pb_backupbuddy::$options['importbuddy_pass_hash'];
         }
     } else {
         // Password passed in arguments.
         $importbuddy_pass_hash = md5($arguments['password']);
     }
     require_once pb_backupbuddy::plugin_path() . '/classes/core.php';
     return array('api' => '4', 'status' => 'ok', 'message' => 'ImportBuddy retrieved.', 'importbuddy' => base64_encode(backupbuddy_core::importbuddy('', $importbuddy_pass_hash, $returnNotEcho = true)));
 }
Esempio n. 16
0
 /**
  * Run a BackupBuddy backup. http://getbackupbuddy.com
  *
  * ## OPTIONS
  * 
  * <profile>
  * : Profile may either specify the profile ID number, "full" to run the first defined Full backup profile, or "db" to run the first defined Database-only backup profile. The first Full and Database-only profiles are always available as they are not user-deletable. To find the profile number, run a backup inside BackupBuddy in WordPress and note the number at the end of the URL (3 in this case): http://...&backupbuddy_backup=3
  *
  * [--quiet]
  * : Suppresses display of status log information from being output to the screen.
  *
  * ## EXAMPLES
  * 
  *     RUN FULL BACKUP:     wp backupbuddy backup full
  *     RUN PROFILE #3:      wp backupbuddy backup 3
  *
  * @synopsis <profile> [--quiet]
  */
 public function backup($args, $assoc_args)
 {
     $profile = $args[0];
     if ('db' == $profile) {
         // db profile is always index 1.
         $profile = '1';
     } elseif ('full' == $profile) {
         // full profile is always index 2.
         $profile = '2';
     }
     if (is_numeric($profile)) {
         if (isset(pb_backupbuddy::$options['profiles'][$profile])) {
             $profileArray = pb_backupbuddy::$options['profiles'][$profile];
         } else {
             WP_CLI::error('Error #2332904: Invalid profile ID `' . htmlentities($profile) . '`. Profile with this number was not found. Try deactivating then reactivating the plugin. If this fails please reset the plugin Settings back to Defaults from the Settings page.');
             return;
         }
     } else {
         WP_CLI::error('Error #85489548955. Invalid profile ID not numeric: `' . htmlentities($profile) . '`.');
         return;
     }
     require_once pb_backupbuddy::plugin_path() . '/classes/backup.php';
     pb_backupbuddy::$classes['backup'] = new pb_backupbuddy_backup();
     // Set serial ahead of time so can be used by AJAX before backup procedure actually begins.
     $serial = pb_backupbuddy::random_string(10);
     $profileArray['backup_mode'] = '1';
     // Force classic mode when running under command line.
     if (!isset($assoc_args['quiet'])) {
         define('BACKUPBUDDY_WP_CLI', true);
     }
     // Run the backup!
     if (pb_backupbuddy::$classes['backup']->start_backup_process($profileArray, 'manual', array(), array(), 'wp-cli', $serial, array()) !== true) {
         WP_CLI::error('Error #435832: Backup failed. See BackupBuddy log for details.');
         return;
     }
     WP_CLI::success('Backup completed successfully.');
     return;
 }
Esempio n. 17
0
<?php

backupbuddy_core::verifyAjaxAccess();
// Note: importbuddy, backup files, etc should have already been cleaned up by importbuddy itself at this point.
$serial = pb_backupbuddy::_POST('serial');
$direction = pb_backupbuddy::_POST('direction');
pb_backupbuddy::load();
if ('pull' == $direction) {
    // Local so clean up here.
    backupbuddy_core::cleanup_temp_tables($serial);
    die('1');
} elseif ('push' == $direction) {
    // Remote so call API to clean up.
    require_once pb_backupbuddy::plugin_path() . '/classes/remote_api.php';
    $destinationID = pb_backupbuddy::_POST('destinationID');
    if (!isset(pb_backupbuddy::$options['remote_destinations'][$destinationID])) {
        die('Error #8383983: Invalid destination ID `' . htmlentities($destinationID) . '`.');
    }
    $destinationArray = pb_backupbuddy::$options['remote_destinations'][$destinationID];
    if ('site' != $destinationArray['type']) {
        die('Error #8378332: Destination with ID `' . htmlentities($destinationID) . '` not of "site" type.');
    }
    $apiKey = $destinationArray['api_key'];
    $apiSettings = backupbuddy_remote_api::key_to_array($apiKey);
    if (false === ($response = backupbuddy_remote_api::remoteCall($apiSettings, 'confirmDeployment', array('serial' => $serial), 10, null, null, null, null, null, null, null, $returnRaw = true))) {
        $message = 'Error #2378378324. Unable to confirm remote deployment with serial `' . $serial . '` via remote API.';
        pb_backupbuddy::status('error', $message);
        die($message);
    } else {
        if (false === ($response = json_decode($response, true))) {
            $message = 'Error #239872373. Unable to decode remote deployment response with serial `' . $serial . '` via remote API. Remote server response: `' . print_r($response) . '`.';
Esempio n. 18
0
                pb_backupbuddy::status('error', $message);
                backupbuddy_core::mail_error($message);
            }
        }
    }
}
// Cleanup remote S3 multipart chunking.
foreach (pb_backupbuddy::$options['remote_destinations'] as $destination) {
    if ($destination['type'] != 's3') {
        continue;
    }
    if (isset($destination['max_chunk_size']) && $destination['max_chunk_size'] == '0') {
        continue;
    }
    pb_backupbuddy::status('details', 'Found S3 Multipart Chunking Destinations to cleanup.');
    require_once pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php';
    $cleanup_result = pb_backupbuddy_destinations::multipart_cleanup($destination);
    /*
    if ( true === $cleanup_result ) {
    	pb_backupbuddy::status( 'details', 'S3 Multipart Chunking Cleanup Success.' );
    } else {
    	pb_backupbuddy::status( 'error', 'S3 Multipart Chunking Cleanup FAILURE. Manually cleanup stalled multipart send via S3 or try again later.' );
    }
    */
}
// Clean up any temp rollback or deployment database tables.
backupbuddy_core::cleanup_temp_tables();
// Cleanup any cron schedules pointing to non-existing schedules.
$cron = get_option('cron');
// Loop through each cron time to create $crons array for displaying later.
$crons = array();
 *
 * LICENSE: This source file is subject to the New BSD license that is
 * available through the world-wide-web at the following URI:
 * http://www.opensource.org/licenses/bsd-license.php. If you did not receive  
 * a copy of the New BSD License and are unable to obtain it through the web, 
 * please send a note to license@php.net so we can mail you a copy immediately.
 *
 * @category  HTTP
 * @package   HTTP_OAuth
 * @author    Jeff Hodsdon <*****@*****.**> 
 * @copyright 2009 Jeff Hodsdon <*****@*****.**> 
 * @license   http://www.opensource.org/licenses/bsd-license.php New BSD License
 * @link      http://pear.php.net/package/HTTP_OAuth
 * @link      http://github.com/jeffhodsdon/HTTP_OAuth
 */
require_once pb_backupbuddy::plugin_path() . '/destinations/dropbox/lib/dropbuddy/pear_includes/HTTP/OAuth/Exception.php';
/**
 * HTTP_OAuth_Exception_NotImplemented
 * 
 * Exception class thrown when method are not yet implemented.
 *
 * @category  HTTP
 * @package   HTTP_OAuth
 * @author    Jeff Hodsdon <*****@*****.**> 
 * @copyright 2009 Jeff Hodsdon <*****@*****.**> 
 * @license   http://www.opensource.org/licenses/bsd-license.php New BSD License
 * @link      http://pear.php.net/package/HTTP_OAuth
 * @link      http://github.com/jeffhodsdon/HTTP_OAuth
 */
class HTTP_OAuth_Exception_NotImplemented extends HTTP_OAuth_Exception
{
Esempio n. 20
0
 * available through the world-wide-web at the following URI:
 * http://www.opensource.org/licenses/bsd-license.php. If you did not receive
 * a copy of the New BSD License and are unable to obtain it through the web,
 * please send a note to license@php.net so we can mail you a copy immediately.
 *
 * @category  HTTP
 * @package   HTTP_OAuth
 * @author    Jeff Hodsdon <*****@*****.**>
 * @copyright 2009 Jeff Hodsdon <*****@*****.**>
 * @license   http://www.opensource.org/licenses/bsd-license.php New BSD License
 * @link      http://pear.php.net/package/HTTP_OAuth
 * @link      http://github.com/jeffhodsdon/HTTP_OAuth
 */
require_once pb_backupbuddy::plugin_path() . '/destinations/dropbox/lib/dropbuddy/pear_includes/HTTP/OAuth/Message.php';
require_once pb_backupbuddy::plugin_path() . '/destinations/dropbox/lib/dropbuddy/pear_includes/HTTP/OAuth/Exception.php';
require_once pb_backupbuddy::plugin_path() . '/destinations/dropbox/lib/dropbuddy/pear_includes/HTTP/Request2/Response.php';
/**
 * HTTP_OAuth_Consumer_Response
 *
 * Class to handle OAuth responses from a provider.  Accepts and decorates a
 * HTTP_Request2_Response instance
 *
 * @category  HTTP
 * @package   HTTP_OAuth
 * @author    Jeff Hodsdon <*****@*****.**>
 * @copyright 2009 Jeff Hodsdon <*****@*****.**>
 * @license   http://www.opensource.org/licenses/bsd-license.php New BSD License
 * @link      http://pear.php.net/package/HTTP_OAuth
 * @link      http://github.com/jeffhodsdon/HTTP_OAuth
 */
class HTTP_OAuth_Consumer_Response extends HTTP_OAuth_Message
Esempio n. 21
0
 /**
  *	add_directory_to_zip()
  *
  *	Adds a directory to a new or existing (TODO: not yet available) ZIP file.
  *
  *	@param	string				Full path & filename of ZIP file to create.
  *	@param	string				Full directory to add to zip file.
  *	@param	array( string )		Array of strings of paths/files to exclude from zipping
  *	@param	string				Full directory path to directory to temporarily place ZIP
  *	@param	boolean				True: only use PCLZip. False: try all available
  *
  *	@return						true on success, false otherwise
  *
  */
 public function add_directory_to_zip($zip_file, $add_directory, $excludes = array(), $temporary_zip_directory = '')
 {
     if (true === $this->_is_experimental) {
         pb_backupbuddy::status('message', __('Running alternative ZIP system (BETA) based on settings.', 'it-l10n-backupbuddy'));
     } else {
         pb_backupbuddy::status('message', __('Running standard ZIP system based on settings.', 'it-l10n-backupbuddy'));
     }
     // Let's just log if this is a 32 or 64 bit system
     $php_size = pluginbuddy_stat::is_php(pluginbuddy_stat::THIRTY_TWO_BIT) ? "32" : "64";
     pb_backupbuddy::status('details', sprintf(__('Running under %1$s-bit PHP', 'it-l10n-backupbuddy'), $php_size));
     // Make sure we tell what the sapi is
     pb_backupbuddy::status('details', sprintf(__('Server API: %1$s', 'it-l10n-backupbuddy'), $this->get_sapi_name()));
     $zip_methods = array();
     $sanitized_excludes = array();
     $listmaker = NULL;
     // Set some additional system excludes here for now - these are all from the site install root
     $additional_excludes = array(self::NORM_DIRECTORY_SEPARATOR . 'importbuddy' . self::NORM_DIRECTORY_SEPARATOR, self::NORM_DIRECTORY_SEPARATOR . 'importbuddy.php', self::NORM_DIRECTORY_SEPARATOR . 'wp-content' . self::NORM_DIRECTORY_SEPARATOR . 'uploads' . self::NORM_DIRECTORY_SEPARATOR . 'pb_backupbuddy' . self::NORM_DIRECTORY_SEPARATOR);
     // Make sure we have a valid zip method strategy setting to use otherwise fall back to emergency compatibility
     if (isset(pb_backupbuddy::$options['zip_method_strategy']) && '0' !== pb_backupbuddy::$options['zip_method_strategy']) {
         $zip_method_strategy = pb_backupbuddy::$options['zip_method_strategy'];
         switch ($zip_method_strategy) {
             case "1":
                 // Best Available
                 $zip_methods = $this->get_best_zip_methods(array('is_archiver'));
                 pb_backupbuddy::status('details', __('Using Best Available zip method based on settings.', 'it-l10n-backupbuddy'));
                 break;
             case "2":
                 // All Available
                 $zip_methods = $this->_zip_methods;
                 pb_backupbuddy::status('details', __('Using All Available zip methods in preferred order based on settings.', 'it-l10n-backupbuddy'));
                 break;
             case "3":
                 // Force Compatibility
                 $zip_methods = $this->get_compatibility_zip_methods();
                 pb_backupbuddy::status('message', __('Using Forced Compatibility zip method based on settings.', 'it-l10n-backupbuddy'));
                 break;
             default:
                 // Hmm...unrecognized value - emergency compatibility
                 $zip_methods = $this->get_compatibility_zip_methods();
                 pb_backupbuddy::status('message', sprintf(__('Forced Compatibility Mode as Zip Method Strategy setting not recognized: %1$s', 'it-l10n-backupbuddy'), $zip_method_strategy));
         }
     } else {
         // We got no or an invalid zip method strategy which is a bad situation - emergency compatibility is the order of the day
         $zip_methods = $this->get_compatibility_zip_methods();
         pb_backupbuddy::status('message', __('Forced Compatibility Mode as Zip Method Strategy not set or setting not recognized.', 'it-l10n-backupbuddy'));
     }
     // Better make sure we have some available methods
     if (empty($zip_methods)) {
         // Hmm, we don't seem to have any available methods, oops, best go no further
         pb_backupbuddy::status('details', __('Failed to create a Zip Archive file - no available methods.', 'it-l10n-backupbuddy'));
         // We should have a temporary directory, must get rid of it, can simply rmdir it as it will (should) be empty
         if (!empty($temporary_zip_directory) && file_exists($temporary_zip_directory)) {
             if (!rmdir($temporary_zip_directory)) {
                 pb_backupbuddy::status('details', __('Temporary directory could not be deleted: ', 'it-l10n-backupbuddy') . $temporary_zip_directory);
             }
         }
         return false;
     }
     pb_backupbuddy::status('details', __('Creating ZIP file', 'it-l10n-backupbuddy') . ' `' . $zip_file . '`. ' . __('Adding directory', 'it-l10n-backupbuddy') . ' `' . $add_directory . '`. ' . __('Excludes', 'it-l10n-backupbuddy') . ': ' . implode(',', $excludes));
     // We'll try and allow exclusions for pclzip if we can
     include_once pb_backupbuddy::plugin_path() . '/lib/' . $this->_whereami . '/zbdir.php';
     if (class_exists('pluginbuddy_zbdir')) {
         // Generate our sanitized list of directories/files to exclude as absolute paths (normalized) for zbdir
         $sanitized_excludes = $this->sanitize_excludes($excludes, $additional_excludes, $add_directory);
         // Now let's create the list of items to add to the zip - first build the tree
         $listmaker = new pluginbuddy_zbdir($add_directory, $sanitized_excludes);
         // Re-generate our sanitized list of directories/files to exclude as relative paths
         // Slight kludge to deal with being able to enable/disable the inclusion processing
         // (currently configured in wp-config.php) so always need to provide the excludes as
         // relative path for now. This needs to be tidied up in future if/when the capability
         // is established as standard
         $sanitized_excludes = $this->sanitize_excludes($excludes, $additional_excludes);
     } else {
         // Generate our sanitized list of directories/files to exclude as relative paths
         $sanitized_excludes = $this->sanitize_excludes($excludes, $additional_excludes);
     }
     // Iterate over the methods - once we succeed just return directly otherwise drop through
     foreach ($zip_methods as $method_tag) {
         // First make sure we can archive with this method
         if ($this->_zip_methods_details[$method_tag]['attr']['is_archiver'] === true) {
             $class_name = 'pluginbuddy_zbzip' . $method_tag;
             $zipper = new $class_name($this);
             $zipper->set_status_callback(array(&$this, 'status'));
             // We need to tell the method what details belong to it
             $zipper->set_method_details($this->_zip_methods_details[$method_tag]);
             // Tell the method the server api in use
             $zipper->set_sapi_name($this->get_sapi_name());
             pb_backupbuddy::status('details', __('Trying ', 'it-l10n-backupbuddy') . $method_tag . __(' method for ZIP.', 'it-l10n-backupbuddy'));
             // As we are looping make sure we have no stale file information
             clearstatcache();
             // The temporary zip directory _must_ exist
             if (!empty($temporary_zip_directory)) {
                 if (!file_exists($temporary_zip_directory)) {
                     // Create temp dir if it does not exist.
                     mkdir($temporary_zip_directory);
                 }
             }
             // Now we are ready to try and produce the backup
             if ($zipper->create($zip_file, $add_directory, $sanitized_excludes, $temporary_zip_directory, $listmaker) === true) {
                 // Got a valid zip file so we can just return - method will have cleaned up the temporary directory
                 pb_backupbuddy::status('details', __('The ', 'it-l10n-backupbuddy') . $method_tag . __(' method for ZIP was successful.', 'it-l10n-backupbuddy'));
                 unset($zipper);
                 // We have to return here because we cannot break out of foreach
                 return true;
             } else {
                 // Method will have cleaned up the temporary directory
                 pb_backupbuddy::status('details', __('The ', 'it-l10n-backupbuddy') . $method_tag . __(' method for ZIP was unsuccessful.', 'it-l10n-backupbuddy'));
                 unset($zipper);
             }
         } else {
             // This method is not considered suitable (reliable enough) for creating archives or lacked zip capability
             pb_backupbuddy::status('details', __('The ', 'it-l10n-backupbuddy') . $method_tag . __(' method is not currently supported for backup.', 'it-l10n-backupbuddy'));
         }
     }
     // If we get here then have failed in all attempts
     pb_backupbuddy::status('details', __('Failed to create a Zip Archive file with any nominated method.', 'it-l10n-backupbuddy'));
     return false;
 }
Esempio n. 22
0
 public function _import_commandline($sql_file, $old_prefix, $query_start = 0, $ignore_existing = false)
 {
     pb_backupbuddy::status('details', 'mysqlbuddy: Preparing to run command line mysql import via exec().');
     // If prefix has changed then need to update the file.
     if ($old_prefix != $this->_database_prefix) {
         if (!isset(pb_backupbuddy::$classes['textreplacebuddy'])) {
             require_once pb_backupbuddy::plugin_path() . '/lib/textreplacebuddy/textreplacebuddy.php';
             pb_backupbuddy::$classes['textreplacebuddy'] = new pb_backupbuddy_textreplacebuddy();
         }
         pb_backupbuddy::$classes['textreplacebuddy']->set_methods(array('commandline'));
         // dont fallback into text version here.
         $regex_condition = "(INSERT INTO|CREATE TABLE|REFERENCES|CONSTRAINT|ALTER TABLE) (`?){$old_prefix}(`?)";
         pb_backupbuddy::$classes['textreplacebuddy']->string_replace($sql_file, $old_prefix, $this->_database_prefix, $regex_condition);
         $sql_file = $sql_file . '.tmp';
         // New SQL file created by textreplacebuddy.
     }
     /********** Begin preparing command **********/
     // Handle Windows wanting .exe. Note: executable directory path is prepended on exec() line of code.
     if (stristr(PHP_OS, 'WIN') && !stristr(PHP_OS, 'DARWIN')) {
         // Running Windows. (not darwin)
         $command = 'msql.exe';
     } else {
         $command = 'mysql';
     }
     // Handle possible sockets.
     if ($this->_database_socket != '') {
         $command .= " --socket={$this->_database_socket}";
         pb_backupbuddy::status('details', 'mysqlbuddy: Using sockets in command.');
     }
     // Set default charset if available.
     global $wpdb;
     if (isset($wpdb)) {
         pb_backupbuddy::status('details', 'wpdb charset override for commandline: ' . $wpdb->charset);
         $command .= " --default-character-set=" . $wpdb->charset;
     }
     //$command .= " --host={$this->_database_host} --user={$this->_database_user} --password={$this->_database_pass} --default_character_set utf8 {$this->_database_name} < {$sql_file}";
     $command .= " --host=" . escapeshellarg($this->_database_host) . " --user="******" --password="******" " . escapeshellarg($this->_database_name) . " 2>&1 < {$sql_file}";
     // 2>&1 redirect STDERR to STDOUT.
     /********** End preparing command **********/
     // Run command.
     pb_backupbuddy::status('details', 'mysqlbuddy: Running import via command line next.');
     list($exec_output, $exec_exit_code) = $this->_commandbuddy->execute($this->_mysql_directory . $command);
     // TODO: Removed mysql pinging here. Do we need (or even want) that here?
     // Check the result of the execution.
     if ($exec_exit_code == '0') {
         pb_backupbuddy::status('details', 'mysqlbuddy: Command appears to succeeded and returned proper response.');
         return true;
     } else {
         pb_backupbuddy::status('error', 'mysqlbuddy: Command did not exit normally. Falling back to database dump compatibility modes.');
         return false;
     }
     // Should never get to here.
     pb_backupbuddy::status('error', 'mysqlbuddy: Uncaught exception #433053890.');
     return false;
 }
Esempio n. 23
0
<?php // This code runs whenever in the wp-admin.



/********** MISC **********/



pb_backupbuddy::load();

// Load backupbuddy class with helper functions.
if ( !isset( pb_backupbuddy::$classes['core'] ) ) {
	require_once( pb_backupbuddy::plugin_path() . '/classes/core.php' );
	pb_backupbuddy::$classes['core'] = new pb_backupbuddy_core();
}

/********** Begin directory checking. **********/
// Keep backup directory up to date.
if ( pb_backupbuddy::$options['backup_directory'] != ( ABSPATH . 'wp-content/uploads/backupbuddy_backups/' ) ) {
	pb_backupbuddy::status( 'details', 'Backup directory has changed. Updating from `' . pb_backupbuddy::$options['backup_directory'] . '` to `' . ABSPATH . 'wp-content/uploads/backupbuddy_backups/' . '`.' );
	pb_backupbuddy::$options['backup_directory'] = ABSPATH . 'wp-content/uploads/backupbuddy_backups/';
	pb_backupbuddy::save();
}
// Make backup directory if it does not exist yet.
//pb_backupbuddy::status( 'details', 'Verifying backup directory `' . pb_backupbuddy::$options['backup_directory'] . '` exists.' );
if ( !file_exists( pb_backupbuddy::$options['backup_directory'] ) ) {
	pb_backupbuddy::status( 'details', 'Backup directory does not exist. Attempting to create.' );
	if ( pb_backupbuddy::$filesystem->mkdir( pb_backupbuddy::$options['backup_directory'] ) === false ) {
		pb_backupbuddy::status( 'error', sprintf( __('Unable to create backup storage directory (%s)', 'it-l10n-backupbuddy' ) , pb_backupbuddy::$options['backup_directory'] ) );
		pb_backupbuddy::alert( sprintf( __('Unable to create backup storage directory (%s)', 'it-l10n-backupbuddy' ) , pb_backupbuddy::$options['backup_directory'] ), true, '9002' );
	}
Esempio n. 24
0
    }
    unset($multisite_option);
}
if ($options !== false) {
    // If options is not false then we need to upgrade.
    pb_backupbuddy::status('details', 'Migrating data structure. 2.x data discovered.');
    backupbuddy_core::verify_directories();
    require_once pb_backupbuddy::plugin_path() . '/controllers/activation.php';
}
unset($options);
// Check if data version is behind & run activation upgrades if needed.
$default_options = pb_backupbuddy::settings('default_options');
if (pb_backupbuddy::$options['data_version'] < $default_options['data_version']) {
    backupbuddy_core::verify_directories();
    pb_backupbuddy::status('details', 'Data structure version of `' . pb_backupbuddy::$options['data_version'] . '` behind current version of `' . $default_options['data_version'] . '`. Running activation upgrade.');
    require_once pb_backupbuddy::plugin_path() . '/controllers/activation.php';
}
/* END HANDLING DATA STRUCTURE UPGRADE */
// Schedule daily housekeeping.
if (false === wp_next_scheduled(pb_backupbuddy::cron_tag('housekeeping'))) {
    // if schedule does not exist...
    backupbuddy_core::schedule_event(time() + 60 * 60 * 2, 'daily', pb_backupbuddy::cron_tag('housekeeping'), array());
    // Add schedule.
}
/********** ACTIONS (admin) **********/
// Set up reminders if enabled.
if (pb_backupbuddy::$options['backup_reminders'] == '1') {
    pb_backupbuddy::add_action(array('load-update-core.php', 'wp_update_backup_reminder'));
    pb_backupbuddy::add_action(array('post_updated_messages', 'content_editor_backup_reminder_on_update'));
}
// Display warning to network activate if running in normal mode on a MultiSite Network.
Esempio n. 25
0
 public function restoreFiles()
 {
     $this->_before(__FUNCTION__);
     // Zip & Unzip library setup.
     require_once pb_backupbuddy::plugin_path() . '/lib/zipbuddy/zipbuddy.php';
     pb_backupbuddy::$classes['zipbuddy'] = new pluginbuddy_zipbuddy($this->_state['restoreFileRoot'], array(), 'unzip');
     if (!file_exists($this->_state['archive'])) {
         pb_backupbuddy::status('error', 'Unable to find specified backup archive `' . $this->_state['archive'] . '`');
         return false;
     }
     pb_backupbuddy::status('message', 'Unzipping archive `' . $this->_state['archive'] . '` into `' . $this->_state['restoreFileRoot'] . '`');
     // Set compatibility mode if defined in advanced options.
     if ('all' == $this->_state['zipMethodStrategy']) {
         $compatibilityMode = false;
     } else {
         $compatibilityMode = $this->_state['zipMethodStrategy'];
     }
     // Extract zip file & verify it worked.
     if (true !== ($result = pb_backupbuddy::$classes['zipbuddy']->unzip($this->_state['archive'], $this->_state['restoreFileRoot'], $compatibilityMode))) {
         pb_backupbuddy::status('error', 'Failure extracting backup archive.');
         return false;
     } else {
         pb_backupbuddy::status('details', 'Success extracting backup archive.');
         return true;
     }
 }
Esempio n. 26
0
 function test_rackspace($rs_username, $rs_api_key, $rs_container, $rs_server)
 {
     if (empty($rs_username) || empty($rs_api_key) || empty($rs_container)) {
         return __('Missing one or more required fields.', 'it-l10n-backupbuddy');
     }
     require_once pb_backupbuddy::plugin_path() . '/lib/rackspace/cloudfiles.php';
     $auth = new CF_Authentication($rs_username, $rs_api_key, NULL, $rs_server);
     if (!$auth->authenticate()) {
         return __('Unable to authenticate. Verify your username/api key.', 'it-l10n-backupbuddy');
     }
     $conn = new CF_Connection($auth);
     // Set container
     $container = @$conn->get_container($rs_container);
     // returns object on success, string error message on failure.
     if (!is_object($container)) {
         return __('There was a problem selecting the container:', 'it-l10n-backupbuddy') . ' ' . $container;
     }
     // Create test file
     $testbackup = @$container->create_object('backupbuddytest.txt');
     if (!$testbackup->load_from_filename(pb_backupbuddy::plugin_path() . '/readme.txt')) {
         return __('BackupBuddy was not able to write the test file.', 'it-l10n-backupbuddy');
     }
     // Delete test file from Rackspace
     if (!$container->delete_object('backupbuddytest.txt')) {
         return __('Unable to delete file from container.', 'it-l10n-backupbuddy');
     }
     return true;
     // Success
 }
		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();
die;
/* restore_file_view()
*
* View contents of a file (text) that is inside a zip archive.
*
*/
pb_backupbuddy::$ui->ajax_header(true, false);
// js, no padding
$archive_file = pb_backupbuddy::_GET('archive');
// archive to extract from.
$file = pb_backupbuddy::_GET('file');
// file to extract.
$serial = backupbuddy_core::get_serial_from_file($archive_file);
// serial of archive.
$temp_file = uniqid();
// temp filename to extract into.
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)) {
    $error = 'Error #458485945b: Unable to create temporary location.';
    pb_backupbuddy::status('error', $error);
    die($error);
}
// 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)) {
Esempio n. 29
0
 public static function test($settings)
 {
     $remote_path = self::get_remote_path($settings['directory']);
     // Has leading and trailng slashes.
     $manage_data = pb_backupbuddy_destination_stash::get_manage_data($settings);
     if (!is_array($manage_data['credentials'])) {
         // Credentials were somehow faulty. User changed password after prior page? Unlikely but you never know...
         $error_msg = 'Error #8484383c: Your authentication credentials for Stash failed. Verify your login and password to Stash. You may need to update the Stash destination settings. Perhaps you recently changed your password?';
         pb_backupbuddy::status('error', $error_msg);
         return $error_msg;
     }
     // Try sending a file.
     $send_response = pb_backupbuddy_destinations::send($settings, dirname(dirname(__FILE__)) . '/remote-send-test.php', $send_id = 'TEST-' . pb_backupbuddy::random_string(12));
     // 3rd param true forces clearing of any current uploads.
     if (false === $send_response) {
         $send_response = 'Error sending test file to Stash.';
     } else {
         $send_response = 'Success.';
     }
     // S3 object for managing files.
     $credentials = pb_backupbuddy_destination_stash::get_manage_data($settings);
     $s3_manage = new AmazonS3($manage_data['credentials']);
     if ($settings['ssl'] == 0) {
         @$s3_manage->disable_ssl(true);
     }
     // Delete sent file.
     $delete_response = 'Success.';
     $delete_response = $s3_manage->delete_object($manage_data['bucket'], $manage_data['subkey'] . $remote_path . 'remote-send-test.php');
     if (!$delete_response->isOK()) {
         $delete_response = 'Unable to delete test Stash file `remote-send-test.php`. Details: `' . print_r($response, true) . '`.';
         pb_backupbuddy::status('details', $delete_response);
     } else {
         $delete_response = 'Success.';
     }
     // Load destination fileoptions.
     pb_backupbuddy::status('details', 'About to load fileoptions data.');
     require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
     $fileoptions_obj = new pb_backupbuddy_fileoptions(backupbuddy_core::getLogDirectory() . 'fileoptions/send-' . $send_id . '.txt', $read_only = false, $ignore_lock = false, $create_file = false);
     if (true !== ($result = $fileoptions_obj->is_ok())) {
         pb_backupbuddy::status('error', __('Fatal Error #9034.84838. Unable to access fileoptions data.', 'it-l10n-backupbuddy') . ' Error: ' . $result);
         return false;
     }
     pb_backupbuddy::status('details', 'Fileoptions data loaded.');
     $fileoptions =& $fileoptions_obj->options;
     if ('Success.' != $send_response || 'Success.' != $delete_response) {
         $fileoptions['status'] = 'failure';
         $fileoptions_obj->save();
         unset($fileoptions_obj);
         return 'Send details: `' . $send_response . '`. Delete details: `' . $delete_response . '`.';
     } else {
         $fileoptions['status'] = 'success';
         $fileoptions['finish_time'] = time();
     }
     $fileoptions_obj->save();
     unset($fileoptions_obj);
     return true;
 }
Esempio n. 30
0
// Reset disalerts.
if (pb_backupbuddy::_GET('reset_disalerts') != '') {
    pb_backupbuddy::$options['disalerts'] = array();
    pb_backupbuddy::save();
    pb_backupbuddy::alert('Dismissed alerts have been reset. They may now be visible again.');
}
echo '<textarea readonly="readonly" style="width: 100%;" wrap="off" cols="65" rows="7">';
if (file_exists($log_file)) {
    readfile($log_file);
} else {
    echo __('Nothing has been logged.', 'it-l10n-backupbuddy');
}
echo '</textarea>';
echo '<a href="' . pb_backupbuddy::page_url() . '&reset_log=true" class="button secondary-button">' . __('Clear Log', 'it-l10n-backupbuddy') . '</a>';
pb_backupbuddy::$ui->end_metabox();
plugin_information(pb_backupbuddy::settings('slug'), array('name' => pb_backupbuddy::settings('name'), 'path' => pb_backupbuddy::plugin_path()));
?>
		
		
		<br style="clear: both;">

		<div style="float: left;">
			<a href="<?php 
echo pb_backupbuddy::page_url();
?>
&cleanup_now=true" class="button secondary-button"><?php 
_e('Cleanup Temporary Files', 'it-l10n-backupbuddy');
?>
</a>
			&nbsp;
			<a href="<?php