summaryrefslogtreecommitdiff
path: root/maintenance/orphans.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2014-12-27 15:41:37 +0100
committerPierre Schmitz <pierre@archlinux.de>2014-12-31 11:43:28 +0100
commitc1f9b1f7b1b77776192048005dcc66dcf3df2bfb (patch)
tree2b38796e738dd74cb42ecd9bfd151803108386bc /maintenance/orphans.php
parentb88ab0086858470dd1f644e64cb4e4f62bb2be9b (diff)
Update to MediaWiki 1.24.1
Diffstat (limited to 'maintenance/orphans.php')
-rw-r--r--maintenance/orphans.php36
1 files changed, 21 insertions, 15 deletions
diff --git a/maintenance/orphans.php b/maintenance/orphans.php
index b4d255ab..7e27107a 100644
--- a/maintenance/orphans.php
+++ b/maintenance/orphans.php
@@ -6,7 +6,7 @@
* Man this is depressing.
*
* Copyright © 2005 Brion Vibber <brion@pobox.com>
- * http://www.mediawiki.org/
+ * https://www.mediawiki.org/
*
* 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
@@ -40,15 +40,13 @@ class Orphans extends Maintenance {
public function __construct() {
parent::__construct();
$this->mDescription = "Look for 'orphan' revisions hooked to pages which don't exist\n" .
- "and 'childless' pages with no revisions\n" .
- "Then, kill the poor widows and orphans\n" .
- "Man this is depressing";
+ "and 'childless' pages with no revisions\n" .
+ "Then, kill the poor widows and orphans\n" .
+ "Man this is depressing";
$this->addOption( 'fix', 'Actually fix broken entries' );
}
public function execute() {
- global $wgTitle;
- $wgTitle = Title::newFromText( 'Orphan revision cleanup script' );
$this->checkOrphans( $this->hasOption( 'fix' ) );
$this->checkSeparation( $this->hasOption( 'fix' ) );
# Does not work yet, do not use
@@ -57,8 +55,8 @@ class Orphans extends Maintenance {
/**
* Lock the appropriate tables for the script
- * @param $db DatabaseBase object
- * @param $extraTable String The name of any extra tables to lock (eg: text)
+ * @param DatabaseBase $db
+ * @param string $extraTable The name of any extra tables to lock (eg: text)
*/
private function lockTables( $db, $extraTable = array() ) {
$tbls = array( 'page', 'revision', 'redirect' );
@@ -70,7 +68,7 @@ class Orphans extends Maintenance {
/**
* Check for orphan revisions
- * @param $fix bool Whether to fix broken revisions when found
+ * @param bool $fix Whether to fix broken revisions when found
*/
private function checkOrphans( $fix ) {
$dbw = wfGetDB( DB_MASTER );
@@ -81,7 +79,8 @@ class Orphans extends Maintenance {
$this->lockTables( $dbw );
}
- $this->output( "Checking for orphan revision table entries... (this may take a while on a large wiki)\n" );
+ $this->output( "Checking for orphan revision table entries... "
+ . "(this may take a while on a large wiki)\n" );
$result = $dbw->query( "
SELECT *
FROM $revision LEFT OUTER JOIN $page ON rev_page=page_id
@@ -90,8 +89,13 @@ class Orphans extends Maintenance {
$orphans = $result->numRows();
if ( $orphans > 0 ) {
global $wgContLang;
+
$this->output( "$orphans orphan revisions...\n" );
- $this->output( sprintf( "%10s %10s %14s %20s %s\n", 'rev_id', 'rev_page', 'rev_timestamp', 'rev_user_text', 'rev_comment' ) );
+ $this->output( sprintf(
+ "%10s %10s %14s %20s %s\n",
+ 'rev_id', 'rev_page', 'rev_timestamp', 'rev_user_text', 'rev_comment'
+ ) );
+
foreach ( $result as $row ) {
$comment = ( $row->rev_comment == '' )
? ''
@@ -119,7 +123,7 @@ class Orphans extends Maintenance {
}
/**
- * @param $fix bool
+ * @param bool $fix
* @todo DON'T USE THIS YET! It will remove entries which have children,
* but which aren't properly attached (eg if page_latest is bogus
* but valid revisions do exist)
@@ -133,7 +137,8 @@ class Orphans extends Maintenance {
$this->lockTables( $dbw );
}
- $this->output( "\nChecking for childless page table entries... (this may take a while on a large wiki)\n" );
+ $this->output( "\nChecking for childless page table entries... "
+ . "(this may take a while on a large wiki)\n" );
$result = $dbw->query( "
SELECT *
FROM $page LEFT OUTER JOIN $revision ON page_latest=rev_id
@@ -167,7 +172,7 @@ class Orphans extends Maintenance {
/**
* Check for pages where page_latest is wrong
- * @param $fix bool Whether to fix broken entries
+ * @param bool $fix Whether to fix broken entries
*/
private function checkSeparation( $fix ) {
$dbw = wfGetDB( DB_MASTER );
@@ -178,7 +183,8 @@ class Orphans extends Maintenance {
$this->lockTables( $dbw, array( 'user', 'text' ) );
}
- $this->output( "\nChecking for pages whose page_latest links are incorrect... (this may take a while on a large wiki)\n" );
+ $this->output( "\nChecking for pages whose page_latest links are incorrect... "
+ . "(this may take a while on a large wiki)\n" );
$result = $dbw->query( "
SELECT *
FROM $page LEFT OUTER JOIN $revision ON page_latest=rev_id