Пример #1
0
 /**
  * Schedules events
  */
 function schedule()
 {
     if ($this->_config->get_boolean('objectcache.enabled') && $this->_config->get_string('objectcache.engine') == 'file') {
         if (!nxt_next_scheduled('w3_objectcache_cleanup')) {
             nxt_schedule_event(time(), 'w3_objectcache_cleanup', 'w3_objectcache_cleanup');
         }
     } else {
         $this->unschedule();
     }
 }
Пример #2
0
 /**
  * Schedule upload event
  */
 function schedule_upload()
 {
     if ($this->_config->get_boolean('cdn.enabled') && $this->_config->get_boolean('cdn.autoupload.enabled') && !w3_is_cdn_mirror($this->_config->get_string('cdn.engine'))) {
         if (!nxt_next_scheduled('w3_cdn_cron_upload')) {
             nxt_schedule_event(time(), 'w3_cdn_cron_upload', 'w3_cdn_cron_upload');
         }
     } else {
         $this->unschedule_upload();
     }
 }
Пример #3
0
/**
 * Called on plugin activation and upgrading.
 *
 * @see register_activation_hook
 */
function openid_activate_plugin()
{
    global $nxt_rewrite;
    // if first time activation, set OpenID capability for administrators
    if (get_option('openid_plugin_revision') === false) {
        global $nxt_roles;
        $role = $nxt_roles->get_role('administrator');
        if ($role) {
            $role->add_cap('use_openid_provider');
        }
    }
    // for some reason, show_on_front is not always set, causing is_front_page() to fail
    $show_on_front = get_option('show_on_front');
    if (empty($show_on_front)) {
        update_option('show_on_front', 'posts');
    }
    // Add custom OpenID options
    add_option('openid_enable_commentform', true);
    add_option('openid_plugin_enabled', true);
    add_option('openid_plugin_revision', 0);
    add_option('openid_db_revision', 0);
    add_option('openid_enable_approval', false);
    add_option('openid_xrds_returnto', true);
    add_option('openid_comment_displayname_length', 12);
    openid_create_tables();
    openid_migrate_old_data();
    // setup schedule cleanup
    nxt_clear_scheduled_hook('cleanup_openid');
    nxt_schedule_event(time(), 'hourly', 'cleanup_openid');
    // flush rewrite rules
    if (!isset($nxt_rewrite)) {
        $nxt_rewrite = new nxt_Rewrite();
    }
    $nxt_rewrite->flush_rules();
    // set current revision
    update_option('openid_plugin_revision', OPENID_PLUGIN_REVISION);
    openid_remove_historical_options();
}
Пример #4
0
/**
 * Schedule core, theme, and plugin update checks.
 *
 * @since 3.1.0
 */
function nxt_schedule_update_checks()
{
    if (!nxt_next_scheduled('nxt_version_check') && !defined('nxt_INSTALLING')) {
        nxt_schedule_event(time(), 'twicedaily', 'nxt_version_check');
    }
    if (!nxt_next_scheduled('nxt_update_plugins') && !defined('nxt_INSTALLING')) {
        nxt_schedule_event(time(), 'twicedaily', 'nxt_update_plugins');
    }
    if (!nxt_next_scheduled('nxt_update_themes') && !defined('nxt_INSTALLING')) {
        nxt_schedule_event(time(), 'twicedaily', 'nxt_update_themes');
    }
}
Пример #5
0
 function WikiNotifications()
 {
     if (!nxt_next_scheduled('cron_email_hook')) {
         nxt_schedule_event(time(), 'weekly', 'cron_email_hook');
     }
 }
Пример #6
0
        $c = get_blog_count();
        if ($c <= 50 || $c > 50 && mt_rand(0, (int) ($c / 50)) == 1) {
            require_once ABSPATH . nxtINC . '/http.php';
            $response = nxt_remote_get(admin_url('upgrade.php?step=1'), array('timeout' => 120, 'httpversion' => '1.1'));
            do_action('after_mu_upgrade', $response);
            unset($response);
        }
        unset($c);
    }
}
require_once ABSPATH . 'nxt-admin/includes/admin.php';
auth_redirect();
nocache_headers();
// Schedule trash collection
if (!nxt_next_scheduled('nxt_scheduled_delete') && !defined('nxt_INSTALLING')) {
    nxt_schedule_event(time(), 'daily', 'nxt_scheduled_delete');
}
set_screen_options();
$date_format = get_option('date_format');
$time_format = get_option('time_format');
nxt_reset_vars(array('profile', 'redirect', 'redirect_url', 'a', 'text', 'trackback', 'pingback'));
nxt_enqueue_script('common');
nxt_enqueue_script('jquery-color');
$editing = false;
if (isset($_GET['page'])) {
    $plugin_page = stripslashes($_GET['page']);
    $plugin_page = plugin_basename($plugin_page);
}
if (isset($_REQUEST['post_type']) && post_type_exists($_REQUEST['post_type'])) {
    $typenow = $_REQUEST['post_type'];
} else {
Пример #7
0
/**
 * Reschedule a recurring event.
 *
 * @since 2.1.0
 *
 * @param int $timestamp Timestamp for when to run the event.
 * @param string $recurrence How often the event should recur.
 * @param string $hook Action hook to execute when cron is run.
 * @param array $args Optional. Arguments to pass to the hook's callback function.
 * @return bool|null False on failure. Null when event is rescheduled.
 */
function nxt_reschedule_event($timestamp, $recurrence, $hook, $args = array())
{
    $crons = _get_cron_array();
    $schedules = nxt_get_schedules();
    $key = md5(serialize($args));
    $interval = 0;
    // First we try to get it from the schedule
    if (0 == $interval) {
        $interval = $schedules[$recurrence]['interval'];
    }
    // Now we try to get it from the saved interval in case the schedule disappears
    if (0 == $interval) {
        $interval = $crons[$timestamp][$hook][$key]['interval'];
    }
    // Now we assume something is wrong and fail to schedule
    if (0 == $interval) {
        return false;
    }
    $now = time();
    if ($timestamp >= $now) {
        $timestamp = $now + $interval;
    } else {
        $timestamp = $now + ($interval - ($now - $timestamp) % $interval);
    }
    nxt_schedule_event($timestamp, $recurrence, $hook, $args);
}
Пример #8
0
 /**
  * Schedule prime event
  */
 function schedule_prime()
 {
     if ($this->_config->get_boolean('pgcache.enabled') && $this->_config->get_boolean('pgcache.prime.enabled')) {
         if (!nxt_next_scheduled('w3_pgcache_prime')) {
             nxt_schedule_event(time(), 'w3_pgcache_prime', 'w3_pgcache_prime');
         }
     } else {
         $this->unschedule_prime();
     }
 }
Пример #9
0
/**
 * Schedule update of the network-wide counts for the current network.
 *
 * @since 3.1.0
 */
function nxt_schedule_update_network_counts()
{
    if (!is_main_site()) {
        return;
    }
    if (!nxt_next_scheduled('update_network_counts') && !defined('nxt_INSTALLING')) {
        nxt_schedule_event(time(), 'twicedaily', 'update_network_counts');
    }
}