dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Allow server selection when running sql.php
[lhc/web/wiklou.git]
/
maintenance
/
removeUnusedAccounts.php
diff --git
a/maintenance/removeUnusedAccounts.php
b/maintenance/removeUnusedAccounts.php
index
490602d
..
2d75722
100644
(file)
--- a/
maintenance/removeUnusedAccounts.php
+++ b/
maintenance/removeUnusedAccounts.php
@@
-23,7
+23,7
@@
* @author Rob Church <robchur@gmail.com>
*/
* @author Rob Church <robchur@gmail.com>
*/
-require_once
( dirname( __FILE__ ) . '/Maintenance.php' )
;
+require_once
__DIR__ . '/Maintenance.php'
;
/**
* Maintenance script that removes unused user accounts from the database.
/**
* Maintenance script that removes unused user accounts from the database.
@@
-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__ );
$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__ );
$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 );
*/
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__ );
$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( $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;
$dbo->commit( __METHOD__ );
return $count == 0;
@@
-113,4
+124,4
@@
class RemoveUnusedAccounts extends Maintenance {
}
$maintClass = "RemoveUnusedAccounts";
}
$maintClass = "RemoveUnusedAccounts";
-require_once
( RUN_MAINTENANCE_IF_MAIN )
;
+require_once
RUN_MAINTENANCE_IF_MAIN
;