Esempio n. 1
0
 /**
  * Rebuild the search index.
  * @return boolean
  */
 function rebuildSearchIndex()
 {
     import('classes.search.ArticleSearchIndex');
     $articleSearchIndex = new ArticleSearchIndex();
     $articleSearchIndex->rebuildIndex();
     return true;
 }
Esempio n. 2
0
 /**
  * Rebuild the search index for all articles in all journals.
  */
 function execute()
 {
     // If we have an argument that this must be a journal path.
     $journal = null;
     if (count($this->argv)) {
         $journalPath = array_shift($this->argv);
         $journalDao =& DAORegistry::getDAO('JournalDAO');
         $journal =& $journalDao->getJournalByPath($journalPath);
         if (!$journal) {
             die(__('search.cli.rebuildIndex.unknownJournal', array('journalPath' => $journalPath)) . "\n");
         }
     }
     // Register a router hook so that we can construct
     // useful URLs to journal content.
     HookRegistry::register('Request::getBaseUrl', array(&$this, 'callbackBaseUrl'));
     // Let the search implementation re-build the index.
     $articleSearchIndex = new ArticleSearchIndex();
     $articleSearchIndex->rebuildIndex(true, $journal);
 }
Esempio n. 3
0
 /**
  * Rebuild the search index for all articles in all journals.
  */
 function execute()
 {
     // Check whether we have (optional) switches.
     $switches = array();
     while (count($this->argv) && substr($this->argv[0], 0, 1) == '-') {
         $switches[] = array_shift($this->argv);
     }
     // If we have another argument that this must be a journal path.
     $journal = null;
     if (count($this->argv)) {
         $journalPath = array_shift($this->argv);
         $journalDao = DAORegistry::getDAO('JournalDAO');
         $journal = $journalDao->getByPath($journalPath);
         if (!$journal) {
             die(__('search.cli.rebuildIndex.unknownJournal', array('journalPath' => $journalPath)) . "\n");
         }
     }
     // Register a router hook so that we can construct
     // useful URLs to journal content.
     HookRegistry::register('Request::getBaseUrl', array($this, 'callbackBaseUrl'));
     // Let the search implementation re-build the index.
     $articleSearchIndex = new ArticleSearchIndex();
     $articleSearchIndex->rebuildIndex(true, $journal, $switches);
 }
Esempio n. 4
0
 /**
  * Rebuild the search index for all articles in all journals.
  */
 function execute()
 {
     ArticleSearchIndex::rebuildIndex(true);
 }
Esempio n. 5
0
 /**
  * Rebuild the article search index.
  * Note: Rebuilds index for _all_ journals (non-optimal, but shouldn't be a problem)
  * Based on code from tools/rebuildSearchIndex.php
  */
 function rebuildSearchIndex()
 {
     if ($this->hasOption('verbose')) {
         printf("Rebuilding search index\n");
     }
     ArticleSearchIndex::rebuildIndex();
 }
Esempio n. 6
0
 /**
  * Rebuild the search index.
  * @return boolean
  */
 function rebuildSearchIndex()
 {
     import('classes.search.ArticleSearchIndex');
     ArticleSearchIndex::rebuildIndex();
     return true;
 }
Esempio n. 7
0
 /**
  * @covers ArticleSearchIndex
  */
 public function testRebuildIndexViaPluginHook()
 {
     // Diverting to the search plugin hook.
     HookRegistry::register('ArticleSearchIndex::rebuildIndex', array($this, 'callbackRebuildIndex'));
     // Test log output.
     $this->expectOutputString("Some log message from the plug-in.");
     // Simulate rebuilding the index via hook.
     $articleSearchIndex = new ArticleSearchIndex();
     $articleSearchIndex->rebuildIndex(true);
     // With log
     $articleSearchIndex->rebuildIndex(false);
     // Without log (that's why we expect the log message to appear only once).
     // Remove the test hook.
     HookRegistry::clear('ArticleSearchIndex::rebuildIndex');
 }