Author: Mikael Mattsson (mikael@wallmanderco.se)
示例#1
0
 /**
  * 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];
 }
示例#2
0
 /**
  * Admin Indexing Page.
  */
 public static function getIndex()
 {
     $sites = WordPress::getSites();
     require ESI_PATH . '/views/admin/index.php';
 }