/** * Called in admin to reindex all posts in all blogs. * * @param int $site * @param int $from * @param int $size * * @return array */ public function reindex($site, $from, $size) { add_filter('esi_skip_query_integration', '__return_true'); WordPress::switchToBlog($site); $this->setBlog($site); Config::setOption('is_indexing', time()); Config::setOption('user_index_version', Config::option('plugin_index_version')); list($indexed, $total) = $this->reindexBlog($from, $size); if ($indexed >= $total) { Config::setOption('is_indexing', false); Elasticsearch::optimize(); } WordPress::restoreCurrentBlog(); $this->setBlog(); return [$indexed, $total]; }
/** * Admin Indexing Page. */ public static function getIndex() { $sites = WordPress::getSites(); require ESI_PATH . '/views/admin/index.php'; }