예제 #1
0
 /**
  * Start the rebuild process and save any necesarry status flags
  */
 public static function rebuildIndex()
 {
     $indexed_comments = WPSearch_Utility::getOption(WPSearch_Core::KEY_INDEX_COMMENTS);
     $indexed_categories = WPSearch_Utility::getOption(WPSearch_Core::KEY_INDEX_CATEGORIES);
     WPSearch_Utility::setOption(WPSearch_Core::KEY_INDEXED_COMMENTS, $indexed_comments);
     WPSearch_Utility::setOption(WPSearch_Core::KEY_INDEXED_CATEGORIES, $indexed_categories);
     $indexed_comments = $indexed_comments == 'true';
     $indexed_categories = $indexed_categories == 'true';
     $success = WPSearch_Search::instance()->buildFullIndex($indexed_comments, $indexed_categories);
     die(json_encode(array('success' => $success)));
 }
예제 #2
0
 private function _doesSearchCategories()
 {
     return WPSearch_Utility::getOption(WPSearch_Core::KEY_SEARCH_CATEGORIES) == 'true';
 }
예제 #3
0
 /**
  * The callback that is executed when the user is loading the admin page.
  *  Basically, output the page content for the admin page. The function
  *  acts just like a controller method for and MVC app. That is, it loads
  *  a view.
  */
 public function adminMenuCallback()
 {
     WPSearch_Log::add('debug', "Admin page callback executed");
     WPSearch_Utility::sendInstallReportIfNew();
     $stats = WPSearch_Search::instance()->getStats();
     $about = WPSearch_Search::instance()->getAbout();
     $errors = WPSearch_Search::instance()->runTests();
     $search_types = unserialize(WPSearch_Utility::getOption(self::KEY_SEARCH_TYPES, FALSE));
     $search_types = $search_types !== FALSE ? $search_types : self::$_defaultSearchTypes;
     $data = array();
     if ($about) {
         $data['is_alive'] = true;
         $data['total_docs'] = $stats->total;
         $data['indexed_docs'] = $stats->current;
         $data['is_building'] = $stats->reindexing;
         $data['last_reindex'] = $stats->last_rebuild;
         $data['about'] = $about;
         $data['errors'] = $errors;
         $data['searched_types'] = $search_types;
         $data['post_types'] = get_post_types();
         $data['index_comments'] = WPSearch_Utility::getOption(self::KEY_INDEX_COMMENTS) == 'true';
         $data['index_categories'] = WPSearch_Utility::getOption(self::KEY_INDEX_CATEGORIES) == 'true';
         $data['indexed_comments'] = WPSearch_Utility::getOption(self::KEY_INDEXED_COMMENTS) == 'true';
         $data['indexed_categories'] = WPSearch_Utility::getOption(self::KEY_INDEXED_CATEGORIES) == 'true';
         $data['title_boost'] = WPSearch_Utility::getOption(self::KEY_TITLE_BOOST, self::DEFAULT_TITLE_BOOST);
         $data['content_boost'] = WPSearch_Utility::getOption(self::KEY_CONTENT_BOOST, self::DEFAULT_CONTENT_BOOST);
         $data['service_tag'] = WPSearch_Utility::getServiceTag();
     } else {
         $data['is_alive'] = false;
         $data['error_message'] = 'The backend WPSearch Driver is not responding.';
     }
     WPSearch_View::load('admin', $data);
 }