X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=maintenance%2FupdateDoubleWidthSearch.php;h=41988d1b259be913565526d3e294ee85dd7c32d8;hb=f3b38123cbd8ac70dcdcbbd5489c588038fc317e;hp=09eaf7595c2d713c91ed7feabd08da423455ebe2;hpb=54badce2d8d5e62e54ae3fbada2fa2570dd69aa2;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/updateDoubleWidthSearch.php b/maintenance/updateDoubleWidthSearch.php index 09eaf7595c..41988d1b25 100644 --- a/maintenance/updateDoubleWidthSearch.php +++ b/maintenance/updateDoubleWidthSearch.php @@ -1,6 +1,6 @@ hasOption( 'q' ); $maxLockTime = $this->getOption( 'l', 20 ); - $lockTime = time(); $dbw = wfGetDB( DB_MASTER ); - if( $dbw->getType() !== 'mysql' ) { - $this->output( "This change is only needed on MySQL, quitting..." ); - exit(1); + if ( $dbw->getType() !== 'mysql' ) { + $this->error( "This change is only needed on MySQL, quitting.\n", true ); } - $res = $this->findRows($dbw); - $this->updateSearchIndex($maxLockTime, array($this, 'searchIndexUpdateCallback'), $dbw, $res); + $res = $this->findRows( $dbw ); + $this->updateSearchIndex( $maxLockTime, array( $this, 'searchIndexUpdateCallback' ), $dbw, $res ); $this->output( "Done\n" ); } - public function searchIndexUpdateCallback($dbw, $row) { + public function searchIndexUpdateCallback( $dbw, $row ) { return $this->updateSearchIndexForPage( $dbw, $row->si_page ); } - private function findRows($dbw) { + private function findRows( $dbw ) { $searchindex = $dbw->tableName( 'searchindex' ); $regexp = '[[:<:]]u8efbd([89][1-9a]|8[b-f]|90)[[:>:]]'; $sql = "SELECT si_page FROM $searchindex - WHERE ( si_text RLIKE '$regexp' ) - OR ( si_title RLIKE '$regexp' )"; + WHERE ( si_text RLIKE '$regexp' ) + OR ( si_title RLIKE '$regexp' )"; return $dbw->query( $sql, __METHOD__ ); } } $maintClass = "UpdateDoubleWidthSearch"; -require_once( DO_MAINTENANCE ); +require_once RUN_MAINTENANCE_IF_MAIN;