Clean up transactions in maintenance scripts
authorAaron Schulz <aschulz@wikimedia.org>
Tue, 22 Dec 2015 08:51:42 +0000 (00:51 -0800)
committerReedy <reedy@wikimedia.org>
Wed, 30 Dec 2015 23:40:35 +0000 (23:40 +0000)
Add transaction methods to complement getDB().
This makes it easy to grep for direct begin()/commit()
calls to IDatabase by having script use their own
wrapper. Maintenance scripts are one of the few places
that can (and need to) use begin/commit instead of the
start/end atomic methods.

Eventually, there should be almost no direct callers
and those methods can be made stricter about throwing
errors on nested calls.

Change-Id: Ibbfc7a77c0d2a55f7fc2261087f6c3a19061e0aa

22 files changed:
maintenance/Maintenance.php
maintenance/cleanupImages.php
maintenance/cleanupPreferences.php
maintenance/cleanupSpam.php
maintenance/deleteArchivedFiles.php
maintenance/deleteOldRevisions.php
maintenance/deleteOrphanedRevisions.php
maintenance/deleteSelfExternals.php
maintenance/migrateUserGroup.php
maintenance/moveBatch.php
maintenance/nukeNS.php
maintenance/nukePage.php
maintenance/populateLogUsertext.php
maintenance/populateRevisionLength.php
maintenance/populateRevisionSha1.php
maintenance/reassignEdits.php
maintenance/rebuildFileCache.php
maintenance/storage/compressOld.php
maintenance/storage/fixBug20757.php
maintenance/storage/recompressTracked.php
maintenance/updateCollation.php
maintenance/wrapOldPasswords.php

