MediaWiki  master
purgeExpiredUserrights.php
Go to the documentation of this file.
1 <?php
24 
25 require_once __DIR__ . '/Maintenance.php';
26 
27 /*
28  * Maintenance script to move expired userrights to user_former_groups
29  *
30  * @since 1.31
31  */
32 
34  public function __construct() {
35  parent::__construct();
36  $this->addDescription( 'Move expired userrights from user_groups to former_user_groups table.' );
37  }
38 
39  public function execute() {
40  $this->output( "Purging expired user rights...\n" );
41  $res = MediaWikiServices::getInstance()->getUserGroupManager()->purgeExpired();
42  if ( $res === false ) {
43  $this->output( "Purging failed.\n" );
44  } else {
45  $this->output( "$res rows purged.\n" );
46  }
47  }
48 }
49 
50 $maintClass = PurgeExpiredUserrights::class;
51 require_once RUN_MAINTENANCE_IF_MAIN;
RUN_MAINTENANCE_IF_MAIN
const RUN_MAINTENANCE_IF_MAIN
Definition: Maintenance.php:38
$maintClass
$maintClass
Definition: purgeExpiredUserrights.php:50
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition: MediaWikiServices.php:154
Maintenance\addDescription
addDescription( $text)
Set the description text.
Definition: Maintenance.php:327
Maintenance
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
Definition: Maintenance.php:55
$res
$res
Definition: testCompression.php:57
PurgeExpiredUserrights
Definition: purgeExpiredUserrights.php:33
PurgeExpiredUserrights\execute
execute()
Do the actual work.
Definition: purgeExpiredUserrights.php:39
PurgeExpiredUserrights\__construct
__construct()
Default constructor.
Definition: purgeExpiredUserrights.php:34
Maintenance\output
output( $out, $channel=null)
Throw some output to the user.
Definition: Maintenance.php:434