Beispiel #1
0
 public static function unregisterCronTasks()
 {
     if (!empty(self::$_cronTasks)) {
         foreach (self::$_cronTasks as $task) {
             wp_clear_scheduled_hook($task);
         }
         self::$_cronTasks = array();
     }
 }
Beispiel #2
0
//#++
// Add custom links on plugins page
function wssCustomLinks($links)
{
    if (wpsIsValidInstall()) {
        return array_merge(array('<a href="admin.php?page=' . WPS_PLUGIN_PREFIX . 'settings">' . __('Settings', WpsSettings::TEXT_DOMAIN) . '</a>'), $links);
    } else {
        return $links;
    }
}
add_filter("plugin_action_links_" . plugin_basename(__FILE__), 'wssCustomLinks');
//#! register tasks
if ($wpsCanRun) {
    // register cron job
    WsdScheduler::registerCronTask('wssPlugin_WpScanCheckState', array('WsdWpScanner', 'checkWpScan'), '1m');
    // override - scheduled task
    WsdScheduler::registerCronTask('wps_check_user_admin', array('WsdCheck', 'adminUsername'), '8h');
    WsdScheduler::registerCronTask('wps_check_admin_install_file', array('WsdCheck', 'check_adminInstallFile'), 'hourly');
    WsdScheduler::registerCronTask('wps_check_admin_upgrade_file', array('WsdCheck', 'check_adminUpgradeFile'), 'hourly');
    // scheduled task - hourly cleanup of events in live traffic
    WsdScheduler::registerCronTask('wps_cleanup_live_traffic', array('WsdLiveTraffic', 'clearEvents'), 'hourly');
    // stacked
    WsdScheduler::registerTask(array('WsdWatch', 'userPasswordUpdate'));
    // #! run fixes. Only those checked by the user will run (@see: settings page)
    wpsRunFixes();
    //#! run checks.
    add_action('init', array('WsdCheck', 'check_tablePrefix'));
    add_action('init', array('WsdCheck', 'check_currentVersion'));
    add_action('init', array('WsdCheck', 'check_files'));
}
//#! End index.php
Beispiel #3
0
function _wpsSiteDeactivate($mu = false, $blogID = 1)
{
    WsdScheduler::unregisterCronTasks();
    if ($mu) {
        delete_blog_option($blogID, 'WPS_NETWORK_INSTALL');
        delete_blog_option($blogID, 'WPS_PLUGIN_ACTIVATED');
        delete_blog_option($blogID, WpsSettings::WP_FILE_SCAN_OPTION_NAME);
        delete_blog_option($blogID, WpsSettings::PLUGIN_ERROR_NOTICE_OPTION);
        delete_blog_option($blogID, WpsSettings::CAN_RUN_TASKS_OPTION_NAME);
        delete_blog_option($blogID, WpsSettings::ENABLE_LIVE_TRAFFIC);
    } else {
        delete_option('WPS_PLUGIN_ACTIVATED');
        delete_option(WpsSettings::WP_FILE_SCAN_OPTION_NAME);
        delete_option(WpsSettings::PLUGIN_ERROR_NOTICE_OPTION);
        delete_option(WpsSettings::CAN_RUN_TASKS_OPTION_NAME);
        delete_option(WpsSettings::ENABLE_LIVE_TRAFFIC);
    }
}
Beispiel #4
0
 public static function deactivate($blogId = 1)
 {
     WsdScheduler::unregisterCronTasks();
     delete_option(WpsSettings::WP_FILE_SCAN_OPTION_NAME);
     delete_option(WpsSettings::PLUGIN_ERROR_NOTICE_OPTION);
     delete_option(WpsSettings::PLUGIN_SETTINGS_OPTION_NAME);
     delete_option(WpsSettings::PLUGIN_ERROR_NOTICE_OPTION);
     delete_option(WpsSettings::CAN_RUN_TASKS_OPTION_NAME);
 }