public static function cron() { // Only run the cron if this plugin is the active search plugin if (get_config('searchplugin') !== 'elasticsearch') { return; } // store the last time the function was executed: eg: 2013-04-11 16:45:30 $timestamp = date('Y-m-d H:i:s'); $last_run = get_config_plugin('search', 'elasticsearch', 'lastrun'); if (isset($last_run)) { ElasticsearchIndexing::add_to_queue_access($last_run, $timestamp); } set_config_plugin('search', 'elasticsearch', 'lastrun', $timestamp); // process the queue self::index_queued_items(); }