Page Menu
Home
Miraheze
Search
Configure Global Search
Log In
Paste
P132
(An Untitled Masterwork)
Active
Public
Actions
Authored by
Paladox
on Nov 2 2018, 01:59.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Flag For Later
Award Token
Tags
None
Referenced Files
F861833:
Nov 2 2018, 02:03
2018-11-02 02:03:43 (UTC+0)
F861830:
Nov 2 2018, 01:59
2018-11-02 01:59:50 (UTC+0)
Subscribers
None
class MirahezeQuickDbScript extends Maintenance {
public function __construct() {
parent::__construct();
}
public function execute() {
global $wgCreateWikiDatabase;
$dbw = wfGetDB( DB_MASTER, [], $wgCreateWikiDatabase );
$res = $dbw->select(
'cw_wikis',
'*',
array(),
__METHOD__
);
if ( !$res || !is_object( $res ) ) {
throw new MWException( '$res was not set to a valid array.' );
}
foreach ( $res as $row ) {
$DBname = $row->wiki_dbname;
$dbw->selectDB( $wgCreateWikiDatabase );
$res = $dbr->selectRow(
'logging',
'log_timestamp',
array(
'log_action' => 'createwiki',
'log_params' => serialize( array( '4::wiki' => $dbname ) )
),
__METHOD__,
array( // Sometimes a wiki might have been created multiple times.
'ORDER BY' => 'log_timestamp DESC'
)
);
$dbw->insert( 'cw_wikis',
[
'wiki_creation' => $res->log_timestamp,
],
__METHOD__
);
$this->output( "Inserted {$res->log_timestamp} into wiki_creation column for db {$DBname}\n")
}
}
}
$maintClass = 'MirahezeQuickDbScript';
require_once RUN_MAINTENANCE_IF_MAIN;
Event Timeline
Paladox
created this paste.
Nov 2 2018, 01:59
2018-11-02 01:59:50 (UTC+0)
Paladox
edited the content of this paste.
(Show Details)
Nov 2 2018, 02:03
2018-11-02 02:03:43 (UTC+0)
Log In to Comment