index 185a1f4..3dd7ee8 100644 (file)
@@ -105,7 +105,7 @@ abstract class Maintenance {
 
        /**
         * Used by getDB() / setDB()
-        * @var DatabaseBase
+        * @var IDatabase
         */
        private $mDb = null;
 
@@ -1071,7 +1071,7 @@ abstract class Maintenance {
        public function purgeRedundantText( $delete = true ) {
                # Data should come off the master, wrapped in a transaction
                $dbw = $this->getDB( DB_MASTER );
-               $dbw->begin( __METHOD__ );
+               $this->beginTransaction( $dbw, __METHOD__ );
 
                # Get "active" text records from the revisions table
                $this->output( 'Searching for active text records in revisions table...' );
@@ -1114,7 +1114,7 @@ abstract class Maintenance {
                }
 
                # Done
-               $dbw->commit( __METHOD__ );
+               $this->commitTransaction( $dbw, __METHOD__ );
        }
 
        /**
@@ -1130,7 +1130,10 @@ abstract class Maintenance {
         * If not set, wfGetDB() will be used.
         * This function has the same parameters as wfGetDB()
         *
-        * @return DatabaseBase
+        * @param integer $db DB index (DB_SLAVE/DB_MASTER)
+        * @param array $groups; default: empty array
+        * @param string|bool $wiki; default: current wiki
+        * @return IDatabase
         */
        protected function getDB( $db, $groups = array(), $wiki = false ) {
                if ( is_null( $this->mDb ) ) {
@@ -1143,12 +1146,54 @@ abstract class Maintenance {
        /**
         * Sets database object to be returned by getDB().
         *
-        * @param DatabaseBase $db Database object to be used
+        * @param IDatabase $db Database object to be used
         */
-       public function setDB( $db ) {
+       public function setDB( IDatabase $db ) {
                $this->mDb = $db;
        }
 
+       /**
+        * Begin a transcation on a DB
+        *
+        * This method makes it clear that begin() is called from a maintenance script,
+        * which has outermost scope. This is safe, unlike $dbw->begin() called in other places.
+        *
+        * @param IDatabase $dbw
+        * @param string $fname Caller name
+        * @since 1.27
+        */
+       protected function beginTransaction( IDatabase $dbw, $fname ) {
+               $dbw->begin( $fname );
+       }
+
+       /**
+        * Commit a transcation on a DB
+        *
+        * This method makes it clear that commit() is called from a maintenance script,
+        * which has outermost scope. This is safe, unlike $dbw->commit() called in other places.
+        *
+        * @param IDatabase $dbw
+        * @param string $fname Caller name
+        * @since 1.27
+        */
+       protected function commitTransaction( IDatabase $dbw, $fname ) {
+               $dbw->commit( $fname );
+       }
+
+       /**
+        * Rollback a transcation on a DB
+        *
+        * This method makes it clear that rollback() is called from a maintenance script,
+        * which has outermost scope. This is safe, unlike $dbw->rollback() called in other places.
+        *
+        * @param IDatabase $dbw
+        * @param string $fname Caller name
+        * @since 1.27
+        */
+       protected function rollbackTransaction( IDatabase $dbw, $fname ) {
+               $dbw->rollback( $fname );
+       }
+
        /**
         * Lock the search index
         * @param DatabaseBase &$db
index 1bd0217..5baa8d3 100644 (file)
@@ -167,7 +167,7 @@ class ImageCleanup extends TableCleanup {
                } else {
                        $this->output( "renaming $path to $finalPath\n" );
                        // @todo FIXME: Should this use File::move()?
-                       $db->begin( __METHOD__ );
+                       $this->beginTransaction( $db, __METHOD__ );
                        $db->update( 'image',
                                array( 'img_name' => $final ),
                                array( 'img_name' => $orig ),
@@ -184,16 +184,16 @@ class ImageCleanup extends TableCleanup {
                        if ( !file_exists( $dir ) ) {
                                if ( !wfMkdirParents( $dir, null, __METHOD__ ) ) {
                                        $this->output( "RENAME FAILED, COULD NOT CREATE $dir" );
-                                       $db->rollback( __METHOD__ );
+                                       $this->rollbackTransaction( $db, __METHOD__ );
 
                                        return;
                                }
                        }
                        if ( rename( $path, $finalPath ) ) {
-                               $db->commit( __METHOD__ );
+                               $this->commitTransaction( $db, __METHOD__ );
                        } else {
                                $this->error( "RENAME FAILED" );
-                               $db->rollback( __METHOD__ );
+                               $this->rollbackTransaction( $db, __METHOD__ );
                        }
                }
        }
index 4e19b79..5253ab3 100644 (file)
@@ -34,8 +34,8 @@ class CleanupPreferences extends Maintenance {
        public function execute() {
                global $wgHiddenPrefs;
 
-               $dbw = wfGetDB( DB_MASTER );
-               $dbw->begin( __METHOD__ );
+               $dbw = $this->getDB( DB_MASTER );
+               $this->beginTransaction( $dbw, __METHOD__ );
                foreach ( $wgHiddenPrefs as $item ) {
                        $dbw->delete(
                                'user_properties',
@@ -43,7 +43,7 @@ class CleanupPreferences extends Maintenance {
                                __METHOD__
                        );
                };
-               $dbw->commit( __METHOD__ );
+               $this->commitTransaction( $dbw, __METHOD__ );
                $this->output( "Finished!\n" );
        }
 }
index 44d5810..e6471dd 100644 (file)
@@ -121,7 +121,7 @@ class CleanupSpam extends Maintenance {
                        $this->output( "False match\n" );
                } else {
                        $dbw = wfGetDB( DB_MASTER );
-                       $dbw->begin( __METHOD__ );
+                       $this->beginTransaction( $dbw, __METHOD__ );
                        $page = WikiPage::factory( $title );
                        if ( $rev ) {
                                // Revert to this revision
@@ -151,7 +151,7 @@ class CleanupSpam extends Maintenance {
                                        wfMessage( 'spam_blanking', $domain )->inContentLanguage()->text()
                                );
                        }
-                       $dbw->commit( __METHOD__ );
+                       $this->commitTransaction( $dbw, __METHOD__ );
                }
        }
 }
index bd8ca10..94ebf87 100644 (file)
@@ -47,7 +47,7 @@ class DeleteArchivedFiles extends Maintenance {
 
                # Data should come off the master, wrapped in a transaction
                $dbw = $this->getDB( DB_MASTER );
-               $dbw->begin( __METHOD__ );
+               $this->beginTransaction( $dbw, __METHOD__ );
                $repo = RepoGroup::singleton()->getLocalRepo();
 
                # Get "active" revisions from the filearchive table
@@ -113,7 +113,7 @@ class DeleteArchivedFiles extends Maintenance {
                        $dbw->delete( 'filearchive', array( 'fa_id' => $id ), __METHOD__ );
                }
 
-               $dbw->commit( __METHOD__ );
+               $this->commitTransaction( $dbw, __METHOD__ );
                $this->output( "Done! [$count file(s)]\n" );
        }
 }
index 847d863..0c06ec5 100644 (file)
@@ -46,7 +46,7 @@ class DeleteOldRevisions extends Maintenance {
 
                # Data should come off the master, wrapped in a transaction
                $dbw = wfGetDB( DB_MASTER );
-               $dbw->begin( __METHOD__ );
+               $this->beginTransaction( $dbw, __METHOD__ );
 
                $pageConds = array();
                $revConds = array();
@@ -92,7 +92,7 @@ class DeleteOldRevisions extends Maintenance {
 
                # This bit's done
                # Purge redundant text records
-               $dbw->commit( __METHOD__ );
+               $this->commitTransaction( $dbw, __METHOD__ );
                if ( $delete ) {
                        $this->purgeRedundantText( true );
                }
index 7f1ffe4..776d345 100644 (file)
@@ -44,7 +44,7 @@ class DeleteOrphanedRevisions extends Maintenance {
                $report = $this->hasOption( 'report' );
 
                $dbw = wfGetDB( DB_MASTER );
-               $dbw->begin( __METHOD__ );
+               $this->beginTransaction( $dbw, __METHOD__ );
                list( $page, $revision ) = $dbw->tableNamesN( 'page', 'revision' );
 
                # Find all the orphaned revisions
@@ -63,7 +63,7 @@ class DeleteOrphanedRevisions extends Maintenance {
 
                # Nothing to do?
                if ( $report || $count == 0 ) {
-                       $dbw->commit( __METHOD__ );
+                       $this->commitTransaction( $dbw, __METHOD__ );
                        exit( 0 );
                }
 
@@ -73,7 +73,7 @@ class DeleteOrphanedRevisions extends Maintenance {
                $this->output( "done.\n" );
 
                # Close the transaction and call the script to purge unused text records
-               $dbw->commit( __METHOD__ );
+               $this->commitTransaction( $dbw, __METHOD__ );
                $this->purgeRedundantText( true );
        }
 
index a097622..a397663 100644 (file)
@@ -42,7 +42,7 @@ class DeleteSelfExternals extends Maintenance {
                $db = wfGetDB( DB_MASTER );
                while ( 1 ) {
                        wfWaitForSlaves();
-                       $db->commit( __METHOD__ );
+                       $this->commitTransaction( $db, __METHOD__ );
                        $q = $db->limitResult( "DELETE /* deleteSelfExternals */ FROM externallinks WHERE el_to"
                                . $db->buildLike( $wgServer . '/', $db->anyString() ), $this->mBatchSize );
                        $this->output( "Deleting a batch\n" );
index 6903365..a0c41fd 100644 (file)
@@ -58,7 +58,7 @@ class MigrateUserGroup extends Maintenance {
                        $affected = 0;
                        $this->output( "Doing users $blockStart to $blockEnd\n" );
 
-                       $dbw->begin( __METHOD__ );
+                       $this->beginTransaction( $dbw, __METHOD__ );
                        $dbw->update( 'user_groups',
                                array( 'ug_group' => $newGroup ),
                                array( 'ug_group' => $oldGroup,
@@ -77,7 +77,7 @@ class MigrateUserGroup extends Maintenance {
                                __METHOD__
                        );
                        $affected += $dbw->affectedRows();
-                       $dbw->commit( __METHOD__ );
+                       $this->commitTransaction( $dbw, __METHOD__ );
 
                        // Clear cache for the affected users (bug 40340)
                        if ( $affected > 0 ) {
index 5849908..8a81fdd 100644 (file)
@@ -106,13 +106,13 @@ class MoveBatch extends Maintenance {
                        }
 
                        $this->output( $source->getPrefixedText() . ' --> ' . $dest->getPrefixedText() );
-                       $dbw->begin( __METHOD__ );
+                       $this->beginTransaction( $dbw, __METHOD__ );
                        $mp = new MovePage( $source, $dest );
                        $status = $mp->move( $wgUser, $reason, !$noredirects );
                        if ( !$status->isOK() ) {
                                $this->output( "\nFAILED: " . $status->getWikiText() );
                        }
-                       $dbw->commit( __METHOD__ );
+                       $this->commitTransaction( $dbw, __METHOD__ );
                        $this->output( "\n" );
 
                        if ( $interval ) {
index 64bf1b6..04e2673 100644 (file)
@@ -55,7 +55,7 @@ class NukeNS extends Maintenance {
                $delete = $this->getOption( 'delete', false );
                $all = $this->getOption( 'all', false );
                $dbw = wfGetDB( DB_MASTER );
-               $dbw->begin( __METHOD__ );
+               $this->beginTransaction( $dbw, __METHOD__ );
 
                $tbl_pag = $dbw->tableName( 'page' );
                $tbl_rev = $dbw->tableName( 'revision' );
@@ -86,7 +86,7 @@ class NukeNS extends Maintenance {
                                // I already have the id & revs
                                if ( $delete ) {
                                        $dbw->query( "DELETE FROM $tbl_pag WHERE page_id = $id" );
-                                       $dbw->commit( __METHOD__ );
+                                       $this->commitTransaction( $dbw, __METHOD__ );
                                        // Delete revisions as appropriate
                                        $child = $this->runChild( 'NukePage', 'nukePage.php' );
                                        $child->deleteRevisions( $revs );
@@ -97,7 +97,7 @@ class NukeNS extends Maintenance {
                                $this->output( "skip: " . $title->getPrefixedText() . "\n" );
                        }
                }
-               $dbw->commit( __METHOD__ );
+               $this->commitTransaction( $dbw, __METHOD__ );
 
                if ( $n_deleted > 0 ) {
                        # update statistics - better to decrement existing count, or just count
index 1870273..94e3409 100644 (file)
@@ -44,7 +44,7 @@ class NukePage extends Maintenance {
                $delete = $this->getOption( 'delete', false );
 
                $dbw = wfGetDB( DB_MASTER );
-               $dbw->begin( __METHOD__ );
+               $this->beginTransaction( $dbw, __METHOD__ );
 
                $tbl_pag = $dbw->tableName( 'page' );
                $tbl_rec = $dbw->tableName( 'recentchanges' );
@@ -79,7 +79,7 @@ class NukePage extends Maintenance {
                                $this->output( "done.\n" );
                        }
 
-                       $dbw->commit( __METHOD__ );
+                       $this->commitTransaction( $dbw, __METHOD__ );
 
                        # Delete revisions as appropriate
                        if ( $delete && $count ) {
@@ -99,20 +99,20 @@ class NukePage extends Maintenance {
                        }
                } else {
                        $this->output( "not found in database.\n" );
-                       $dbw->commit( __METHOD__ );
+                       $this->commitTransaction( $dbw, __METHOD__ );
                }
        }
 
        public function deleteRevisions( $ids ) {
                $dbw = wfGetDB( DB_MASTER );
-               $dbw->begin( __METHOD__ );
+               $this->beginTransaction( $dbw, __METHOD__ );
 
                $tbl_rev = $dbw->tableName( 'revision' );
 
                $set = implode( ', ', $ids );
                $dbw->query( "DELETE FROM $tbl_rev WHERE rev_id IN ( $set )" );
 
-               $dbw->commit( __METHOD__ );
+               $this->commitTransaction( $dbw, __METHOD__ );
        }
 }
 
index 96cb1ec..60329c0 100644 (file)
@@ -67,12 +67,12 @@ class PopulateLogUsertext extends LoggedUpdateMaintenance {
                        $res = $db->select( array( 'logging', 'user' ),
                                array( 'log_id', 'user_name' ), $cond, __METHOD__ );
 
-                       $db->begin( __METHOD__ );
+                       $this->beginTransaction( $db, __METHOD__ );
                        foreach ( $res as $row ) {
                                $db->update( 'logging', array( 'log_user_text' => $row->user_name ),
                                        array( 'log_id' => $row->log_id ), __METHOD__ );
                        }
-                       $db->commit( __METHOD__ );
+                       $this->commitTransaction( $db, __METHOD__ );
                        $blockStart += $this->mBatchSize;
                        $blockEnd += $this->mBatchSize;
                        wfWaitForSlaves();
index b73ac7f..a9fb394 100644 (file)
@@ -100,14 +100,14 @@ class PopulateRevisionLength extends LoggedUpdateMaintenance {
                                __METHOD__
                        );
 
-                       $db->begin( __METHOD__ );
+                       $this->beginTransaction( $db, __METHOD__ );
                        # Go through and update rev_len from these rows.
                        foreach ( $res as $row ) {
                                if ( $this->upgradeRow( $row, $table, $idCol, $prefix ) ) {
                                        $count++;
                                }
                        }
-                       $db->commit( __METHOD__ );
+                       $this->commitTransaction( $db, __METHOD__ );
 
                        $blockStart += $this->mBatchSize;
                        $blockEnd += $this->mBatchSize;
index b401db0..43504b1 100644 (file)
@@ -95,13 +95,13 @@ class PopulateRevisionSha1 extends LoggedUpdateMaintenance {
                                AND $idCol IS NOT NULL AND {$prefix}_sha1 = ''";
                        $res = $db->select( $table, '*', $cond, __METHOD__ );
 
-                       $db->begin( __METHOD__ );
+                       $this->beginTransaction( $db, __METHOD__ );
                        foreach ( $res as $row ) {
                                if ( $this->upgradeRow( $row, $table, $idCol, $prefix ) ) {
                                        $count++;
                                }
                        }
-                       $db->commit( __METHOD__ );
+                       $this->commitTransaction( $db, __METHOD__ );
 
                        $blockStart += $this->mBatchSize;
                        $blockEnd += $this->mBatchSize;
@@ -121,20 +121,20 @@ class PopulateRevisionSha1 extends LoggedUpdateMaintenance {
                        array( 'ar_rev_id IS NULL', 'ar_sha1' => '' ), __METHOD__ );
 
                $updateSize = 0;
-               $db->begin( __METHOD__ );
+               $this->beginTransaction( $db, __METHOD__ );
                foreach ( $res as $row ) {
                        if ( $this->upgradeLegacyArchiveRow( $row ) ) {
                                ++$count;
                        }
                        if ( ++$updateSize >= 100 ) {
                                $updateSize = 0;
-                               $db->commit( __METHOD__ );
+                               $this->commitTransaction( $db, __METHOD__ );
                                $this->output( "Commited row with ar_timestamp={$row->ar_timestamp}\n" );
                                wfWaitForSlaves();
-                               $db->begin( __METHOD__ );
+                               $this->beginTransaction( $db, __METHOD__ );
                        }
                }
-               $db->commit( __METHOD__ );
+               $this->commitTransaction( $db, __METHOD__ );
 
                return $count;
        }
index 679cadb..4d1c537 100644 (file)
@@ -75,7 +75,7 @@ class ReassignEdits extends Maintenance {
         */
        private function doReassignEdits( &$from, &$to, $rc = false, $report = false ) {
                $dbw = wfGetDB( DB_MASTER );
-               $dbw->begin( __METHOD__ );
+               $this->beginTransaction( $dbw, __METHOD__ );
 
                # Count things
                $this->output( "Checking current edits..." );
@@ -139,7 +139,7 @@ class ReassignEdits extends Maintenance {
                        }
                }
 
-               $dbw->commit( __METHOD__ );
+               $this->commitTransaction( $dbw, __METHOD__ );
 
                return (int)$total;
        }
index 924457a..4147491 100644 (file)
@@ -99,7 +99,7 @@ class RebuildFileCache extends Maintenance {
                                array( 'ORDER BY' => 'page_id ASC', 'USE INDEX' => 'PRIMARY' )
                        );
 
-                       $dbw->begin( __METHOD__ ); // for any changes
+                       $this->beginTransaction( $dbw, __METHOD__ ); // for any changes
                        foreach ( $res as $row ) {
                                $rebuilt = false;
                                $wgRequestTime = microtime( true ); # bug 22852
@@ -145,7 +145,7 @@ class RebuildFileCache extends Maintenance {
                                        $this->output( "Page {$row->page_id} not cacheable\n" );
                                }
                        }
-                       $dbw->commit( __METHOD__ ); // commit any changes (just for sanity)
+                       $this->commitTransaction( $dbw, __METHOD__ ); // commit any changes (just for sanity)
 
                        $blockStart += $this->mBatchSize;
                        $blockEnd += $this->mBatchSize;
index 16c676d..f115bf8 100644 (file)
@@ -359,7 +359,7 @@ class CompressOld extends Maintenance {
 
                                $chunk = new ConcatenatedGzipHistoryBlob();
                                $stubs = array();
-                               $dbw->begin( __METHOD__ );
+                               $this->beginTransaction( $dbw, __METHOD__ );
                                $usedChunk = false;
                                $primaryOldid = $revs[$i]->rev_text_id;
 
@@ -463,7 +463,7 @@ class CompressOld extends Maintenance {
                                }
                                # Done, next
                                $this->output( "/" );
-                               $dbw->commit( __METHOD__ );
+                               $this->commitTransaction( $dbw, __METHOD__ );
                                $i += $thisChunkSize;
                                wfWaitForSlaves();
                        }
index dd4cd54..c6692b5 100644 (file)
@@ -213,7 +213,7 @@ class FixBug20757 extends Maintenance {
 
                                if ( !$dryRun ) {
                                        // Reset the text row to point to the original copy
-                                       $dbw->begin( __METHOD__ );
+                                       $this->beginTransaction( $dbw, __METHOD__ );
                                        $dbw->update(
                                                'text',
                                                // SET
@@ -241,7 +241,7 @@ class FixBug20757 extends Maintenance {
                                                ),
                                                __METHOD__
                                        );
-                                       $dbw->commit( __METHOD__ );
+                                       $this->commitTransaction( $dbw, __METHOD__ );
                                        $this->waitForSlaves();
                                }
 
index f7907ad..62e057b 100644 (file)
@@ -559,7 +559,7 @@ class RecompressTracked {
                        exit( 1 );
                }
                $dbw = wfGetDB( DB_MASTER );
-               $dbw->begin( __METHOD__ );
+               $this->beginTransaction( $dbw, __METHOD__ );
                $dbw->update( 'text',
                        array( // set
                                'old_text' => $url,
@@ -575,7 +575,7 @@ class RecompressTracked {
                        array( 'bt_text_id' => $textId ),
                        __METHOD__
                );
-               $dbw->commit( __METHOD__ );
+               $this->commitTransaction( $dbw, __METHOD__ );
        }
 
        /**
@@ -766,7 +766,7 @@ class CgzCopyTransaction {
                 * We do a locking read to prevent closer-run race conditions.
                 */
                $dbw = wfGetDB( DB_MASTER );
-               $dbw->begin( __METHOD__ );
+               $this->beginTransaction( $dbw, __METHOD__ );
                $res = $dbw->select( 'blob_tracking',
                        array( 'bt_text_id', 'bt_moved' ),
                        array( 'bt_text_id' => array_keys( $this->referrers ) ),
@@ -820,7 +820,7 @@ class CgzCopyTransaction {
                $targetDB->commit( __METHOD__ );
                // Critical section here: interruption at this point causes blob duplication
                // Reversing the order of the commits would cause data loss instead
-               $dbw->commit( __METHOD__ );
+               $this->commitTransaction( $dbw, __METHOD__ );
 
                // Write the new URLs to the text table and set the moved flag
                if ( !$this->parent->copyOnly ) {
index 5cf8afa..bb75314 100644 (file)
@@ -141,7 +141,7 @@ TEXT;
                        $this->output( " processing..." );
 
                        if ( !$dryRun ) {
-                               $dbw->begin( __METHOD__ );
+                               $this->beginTransaction( $dbw, __METHOD__ );
                        }
                        foreach ( $res as $row ) {
                                $title = Title::newFromRow( $row );
@@ -193,7 +193,7 @@ TEXT;
                                }
                        }
                        if ( !$dryRun ) {
-                               $dbw->commit( __METHOD__ );
+                               $this->commitTransaction( $dbw, __METHOD__ );
                        }
 
                        $count += $res->numRows();
index 37272a0..e0c10f8 100644 (file)
@@ -72,7 +72,7 @@ class WrapOldPasswords extends Maintenance {
 
                $minUserId = 0;
                do {
-                       $dbw->begin();
+                       $this->beginTransaction( $dbw, __METHOD__ );
 
                        $res = $dbw->select( 'user',
                                array( 'user_id', 'user_name', 'user_password' ),
@@ -112,7 +112,7 @@ class WrapOldPasswords extends Maintenance {
                                $minUserId = $row->user_id;
                        }
 
-                       $dbw->commit();
+                       $this->commitTransaction( $dbw, __METHOD__ );
 
                        // Clear memcached so old passwords are wiped out
                        foreach ( $updateUsers as $user ) {