Page MenuHomeMiraheze
Paste P285

(An Untitled Masterwork)
ActivePublic

Authored by Paladox on Mar 28 2020, 16:40.
Tags
None
Referenced Files
F1137385: raw.txt
Mar 28 2020, 16:42
F1137384: raw.txt
Mar 28 2020, 16:40
Subscribers
None
<?php
/**
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
* @file
* @ingroup Maintenance
* @author Southparkfan
* @author John Lewis
* @version 2.1
*/
use MediaWiki\Shell\Shell;
require_once( __DIR__ . '/../../../maintenance/Maintenance.php' );
class Test extends Maintenance {
public function __construct() {
parent::__construct();
$this->addOption( 'write', 'Actually make changes to wikis which are considered for the next stage in dormancy', false, false );
$this->mDescription = 'A script to find inactive wikis in a farm.';
}
public function execute() {
global $wgCreateWikiDatabase, $wgCreateWikiStateDays;
$dbw = wfGetDB( DB_MASTER, [], $wgCreateWikiDatabase );
$res = $dbw->select(
'cw_wikis',
[
'wiki_dbname',
'wiki_inactive',
'wiki_inactive_timestamp',
'wiki_closed',
'wiki_closed_timestamp',
'wiki_creation',
'wiki_deleted'
],
[
'wiki_deleted' => 0
],
__METHOD__
);
foreach ( $res as $row ) {
if ( isset( $wgLBFactoryConf[$row->wiki_dbname] ) ) {
echo $row->wiki_dbname;
}
}
}
}
$maintClass = 'Test';
require_once RUN_MAINTENANCE_IF_MAIN;