示例#1
1
文件: restore.php 项目: arobbins/iab
 public function __construct($type, $existingState = '')
 {
     pb_backupbuddy::status('details', 'Constructing rollback class.');
     if ('rollback' != $type && 'restore' != $type) {
         $this->_error('Invalid restore type `' . htmlentities($type) . '`.');
         return false;
     }
     register_shutdown_function(array(&$this, 'shutdown_function'));
     pb_backupbuddy::status('details', 'Setting restore state defaults.');
     $this->_state = array('type' => $type, 'archive' => '', 'serial' => '', 'tempPath' => '', 'data' => array(), 'undoURL' => '', 'forceMysqlMethods' => array(), 'autoAdvance' => true, 'maxExecutionTime' => backupbuddy_core::detectMaxExecutionTime(), 'dbImportPoint' => 0, 'zipMethodStrategy' => 'all', 'restoreFiles' => true, 'restoreDatabase' => true, 'migrateHtaccess' => true, 'databaseSettings' => array('server' => '', 'database' => '', 'username' => '', 'password' => '', 'prefix' => '', 'tempPrefix' => '', 'wipePrefix' => false, 'renamePrefix' => false, 'wipeDatabase' => false, 'ignoreSqlErrors' => false, 'sqlFiles' => array(), 'sqlFilesLocation' => '', 'databaseMethodStrategy' => 'php', 'importResumePoint' => '', 'importedResumeRows' => 0, 'importedResumeFails' => 0, 'importedResumeTime' => 0, 'migrateDatabase' => true, 'migrateDatabaseBruteForce' => true, 'migrateResumeSteps' => '', 'migrateResumePoint' => ''), 'cleanup' => array('deleteArchive' => true, 'deleteTempFiles' => true, 'deleteImportBuddy' => true, 'deleteImportLog' => true), 'potentialProblems' => array(), 'stepHistory' => array());
     // Restore-specific default options.
     if ('restore' == $type) {
         $this->_state['skipUnzip'] = false;
         $this->_state['restoreFiles'] = true;
         $this->_state['restoreDatabase'] = true;
         $this->_state['migrateHtaccess'] = true;
         $this->_state['tempPath'] = ABSPATH . 'importbuddy/temp_' . pb_backupbuddy::$options['log_serial'] . '/';
     } elseif ('rollback' == $type) {
         $this->_state['tempPath'] = backupbuddy_core::getTempDirectory() . $this->_state['type'] . '_' . $this->_state['serial'] . '/';
     }
     if (is_array($existingState)) {
         // User passed along an existing state to resume.
         pb_backupbuddy::status('details', 'Using provided restore state data.');
         $this->_state = $this->_array_replace_recursive($this->_state, $existingState);
     }
     // Check if a default state override exists.  Used by automated restoring.
     /*
     if ( isset( pb_backupbuddy::$options['default_state_overrides'] ) && ( count( pb_backupbuddy::$options['default_state_overrides'] ) > 0 ) ) { // Default state overrides exist. Apply them.
     	$this->_state = array_merge( $this->_state, pb_backupbuddy::$options['default_state_overrides'] );
     }
     */
     pb_backupbuddy::status('details', 'Restore class constructed in `' . $type . '` mode.');
     pb_backupbuddy::set_greedy_script_limits();
     // Just always assume we need this during restores/rollback...
 }
示例#2
0
 public function __construct($database_host, $database_name, $database_user, $database_pass, $database_prefix, $force_methods = array(), $maxExecution = '', $max_rows_per_select = '')
 {
     if (isset(pb_backupbuddy::$options['phpmysqldump_maxrows']) && '' != pb_backupbuddy::$options['phpmysqldump_maxrows'] && is_numeric(pb_backupbuddy::$options['phpmysqldump_maxrows'])) {
         $this->_max_rows_per_select = pb_backupbuddy::$options['phpmysqldump_maxrows'];
     }
     if ('' != $max_rows_per_select && is_numeric($max_rows_per_select)) {
         $this->_max_rows_per_select = $max_rows_per_select;
     }
     pb_backupbuddy::status('details', 'Compatibility mysqldump (if applicable) max rows per select set to ' . $this->_max_rows_per_select . '.');
     // Handles command line execution.
     require_once pb_backupbuddy::plugin_path() . '/lib/commandbuddy/commandbuddy.php';
     $this->_commandbuddy = new pb_backupbuddy_commandbuddy();
     // Check for use of sockets in host. Handle if using sockets.
     //$database_host = 'localhost:/Applications/XAMPP/xamppfiles/var/mysql/mysql.sock';
     if (strpos($database_host, ':') === false) {
         // Normal host. No socket or port specified.
         pb_backupbuddy::status('details', 'Database host for dumping: `' . $database_host . '`');
         $this->_database_host = $database_host;
     } else {
         // Non-normal host specification. Either socket or port number is specified.
         $host_split = explode(':', $database_host);
         if (!is_numeric($host_split[1])) {
             // String so assume a socket.
             pb_backupbuddy::status('details', 'Database host (socket) for dumping. Host: `' . $host_split[0] . '`; Socket: `' . $host_split[1] . '`.');
             $this->_database_host = $host_split[0];
             $this->_database_socket = $host_split[1];
         } elseif (is_numeric($host_split[1])) {
             // Port number specified.
             $this->_database_host = $host_split[0];
             $this->_database_port = $host_split[1];
         } else {
             // Uknown. Leave as one piece.
             $this->_database_host = $database_host;
         }
     }
     unset($host_split);
     pb_backupbuddy::status('details', 'Loading mysqlbuddy library.');
     pb_backupbuddy::status('details', 'Mysql server default directories: `' . implode(',', $this->_default_mysql_directories) . '`');
     $this->_database_name = $database_name;
     $this->_database_user = $database_user;
     $this->_database_pass = $database_pass;
     $this->_database_prefix = $database_prefix;
     if (is_array($force_methods)) {
         pb_backupbuddy::status('details', 'mysqlbuddy: Force method of `' . count($force_methods) . '` passed.');
     } else {
         pb_backupbuddy::status('details', 'mysqlbuddy: Force method not an array.');
     }
     // Set mechanism for dumping / restoring.
     if (count($force_methods) > 0) {
         // Mechanism forced. Overriding automatic check.
         pb_backupbuddy::status('message', 'mysqlbuddy: Settings overriding automatic detection of available database dump methods. Using forced override methods: `' . implode(',', $force_methods) . '`.');
         if (in_array('commandline', $force_methods)) {
             pb_backupbuddy::status('details', 'Forced methods include commandline so calculating mysql directory.');
             $this->_mysql_directories = $this->_calculate_mysql_dir();
             // Try to determine mysql location / possible locations.
             $this->_methods = $this->available_dump_methods();
             // Run after _calculate_mysql_dir().
         }
         $this->_methods = $force_methods;
     } else {
         // No method defined; auto-detect the best.
         pb_backupbuddy::status('message', 'mysqlbuddy: Method not forced. About to detect directory and available methods.');
         $this->_mysql_directories = $this->_calculate_mysql_dir();
         // Try to determine mysql location / possible locations.
         $this->_methods = $this->available_dump_methods();
         // Run after _calculate_mysql_dir().
     }
     pb_backupbuddy::status('message', 'mysqlbuddy: Detected database dump methods: `' . implode(',', $this->_methods) . '`.');
     // Figure out max execution time allowed.
     if ('' != $maxExecution && is_numeric($maxExecution)) {
         $this->_maxExecutionTime = $maxExecution;
     } else {
         // Not passed. Deduce.
         if (isset(pb_backupbuddy::$options['max_execution_time'])) {
             $this->_maxExecutionTime = pb_backupbuddy::$options['max_execution_time'];
         } else {
             // Detect max execution time.
             $this->_maxExecutionTime = backupbuddy_core::detectMaxExecutionTime();
         }
     }
     if ('-1' == $this->_maxExecutionTime) {
         pb_backupbuddy::status('details', 'Max execution time chunking disabled by passing -1 to constructor. No chunking will be used for the database dump.');
     } else {
         pb_backupbuddy::status('details', 'If applicable, breaking up with max execution time `' . $this->_maxExecutionTime . '` seconds.');
     }
 }
示例#3
0
        $_POST['pb_backupbuddy_bucket'] = strtolower($_POST['pb_backupbuddy_bucket']);
        // bucket must be lower-case.
    }
}
// Form settings.
$settings_form->add_setting(array('type' => 'text', 'name' => 'title', 'title' => __('Destination name', 'it-l10n-backupbuddy'), 'tip' => __('Name of the new destination to create. This is for your convenience only.', 'it-l10n-backupbuddy'), 'rules' => 'required|string[1-45]', 'default' => $default_name));
$settings_form->add_setting(array('type' => 'text', 'name' => 'accesskey', 'title' => __('AWS access key', 'it-l10n-backupbuddy'), 'tip' => __('[Example: BSEGHGSDEUOXSQOPGSBE] - Log in to your Amazon S3 AWS Account and navigate to Account: Access Credentials: Security Credentials.', 'it-l10n-backupbuddy'), 'rules' => 'required|string[1-45]', 'after' => ' <a target="_new" href="http://ithemes.com/codex/page/BackupBuddy_Remote_Destinations:_Amazon_S3">Help setting up S3</a>'));
if ($mode == 'add') {
    // text mode to show secret key during adding.
    $secretkey_type_mode = 'text';
} else {
    // pass field to hide secret key for editing.
    $secretkey_type_mode = 'password';
}
$settings_form->add_setting(array('type' => $secretkey_type_mode, 'name' => 'secretkey', 'title' => __('AWS secret key', 'it-l10n-backupbuddy'), 'tip' => __('[Example: GHOIDDWE56SDSAZXMOPR] - Log in to your Amazon S3 AWS Account and navigate to Account: Access Credentials: Security Credentials.', 'it-l10n-backupbuddy'), 'rules' => 'required|string[1-45]'));
$settings_form->add_setting(array('type' => 'text', 'name' => 'bucket', 'title' => __('Bucket name', 'it-l10n-backupbuddy'), 'tip' => __('[Example: wordpress_backups] - This bucket will be created for you automatically if it does not already exist. Bucket names must be globally unique amongst all Amazon S3 users.', 'it-l10n-backupbuddy'), 'after' => '', 'rules' => 'required|string[1-500]'));
$settings_form->add_setting(array('type' => 'text', 'name' => 'full_archive_limit', 'title' => __('Full backup limit', 'it-l10n-backupbuddy'), 'tip' => __('[Example: 5] - Enter 0 for no limit. This is the maximum number of Full (complete) backup archives for this site (based on filename) to be stored in this specific destination. If this limit is met the oldest backup of this type will be deleted.', 'it-l10n-backupbuddy'), 'rules' => 'required|int[0-9999999]', 'css' => 'width: 50px;', 'after' => ' backups'));
$settings_form->add_setting(array('type' => 'text', 'name' => 'db_archive_limit', 'title' => __('Database only limit', 'it-l10n-backupbuddy'), 'tip' => __('[Example: 5] - Enter 0 for no limit. This is the maximum number of Database Only backup archives for this site (based on filename) to be stored in this specific destination. If this limit is met the oldest backup of this type will be deleted.', 'it-l10n-backupbuddy'), 'rules' => 'required|int[0-9999999]', 'css' => 'width: 50px;', 'after' => ' backups'));
$settings_form->add_setting(array('type' => 'text', 'name' => 'files_archive_limit', 'title' => __('Files only limit', 'it-l10n-backupbuddy'), 'tip' => __('[Example: 5] - Enter 0 for no limit. This is the maximum number of Files Only backup archives for this site (based on filename) to be stored in this specific destination. If this limit is met the oldest backup of this type will be deleted.', 'it-l10n-backupbuddy'), 'rules' => 'required|int[0-9999999]', 'css' => 'width: 50px;', 'after' => ' backups'));
$settings_form->add_setting(array('type' => 'text', 'name' => 'directory', 'title' => __('Directory (optional)', 'it-l10n-backupbuddy'), 'tip' => __('[Example: backupbuddy] - Directory name to place the backup within.', 'it-l10n-backupbuddy'), 'rules' => 'string[0-500]'));
$settings_form->add_setting(array('type' => 'title', 'name' => 'advanced_begin', 'title' => '<span class="dashicons dashicons-arrow-right"></span> ' . __('Advanced Options', 'it-l10n-backupbuddy'), 'row_class' => 'advanced-toggle-title'));
$settings_form->add_setting(array('type' => 'select', 'name' => 'region', 'title' => __('New bucket region', 'it-l10n-backupbuddy'), 'options' => array('s3.amazonaws.com' => 'US Standard [default]', 's3-us-west-2.amazonaws.com' => 'US West (Oregon)', 's3-us-west-1.amazonaws.com' => 'US West (Northern California)', 's3-eu-central-1.amazonaws.com' => 'EU (Frankfurt)', 's3-eu-west-1.amazonaws.com' => 'EU (Ireland)', 's3-ap-southeast-1.amazonaws.com' => 'Asia Pacific (Singapore)', 's3-ap-southeast-2.amazonaws.com' => 'Asia Pacific (Sydney)', 's3-ap-northeast-1.amazonaws.com' => 'Asia Pacific (Tokyo)', 's3-sa-east-1.amazonaws.com' => 'South America (Sao Paulo)'), 'tip' => __('[Default: US Standard] - Determines the region where NEW buckets will be created (if any). If your bucket already exists then it will NOT be modified.', 'it-l10n-backupbuddy'), 'rules' => 'required', 'after' => ' <span class="description">Applies to <b>new</b> buckets only.</span>', 'row_class' => 'advanced-toggle'));
$settings_form->add_setting(array('type' => 'select', 'name' => 'storage', 'title' => __('Storage Class', 'it-l10n-backupbuddy'), 'options' => array('STANDARD' => 'Standard Storage [default]', 'REDUCED_REDUNDANCY' => 'Reduced Redundancy'), 'tip' => __('[Default: Standard Storage] - Determines the type of storage to use when placing this file on Amazon S3. Reduced redundancy offers less protection against loss but costs less. See Amazon for for details.', 'it-l10n-backupbuddy'), 'rules' => 'required', 'row_class' => 'advanced-toggle'));
$settings_form->add_setting(array('type' => 'text', 'name' => 'max_chunk_size', 'title' => __('Max chunk size', 'it-l10n-backupbuddy'), 'tip' => __('[Example: 5] - Enter 0 for no chunking; minimum of 5 if enabling. This is the maximum file size to send in one whole piece. Files larger than this will be transferred in pieces up to this file size one part at a time. This allows to transfer of larger files than you server may allow by breaking up the send process. Chunked files may be delayed if there is little site traffic to trigger them. Amazon recommends 100mb chunk sizes or less.', 'it-l10n-backupbuddy'), 'rules' => 'required|int[0-9999999]', 'css' => 'width: 50px;', 'after' => ' MB. <span class="description">' . __('Default', 'it-l10n-backupbuddy') . ': 80 MB</span>', 'row_class' => 'advanced-toggle'));
$settings_form->add_setting(array('type' => 'text', 'name' => 'max_burst', 'title' => __('Send per burst', 'it-l10n-backupbuddy'), 'tip' => __('[Default 25] - This is the amount of data that will be sent per burst within a single PHP page load/chunk. Bursts happen within a single page load. Chunks occur when broken up between page loads/PHP instances. Reduce if hitting PHP memory limits. Chunking time limits will only be checked between bursts. Lower burst size if timeouts occur before chunking checks trigger.', 'it-l10n-backupbuddy'), 'rules' => 'required|int[0-9999999]', 'css' => 'width: 50px;', 'after' => ' MB', 'row_class' => 'advanced-toggle'));
$settings_form->add_setting(array('type' => 'text', 'name' => 'max_time', 'title' => __('Max time per chunk', 'it-l10n-backupbuddy'), 'tip' => __('[Example: 30] - Enter 0 for no limit (aka no chunking; bursts may still occur based on burst size setting). This is the maximum number of seconds per page load that bursts will occur. If this time is exceeded when a burst finishes then the next burst will be chunked and ran on a new page load. Multiple bursts may be sent within each chunk.', 'it-l10n-backupbuddy'), 'rules' => '', 'css' => 'width: 50px;', 'after' => ' secs. <span class="description">' . __('Blank for detected default:', 'it-l10n-backupbuddy') . ' ' . backupbuddy_core::detectMaxExecutionTime() . ' sec</span>', 'row_class' => 'advanced-toggle'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'ssl', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Encrypt connection', 'it-l10n-backupbuddy') . '*', 'tip' => __('[Default: enabled] - When enabled, all transfers will be encrypted with SSL encryption. Disabling this may aid in connection troubles but results in lessened security. Note: Once your files arrive on our server they are encrypted using AES256 encryption. They are automatically decrypted upon download as needed.', 'it-l10n-backupbuddy'), 'css' => '', 'after' => '<span class="description"> ' . __('Enable connecting over SSL.', 'it-l10n-backupbuddy') . '<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* Files are always encrypted with AES256 upon arrival at S3.</span>', 'rules' => '', 'row_class' => 'advanced-toggle'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'use_packaged_cert', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Use included CA bundle', 'it-l10n-backupbuddy'), 'tip' => __('[Default: disabled] - When enabled, BackupBuddy will use its own bundled SSL certificate bundle for connecting to the server. Use this if SSL fails due to SSL certificate issues with your server.', 'it-l10n-backupbuddy'), 'css' => '', 'after' => '<span class="description"> ' . __('Use included certificate bundle.', 'it-l10n-backupbuddy') . '</span>', 'rules' => '', 'row_class' => 'advanced-toggle'));
if ($mode !== 'edit') {
    $settings_form->add_setting(array('type' => 'checkbox', 'name' => 'disable_file_management', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Disable file management', 'it-l10n-backupbuddy'), 'tip' => __('[Default: unchecked] - When checked, selecting this destination disables browsing or accessing files stored at this destination from within BackupBuddy.', 'it-l10n-backupbuddy'), 'css' => '', 'rules' => '', 'row_class' => 'advanced-toggle'));
}
示例#4
0
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'include_importbuddy', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Include ImportBuddy in full backup archive', 'it-l10n-backupbuddy'), 'tip' => __('[Default: enabled] - When enabled, the importbuddy.php (restoration tool) file will be included within the backup archive ZIP file in the location `/' . str_replace(ABSPATH, '', backupbuddy_core::getTempDirectory()) . ' xxxxxxxxxx/ importbuddy.php` where the x\'s match the unique random string in the backup ZIP filename.', 'it-l10n-backupbuddy'), 'css' => '', 'after' => ' <span style="white-space: nowrap;"><span class="description">' . __('Located in backup', 'it-l10n-backupbuddy') . ':</span>&nbsp; <span class="code" style="white-space: normal; background: #EAEAEA;"">/' . str_replace(ABSPATH, '', backupbuddy_core::getTempDirectory()) . 'xxxxxxxxxx/importbuddy.php</span>', 'rules' => 'required'));
$log_file = backupbuddy_core::getLogDirectory() . 'log-' . pb_backupbuddy::$options['log_serial'] . '.txt';
$settings_form->add_setting(array('type' => 'select', 'name' => 'log_level', 'title' => __('Logging Level', 'it-l10n-backupbuddy'), 'options' => array('0' => __('None', 'it-l10n-backupbuddy'), '1' => __('Errors Only', 'it-l10n-backupbuddy'), '2' => __('Errors & Warnings', 'it-l10n-backupbuddy'), '3' => __('Everything (troubleshooting mode)', 'it-l10n-backupbuddy')), 'tip' => sprintf(__('[Default: Errors Only] - This option controls how much activity is logged for records or troubleshooting. Logs may be viewed from the Logs / Other tab on the Settings page. Additionally when in Everything / Troubleshooting mode error emails will contain encrypted troubleshooting data for support. Log file: %s', 'it-l10n-backupbuddy'), $log_file), 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'select', 'name' => 'default_backup_tab', 'title' => __('Default backup tab', 'it-l10n-backupbuddy'), 'options' => array('0' => __('Overview', 'it-l10n-backupbuddy'), '1' => __('Status Log', 'it-l10n-backupbuddy')), 'tip' => sprintf(__('[Default: Overview] - The default tab open during a backup is the overview tab. A more technical view is available in the Status tab.', 'it-l10n-backupbuddy')), 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'text', 'name' => 'max_site_log_size', 'title' => __('Maximum log file size', 'it-l10n-backupbuddy'), 'tip' => __('[Default: 10 MB] - If the log file exceeds this size then it will be cleared to prevent it from using too much space.'), 'rules' => 'required|int', 'css' => 'width: 50px;', 'after' => ' MB'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'disable_localization', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Disable language localization', 'it-l10n-backupbuddy'), 'tip' => __('[Default: Unchecked] When checked language localization support will be disabled. BackupBuddy will revert to full English language mode. Use this to display logs in English for support.', 'it-l10n-backupbuddy') . '</span>', 'css' => '', 'after' => '<span class="description"> ' . __('Check to run BackupBuddy in English. This is useful for support.', 'it-l10n-backupbuddy') . '</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'title', 'name' => 'title_advanced', 'title' => __('Technical & Server Compatibility', 'it-l10n-backupbuddy')));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'delete_archives_pre_backup', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Delete all backup archives prior to backups', 'it-l10n-backupbuddy'), 'tip' => __('[Default: disabled] - When enabled all local backup archives will be deleted prior to each backup. This is useful if in compatibilty mode to prevent backing up existing files.', 'it-l10n-backupbuddy'), 'css' => '', 'after' => '<span class="description"> ' . __('Use is exclusions are malfunctioning or for special purposes.', 'it-l10n-backupbuddy') . '</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'disable_https_local_ssl_verify', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Disable local SSL certificate verification', 'it-l10n-backupbuddy'), 'tip' => __('[Default: Disabled] When checked, WordPress will skip local https SSL verification.', 'it-l10n-backupbuddy') . '</span>', 'css' => '', 'after' => '<span class="description"> ' . __('Workaround if local SSL verification fails (ie. for loopback & local CA cert issues).', 'it-l10n-backupbuddy') . '</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'prevent_flush', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Prevent Flushing', 'it-l10n-backupbuddy'), 'tip' => __('[Default: not prevented (unchecked)] - Rarely some servers die unexpectedly when flush() or ob_flush() are called multiple times during the same PHP process. Checking this prevents these from ever being called during backups.', 'it-l10n-backupbuddy'), 'css' => '', 'after' => '<span class="description"> ' . __('Check if directed by support.', 'it-l10n-backupbuddy') . '</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'save_comment_meta', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Save meta data in comment', 'it-l10n-backupbuddy'), 'tip' => __('[Default: Enabled] When enabled, BackupBuddy will store general backup information in the ZIP comment header such as Site URL, backup type & time, serial, etc. during backup creation.', 'it-l10n-backupbuddy') . '</span>', 'css' => '', 'after' => '<span class="description"> ' . __('If backups hang when saving meta data disabling skips this process.', 'it-l10n-backupbuddy') . '</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'profiles#0#integrity_check', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Perform integrity check on backup files', 'it-l10n-backupbuddy'), 'tip' => __('[Default: enabled] - By default each backup file is checked for integrity and completion the first time it is viewed on the Backup page.  On some server configurations this may cause memory problems as the integrity checking process is intensive.  If you are experiencing out of memory errors on the Backup file listing, you can uncheck this to disable this feature.', 'it-l10n-backupbuddy'), 'css' => '', 'after' => '<span class="description"> ' . __('Disable if the backup page will not load or backups hang on integrity check.', 'it-l10n-backupbuddy') . '</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'backup_cron_rescheduling', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Reschedule missing crons in manual backups', 'it-l10n-backupbuddy'), 'tip' => __('[Default: disabled] - To proceed to subsequent steps during backups BackupBuddy schedules the next step with the WordPress cron system.  If this cron goes missing the backup cannot proceed. This feature instructs BackupBuddy to attempt to re-schedule this cron as it occurs.', 'it-l10n-backupbuddy'), 'css' => '', 'after' => '<span class="description"> ' . __('Check if directed by support.', 'it-l10n-backupbuddy') . '</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'select', 'name' => 'backup_mode', 'title' => __('Default global backup mode', 'it-l10n-backupbuddy'), 'options' => array('1' => __('Classic (v1.x) - Entire backup in single PHP page load', 'it-l10n-backupbuddy'), '2' => __('Modern (v2.x+) - Split across page loads via WP cron', 'it-l10n-backupbuddy')), 'tip' => __('[Default: Modern] - If you are encountering difficulty backing up due to WordPress cron, HTTP Loopbacks, or other features specific to version 2.x you can try classic mode which runs like BackupBuddy v1.x did.', 'it-l10n-backupbuddy'), 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'title', 'name' => 'title_database', 'title' => __('Database', 'it-l10n-backupbuddy')));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'profiles#0#skip_database_dump', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Skip database dump on backup', 'it-l10n-backupbuddy'), 'tip' => __('[Default: disabled] - (WARNING: This prevents BackupBuddy from backing up the database during any kind of backup. This is for troubleshooting / advanced usage only to work around being unable to backup the database.', 'it-l10n-backupbuddy'), 'css' => '', 'after' => '<span class="description"> ' . __('Completely bypass backing up database for all database types. Use caution.', 'it-l10n-backupbuddy') . '</span>', 'rules' => 'required', 'orientation' => 'vertical'));
$settings_form->add_setting(array('type' => 'select', 'name' => 'database_method_strategy', 'title' => __('Database method strategy', 'it-l10n-backupbuddy'), 'options' => array('php' => __('PHP-based: Supports automated chunked resuming - default', 'it-l10n-backupbuddy'), 'commandline' => __('Commandline: Fast but does not support resuming', 'it-l10n-backupbuddy'), 'all' => __('All Available: ( PHP [chunking] > Commandline via exec()  )', 'it-l10n-backupbuddy')), 'tip' => __('[Default: PHP-based] - Normally use PHP-based which supports chunking (as of BackupBuddy v5) to support larger databases. Commandline-based database dumps use mysqldump which is very fast and efficient but cannot be broken up into smaller steps if it is too large which could result in timeouts on larger servers.', 'it-l10n-backupbuddy'), 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'breakout_tables', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Break out big table dumps into steps', 'it-l10n-backupbuddy'), 'tip' => __('[Default: enabled] When enabled, BackupBuddy will dump some of the commonly larger tables in separate steps. Note this only applies to command-line based dumps as PHP-based dumps automatically support chunking with resume on table and/or row as needed.', 'it-l10n-backupbuddy') . '</span>', 'css' => '', 'after' => '<span class="description"> ' . __('Commandline method: Break up dumping of big tables (chunking)', 'it-l10n-backupbuddy') . '</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'text', 'name' => 'phpmysqldump_maxrows', 'title' => __('Compatibility mode max rows per select', 'it-l10n-backupbuddy'), 'tip' => __('[Default: *blank*] - When BackupBuddy is using compatibility mdoe mysql dumping (via PHP), BackupBuddy selects data from the database. Reducing this number has BackupBuddy grab smaller portions from the database at a time. Leave blank to use built in default (around 2000 rows per select).', 'it-l10n-backupbuddy'), 'css' => 'width: 50px;', 'after' => ' rows. <span class="description"> ' . __('Blank for default.', 'it-l10n-backupbuddy') . ' (~1000 rows/select)</span>', 'rules' => 'int'));
$settings_form->add_setting(array('type' => 'text', 'name' => 'max_execution_time', 'title' => __('Maximum time per chunk', 'it-l10n-backupbuddy'), 'tip' => __('[Default: *blank*] - The maximum amount of time BackupBuddy should allow a database import chunk to run. BackupBuddy by default limits each chunk to your Maximum PHP runtime when using the default PHP-based method. If your database dump step is timing out then lowering this value will instruct the script to limit each `chunk` to allow it to finish within this time period. Raising this value above your servers limits will not increase or override server settings.', 'it-l10n-backupbuddy'), 'css' => 'width: 50px;', 'after' => ' sec. <span class="description"> ' . __('Blank for detected default.', 'it-l10n-backupbuddy') . ' (' . backupbuddy_core::detectMaxExecutionTime() . ' sec)</span>', 'rules' => 'int'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'ignore_command_length_check', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Ignore command line length check results', 'it-l10n-backupbuddy'), 'tip' => __('[Default: disabled] - WARNING: BackupBuddy attempts to determine your system\'s maximum command line length to insure that database operation commands do not get inadvertantly cut off. On some systems it is not possible to reliably detect this information which could result infalling back into compatibility mode even though the system is capable of running in normal operational modes. This option instructs BackupBuddy to ignore the results of the command line length check.', 'it-l10n-backupbuddy'), 'css' => '', 'after' => '<span class="description"> ' . __('Check if directed by support.', 'it-l10n-backupbuddy') . '</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'title', 'name' => 'title_zip', 'title' => __('Zip', 'it-l10n-backupbuddy')));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'compression', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Enable zip compression', 'it-l10n-backupbuddy'), 'tip' => __('[Default: enabled] - ZIP compression decreases file sizes of stored backups. If you are encountering timeouts due to the script running too long, disabling compression may allow the process to complete faster.', 'it-l10n-backupbuddy'), 'css' => '', 'after' => '<span class="description"> ' . __('Unchecking typically DOUBLES the amount of data which may be zipped up before timeouts.', 'it-l10n-backupbuddy') . '</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'select', 'name' => 'zip_method_strategy', 'title' => __('Zip method strategy', 'it-l10n-backupbuddy'), 'options' => array('1' => __('Best Available', 'it-l10n-backupbuddy'), '2' => __('All Available', 'it-l10n-backupbuddy'), '3' => __('Force Compatibility', 'it-l10n-backupbuddy')), 'tip' => __('[Default: Best Only] - Normally use Best Available but if the server is unreliable in this mode can try All Available or Force Compatibility', 'it-l10n-backupbuddy'), 'after' => '<span class="description"> ' . __('Select Force Compatibility if absolutely necessary.', 'it-l10n-backupbuddy') . '</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'alternative_zip_2', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Alternative zip system (BETA)', 'it-l10n-backupbuddy'), 'tip' => __('[Default: Disabled] Use if directed by support.', 'it-l10n-backupbuddy') . '</span>', 'css' => '', 'after' => '<span class="description"> Check if directed by support.</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'disable_zipmethod_caching', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Disable zip method caching', 'it-l10n-backupbuddy'), 'tip' => __('[Default: Disabled] Use if directed by support. Bypasses caching available zip methods so they are always displayed in logs. When unchecked BackupBuddy will cache command line zip testing for a few minutes so it does not run too often. This means that your backup status log may not always show the test results unless you disable caching.', 'it-l10n-backupbuddy') . '</span>', 'css' => '', 'after' => '<span class="description"> Check if directed by support to always log zip detection.</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'ignore_zip_warnings', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Ignore zip archive warnings', 'it-l10n-backupbuddy'), 'tip' => __('[Default: Disabled] When enabled BackupBuddy will ignore non-fatal warnings encountered during the backup process such as inability to read or access a file, symlink problems, etc. These non-fatal warnings will still be logged.', 'it-l10n-backupbuddy') . '</span>', 'css' => '', 'after' => '<span class="description"> Check to ignore non-fatal errors when zipping files.</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'ignore_zip_symlinks', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Ignore/do-not-follow symbolic links', 'it-l10n-backupbuddy'), 'tip' => __('[Default: Enabled] When enabled BackupBuddy will ignore/not-follow symbolic links encountered during the backup process', 'it-l10n-backupbuddy') . '</span>', 'css' => '', 'after' => '<span class="description"> Symbolic links are followed by default. Unfollowable links may cause failures.</span>', 'rules' => 'required'));
$settings_form->process();
// Handles processing the submitted form (if applicable).
$settings_form->display_settings('Save Advanced Settings');
示例#5
0
 public static function send($settings = array(), $file, $send_id = '', $delete_after = false)
 {
     global $pb_backupbuddy_destination_errors;
     if ('1' == $settings['disabled']) {
         $pb_backupbuddy_destination_errors[] = __('Error #48933: This destination is currently disabled. Enable it under this destination\'s Advanced Settings.', 'it-l10n-backupbuddy');
         return false;
     }
     $settings = self::_init($settings);
     // Handles formatting & sanitizing settings.
     $chunkSizeBytes = $settings['max_burst'] * 1024 * 1024;
     // Send X mb at a time to limit memory usage.
     self::$_timeStart = microtime(true);
     if (pb_backupbuddy::$options['log_level'] == '3') {
         // Full logging enabled.
         pb_backupbuddy::status('details', 'Settings due to log level: `' . print_r($settings, true) . '`.');
     }
     // Initiate multipart upload.
     if ('' == $settings['_multipart_id']) {
         // New transfer. Note: All transfers are handled as presumed multiparts for ease.
         // Handle chunking of file into a multipart upload (if applicable).
         $file_size = filesize($file);
         pb_backupbuddy::status('details', 'File size of `' . pb_backupbuddy::$format->file_size($file_size) . '`.');
         if ('1' != $settings['stash_mode']) {
             // About to chunk so cleanup any previous hanging multipart transfers.
             self::multipart_cleanup($settings);
         }
         // Initiate multipart upload with S3.
         pb_backupbuddy::status('details', 'Initiating multipart transfer.');
         $thisCall = array('Bucket' => $settings['bucket'], 'Key' => $settings['directory'] . basename($file), 'StorageClass' => $settings['storage'], 'ServerSideEncryption' => 'AES256');
         if ('1' == $settings['stash_mode']) {
             $thisCall['Key'] = $settings['_stash_object'];
             unset($thisCall['StorageClass']);
         }
         try {
             $response = self::$_client->createMultipartUpload($thisCall);
         } catch (Exception $e) {
             if (pb_backupbuddy::$options['log_level'] == '3') {
                 // Full logging enabled.
                 pb_backupbuddy::status('details', 'Call details due to logging level: `' . print_r($thisCall, true) . '`.');
             }
             return self::_error('Error #389383: Unable to initiate multipart upload. Details: `' . $e->getMessage() . '`.');
         }
         // Made it here so SUCCESS initiating multipart!
         $upload_id = (string) $response['UploadId'];
         pb_backupbuddy::status('details', 'Initiated multipart upload with ID `' . $upload_id . '`.');
         $backup_type = backupbuddy_core::getBackupTypeFromFile($file);
         // Calculate multipart settings.
         $multipart_destination_settings = $settings;
         $multipart_destination_settings['_multipart_id'] = $upload_id;
         $multipart_destination_settings['_multipart_partnumber'] = 0;
         $multipart_destination_settings['_multipart_file'] = $file;
         $multipart_destination_settings['_multipart_remotefile'] = $settings['directory'] . basename($file);
         if ('1' == $settings['stash_mode']) {
             $multipart_destination_settings['_multipart_remotefile'] = $settings['_stash_object'];
         }
         $multipart_destination_settings['_multipart_counts'] = self::_get_multipart_counts($file_size, $settings['max_burst'] * 1024 * 1024);
         // Size of chunks expected to be in bytes.
         $multipart_destination_settings['_multipart_backup_type'] = $backup_type;
         $multipart_destination_settings['_multipart_backup_size'] = $file_size;
         $multipart_destination_settings['_multipart_etag_parts'] = array();
         //pb_backupbuddy::status( 'details', 'Multipart settings to pass:'******'_multipart_status'] = 'Starting send of ' . count( $multipart_destination_settings['_multipart_counts'] ) . ' parts.';
         pb_backupbuddy::status('details', 'Multipart initiated; passing over to send first chunk this run.');
         $settings = $multipart_destination_settings;
         // Copy over settings.
         unset($multipart_destination_settings);
     }
     // end initiating multipart.
     // Send parts.
     $backup_type = str_replace('/', '', $settings['_multipart_backup_type']);
     // For use later by file limiting.
     $backup_size = $settings['_multipart_backup_size'];
     $maxTime = $settings['max_time'];
     if ('' == $maxTime || !is_numeric($maxTime)) {
         pb_backupbuddy::status('details', 'Max time not set in settings so detecting server max PHP runtime.');
         $maxTime = backupbuddy_core::detectMaxExecutionTime();
     }
     pb_backupbuddy::status('details', 'Using max runtime: `' . $maxTime . '`.');
     // Open file for streaming.
     $f = @fopen($settings['_multipart_file'], 'r');
     if (false === $f) {
         return self::_error('Error #437734. Unable to open file `' . $settings['_multipart_file'] . '` to send. Did it get deleted?');
     }
     $fileDone = false;
     while (!$fileDone && !feof($f)) {
         $sendStart = microtime(true);
         if (!isset($settings['_retry_stash_confirm']) || true !== $settings['_retry_stash_confirm']) {
             // Skip send if only needing to confirm.
             // Made it here so success sending part. Increment for next part to send.
             $settings['_multipart_partnumber']++;
             if (!isset($settings['_multipart_counts'][$settings['_multipart_partnumber'] - 1]['seekTo'])) {
                 pb_backupbuddy::status('error', 'Error #8239933: Missing multipart partnumber to seek to. Settings array: `' . print_r($settings, true) . '`.');
             }
             if (-1 == fseek($f, (int) $settings['_multipart_counts'][$settings['_multipart_partnumber'] - 1]['seekTo'])) {
                 return self::_error('Error #833838: Unable to fseek file.');
             }
             pb_backupbuddy::status('details', 'Beginning upload of part `' . $settings['_multipart_partnumber'] . '` of `' . count($settings['_multipart_counts']) . '` parts of file `' . $settings['_multipart_file'] . '` to remote location `' . $settings['_multipart_remotefile'] . '` with multipart ID `' . $settings['_multipart_id'] . '`.');
             $contentLength = (int) $settings['_multipart_counts'][$settings['_multipart_partnumber'] - 1]['length'];
             $uploadArr = array('Bucket' => $settings['bucket'], 'Key' => $settings['_multipart_remotefile'], 'UploadId' => $settings['_multipart_id'], 'PartNumber' => $settings['_multipart_partnumber'], 'ContentLength' => $contentLength, 'Body' => fread($f, $contentLength));
             //pb_backupbuddy::status( 'details', 'Send array: `' . print_r( $uploadArr, true ) . '`.' );
             //error_log( print_r( $uploadArr, true ) );
             try {
                 $response = self::$_client->uploadPart($uploadArr);
             } catch (Exception $e) {
                 @fclose($f);
                 return self::_error('Error #3897923: Unable to upload file part for multipart upload of ID `' . $settings['_multipart_id'] . '`. Details: `' . $e->getMessage() . '`.');
             }
             self::$_chunksSentThisRound++;
             $settings['_multipart_etag_parts'][] = array('PartNumber' => $settings['_multipart_partnumber'], 'ETag' => $response['ETag']);
             if (pb_backupbuddy::$options['log_level'] == '3') {
                 // Full logging enabled.
                 pb_backupbuddy::status('details', 'Success sending chunk. Upload details due to log level: `' . print_r($response, true) . '`.');
             } else {
                 pb_backupbuddy::status('details', 'Success sending chunk. Enable full logging for upload result details.');
             }
             $uploaded_size = $contentLength;
             $elapseTime = microtime(true) - $sendStart;
             if (0 == $elapseTime) {
                 $elapseTime = 1;
             }
             $uploaded_speed = $uploaded_size / $elapseTime;
             pb_backupbuddy::status('details', 'Uploaded size this burst: `' . pb_backupbuddy::$format->file_size($uploaded_size) . '`, Start time: `' . $sendStart . '`. Finish time: `' . microtime(true) . '`. Elapsed: `' . (microtime(true) - $sendStart) . '`. Speed: `' . pb_backupbuddy::$format->file_size($uploaded_speed) . '`/sec.');
         }
         // Load fileoptions to the send.
         if (isset($fileoptions_obj)) {
             pb_backupbuddy::status('details', 'fileoptions already loaded from prior pass.');
         } else {
             // load fileoptions
             pb_backupbuddy::status('details', 'About to load fileoptions data.');
             require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
             pb_backupbuddy::status('details', 'Fileoptions instance #10.');
             $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())) {
                 return self::_error(__('Fatal Error #9034.23788723. Unable to access fileoptions data.', 'it-l10n-backupbuddy') . ' Error: ' . $result);
             }
             pb_backupbuddy::status('details', 'Fileoptions data loaded.');
             $fileoptions =& $fileoptions_obj->options;
         }
         //$update_status = 'Sent part ' . $settings['_multipart_partnumber'] . ' of ' . count( $settings['_multipart_counts'] ) . '.';
         if (!isset($settings['_multipart_counts'][$settings['_multipart_partnumber']])) {
             // No more parts exist for this file. Tell S3 the multipart upload is complete and move on.
             if (isset($settings['_retry_stash_confirm']) && true === $settings['_retry_stash_confirm']) {
                 // Need to retry checking that the file confirm was a success.
                 // Grab array of files from customer's stash directory
                 $files = pb_backupbuddy_destination_stash2::listFiles($settings, $settings['_multipart_file']);
                 if (count($files) > 0) {
                     pb_backupbuddy::status('details', 'Stash confirmed upload completition was successful.');
                 } else {
                     pb_backupbuddy::status('error', 'Error #23972793: Error notifying Stash of upload success even after wait. Details: `' . print_r($response, true) . '`.');
                     return false;
                 }
             } else {
                 // Normal Stash part send.
                 $update_status = 'Sent part ' . $settings['_multipart_partnumber'] . ' of ' . count($settings['_multipart_counts']) . ' parts.';
                 pb_backupbuddy::status('details', 'Getting etags and notifying of multipart upload completion.');
                 try {
                     $response = self::$_client->completeMultipartUpload(array('Bucket' => $settings['bucket'], 'UploadId' => $settings['_multipart_id'], 'Key' => $settings['_multipart_remotefile'], 'Parts' => $settings['_multipart_etag_parts']));
                 } catch (Exception $e) {
                     return self::_error('Unable to notify server of completion of all parts for multipart upload `' . $settings['_multipart_id'] . '`. Details: `' . $e->getMessage() . '`.');
                 }
                 pb_backupbuddy::status('details', 'Server notified of multipart completion.');
                 if ('1' == $settings['stash_mode']) {
                     // Stash send confirm.
                     pb_backupbuddy::status('details', 'Notifying Stash of upload completion.');
                     $additionalParams = array('upload_id' => $settings['_stash_upload_id']);
                     $response = pb_backupbuddy_destination_stash2::stashAPI($settings, 'upload-complete', $additionalParams);
                     if (!is_array($response) || !isset($response['success'])) {
                         // If not array OR success key missing. May be a timeout or waiting on AWS system to combine multipart still. Check for file later.
                         $settings['_retry_stash_confirm'] = true;
                         $settings['_multipart_counts'] = array();
                         // No more parts remain.
                         $cronTime = time() + self::STASH_CONFIRM_RETRY_DELAY;
                         $cronArgs = array($settings, $file, $send_id, $delete_after);
                         $cronHashID = md5($cronTime . serialize($cronArgs));
                         $cronArgs[] = $cronHashID;
                         $schedule_result = backupbuddy_core::schedule_single_event($cronTime, 'destination_send', $cronArgs);
                         if (true === $schedule_result) {
                             pb_backupbuddy::status('details', 'Scheduled retry attempt to confirm send in `' . self::STASH_CONFIRM_RETRY_DELAY . '` seconds.');
                         } else {
                             pb_backupbuddy::status('error', 'Scheduled retry attempt FAILED to be scheduled.');
                         }
                         /*
                          *		TODO:	Once PING API is available, request a ping in the future so we make sure this actually runs reasonably soon.
                          *				Because we need a delay we are not firing off the cron here immediately so there will be no chaining of PHP
                          *				which may result in large delays before the next process if there's little site traffic.
                          */
                         return array($settings['_multipart_id'], 'Pending multipart send confirmation.');
                     } else {
                         // Array.
                         if (isset($response['success']) && true !== $response['success']) {
                             // Success key set AND not true.
                             pb_backupbuddy::status('error', 'Error #83298932: Error notifying Stash of upload success. Details: `' . print_r($response, true) . '`.');
                             return false;
                         } else {
                             // Success.
                             pb_backupbuddy::status('details', 'Stash notified of upload completition.');
                         }
                     }
                 }
             }
             // end not a Stash confirm retry.
             pb_backupbuddy::status('details', 'No more parts left for this multipart upload. Clearing multipart instance variables.');
             $settings['_multipart_partnumber'] = 0;
             $settings['_multipart_id'] = '';
             $settings['_multipart_file'] = '';
             $settings['_multipart_remotefile'] = '';
             // Multipart completed so safe to prevent housekeeping of incomplete multipart uploads.
             $settings['_multipart_transferspeeds'][] = $uploaded_speed;
             // Overall upload speed average.
             $uploaded_speed = array_sum($settings['_multipart_transferspeeds']) / count($settings['_multipart_counts']);
             pb_backupbuddy::status('details', 'Upload speed average of all chunks: `' . pb_backupbuddy::$format->file_size($uploaded_speed) . '`.');
             $settings['_multipart_counts'] = array();
             // Update stats.
             $fileoptions['_multipart_status'] = $update_status;
             $fileoptions['finish_time'] = microtime(true);
             $fileoptions['status'] = 'success';
             if (isset($uploaded_speed)) {
                 $fileoptions['write_speed'] = $uploaded_speed;
             }
             $fileoptions_obj->save();
             unset($fileoptions);
             $fileDone = true;
             @fclose($f);
         } else {
             // Parts remain. Schedule to continue if anything is left to upload for this multipart of any individual files.
             pb_backupbuddy::status('details', 'S3 multipart upload has more parts left.');
             $update_status = '<br>';
             $totalSent = 0;
             for ($i = 0; $i < $settings['_multipart_partnumber']; $i++) {
                 $totalSent += $settings['_multipart_counts'][$i]['length'];
             }
             $percentSent = ceil($totalSent / $settings['_multipart_backup_size'] * 100);
             $update_status .= '<div class="backupbuddy-progressbar" data-percent="' . $percentSent . '"><div class="backupbuddy-progressbar-label"></div></div>';
             if ('0' != $maxTime) {
                 // Not unlimited time so see if we can send more bursts this time or if we need to chunk.
                 // If we are within X second of reaching maximum PHP runtime then stop here so that it can be picked up in another PHP process...
                 $totalSizeSent = self::$_chunksSentThisRound * $chunkSizeBytes;
                 // Total bytes sent this PHP load.
                 $bytesPerSec = $totalSizeSent / (microtime(true) - $sendStart);
                 $timeRemaining = $maxTime - (microtime(true) - self::$_timeStart + self::TIME_WIGGLE_ROOM);
                 if ($timeRemaining < 0) {
                     $timeRemaining = 0;
                 }
                 $bytesWeCouldSendWithTimeLeft = $bytesPerSec * $timeRemaining;
                 //pb_backupbuddy::status( 'details', 'Sent this burst: `' . pb_backupbuddy::$format->file_size( $totalSizeSent ) .'` in `' . (microtime(true) - $sendStart ) . '` secs. Speed: `' . pb_backupbuddy::$format->file_size( $bytesPerSec ) . '`/sec. Time Remaining (w/ wiggle): `' . $timeRemaining . '`. Size that could potentially be sent with remaining time: `' . pb_backupbuddy::$format->file_size( $bytesWeCouldSendWithTimeLeft ) . '` with chunk size of `' . pb_backupbuddy::$format->file_size( $chunkSizeBytes ) . '`.' );
                 if ($bytesWeCouldSendWithTimeLeft < $chunkSizeBytes) {
                     // We can send more than a whole chunk (including wiggle room) so send another bit.
                     pb_backupbuddy::status('message', 'Not enough time left (~`' . $timeRemaining . '`) with max time of `' . $maxTime . '` sec to send another chunk at `' . pb_backupbuddy::$format->file_size($bytesPerSec) . '` / sec. Ran for ' . round(microtime(true) - self::$_timeStart, 3) . ' sec. Proceeding to use chunking.');
                     @fclose($fs);
                     $cronTime = time();
                     $cronArgs = array($settings, $file, $send_id, $delete_after);
                     $cronHashID = md5($cronTime . serialize($cronArgs));
                     $cronArgs[] = $cronHashID;
                     $schedule_result = backupbuddy_core::schedule_single_event($cronTime, 'destination_send', $cronArgs);
                     if (true === $schedule_result) {
                         pb_backupbuddy::status('details', 'Next S3 chunk step cron event scheduled.');
                     } else {
                         pb_backupbuddy::status('error', 'Next S3 chunk step cron even FAILED to be scheduled.');
                     }
                     spawn_cron(time() + 150);
                     // Adds > 60 seconds to get around once per minute cron running limit.
                     update_option('_transient_doing_cron', 0);
                     // Prevent cron-blocking for next item.
                     @fclose($f);
                     unset($fileoptions);
                     return array($settings['_multipart_id'], 'Sent part ' . $settings['_multipart_partnumber'] . ' of ' . count($settings['_multipart_counts']) . ' parts.' . $update_status);
                 } else {
                     // End if.
                     pb_backupbuddy::status('details', 'Not approaching limits. Proceeding to next burst this run.');
                 }
             } else {
                 pb_backupbuddy::status('details', 'Max time of zero (0) so assuming unlimited time.');
             }
             $fileoptions['_multipart_status'] = 'Sent part ' . $settings['_multipart_partnumber'] . ' of ' . count($settings['_multipart_counts']) . ' parts.' . $update_status;
             $fileoptions_obj->save();
             //unset( $fileoptions );
         }
         // end no more parts remain.
     }
     // End while not feof.
     /***** BEGIN FILE ARCHIVE LIMITS *****/
     if ('1' == $settings['stash_mode']) {
         // This is being wrapped by the Stash destination. Stash uses a different method of handling archive limiting due to using Stash API.
         pb_backupbuddy_destination_stash2::archiveLimit($settings, $backup_type);
     } else {
         // Normal. This is just a s32 destination.
         self::archiveLimit($settings, $backup_type);
     }
     /***** END FILE ARCHIVE LIMITS *****/
     if (isset($fileoptions_obj)) {
         unset($fileoptions_obj);
     }
     // Success if we made it this far.
     return true;
 }
示例#6
0
echo basename($restoreData['archive']);
?>
">
	<?php 
pb_backupbuddy::nonce();
?>
	<input type="hidden" name="restoreData" value="<?php 
echo base64_encode(serialize($restoreData));
?>
">
	<input type="submit" name="submitForm" class="button button-primary" value="<?php 
echo __('Begin Rollback') . ' &raquo;';
?>
">
	
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	
	<a class="button button-secondary" onclick="jQuery('#pb_backupbuddy_advanced').toggle();">Advanced Options</a>
	<span id="pb_backupbuddy_advanced" style="display: none; margin-left: 15px;">
		<label><input type="checkbox" name="autoAdvance" value="1" checked="checked"> Auto Advance</label>&nbsp;&nbsp;&nbsp;
		<label><input type="checkbox" name="forceMysqlCompatibility" value="1" checked="checked"> Force Mysql Compatibility,</label>
		<label>with chunk time limit: <input size="5" maxlength="5" type="text" name="maxExecutionTime" value="<?php 
echo backupbuddy_core::detectMaxExecutionTime();
?>
"> sec</label>
	</span>
	
</form>


示例#7
0
文件: init.php 项目: jimlongo56/rdiv
 public static function send($settings = array(), $files = array(), $send_id = '', $delete_after = false, $delete_remote_after = false)
 {
     global $pb_backupbuddy_destination_errors;
     if ('1' == $settings['disabled']) {
         $pb_backupbuddy_destination_errors[] = __('Error #48933: This destination is currently disabled. Enable it under this destination\'s Advanced Settings.', 'it-l10n-backupbuddy');
         return false;
     }
     if (!is_array($files)) {
         $files = array($files);
     }
     pb_backupbuddy::status('details', 'Google Drive send() function started. Settings: `' . print_r($settings, true) . '`.');
     self::$_timeStart = microtime(true);
     $settings = self::_normalizeSettings($settings);
     if (false === ($settings = self::_connect($settings))) {
         // $settings =
         return self::_error('Error #38923923: Unable to connect with Google Drive. See log for details.');
     }
     $folderID = $settings['folderID'];
     if ('' == $folderID) {
         $folderID = 'root';
     }
     $chunkSizeBytes = $settings['max_burst'] * 1024 * 1024;
     // Send X mb at a time to limit memory usage.
     foreach ($files as $file) {
         // Determine backup type for limiting later.
         $backup_type = '';
         if (stristr($file, '-db-') !== false) {
             $backup_type = 'db';
         } elseif (stristr($file, '-full-') !== false) {
             $backup_type = 'full';
         } elseif (stristr($file, '-files-') !== false) {
             $backup_type = 'files';
         } elseif (stristr($file, '-export-') !== false) {
             $backup_type = 'export';
         }
         if (!file_exists($file)) {
             return self::_error('Error #37792: File selected to send not found: `' . $file . '`.');
         }
         $fileSize = filesize($file);
         $fileinfo = pathinfo($file);
         $fileextension = $fileinfo['extension'];
         if ('zip' == $fileextension) {
             $mimeType = 'application/zip';
         } elseif ('php' == $fileextension) {
             $mimeType = 'application/x-httpd-php';
         } else {
             $mimeType = '';
         }
         pb_backupbuddy::status('details', 'About to upload file `' . $file . '` of size `' . $fileSize . '` with mimetype `' . $mimeType . '` into folder `' . $folderID . '`. Internal chunk size of `' . $chunkSizeBytes . '` bytes.');
         if ($fileSize > $chunkSizeBytes) {
             pb_backupbuddy::status('details', 'File size `' . pb_backupbuddy::$format->file_size($fileSize) . '` exceeds max burst size `' . $settings['max_burst'] . ' MB` so this will be sent in bursts. If time limit nears then send will be chunked across multiple PHP loads.');
             $settings['_chunks_total'] = ceil($fileSize / $chunkSizeBytes);
         }
         if (0 == $settings['_chunks_total']) {
             $settings['_chunks_total'] = 1;
         }
         //Insert a file
         $driveFile = new Google_Service_Drive_DriveFile();
         $driveFile->setTitle(basename($file));
         $driveFile->setDescription('BackupBuddy file');
         $driveFile->setMimeType($mimeType);
         // Set the parent folder.
         if ('root' != $folderID) {
             $parentsCollectionData = new Google_Service_Drive_ParentReference();
             $parentsCollectionData->setId($folderID);
             $driveFile->setParents(array($parentsCollectionData));
         }
         self::$_client->setDefer(true);
         try {
             $insertRequest = self::$_drive->files->insert($driveFile);
         } catch (Exception $e) {
             pb_backupbuddy::alert('Error #3232783268336: initiating upload. Details: ' . $e->getMessage());
             return false;
         }
         // Handle getting resume information to see if resuming is still an option.
         $resumable = false;
         if ('' != $settings['_media_resumeUri']) {
             $headers = array('content-range' => 'bytes */' . $fileSize);
             $request = new Google_Http_Request($settings['_media_resumeUri'], 'PUT', $headers, '');
             $response = self::$_client->getIo()->makeRequest($request);
             if (308 == $response->getResponseHttpCode()) {
                 $range = $response->getResponseHeader('range');
                 if (!empty($range) && preg_match('/bytes=0-(\\d+)$/', $range, $matches)) {
                     $resumable = true;
                     pb_backupbuddy::status('details', 'Last send reported next byte to be `' . $settings['_media_progress'] . '`.');
                     $settings['_media_progress'] = $matches[1] + 1;
                     pb_backupbuddy::status('details', 'Google Drive resuming is available. Google Drive reports next byte to be `' . $settings['_media_progress'] . '`. Range: `' . $range . '`.');
                 }
             }
             if (!$resumable) {
                 pb_backupbuddy::status('details', 'Google Drive could not resume. Too much time may have passed or some other cause.');
             }
             if ($settings['_media_progress'] >= $fileSize) {
                 pb_backupbuddy::status('details', 'Google Drive resuming not needed. Remote file meets or exceeds file size. Completed.');
                 return true;
             }
         }
         // See https://developers.google.com/api-client-library/php/guide/media_upload
         try {
             $media = new Google_Http_MediaFileUpload(self::$_client, $insertRequest, $mimeType, null, true, $chunkSizeBytes);
         } catch (Exception $e) {
             pb_backupbuddy::alert('Error #3893273937: initiating upload. Details: ' . $e->getMessage());
             return;
         }
         $media->setFileSize($fileSize);
         // Reset these internal variables. NOTE: These are by default private. Must modify MediaFileUpload.php to make this possible by setting these vars public. Thanks Google!
         if ('' != $settings['_media_resumeUri']) {
             $media->resumeUri = $settings['_media_resumeUri'];
             $media->progress = $settings['_media_progress'];
         }
         pb_backupbuddy::status('details', 'Opening file for sending in binary mode.');
         $fs = fopen($file, 'rb');
         // If chunked resuming then seek to the correct place in the file.
         if ('' != $settings['_media_progress'] && $settings['_media_progress'] > 0) {
             // Resuming send of a partially transferred file.
             if (0 !== fseek($fs, $settings['_media_progress'])) {
                 // Go off the resume point as given by Google in case it didnt all make it. //$settings['resume_point'] ) ) { // Returns 0 on success.
                 pb_backupbuddy::status('error', 'Error #3872733: Failed to seek file to resume point `' . $settings['_media_progress'] . '` via fseek().');
                 return false;
             }
             $prevPointer = $settings['_media_progress'];
             //$settings['resume_point'];
         } else {
             // New file send.
             $prevPointer = 0;
         }
         $needProcessChunking = false;
         // Set true if we need to spawn off resuming to a new PHP page load.
         $uploadStatus = false;
         while (!$uploadStatus && !feof($fs)) {
             $chunk = fread($fs, $chunkSizeBytes);
             pb_backupbuddy::status('details', 'Chunk of size `' . pb_backupbuddy::$format->file_size($chunkSizeBytes) . '` read into memory. Total bytes summed: `' . ($settings['_media_progress'] + strlen($chunk)) . '` of filesize: `' . $fileSize . '`.');
             pb_backupbuddy::status('details', 'Sending burst file data next. If next message is not "Burst file data sent" then the send likely timed out. Try reducing burst size. Sending now...');
             // Send chunk of data.
             try {
                 $uploadStatus = $media->nextChunk($chunk);
             } catch (Exception $e) {
                 global $pb_backupbuddy_destination_errors;
                 $pb_backupbuddy_destination_errors[] = $e->getMessage();
                 $error = $e->getMessage();
                 pb_backupbuddy::status('error', 'Error #8239832: Error sending burst data. Details: `' . $error . '`.');
                 return false;
             }
             $settings['_chunks_sent']++;
             self::$_chunksSentThisRound++;
             pb_backupbuddy::status('details', 'Burst file data sent.');
             $maxTime = $settings['max_time'];
             if ('' == $maxTime || !is_numeric($maxTime)) {
                 pb_backupbuddy::status('details', 'Max time not set in settings so detecting server max PHP runtime.');
                 $maxTime = backupbuddy_core::detectMaxExecutionTime();
             }
             //return;
             // Handle splitting up across multiple PHP page loads if needed.
             if (!feof($fs) && 0 != $maxTime) {
                 // More data remains so see if we need to consider chunking to a new PHP process.
                 // If we are within X second of reaching maximum PHP runtime then stop here so that it can be picked up in another PHP process...
                 $totalSizeSent = self::$_chunksSentThisRound * $chunkSizeBytes;
                 // Total bytes sent this PHP load.
                 $bytesPerSec = $totalSizeSent / (microtime(true) - self::$_timeStart);
                 $timeRemaining = $maxTime - (microtime(true) - self::$_timeStart + self::TIME_WIGGLE_ROOM);
                 if ($timeRemaining < 0) {
                     $timeRemaining = 0;
                 }
                 $bytesWeCouldSendWithTimeLeft = $bytesPerSec * $timeRemaining;
                 pb_backupbuddy::status('details', 'Total sent: `' . pb_backupbuddy::$format->file_size($totalSizeSent) . '`. Speed (per sec): `' . pb_backupbuddy::$format->file_size($bytesPerSec) . '`. Time Remaining (w/ wiggle): `' . $timeRemaining . '`. Size that could potentially be sent with remaining time: `' . pb_backupbuddy::$format->file_size($bytesWeCouldSendWithTimeLeft) . '` with chunk size of `' . pb_backupbuddy::$format->file_size($chunkSizeBytes) . '`.');
                 if ($bytesWeCouldSendWithTimeLeft < $chunkSizeBytes) {
                     // We can send more than a whole chunk (including wiggle room) so send another bit.
                     pb_backupbuddy::status('message', 'Not enough time left (~`' . $timeRemaining . '`) with max time of `' . $maxTime . '` sec to send another chunk at `' . pb_backupbuddy::$format->file_size($bytesPerSec) . '` / sec. Ran for ' . round(microtime(true) - self::$_timeStart, 3) . ' sec. Proceeding to use chunking.');
                     @fclose($fs);
                     // Tells next chunk where to pick up.
                     if (isset($chunksTotal)) {
                         $settings['_chunks_total'] = $chunksTotal;
                     }
                     // Grab these vars from the class.  Note that we changed these vars from private to public to make chunked resuming possible.
                     $settings['_media_resumeUri'] = $media->resumeUri;
                     $settings['_media_progress'] = $media->progress;
                     // Schedule cron.
                     $cronTime = time();
                     $cronArgs = array($settings, $files, $send_id, $delete_after);
                     $cronHashID = md5($cronTime . serialize($cronArgs));
                     $cronArgs[] = $cronHashID;
                     $schedule_result = backupbuddy_core::schedule_single_event($cronTime, 'destination_send', $cronArgs);
                     if (true === $schedule_result) {
                         pb_backupbuddy::status('details', 'Next Site chunk step cron event scheduled.');
                     } else {
                         pb_backupbuddy::status('error', 'Next Site chunk step cron even FAILED to be scheduled.');
                     }
                     spawn_cron(time() + 150);
                     // Adds > 60 seconds to get around once per minute cron running limit.
                     update_option('_transient_doing_cron', 0);
                     // Prevent cron-blocking for next item.
                     return array($prevPointer, 'Sent part ' . $settings['_chunks_sent'] . ' of ~' . $settings['_chunks_total'] . ' parts.');
                     // filepointer location, elapsed time during the import
                 } else {
                     // End if.
                     pb_backupbuddy::status('details', 'Not approaching limits.');
                 }
             } else {
                 pb_backupbuddy::status('details', 'No more data remains (eg for chunking) so finishing up.');
                 if ('' != $send_id) {
                     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.397237. Unable to access fileoptions data.', 'it-l10n-backupbuddy') . ' Error: ' . $result);
                         return false;
                     }
                     pb_backupbuddy::status('details', 'Fileoptions data loaded.');
                     $fileoptions =& $fileoptions_obj->options;
                     $fileoptions['_multipart_status'] = 'Sent part ' . $settings['_chunks_sent'] . ' of ~' . $settings['_chunks_total'] . ' parts.';
                     $fileoptions['finish_time'] = microtime(true);
                     $fileoptions['status'] = 'success';
                     $fileoptions_obj->save();
                     unset($fileoptions_obj);
                 }
             }
         }
         fclose($fs);
         self::$_client->setDefer(false);
         if (false == $uploadStatus) {
             global $pb_backupbuddy_destination_errors;
             $pb_backupbuddy_destination_errors[] = 'Error #84347474 sending. Details: ' . $uploadStatus;
             return false;
         } else {
             // Success.
             if (true === $delete_remote_after) {
                 self::deleteFile($settings, $uploadStatus->id);
             }
         }
     }
     // end foreach.
     $db_archive_limit = $settings['db_archive_limit'];
     $full_archive_limit = $settings['full_archive_limit'];
     $files_archive_limit = $settings['files_archive_limit'];
     // BEGIN FILE LIMIT PROCESSING. Enforce archive limits if applicable.
     if ($backup_type == 'full') {
         $limit = $full_archive_limit;
     } elseif ($backup_type == 'db') {
         $limit = $db_archive_limit;
     } elseif ($backup_type == 'files') {
         $limit = $files_archive_limit;
     } else {
         $limit = 0;
         pb_backupbuddy::status('warning', 'Warning #34352453244. Google Drive was unable to determine backup type (reported: `' . $backup_type . '`) so archive limits NOT enforced for this backup.');
     }
     pb_backupbuddy::status('details', 'Google Drive database backup archive limit of `' . $limit . '` of type `' . $backup_type . '` based on destination settings.');
     if ($limit > 0) {
         pb_backupbuddy::status('details', 'Google Drive archive limit enforcement beginning.');
         // Get file listing.
         $searchCount = 1;
         $remoteFiles = array();
         while (count($remoteFiles) == 0 && $searchCount < 5) {
             pb_backupbuddy::status('details', 'Checking archive limits. Attempt ' . $searchCount . '.');
             $remoteFiles = pb_backupbuddy_destination_gdrive::listFiles($settings, "title contains 'backup-' AND title contains '-" . $backup_type . "-' AND '" . $folderID . "' IN parents AND trashed=false");
             //"title contains 'backup' and trashed=false" );
             sleep(1);
             $searchCount++;
         }
         // List backups associated with this site by date.
         $backups = array();
         $prefix = backupbuddy_core::backup_prefix();
         foreach ($remoteFiles as $remoteFile) {
             if ('application/vnd.google-apps.folder' == $remoteFile->mimeType) {
                 // Ignore folders.
                 continue;
             }
             if (strpos($remoteFile->originalFilename, 'backup-' . $prefix . '-') !== false) {
                 // Appears to be a backup file for this site.
                 $backups[$remoteFile->id] = strtotime($remoteFile->modifiedDate);
             }
         }
         arsort($backups);
         pb_backupbuddy::status('details', 'Google Drive found `' . count($backups) . '` backups of this type when checking archive limits.');
         if (count($backups) > $limit) {
             pb_backupbuddy::status('details', 'More archives (' . count($backups) . ') than limit (' . $limit . ') allows. Trimming...');
             $i = 0;
             $delete_fail_count = 0;
             foreach ($backups as $buname => $butime) {
                 $i++;
                 if ($i > $limit) {
                     pb_backupbuddy::status('details', 'Trimming excess file `' . $buname . '`...');
                     if (true !== self::deleteFile($settings, $buname)) {
                         pb_backupbuddy::status('details', 'Unable to delete excess Google Drive file `' . $buname . '`. Details: `' . print_r($pb_backupbuddy_destination_errors, true) . '`.');
                         $delete_fail_count++;
                     }
                 }
             }
             pb_backupbuddy::status('details', 'Finished trimming excess backups.');
             if ($delete_fail_count !== 0) {
                 $error_message = 'Google Drive remote limit could not delete ' . $delete_fail_count . ' backups.';
                 pb_backupbuddy::status('error', $error_message);
                 backupbuddy_core::mail_error($error_message);
             }
         }
         pb_backupbuddy::status('details', 'Google Drive completed archive limiting.');
     } else {
         pb_backupbuddy::status('details', 'No Google Drive archive file limit to enforce.');
     }
     // End remote backup limit
     // Made it this far then success.
     return true;
 }
