X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FupdateSearchIndex.php;h=68a51bd9a582094c5918f1ce70a793da644073aa;hb=3e51aeea1ca1554f033955b463c0e51f0889a47b;hp=2a71e7edc0dc033504f804b88188edd60014662d;hpb=2c6646c7f675296380c61c9be914cc9cf8c4c4f2;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/updateSearchIndex.php b/maintenance/updateSearchIndex.php index 2a71e7edc0..68a51bd9a5 100644 --- a/maintenance/updateSearchIndex.php +++ b/maintenance/updateSearchIndex.php @@ -28,7 +28,7 @@ * @ingroup Maintenance */ -require_once( __DIR__ . '/Maintenance.php' ); +require_once __DIR__ . '/Maintenance.php'; /** * Maintenance script for periodic off-peak updating of the search index. @@ -42,8 +42,18 @@ class UpdateSearchIndex extends Maintenance { $this->mDescription = "Script for periodic off-peak updating of the search index"; $this->addOption( 's', 'starting timestamp', false, true ); $this->addOption( 'e', 'Ending timestamp', false, true ); - $this->addOption( 'p', 'File for saving/loading timestamps, searchUpdate.WIKI_ID.pos by default', false, true ); - $this->addOption( 'l', 'How long the searchindex and revision tables will be locked for', false, true ); + $this->addOption( + 'p', + 'File for saving/loading timestamps, searchUpdate.WIKI_ID.pos by default', + false, + true + ); + $this->addOption( + 'l', + 'How long the searchindex and revision tables will be locked for', + false, + true + ); } public function getDbType() { @@ -60,7 +70,7 @@ class UpdateSearchIndex extends Maintenance { # We can safely delete the file when we're done though. $start = file_get_contents( 'searchUpdate.pos' ); unlink( 'searchUpdate.pos' ); - } elseif( is_readable( $posFile ) ) { + } elseif ( is_readable( $posFile ) ) { $start = file_get_contents( $posFile ); } else { $start = wfTimestamp( TS_MW, time() - 86400 ); @@ -96,10 +106,9 @@ class UpdateSearchIndex extends Maintenance { $end = $dbw->timestamp( $end ); $page = $dbw->tableName( 'page' ); - $sql = "SELECT rc_cur_id,rc_type,rc_moved_to_ns,rc_moved_to_title FROM $recentchanges - JOIN $page ON rc_cur_id=page_id AND rc_this_oldid=page_latest - WHERE rc_timestamp BETWEEN '$start' AND '$end' - "; + $sql = "SELECT rc_cur_id FROM $recentchanges + JOIN $page ON rc_cur_id=page_id AND rc_this_oldid=page_latest + WHERE rc_type != " . RC_LOG . " AND rc_timestamp BETWEEN '$start' AND '$end'"; $res = $dbw->query( $sql, __METHOD__ ); $this->updateSearchIndex( $maxLockTime, array( $this, 'searchIndexUpdateCallback' ), $dbw, $res ); @@ -108,19 +117,9 @@ class UpdateSearchIndex extends Maintenance { } public function searchIndexUpdateCallback( $dbw, $row ) { - if ( $row->rc_type == RC_MOVE || $row->rc_type == RC_MOVE_OVER_REDIRECT ) { - # Rename searchindex entry - $titleObj = Title::makeTitle( $row->rc_moved_to_ns, $row->rc_moved_to_title ); - $title = $titleObj->getPrefixedDBkey(); - $this->output( "$title..." ); - $u = new SearchUpdate( $row->rc_cur_id, $title, false ); - $u->doUpdate(); - $this->output( "\n" ); - } elseif ( $row->rc_type !== RC_LOG ) { - $this->updateSearchIndexForPage( $dbw, $row->rc_cur_id ); - } + $this->updateSearchIndexForPage( $dbw, $row->rc_cur_id ); } } $maintClass = "UpdateSearchIndex"; -require_once( RUN_MAINTENANCE_IF_MAIN ); +require_once RUN_MAINTENANCE_IF_MAIN;