X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2Frebuildtextindex.php;h=900a52a5701051a9f84d00c612cdab4a61e551f0;hb=801a8bdaa38cea5ff4db0440c82e9eb83e083772;hp=c786925440f6bf160b87f2d67cab12e2acf7a0c3;hpb=7c12da8d4fa65c8ce53d24784aca5ceff77f60c1;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/rebuildtextindex.php b/maintenance/rebuildtextindex.php index c786925440..900a52a570 100644 --- a/maintenance/rebuildtextindex.php +++ b/maintenance/rebuildtextindex.php @@ -56,17 +56,17 @@ class RebuildTextIndex extends Maintenance { // Shouldn't be needed for Postgres $this->db = $this->getDB( DB_MASTER ); if ( $this->db->getType() == 'postgres' ) { - $this->error( "This script is not needed when using Postgres.\n", true ); + $this->fatalError( "This script is not needed when using Postgres.\n" ); } if ( $this->db->getType() == 'sqlite' ) { if ( !DatabaseSqlite::getFulltextSearchModule() ) { - $this->error( "Your version of SQLite module for PHP doesn't " - . "support full-text search (FTS3).\n", true ); + $this->fatalError( "Your version of SQLite module for PHP doesn't " + . "support full-text search (FTS3).\n" ); } if ( !$this->db->checkForEnabledSearch() ) { - $this->error( "Your database schema is not configured for " - . "full-text search support. Run update.php.\n", true ); + $this->fatalError( "Your database schema is not configured for " + . "full-text search support. Run update.php.\n" ); } } @@ -93,11 +93,7 @@ class RebuildTextIndex extends Maintenance { $this->output( "Rebuilding index fields for {$count} pages...\n" ); $n = 0; - $fields = array_merge( - Revision::selectPageFields(), - Revision::selectFields(), - Revision::selectTextFields() - ); + $revQuery = Revision::getQueryInfo( [ 'page', 'text' ] ); while ( $n < $count ) { if ( $n ) { @@ -105,9 +101,13 @@ class RebuildTextIndex extends Maintenance { } $end = $n + self::RTI_CHUNK_SIZE - 1; - $res = $this->db->select( [ 'page', 'revision', 'text' ], $fields, + $res = $this->db->select( + $revQuery['tables'], + $revQuery['fields'], [ "page_id BETWEEN $n AND $end", 'page_latest = rev_id', 'rev_text_id = old_id' ], - __METHOD__ + __METHOD__, + [], + $revQuery['joins'] ); foreach ( $res as $s ) { @@ -161,5 +161,5 @@ class RebuildTextIndex extends Maintenance { } } -$maintClass = "RebuildTextIndex"; +$maintClass = RebuildTextIndex::class; require_once RUN_MAINTENANCE_IF_MAIN;