X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FremoveUnusedAccounts.php;h=b4528ca00b0a7ee70291a5751e1dcf5965d0ed90;hb=b809d516dbb7bbf3b2017e8436b4f26477355f79;hp=8bc27c18372f6290a4e57a8f92730ffd733a45bc;hpb=2b3224220d9251fd73c03012465e8470e2a835e1;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/removeUnusedAccounts.php b/maintenance/removeUnusedAccounts.php index 8bc27c1837..b4528ca00b 100644 --- a/maintenance/removeUnusedAccounts.php +++ b/maintenance/removeUnusedAccounts.php @@ -77,6 +77,8 @@ class RemoveUnusedAccounts extends Maintenance { $this->output( "\nDeleting inactive accounts..." ); $dbw = wfGetDB( DB_MASTER ); $dbw->delete( 'user', array( 'user_id' => $del ), __METHOD__ ); + $dbw->delete( 'logging', array( 'log_user' => $del ), __METHOD__ ); + $dbw->delete( 'recentchanges', array( 'rc_user' => $del ), __METHOD__ ); $this->output( "done.\n" ); # Update the site_stats.ss_users field $users = $dbw->selectField( 'user', 'COUNT(*)', array(), __METHOD__ ); @@ -97,8 +99,13 @@ class RemoveUnusedAccounts extends Maintenance { */ private function isInactiveAccount( $id, $master = false ) { $dbo = wfGetDB( $master ? DB_MASTER : DB_SLAVE ); - $checks = array( 'revision' => 'rev', 'archive' => 'ar', 'logging' => 'log', - 'image' => 'img', 'oldimage' => 'oi', 'filearchive' => 'fa' ); + $checks = array( + 'revision' => 'rev', + 'archive' => 'ar', + 'image' => 'img', + 'oldimage' => 'oi', + 'filearchive' => 'fa' + ); $count = 0; $dbo->begin( __METHOD__ ); @@ -106,6 +113,10 @@ class RemoveUnusedAccounts extends Maintenance { $conds = array( $fprefix . '_user' => $id ); $count += (int)$dbo->selectField( $table, 'COUNT(*)', $conds, __METHOD__ ); } + + $conds = array( 'log_user' => $id, 'log_type != ' . $dbo->addQuotes( 'newusers' ) ); + $count += (int)$dbo->selectField( 'logging', 'COUNT(*)', $conds, __METHOD__ ); + $dbo->commit( __METHOD__ ); return $count == 0;