/**
  * Update index when file is undeleted
  * @param Title $oTitle MediaWiki title object of undeleted file
  * @param array $aFileVersions array of undeleted versions
  * @param User $oUser user who performed the undeletion
  * @param string $sReason reason
  * @return bool allow other hooked methods to be executed. Always true.
  */
 public function onFileUndeleteComplete($oTitle, $aFileVersions, $oUser, $sReason)
 {
     try {
         $oFile = wfFindFile($oTitle);
         BuildIndexMainControl::getInstance()->updateIndexFile($oFile);
     } catch (BsException $e) {
         wfDebugLog('ExtendedSearch', 'onFileUndeleteComplete: ' . $e->getMessage());
     }
     return true;
 }
 /**
  * Return a instance of BuildIndexMainControl.
  * @return BuildIndexMainControl Instance of BuildIndexMainControl
  */
 public static function getInstance()
 {
     wfProfileIn('BS::' . __METHOD__);
     if (self::$oInstance === null) {
         self::$oInstance = new self();
     }
     wfProfileOut('BS::' . __METHOD__);
     return self::$oInstance;
 }
 /**
  * Returns status information of create index progress.
  * Error is indicated by return false or return null
  * An ApacheAjaxResponse is expected
  * If you return a string $s a new ApacheAjaxResponse($s) is created
  * @return string Progress in percent or error message.
  */
 public function getCreateFeedback()
 {
     // delete the old Index
     $this->getDeleteFeedback();
     // build the new Index
     $vRes = BuildIndexMainControl::getInstance()->buildIndex();
     /* Beware of returntype:
      * Error is indicated by return false or return null
      * An ApacheAjaxResponse is expected
      * If you return a string $s a new ApacheAjaxResponse($s) is created
      */
     return $vRes;
 }
 /**
  * If server does not answer with http-status 200 an Exception is thrown
  * @param string $sParams Param to specify delete query
  * @return integer status of connect to server
  */
 public function deleteIndex($sParams = '')
 {
     wfProfileIn('BS::' . __METHOD__);
     $customerId = BsConfig::get('MW::ExtendedSearch::CustomerID');
     if (empty($customerId) || strpos($customerId, '?') !== false || strpos($customerId, '*') !== false) {
         return false;
     }
     $sQuery = "wiki:{$customerId}";
     if (!empty($sParams)) {
         $sQuery = "({$sQuery})AND({$sParams})";
     }
     $response = $this->deleteByQuery($sQuery);
     $status = $response->getHttpStatus();
     BuildIndexMainControl::getInstance()->commitAndOptimize(true);
     wfProfileOut('BS::' . __METHOD__);
     return $status;
 }