Legoktm has uploaded a new change for review.
https://gerrit.wikimedia.org/r/173088
Change subject: Add scripts to cleanup LocalPageMoveJob breakage
......................................................................
Add scripts to cleanup LocalPageMoveJob breakage
Probably not worth commiting to the repo, but just
wanted to publish them.
Bug: 72927
Change-Id: I7af2765148cba288333e0c5b2c320b49d7b43d97
---
A maintenance/fix72927.php
A maintenance/fix72927_jobs.php
2 files changed, 111 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CentralAuth
refs/changes/88/173088/1
diff --git a/maintenance/fix72927.php b/maintenance/fix72927.php
new file mode 100644
index 0000000..7323d8c
--- /dev/null
+++ b/maintenance/fix72927.php
@@ -0,0 +1,74 @@
+<?php
+
+$IP = getenv( 'MW_INSTALL_PATH' );
+if ( $IP === false ) {
+ $IP = __DIR__ . '/../../..';
+}
+require_once( "$IP/maintenance/Maintenance.php" );
+
+class Fix72927 extends Maintenance {
+ private $wps;
+ private $phase0 = "20141023184600";
+ private $phase1 = "20141028180500";
+ private $phase2 = "20141029185700";
+
+
+ public function execute() {
+
+ $dbr = wfGetDB( DB_SLAVE );
+ $fix = "20141102204100";
+ $rows = $dbr->select(
+ 'logging',
+ array( 'log_params', 'log_timestamp', 'log_user_text' ),
+ array(
+ 'log_type' => 'gblrename',
+ 'log_action' => 'gblrename',
+ 'log_timestamp >' . $dbr->addQuotes(
$this->phase0 ),
+ 'log_timestamp <' . $dbr->addQuotes( $fix ),
+ )
+ );
+ foreach ( $rows as $row ) {
+ $params = unserialize( $row->log_params );
+ $newname = $params['5::newname'];
+ $ca = new CentralAuthUser( $newname );
+ $attached = $ca->listAttached();
+ foreach ( $attached as $wiki ) {
+ if ( $row->timestamp > $this->getPhase( $wiki )
) {
+ $this->printJobCommand(
+ $wiki,
+ $params['4::oldname'],
+ $newname,
+ $row->log_user_text
+ );
+ }
+ }
+ }
+ }
+
+ private function printJobCommand( $wiki, $oldname, $newname, $stew ) {
+ $this->output( "mwscript fix72927_jobs.php --wiki=\"$wiki\"
--oldname=\"$oldname\" --newname=\"$newname\" --renamer=\"$stew\"\n" );
+ }
+
+ public function getPhase( $wiki ) {
+ if ( in_array( $wiki, array( 'mediawikiwiki', 'testwiki',
'test2wiki' ) ) ) {
+ return $this->phase0;
+ } elseif ( in_array( $wiki, $this->wikipedias()) ) {
+ return $this->phase2;
+ } else {
+ return $this->phase1;
+ }
+ }
+
+ private function wikipedias() {
+ global $IP;
+ if ( $this->wps === null ) {
+ $fname = "$IP/../wikipedia.dblist";
+ $this->wps = array_map( 'trim', explode( "\n",
file_get_contents( $fname ) ) );
+ }
+ return $this->wps;
+ }
+
+}
+
+$maintClass = "Fix72927";
+require_once( RUN_MAINTENANCE_IF_MAIN );
diff --git a/maintenance/fix72927_jobs.php b/maintenance/fix72927_jobs.php
new file mode 100644
index 0000000..206e292
--- /dev/null
+++ b/maintenance/fix72927_jobs.php
@@ -0,0 +1,37 @@
+<?php
+
+$IP = getenv( 'MW_INSTALL_PATH' );
+if ( $IP === false ) {
+ $IP = __DIR__ . '/../../..';
+}
+require_once( "$IP/maintenance/Maintenance.php" );
+
+class Fix72927_Jobs extends Maintenance {
+
+ public function __construct() {
+ parent::__construct();
+ $this->addOption( 'oldname', 'Old name', true, true );
+ $this->addOption( 'newname', 'New name', true, true );
+ $this->addOption( 'renamer', 'Renamer', true, true );
+
+ }
+
+ public function execute() {
+ $params = array(
+ 'from' => $this->getOption( 'oldname' ),
+ 'to' => $this->getOption( 'newname' ),
+ 'renamer' => $this->getOption( 'renamer' ),
+ 'movepages' => true,
+ 'suppressredirects' => true,
+ 'promotetoglobal' => false,
+ );
+
+ $title = Title::newFromText( 'Global rename job' ); // This
isn't used anywhere!
+ $job = new LocalRenameUserJob( $title, $params );
+ $job->movePages();
+ }
+
+}
+
+$maintClass = "Fix72927_Jobs";
+require_once( RUN_MAINTENANCE_IF_MAIN );
--
To view, visit https://gerrit.wikimedia.org/r/173088
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7af2765148cba288333e0c5b2c320b49d7b43d97
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CentralAuth
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits