当前位置: 首页>>代码示例>>PHP>>正文


PHP backupbuddy_core::adjustedMaxExecutionTime方法代码示例

本文整理汇总了PHP中backupbuddy_core::adjustedMaxExecutionTime方法的典型用法代码示例。如果您正苦于以下问题:PHP backupbuddy_core::adjustedMaxExecutionTime方法的具体用法?PHP backupbuddy_core::adjustedMaxExecutionTime怎么用?PHP backupbuddy_core::adjustedMaxExecutionTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在backupbuddy_core的用法示例。


在下文中一共展示了backupbuddy_core::adjustedMaxExecutionTime方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: backup_create_database_dump

 function backup_create_database_dump($tables, $rows_start = 0)
 {
     pb_backupbuddy::status('milestone', 'start_database');
     pb_backupbuddy::status('message', __('Starting database backup process.', 'it-l10n-backupbuddy'));
     if ('php' == pb_backupbuddy::$options['database_method_strategy']) {
         $force_methods = array('php');
     } elseif ('commandline' == pb_backupbuddy::$options['database_method_strategy']) {
         $force_methods = array('commandline');
     } elseif ('all' == pb_backupbuddy::$options['database_method_strategy']) {
         $force_methods = array('php', 'commandline');
     } else {
         pb_backupbuddy::status('error', 'Error #48934: Invalid forced database dump method setting: `' . pb_backupbuddy::$options['database_method_strategy'] . '`.');
         return false;
     }
     $maxExecution = backupbuddy_core::adjustedMaxExecutionTime();
     if ($this->_backup['profile']['backup_mode'] == '1') {
         // Disable DB chunking when in classic mode.
         $maxExecution = -1;
     }
     // Load mysqlbuddy and perform dump.
     require_once pb_backupbuddy::plugin_path() . '/lib/mysqlbuddy/mysqlbuddy.php';
     global $wpdb;
     pb_backupbuddy::$classes['mysqlbuddy'] = new pb_backupbuddy_mysqlbuddy(DB_HOST, DB_NAME, DB_USER, DB_PASSWORD, $wpdb->prefix, $force_methods, $maxExecution);
     // $database_host, $database_name, $database_user, $database_pass, $old_prefix, $force_method = array()
     // Force to single db_1.sql file if enabled via advanced options.
     if ('1' == pb_backupbuddy::$options['force_single_db_file']) {
         pb_backupbuddy::$classes['mysqlbuddy']->force_single_db_file(true);
     }
     // Do the database dump.
     $result = pb_backupbuddy::$classes['mysqlbuddy']->dump($this->_backup['temp_directory'], $tables, $rows_start);
     // if array, returns tables,rowstart
     if (is_array($result)) {
         // Chunking.
         $newStep = array('function' => 'backup_create_database_dump', 'args' => array($result[0], $result[1]), 'start_time' => 0, 'finish_time' => 0, 'attempts' => 0);
         //error_log( print_r( $this->_backup_options->options['steps'], true ) );
         array_splice($this->_backup_options->options['steps'], $this->_currentStepIndex + 1, 0, array($newStep));
         //error_log( print_r( $this->_backup_options->options['steps'], true ) );
         $this->_backup_options->save();
         pb_backupbuddy::status('details', 'Inserted additional database dump step at `' . ($this->_currentStepIndex + 1) . '` to resume at row `' . $result[1] . '`. The next chunk will proceed shortly.');
     }
     // Made it this far so not chunking at this point.
     // Check and make sure mysql server is still around. If it's missing at this point we may not be able to trust that it succeeded properly.
     /*
     // REMOVED 3-3-2014. PHP dump now checks connection status after each table and command line is not related to this. Settings are all stored in fileoptions so this is no longer relevant.
     
     global $wpdb;
     if ( @mysql_ping( $wpdb->dbh ) === false ) { // No longer connected to database if false.
     	pb_backupbuddy::status( 'error', __( 'ERROR #9027b: The mySQL server went away at some point during the database dump step. This is almost always caused by mySQL running out of memory or the mysql server timing out far too early. Contact your host. The database dump integrity can no longer be guaranteed so the backup has been halted.' ) );
     	if ( $result === true ) {
     		pb_backupbuddy::status( 'details', 'The database dump reported SUCCESS prior to this problem.' );
     	} else {
     		pb_backupbuddy::status( 'details', 'The database dump reported FAILURE prior to this problem.' );
     	}
     	pb_backupbuddy::status( 'haltScript', '' ); // Halt JS on page.
     	return false;
     }
     */
     return $result;
 }
开发者ID:jcwproductions,项目名称:jcwproductions-blog,代码行数:59,代码来源:backup.php

示例2: __

        $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();
if (!isset($phpinfo_array['memory_limit'])) {
    $parent_class_val = 'unknown';
开发者ID:arobbins,项目名称:spellestate,代码行数:31,代码来源:_server_tests.php

示例3: array

<?php

// Incoming vars: -NONE-
require_once pb_backupbuddy::plugin_path() . '/destinations/live/live.php';
if (false === ($destination_id = backupbuddy_live::getLiveID())) {
    // $destination_id used by _stats.php.
    return false;
}
require_once pb_backupbuddy::plugin_path() . '/destinations/live/live_periodic.php';
$state = backupbuddy_live_periodic::get_stats();
// If currently running.
if ('daily_init' != $state['step']['function'] && time() - $state['stats']['last_activity'] < backupbuddy_core::adjustedMaxExecutionTime()) {
    set_transient('backupbuddy_live_snapshot', true, 60 * 60 * 48);
    // Request transient to run.
    pb_backupbuddy::status('details', 'Snapshot requested to be ran.');
    if ('1' != pb_backupbuddy::$options['skip_spawn_cron_call']) {
        pb_backupbuddy::status('details', 'Spawning cron now.');
        update_option('_transient_doing_cron', 0);
        // Prevent cron-blocking for next item.
        spawn_cron(time() + 150);
        // Adds > 60 seconds to get around once per minute cron running limit.
    }
} else {
    backupbuddy_live_periodic::_set_next_step('daily_init', array($manual_snapshot = true), $save_now_and_unlock = true);
    $schedule_result = backupbuddy_core::schedule_single_event(time(), 'live_periodic', $cronArgs = array());
    if (true === $schedule_result) {
        pb_backupbuddy::status('details', 'Next Live Periodic chunk step cron event scheduled.');
    } else {
        pb_backupbuddy::status('error', 'Next Live Periodic chunk step cron event FAILED to be scheduled.');
    }
    if ('1' != pb_backupbuddy::$options['skip_spawn_cron_call']) {
开发者ID:arobbins,项目名称:spellestate,代码行数:31,代码来源:_runLiveSnapshot.php

示例4: while

        $stats['next_db_snapshot'] = $next_live_periodic;
        $stats['next_db_snapshot_pretty'] = pb_backupbuddy::$format->date(pb_backupbuddy::$format->localize_time($next_live_periodic));
        $stats['next_periodic_restart'] = $next_live_periodic;
        $stats['next_periodic_restart_pretty'] = pb_backupbuddy::$format->date(pb_backupbuddy::$format->localize_time($next_live_periodic));
        // Calculate approx time schedule will run that will be long enough into the future to trigger snapshot.
        $next_live_snapshot = $next_live_scheduled;
        while ($next_live_snapshot < $next_remote_snapshot) {
            $next_live_snapshot += 60 * 60;
            // Keep increasing the schedule by the live cron interval until it surpasses the minimum periodic time run timestamp.
        }
        $stats['next_remote_snapshot'] = $next_live_snapshot;
        $stats['next_remote_snapshot_pretty'] = pb_backupbuddy::$format->date(pb_backupbuddy::$format->localize_time($next_live_snapshot));
    }
    // If periodic looks to be running now, say so.
    $last_activity_ago = microtime(true) - $state['stats']['last_activity'];
    if ($last_activity_ago < backupbuddy_core::adjustedMaxExecutionTime() + 60) {
        $stats['next_periodic_restart'] = '-1';
        $stats['next_periodic_restart_pretty'] = __('In Progress...', 'it-l10n-backupbuddy');
    }
    // If db process running, say so.
    if ('database_snapshot' == $state['step']['function'] || 'send_pending_db_snapshots' == $state['step']['function'] || 'process_table_deletions' == $state['step']['function']) {
        $stats['next_db_snapshot'] = '-1';
        $stats['next_db_snapshot_pretty'] = __('In Progress...', 'it-l10n-backupbuddy');
    }
}
// Current function.
$stats['current_function'] = $state['step']['function'];
$stats['current_function_pretty'] = backupbuddy_live::pretty_function($state['step']['function']);
if ('database_snapshot' == $state['step']['function']) {
    // For db dump include current table count.
    if (count($state['step']['args']) > 0) {
开发者ID:arobbins,项目名称:spellestate,代码行数:31,代码来源:_stats.php

示例5: get_destination_settings

 public static function get_destination_settings()
 {
     require_once pb_backupbuddy::plugin_path() . '/classes/core.php';
     require_once pb_backupbuddy::plugin_path() . '/destinations/live/init.php';
     $settings = pb_backupbuddy_destination_live::_formatSettings(pb_backupbuddy::$options['remote_destinations'][backupbuddy_live::getLiveID()]);
     if ('' == $settings['max_time']) {
         $settings['max_time'] = backupbuddy_core::adjustedMaxExecutionTime();
     }
     return $settings;
 }
开发者ID:arobbins,项目名称:spellestate,代码行数:10,代码来源:live_periodic.php


注:本文中的backupbuddy_core::adjustedMaxExecutionTime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。