Fix upload hook params
[lhc/web/wiklou.git] / maintenance / removeUnusedAccounts.php
index baa76d7..7b0535b 100644 (file)
@@ -22,7 +22,7 @@
  * @author Rob Church <robchur@gmail.com>
  */
 
-require_once( "Maintenance.php" );
+require_once( dirname(__FILE__) . '/Maintenance.php' );
 
 class RemoveUnusedAccounts extends Maintenance {
        public function __construct() {
@@ -51,7 +51,7 @@ class RemoveUnusedAccounts extends Maintenance {
                        $this->error( "Please put a valid positive integer on the --ignore-touched parameter.", true );
                }
                $touchedSeconds = 86400 * $touched;
-               while( $row = $dbr->fetchObject( $res ) ) {
+               foreach( $res as $row ) {
                        # Check the account, but ignore it if it's within a $excludedGroups group or if it's touched within the $touchedSeconds seconds.
                        $instance = User::newFromId( $row->user_id );
                        if( count( array_intersect( $instance->getEffectiveGroups(), $excludedGroups ) ) == 0
@@ -95,12 +95,12 @@ class RemoveUnusedAccounts extends Maintenance {
                                                 'image' => 'img', 'oldimage' => 'oi' );
                $count = 0;
        
-               $dbo->immediateBegin();
+               $dbo->begin();
                foreach( $checks as $table => $fprefix ) {
                        $conds = array( $fprefix . '_user' => $id );
                        $count += (int)$dbo->selectField( $table, 'COUNT(*)', $conds, __METHOD__ );
                }
-               $dbo->immediateCommit();
+               $dbo->commit();
        
                return $count == 0;
        }