* @author Rob Church <robchur@gmail.com>
*/
-require_once( "Maintenance.php" );
+require_once( dirname(__FILE__) . '/Maintenance.php' );
class RemoveUnusedAccounts extends Maintenance {
public function __construct() {
}
$touched = $this->getOption( 'ignore-touched', "1" );
if( !ctype_digit( $touched ) ) {
- $this->error( "Please put a valid positive integer on the --ignore-touched parameter.\n", true );
+ $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
'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;
}