Pulling back r45388 "Don't needlessly shy from reuniting lost files with their descri...
[lhc/web/wiklou.git] / maintenance / cleanupWatchlist.php
index d2925db..a6cedb2 100644 (file)
@@ -24,9 +24,9 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  * http://www.gnu.org/copyleft/gpl.html
  *
+ * @file
  * @author Brion Vibber <brion at pobox.com>
- * @package MediaWiki
- * @subpackage maintenance
+ * @ingroup Maintenance
  */
 
 $options = array( 'fix' );
@@ -34,6 +34,9 @@ $options = array( 'fix' );
 require_once( 'commandLine.inc' );
 require_once( 'FiveUpgrade.inc' );
 
+/**
+ * @ingroup Maintenance
+ */
 class WatchlistCleanup extends FiveUpgrade {
        function WatchlistCleanup( $dryrun = false ) {
                parent::FiveUpgrade();
@@ -70,9 +73,8 @@ class WatchlistCleanup extends FiveUpgrade {
                $estimatedTotalTime = $delta / $portion;
                $eta = $this->startTime + $estimatedTotalTime;
 
-               global $wgDBname;
                printf( "%s %s: %6.2f%% done on %s; ETA %s [%d/%d] %.2f/sec <%.2f%% updated>\n",
-                       $wgDBname,
+                       wfWikiID(),
                        wfTimestamp( TS_DB, intval( $now ) ),
                        $portion * 100.0,
                        $this->table,
@@ -96,15 +98,13 @@ class WatchlistCleanup extends FiveUpgrade {
                $result = $this->dbr->query( $sql, $fname );
 
                while( $row = $this->dbr->fetchObject( $result ) ) {
-                       $updated = call_user_func( $callback, $row );
+                       call_user_func( $callback, $row );
                }
                $this->log( "Finished $table... $this->updated of $this->processed rows updated" );
                $this->dbr->freeResult( $result );
        }
 
        function processEntry( $row ) {
-               global $wgContLang;
-
                $current = Title::makeTitle( $row->wl_namespace, $row->wl_title );
                $display = $current->getPrefixedText();
 
@@ -123,7 +123,7 @@ class WatchlistCleanup extends FiveUpgrade {
        
        function removeWatch( $row ) {
                if( !$this->dryrun) {
-                       $dbw =& wfGetDB( DB_MASTER );
+                       $dbw = wfGetDB( DB_MASTER );
                        $dbw->delete( 'watchlist', array(
                                'wl_user'      => $row->wl_user,
                                'wl_namespace' => $row->wl_namespace,
@@ -138,4 +138,4 @@ $wgUser->setName( 'Conversion script' );
 $caps = new WatchlistCleanup( !isset( $options['fix'] ) );
 $caps->cleanup();
 
-?>
+