http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90040
Revision: 90040
Author: freakolowsky
Date: 2011-06-14 13:02:05 +0000 (Tue, 14 Jun 2011)
Log Message:
-----------
(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: trunk/extensions/OracleTextSearch/maintainenceFixOTSLinks.php
===================================================================
--- trunk/extensions/OracleTextSearch/maintainenceFixOTSLinks.php
2011-06-14 10:10:51 UTC (rev 90039)
+++ trunk/extensions/OracleTextSearch/maintainenceFixOTSLinks.php
2011-06-14 13:02:05 UTC (rev 90040)
@@ -1,6 +1,11 @@
<?php
-/* run this script out of your $IP/maintenance folder */
-require_once( 'Maintenance.php' );
+if ( getenv( 'MW_INSTALL_PATH' ) !== false ) {
+ $IP = getenv( 'MW_INSTALL_PATH' );
+} else {
+ $dir = dirname( __FILE__ );
+ $IP = "$dir/../..";
+}
+require_once( "$IP/maintenance/Maintenance.php" );
class FixOTSLinks extends Maintenance {
public function __construct() {
@@ -12,9 +17,9 @@
public function execute() {
$doAll = $this->hasOption( 'all' );
if ($doAll) {
- $this->output( "Recreate all index links to
documents\n\n" );
+ $this->output( "Recreating all index links to documents
", 'OracleTextSearch' );
} else {
- $this->output( "Recreate missing index links to
documents\n\n" );
+ $this->output( "Recreating missing index links to
documents ", 'OracleTextSearch' );
}
$this->doRecreate($doAll);
}
@@ -28,36 +33,40 @@
$searchWhere = $all ? '' : ' AND NOT EXISTS (SELECT null FROM
'.$tbl_idx.' WHERE si_page=p.page_id AND si_url IS NOT null)';
$result = $dbw->doQuery('SELECT p.page_id FROM '.$tbl_pag.' p
WHERE p.page_namespace = '.NS_FILE.$searchWhere );
- $this->output($result->numRows().' files found.'."\n\n");
+ $this->output( "[".$result->numRows()." files found] ",
'OracleTextSearch' );
$syncIdx = false;
-
+ $countDone = 0;
+ $countSkipped = 0;
+
while (($row = $result->fetchObject()) !== false) {
$titleObj = Title::newFromID($row->page_id);
$file = wfLocalFile($titleObj->getText());
- $this->output('Updating "'.$titleObj->getText().'" ...
');
-
if (in_array( $file->getMimeType(), $wgExIndexMIMETypes
)) {
$url = $wgExIndexOnHTTP ? preg_replace(
'/^https:/i', 'http:', $file->getFullUrl() ) : $file->getFullUrl();
$dbw->update('searchindex',
array( 'si_url' => $url ),
array( 'si_page' => $row->page_id ),
'SearchIndexUpdate:update' );
- $this->output('complete'."\n");
$syncIdx = true;
} else {
- $this->output('skipped (unsupported or excluded
mime-type)'."\n");
+ $countSkipped++;
}
+ $countDone++;
}
if ( $syncIdx ) {
- $this->output("\n".'Syncing Index'."\n");
+ $this->output( " Syncing... ", 'OracleTextSearch');
$index = $dbw->getProperty('mTablePrefix')."si_url_idx";
$dbw->query( "CALL ctx_ddl.sync_index('$index')" );
}
- $this->output('Recreate finished');
+ $this->output(" Finished ($countDone processed",
'OracleTextSearch');
+ if ( $countSkipped > 0 ) {
+ $this->output(", $countSkipped skipped ",
'OracleTextSearch');
+ }
+ $this->output(")", 'OracleTextSearch');
}
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs