r90040 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90039‎ | r90040 | r90041 >
Date:13:02, 14 June 2011
Author:freakolowsky
Status:resolved
Tags:
Comment:
(Nikerabbit comments on r90038#c18029)
* removed detail output
* channeled the raimaining output
* changed the inclusion of Maintenance.php
Modified paths:
  • /trunk/extensions/OracleTextSearch/maintainenceFixOTSLinks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/OracleTextSearch/maintainenceFixOTSLinks.php
@@ -1,6 +1,11 @@
22 <?php
3 -/* run this script out of your $IP/maintenance folder */
4 -require_once( 'Maintenance.php' );
 3+if ( getenv( 'MW_INSTALL_PATH' ) !== false ) {
 4+ $IP = getenv( 'MW_INSTALL_PATH' );
 5+} else {
 6+ $dir = dirname( __FILE__ );
 7+ $IP = "$dir/../..";
 8+}
 9+require_once( "$IP/maintenance/Maintenance.php" );
510
611 class FixOTSLinks extends Maintenance {
712 public function __construct() {
@@ -12,9 +17,9 @@
1318 public function execute() {
1419 $doAll = $this->hasOption( 'all' );
1520 if ($doAll) {
16 - $this->output( "Recreate all index links to documents\n\n" );
 21+ $this->output( "Recreating all index links to documents ", 'OracleTextSearch' );
1722 } else {
18 - $this->output( "Recreate missing index links to documents\n\n" );
 23+ $this->output( "Recreating missing index links to documents ", 'OracleTextSearch' );
1924 }
2025 $this->doRecreate($doAll);
2126 }
@@ -28,36 +33,40 @@
2934
3035 $searchWhere = $all ? '' : ' AND NOT EXISTS (SELECT null FROM '.$tbl_idx.' WHERE si_page=p.page_id AND si_url IS NOT null)';
3136 $result = $dbw->doQuery('SELECT p.page_id FROM '.$tbl_pag.' p WHERE p.page_namespace = '.NS_FILE.$searchWhere );
32 - $this->output($result->numRows().' files found.'."\n\n");
 37+ $this->output( "[".$result->numRows()." files found] ", 'OracleTextSearch' );
3338
3439 $syncIdx = false;
35 -
 40+ $countDone = 0;
 41+ $countSkipped = 0;
 42+
3643 while (($row = $result->fetchObject()) !== false) {
3744 $titleObj = Title::newFromID($row->page_id);
3845 $file = wfLocalFile($titleObj->getText());
3946
40 - $this->output('Updating "'.$titleObj->getText().'" ... ');
41 -
4247 if (in_array( $file->getMimeType(), $wgExIndexMIMETypes )) {
4348 $url = $wgExIndexOnHTTP ? preg_replace( '/^https:/i', 'http:', $file->getFullUrl() ) : $file->getFullUrl();
4449 $dbw->update('searchindex',
4550 array( 'si_url' => $url ),
4651 array( 'si_page' => $row->page_id ),
4752 'SearchIndexUpdate:update' );
48 - $this->output('complete'."\n");
4953 $syncIdx = true;
5054 } else {
51 - $this->output('skipped (unsupported or excluded mime-type)'."\n");
 55+ $countSkipped++;
5256 }
 57+ $countDone++;
5358 }
5459
5560 if ( $syncIdx ) {
56 - $this->output("\n".'Syncing Index'."\n");
 61+ $this->output( " Syncing... ", 'OracleTextSearch');
5762 $index = $dbw->getProperty('mTablePrefix')."si_url_idx";
5863 $dbw->query( "CALL ctx_ddl.sync_index('$index')" );
5964 }
6065
61 - $this->output('Recreate finished');
 66+ $this->output(" Finished ($countDone processed", 'OracleTextSearch');
 67+ if ( $countSkipped > 0 ) {
 68+ $this->output(", $countSkipped skipped ", 'OracleTextSearch');
 69+ }
 70+ $this->output(")", 'OracleTextSearch');
6271 }
6372 }
6473

Follow-up revisions

RevisionCommit summaryAuthorDate
r90042* interpreted the variable name "channel" a bit differently (10x Nikerabbit)freakolowsky13:25, 14 June 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r90038* Initial commitfreakolowsky07:46, 14 June 2011

Status & tagging log