示例#8
0
    $disabled = '';
    if (0 == pb_backupbuddy::$options['php_runtime_test_minimum_interval']) {
        $disabled = '<span title="' . __('Disabled based on Advanced Settings.', 'it-l10n-backupbuddy') . '">' . __('Disabled', 'it-l10n-backupbuddy') . '</span>';
    }
    $parent_class_test = array('title' => 'Tested PHP Max Execution Time', 'suggestion' => '>= 30 seconds (30+ best)', 'value' => $tested_runtime_value . $disabled . ' <a class="pb_backupbuddy_refresh_stats pb_backupbuddy_testPHPRuntime" rel="run_php_runtime_test" alt="' . pb_backupbuddy::ajax_url('run_php_runtime_test') . '" title="' . __('Run Test (may take several minutes)', 'it-l10n-backupbuddy') . '"><img src="' . pb_backupbuddy::plugin_url() . '/images/refresh_gray.gif" style="vertical-align: -1px;"> <span class="pb_backupbuddy_loading" style="display: none; margin-left: 10px;"><img src="' . pb_backupbuddy::plugin_url() . '/images/loading.gif" alt="' . __('Loading...', 'it-l10n-backupbuddy') . '" title="' . __('Loading...', 'it-l10n-backupbuddy') . '" width="16" height="16" style="vertical-align: -3px;" /></span></a>', 'tip' => __('This is the TESTED amount of time that PHP allows scripts to run. The test was performed by outputting / logging the script time elapsed once per second until PHP timed out and thus the time reported stopped. This gives a fairly accurate number compared to the reported number which is most often overriden at the server with a limit.', 'it-l10n-backupbuddy') . ' ' . 'This test is limited to `' . pb_backupbuddy::$options['php_runtime_test_minimum_interval'] . '` seconds based on your advanced settings (0 = disabled). Automatically rescans during housekeeping after `' . pb_backupbuddy::$options['php_runtime_test_minimum_interval'] . '` seconds elapse between tests as well always on plugin activation.');
    if (is_numeric(pb_backupbuddy::$options['tested_php_runtime']) && pb_backupbuddy::$options['tested_php_runtime'] < 29) {
        $parent_class_test['status'] = 'FAIL';
    } else {
        $parent_class_test['status'] = 'OK';
    }
    array_push($tests, $parent_class_test);
}
// Maximum PHP Runtime (ACTUAL TESTED!)
$bb_php_max_execution = backupbuddy_core::detectMaxExecutionTime() . ' ' . __('secs', 'it-l10n-backupbuddy');
// Lesser of PHP reported and tested.
if (backupbuddy_core::adjustedMaxExecutionTime() != backupbuddy_core::detectMaxExecutionTime()) {
    // Takes into account user override.
    $bb_php_max_execution = '<strike>' . $bb_php_max_execution . '</strike> ' . __('Overridden in settings to:', 'it-l10n-backupbuddy') . ' ' . backupbuddy_core::adjustedMaxExecutionTime() . ' ' . __('secs', 'it-l10n-backupbuddy');
}
if (!defined('PB_IMPORTBUDDY')) {
    $parent_class_test = array('title' => 'BackupBuddy PHP Max Execution Time', 'suggestion' => '>= 30 seconds (30+ best)', 'value' => $bb_php_max_execution, 'tip' => __('This is the max execution time BackupBuddy is using for chunking. It is the lesser of the values of the reported PHP execution time and actual tested execution time. If the BackupBuddy "Max time per chunk" Advanced Setting is set then that value is used instead.', 'it-l10n-backupbuddy'));
    if ($bb_php_max_execution < 30) {
        $parent_class_test['status'] = 'FAIL';
    } else {
        $parent_class_test['status'] = 'OK';
    }
    array_push($tests, $parent_class_test);
}
$phpinfo_array = phpinfo_array(4);
// MEMORY LIMIT
$mem_limits = array();