private function insertData( $dbw ) {
$range = range( 0, 1024 );
$data = array();
- foreach( $range as $r ) {
+ foreach ( $range as $r ) {
$data[] = array( 'text' => $r );
}
$dbw->insert( 'test', $data, __METHOD__ );
array( 'function' => array( $this, 'benchstr_replace' ) ),
array( 'function' => array( $this, 'benchstrtr_indirect' ) ),
array( 'function' => array( $this, 'benchstr_replace_indirect' ) ),
- ));
+ ) );
print $this->getFormattedResults();
}
}
function benchstr_replace() {
- str_replace( "_", " ", "[[MediaWiki:Some_random_test_page]]");
+ str_replace( "_", " ", "[[MediaWiki:Some_random_test_page]]" );
}
function benchstrtr_indirect() {
);
// @codingStandardsIgnoreEnd
- $this->canRun = function_exists ( 'mb_check_encoding' );
+ $this->canRun = function_exists( 'mb_check_encoding' );
if ( $this->canRun ) {
$this->mDescription = "Benchmark for using a regexp vs. mb_check_encoding " .
return;
}
$benchmarks = array();
- foreach ($this->data as $val) {
+ foreach ( $this->data as $val ) {
$benchmarks[] = array(
'function' => array( $this, 'use_regexp' ),
- 'args' => array( rawurldecode ( $val ) )
+ 'args' => array( rawurldecode( $val ) )
);
$benchmarks[] = array(
'function' => array( $this, 'use_regexp_non_capturing' ),
- 'args' => array( rawurldecode ( $val ) )
+ 'args' => array( rawurldecode( $val ) )
);
$benchmarks[] = array(
'function' => array( $this, 'use_regexp_once_only' ),
- 'args' => array( rawurldecode ( $val ) )
+ 'args' => array( rawurldecode( $val ) )
);
$benchmarks[] = array(
'function' => array( $this, 'use_mb_check_encoding' ),
- 'args' => array( rawurldecode ( $val ) )
+ 'args' => array( rawurldecode( $val ) )
);
}
$this->bench( $benchmarks );
function use_regexp( $s ) {
$this->isutf8 = preg_match( '/^([\x00-\x7f]|[\xc0-\xdf][\x80-\xbf]|' .
- '[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xf7][\x80-\xbf]{3})+$/', $s );
+ '[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xf7][\x80-\xbf]{3})+$/', $s );
}
function use_regexp_non_capturing( $s ) {
// Same as above with a non-capturing subgroup.
$this->isutf8 = preg_match( '/^(?:[\x00-\x7f]|[\xc0-\xdf][\x80-\xbf]|' .
- '[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xf7][\x80-\xbf]{3})+$/', $s );
+ '[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xf7][\x80-\xbf]{3})+$/', $s );
}
function use_regexp_once_only( $s ) {
// Same as above with a once-only subgroup.
$this->isutf8 = preg_match( '/^(?>[\x00-\x7f]|[\xc0-\xdf][\x80-\xbf]|' .
- '[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xf7][\x80-\xbf]{3})+$/', $s );
+ '[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xf7][\x80-\xbf]{3})+$/', $s );
}
function use_mb_check_encoding( $s ) {
'function' => 'wfBaseConvert',
'args' => array( $number, $inbase, $outbase, 0, true, 'gmp' )
),
- ));
+ ) );
$this->output( $this->getFormattedResults() );
}
protected static function makeRandomNumber( $base, $length ) {
$baseChars = "0123456789abcdefghijklmnopqrstuvwxyz";
$res = "";
- for( $i = 0; $i < $length; $i++ ) {
- $res .= $baseChars[mt_rand(0, $base - 1)];
+ for ( $i = 0; $i < $length; $i++ ) {
+ $res .= $baseChars[mt_rand( 0, $base - 1 )];
}
+
return $res;
}
}
$this->bench( array(
array( 'function' => array( $this, 'wfIsWindows' ) ),
array( 'function' => array( $this, 'wfIsWindowsCached' ) ),
- ));
+ ) );
print $this->getFormattedResults();
}
// bench function 2
function wfIsWindowsCached() {
static $isWindows = null;
- if( $isWindows == null ) {
+ if ( $isWindows == null ) {
$isWindows = self::is_win();
}
+
return $isWindows;
}
}
$time = $this->benchHooks();
$this->output( 'Loaded (one) hook: ' . $time . "\n" );
- for( $i = 0; $i < 9; $i++ ) {
+ for ( $i = 0; $i < 9; $i++ ) {
$wgHooks['Test'][] = array( $this, 'test' );
}
$time = $this->benchHooks();
$this->output( 'Loaded (ten) hook: ' . $time . "\n" );
- for( $i = 0; $i < 90; $i++ ) {
+ for ( $i = 0; $i < 90; $i++ ) {
$wgHooks['Test'][] = array( $this, 'test' );
}
$time = $this->benchHooks();
}
$delta = microtime( true ) - $start;
$pertrial = $delta / $trials;
+
return sprintf( "Took %6.3fms",
$pertrial * 1000 );
}
false, true );
$this->addOption( 'tpl-time',
'Use templates which were current at the given time (except that moves and ' .
- 'deletes are not handled properly)',
+ 'deletes are not handled properly)',
false, true );
}
printf( "CPU time = %.3f s, wall clock time = %.3f s\n",
// CPU time
$endUsage['ru_utime.tv_sec'] + $endUsage['ru_utime.tv_usec'] * 1e-6
- - $startUsage['ru_utime.tv_sec'] - $startUsage['ru_utime.tv_usec'] * 1e-6,
+ - $startUsage['ru_utime.tv_sec'] - $startUsage['ru_utime.tv_usec'] * 1e-6,
// Wall clock time
$endTime - $startTime );
}
$delta = microtime( true ) - $start;
$pertrial = $delta / $trials;
$pertitle = $pertrial / count( $urls );
+
return sprintf( "%4d titles in %6.2fms (%6.2fms each)",
count( $urls ), $pertrial * 1000.0, $pertitle * 1000.0 );
}
for ( $i = 0; $i < $length; $i++ ) {
$list[] = $this->randomUrl();
}
+
return $list;
}
*/
private function randomUrl() {
global $wgServer, $wgArticlePath;
+
return $wgServer . str_replace( '$1', $this->randomTitle(), $wgArticlePath );
}
for ( $i = 0; $i < $length; $i++ ) {
$str .= chr( mt_rand( ord( 'a' ), ord( 'z' ) ) );
}
+
return ucfirst( $str );
}
}
$count = $result->numRows();
$this->output( "Found $count redirects.\n" .
- "Checking for bad redirects:\n\n" );
+ "Checking for bad redirects:\n\n" );
foreach ( $result as $row ) {
$title = Title::makeTitle( $row->page_namespace, $row->page_title );
$numGood++;
}
-
} while ( $res->numRows() );
$this->output( "Good images: $numGood/$numImages\n" );
$this->mIgnorePaths = array(
// Compat stuff, explodes on PHP 5.3
"includes/NamespaceCompat.php$",
- );
+ );
$this->mNoStyleCheckPaths = array(
// Third-party code we don't care about
"QPoll/Excel/",
"/geshi/",
"/smarty/",
- );
+ );
if ( $this->hasOption( 'path' ) ) {
$path = $this->getOption( 'path' );
if ( !$this->addPath( $path ) ) {
$this->error( "Error: can't find file or directory $path\n", true );
}
+
return; // process only this path
} elseif ( $this->hasOption( 'list-file' ) ) {
$file = $this->getOption( 'list-file' );
$this->addPath( $path );
}
fclose( $f );
+
return;
} elseif ( $this->hasOption( 'modified' ) ) {
$this->output( "Retrieving list from Git... " );
$this->mFiles[] = $file;
}
}
+
return;
}
return false;
}
}
+
return true;
}
*/
private function addPath( $path ) {
global $IP;
+
return $this->addFileOrDir( $path ) || $this->addFileOrDir( "$IP/$path" );
}
} else {
return false;
}
+
return true;
}
$this->mFailures[$file] = $errors;
}
}
+
return $ret;
}
if ( strpos( $res, 'No syntax errors detected' ) === false ) {
$this->mFailures[$file] = $res;
$this->output( $res . "\n" );
+
return false;
}
+
return true;
}
);
foreach ( $res as $row ) {
- if ( ! User::isValidUserName( $row->user_name ) ) {
+ if ( !User::isValidUserName( $row->user_name ) ) {
$this->error( sprintf( "%s: %6d: '%s'\n", wfWikiID(), $row->user_id, $row->user_name ) );
wfDebugLog( 'checkUsernames', $row->user_name );
}
if ( $db->indexExists( 'text', $index, __METHOD__ ) ) {
$this->output( "Dropping index $index from the text table..." );
$db->query( "DROP INDEX " . $db->addIdentifierQuotes( $index )
- . " ON " . $db->tableName( 'text' ) );
+ . " ON " . $db->tableName( 'text' ) );
$this->output( "done.\n" );
}
}
if ( $db->fieldExists( 'text', $field, __METHOD__ ) ) {
$this->output( "Dropping the $field field from the text table..." );
$db->query( "ALTER TABLE " . $db->tableName( 'text' )
- . " DROP COLUMN " . $db->addIdentifierQuotes( $field ) );
+ . " DROP COLUMN " . $db->addIdentifierQuotes( $field ) );
$this->output( "done.\n" );
}
}
$lower = $wgContLang->lcfirst( $row->page_title );
if ( $upper == $lower ) {
$this->output( "\"$display\" already lowercase.\n" );
+
return $this->progress( 0 );
}
$targetDisplay = $target->getPrefixedText();
if ( $target->exists() ) {
$this->output( "\"$display\" skipped; \"$targetDisplay\" already exists\n" );
+
return $this->progress( 0 );
}
}
}
}
+
return $this->progress( 0 );
}
}
if ( $source == '' ) {
// Ye olde empty rows. Just kill them.
$this->killRow( $source );
+
return $this->progress( 1 );
}
return $this->progress( 0 );
}
$this->pokeFile( $source, $safe );
+
return $this->progress( 1 );
}
$munged = $title->getDBkey();
$this->output( "page $source ($munged) doesn't match self.\n" );
$this->pokeFile( $source, $munged );
+
return $this->progress( 1 );
}
if ( !isset( $this->repo ) ) {
$this->repo = RepoGroup::singleton()->getLocalRepo();
}
+
return $this->repo->getRootDirectory() . '/' . $this->repo->getHashPath( $name ) . $name;
}
if ( !file_exists( $path ) ) {
$this->output( "missing file: $path\n" );
$this->killRow( $orig );
+
return;
}
$version = 0;
$final = $new;
$conflict = ( $this->imageExists( $final, $db ) ||
- ( $this->pageExists( $orig, $db ) && $this->pageExists( $final, $db ) ) );
+ ( $this->pageExists( $orig, $db ) && $this->pageExists( $final, $db ) ) );
while ( $conflict ) {
$this->output( "Rename conflicts with '$final'...\n" );
if ( !wfMkdirParents( $dir, null, __METHOD__ ) ) {
$this->output( "RENAME FAILED, COULD NOT CREATE $dir" );
$db->rollback( __METHOD__ );
+
return;
}
}
$test = Title::makeTitleSafe( NS_FILE, $x );
if ( is_null( $test ) || $test->getDBkey() !== $x ) {
$this->error( "Unable to generate safe title from '$name', got '$x'" );
+
return false;
}
$title = Title::newFromID( $id );
if ( !$title ) {
$this->error( "Internal error: no page for ID $id" );
+
return;
}
$currentRevId = $rev->getId();
while ( $rev && ( $rev->isDeleted( Revision::DELETED_TEXT )
- || LinkFilter::matchEntry( $rev->getContent( Revision::RAW ), $domain ) ) ) {
+ || LinkFilter::matchEntry( $rev->getContent( Revision::RAW ), $domain ) )
+ ) {
$rev = $rev->getPrevious();
}
. "({$row->wl_namespace}, \"{$row->wl_title}\")\n" );
$updated = $this->removeWatch( $row );
$this->progress( $updated );
+
return;
}
$this->progress( 0 );
private function removeWatch( $row ) {
if ( !$this->dryrun && $this->hasOption( 'fix' ) ) {
$dbw = wfGetDB( DB_MASTER );
- $dbw->delete( 'watchlist', array(
+ $dbw->delete(
+ 'watchlist', array(
'wl_user' => $row->wl_user,
'wl_namespace' => $row->wl_namespace,
'wl_title' => $row->wl_title ),
- __METHOD__ );
+ __METHOD__
+ );
+
$this->output( "- removed\n" );
+
return 1;
} else {
return 0;
if ( !$this->stripParametersEnabled ) {
return $text;
}
+
return preg_replace( '/(<a) [^>]+>/', '$1>', $text );
}
/* Look for the parser in a file appropiately named in the current folder */
if ( !class_exists( $parserName ) && file_exists( "$parserName.php" ) ) {
global $wgAutoloadClasses;
- $wgAutoloadClasses[ $parserName ] = realpath( '.' ) . "/$parserName.php";
+ $wgAutoloadClasses[$parserName] = realpath( '.' ) . "/$parserName.php";
}
}
-
}
$maintClass = "CompareParsers";
$type = $dbw->getType();
if ( $type != 'mysql' ) {
$this->output( "Link table conversion not necessary for $type\n" );
+
return;
}
if ( $dbw->tableExists( 'pagelinks' ) ) {
$this->output( "...have pagelinks; skipping old links table updates\n" );
+
return;
}
$res = $dbw->query( "SELECT l_from FROM $links LIMIT 1" );
if ( $dbw->fieldType( $res, 0 ) == "int" ) {
$this->output( "Schema already converted\n" );
+
return;
}
} else {
$fh = false;
if ( $this->logPerformance ) {
- $fh = fopen ( $perfLogFilename, "w" );
+ $fh = fopen( $perfLogFilename, "w" );
if ( !$fh ) {
$this->error( "Couldn't open $perfLogFilename" );
$this->logPerformance = false;
$baseTime = $startTime = $this->getMicroTime();
# Create a title -> cur_id map
$this->output( "Loading IDs from $cur table...\n" );
- $this->performanceLog ( $fh, "Reading $numRows rows from cur table...\n" );
- $this->performanceLog ( $fh, "rows read vs seconds elapsed:\n" );
+ $this->performanceLog( $fh, "Reading $numRows rows from cur table...\n" );
+ $this->performanceLog( $fh, "rows read vs seconds elapsed:\n" );
$dbw->bufferResults( false );
$res = $dbw->query( "SELECT cur_namespace,cur_title,cur_id FROM $cur" );
"Total execution time: " . ( $this->getMicroTime() - $startTime ) . " seconds.\n"
);
if ( $this->logPerformance ) {
- fclose ( $fh );
+ fclose( $fh );
}
}
# --------------------------------------------------------------------
if ( !( $dbConn->isOpen() ) ) {
$this->output( "Opening connection to database failed.\n" );
+
return;
}
$links_temp = $dbConn->tableName( 'links_temp' );
$this->output( "Creating temporary links table..." );
if ( $this->hasOption( 'noKeys' ) ) {
$dbConn->query( "CREATE TABLE $links_temp ( " .
- "l_from int(8) unsigned NOT NULL default '0', " .
- "l_to int(8) unsigned NOT NULL default '0')" );
+ "l_from int(8) unsigned NOT NULL default '0', " .
+ "l_to int(8) unsigned NOT NULL default '0')" );
} else {
$dbConn->query( "CREATE TABLE $links_temp ( " .
- "l_from int(8) unsigned NOT NULL default '0', " .
- "l_to int(8) unsigned NOT NULL default '0', " .
- "UNIQUE KEY l_from(l_from,l_to), " .
- "KEY (l_to))" );
+ "l_from int(8) unsigned NOT NULL default '0', " .
+ "l_to int(8) unsigned NOT NULL default '0', " .
+ "UNIQUE KEY l_from(l_from,l_to), " .
+ "KEY (l_to))" );
}
$this->output( " done.\n\n" );
}
private function getMicroTime() { # return time in seconds, with microsecond accuracy
list( $usec, $sec ) = explode( " ", microtime() );
+
return ( (float)$usec + (float)$sec );
}
}
if ( !$dbw->fieldExists( 'user', 'user_options', __METHOD__ ) ) {
$this->output( "nothing to migrate. " );
+
return;
}
while ( $id !== null ) {
$same = ( $src->getFileSha1Base36( array( 'src' => $sPath, 'latest' => 1 ) )
=== $dst->getFileSha1Base36( array( 'src' => $dPath, 'latest' => 1 ) ) );
}
+
return $same;
}
}
$totalOK += count( $batch );
$dst->waitForBackups();
}
+
return array( $total, $totalOK );
}
}
if ( $exists && !$password && count( $promotions ) === 0 ) {
$this->output( "Account exists and nothing to do.\n" );
+
return;
} elseif ( count( $promotions ) !== 0 ) {
$promoText = "User:{$username} into " . implode( ', ', $promotions ) . "...\n";
$sha1 = LocalRepo::getHashFromKey( $key );
}
// Check if the file is used anywhere...
- $inuse = $dbw->selectField( 'oldimage', '1',
- array( 'oi_sha1' => $sha1,
- 'oi_deleted & ' . File::DELETED_FILE => File::DELETED_FILE ),
+ $inuse = $dbw->selectField(
+ 'oldimage',
+ '1',
+ array(
+ 'oi_sha1' => $sha1,
+ 'oi_deleted & ' . File::DELETED_FILE => File::DELETED_FILE
+ ),
__METHOD__,
array( 'FOR UPDATE' )
);
public function execute() {
if ( !$this->hasOption( 'delete' ) ) {
$this->output( "Use --delete to actually confirm this script\n" );
+
return;
}
$force = $this->hasOption( 'force' );
/**
* Perform the delete on archived revisions.
-
* @param object $maint An object (typically of class Maintenance)
* that implements two methods: handleOutput() and
* purgeRedundantText(). See Maintenance for a description of
* Deletes a batch of pages.
* Usage: php deleteBatch.php [-u <user>] [-r <reason>] [-i <interval>] [listfile]
* where
- * [listfile] is a file where each line contains the title of a page to be
- * deleted, standard input is used if listfile is not given.
- * <user> is the username
- * <reason> is the delete reason
- * <interval> is the number of seconds to sleep for after each delete
+ * [listfile] is a file where each line contains the title of a page to be
+ * deleted, standard input is used if listfile is not given.
+ * <user> is the username
+ * <reason> is the delete reason
+ * <interval> is the number of seconds to sleep for after each delete
*
* 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
public function __construct() {
parent::__construct();
$this->mDescription = "Deletes all pages in the MediaWiki namespace" .
- " which were last edited by \"MediaWiki default\"";
+ " which were last edited by \"MediaWiki default\"";
}
public function execute() {
if ( $dbr->numRows( $res ) == 0 ) {
# No more messages left
$this->output( "done.\n" );
+
return;
}
if ( $messageInfo['equalPages'] === 0 ) {
// No more equal messages left
$this->output( "\ndone.\n" );
+
return;
}
$this->output( " (include --delete-talk to also delete the talk pages)" );
}
$this->output( "\n" );
+
return;
}
private function getImageCount() {
$dbr = wfGetDB( DB_SLAVE );
+
return $dbr->selectField( 'image', 'COUNT(*)', array(), __METHOD__ );
}
}
}
$this->output( "Deleting revision(s) " . implode( ',', $this->mArgs ) .
- " from " . wfWikiID() . "...\n" );
+ " from " . wfWikiID() . "...\n" );
$dbw = wfGetDB( DB_MASTER );
$affected = 0;
foreach ( $this->mArgs as $revID ) {
$dbw->insertSelect( 'archive', array( 'page', 'revision' ),
array(
- 'ar_namespace' => 'page_namespace',
- 'ar_title' => 'page_title',
- 'ar_page_id' => 'page_id',
- 'ar_comment' => 'rev_comment',
- 'ar_user' => 'rev_user',
- 'ar_user_text' => 'rev_user_text',
- 'ar_timestamp' => 'rev_timestamp',
+ 'ar_namespace' => 'page_namespace',
+ 'ar_title' => 'page_title',
+ 'ar_page_id' => 'page_id',
+ 'ar_comment' => 'rev_comment',
+ 'ar_user' => 'rev_user',
+ 'ar_user_text' => 'rev_user_text',
+ 'ar_timestamp' => 'rev_timestamp',
'ar_minor_edit' => 'rev_minor_edit',
- 'ar_rev_id' => 'rev_id',
- 'ar_text_id' => 'rev_text_id',
- 'ar_deleted' => 'rev_deleted',
- 'ar_len' => 'rev_len',
- ), array(
+ 'ar_rev_id' => 'rev_id',
+ 'ar_text_id' => 'rev_text_id',
+ 'ar_deleted' => 'rev_deleted',
+ 'ar_len' => 'rev_len',
+ ),
+ array(
'rev_id' => $revID,
'page_id = rev_page'
- ), __METHOD__
+ ),
+ __METHOD__
);
if ( !$dbw->affectedRows() ) {
$this->output( "Revision $revID not found\n" );
# the php webserver will discard post data and things like login
# will not function in the dev environment.
require $file;
+
return true;
}
$mime = false;
header( "Content-Length: " . filesize( $file ) );
// Stream that out to the browser
fpassthru( $f );
+
return true;
}
--filter=<type>[:<options>] Add a filter on an output branch
ENDS
-);
+ );
}
$title = $rev->getTitle();
if ( !$title ) {
$this->error( "Got bogus revision with null title!" );
+
return;
}
--spawn Spawn a subprocess for loading text records
--help Display this help message
ENDS
-);
+ );
}
$this->mSharedSupplement = true;
}
}
- $this->{ $this->mAction } ( $this->mShared );
+ $this->{$this->mAction} ( $this->mShared );
if ( $this->mSharedSupplement ) {
$this->fetchUsed( true );
}
/**
* returns a string containing the following in order:
- * textid
- * \n
- * length of text (-1 on error = failure to retrieve/unserialize/gunzip/etc)
- * \n
- * text (may be empty)
+ * textid
+ * \n
+ * length of text (-1 on error = failure to retrieve/unserialize/gunzip/etc)
+ * \n
+ * text (may be empty)
*
* note that that the text string itself is *not* followed by newline
*/
if ( $text === false ) {
# actual error, not zero-length text
$textLen = "-1";
- }
- else {
+ } else {
$textLen = strlen( $text );
}
$this->output( $textId . "\n" . $textLen . "\n" . $text );
if ( $text === false ) {
return false;
}
+
return $text;
}
}
* @return array Array of documented hooks
*/
private function getHooksFromLocalDoc( $doc ) {
- $m = array();
- $content = file_get_contents( $doc );
- preg_match_all( "/\n'(.*?)':/", $content, $m );
- return array_unique( $m[1] );
+ $m = array();
+ $content = file_get_contents( $doc );
+ preg_match_all( "/\n'(.*?)':/", $content, $m );
+
+ return array_unique( $m[1] );
}
/**
* @return array of documented hooks
*/
private function getHooksFromOnlineDoc() {
- // All hooks
- $allhookdata = Http::get(
- 'http://www.mediawiki.org/w/api.php?action=query&list=categorymembers&'
- . 'cmtitle=Category:MediaWiki_hooks&cmlimit=500&format=php'
- );
- $allhookdata = unserialize( $allhookdata );
- $allhooks = array();
- foreach ( $allhookdata['query']['categorymembers'] as $page ) {
- $found = preg_match( '/Manual\:Hooks\/([a-zA-Z0-9- :]+)/', $page['title'], $matches );
- if ( $found ) {
- $hook = str_replace( ' ', '_', $matches[1] );
- $allhooks[] = $hook;
- }
+ // All hooks
+ $allhookdata = Http::get(
+ 'http://www.mediawiki.org/w/api.php?action=query&list=categorymembers&'
+ . 'cmtitle=Category:MediaWiki_hooks&cmlimit=500&format=php'
+ );
+ $allhookdata = unserialize( $allhookdata );
+ $allhooks = array();
+ foreach ( $allhookdata['query']['categorymembers'] as $page ) {
+ $found = preg_match( '/Manual\:Hooks\/([a-zA-Z0-9- :]+)/', $page['title'], $matches );
+ if ( $found ) {
+ $hook = str_replace( ' ', '_', $matches[1] );
+ $allhooks[] = $hook;
}
- // Removed hooks
- $oldhookdata = Http::get(
- 'http://www.mediawiki.org/w/api.php?action=query&list=categorymembers&'
- . 'cmtitle=Category:Removed_hooks&cmlimit=500&format=php'
- );
- $oldhookdata = unserialize( $oldhookdata );
- $removed = array();
- foreach ( $oldhookdata['query']['categorymembers'] as $page ) {
- $found = preg_match( '/Manual\:Hooks\/([a-zA-Z0-9- :]+)/', $page['title'], $matches );
- if ( $found ) {
- $hook = str_replace( ' ', '_', $matches[1] );
- $removed[] = $hook;
- }
+ }
+ // Removed hooks
+ $oldhookdata = Http::get(
+ 'http://www.mediawiki.org/w/api.php?action=query&list=categorymembers&'
+ . 'cmtitle=Category:Removed_hooks&cmlimit=500&format=php'
+ );
+ $oldhookdata = unserialize( $oldhookdata );
+ $removed = array();
+ foreach ( $oldhookdata['query']['categorymembers'] as $page ) {
+ $found = preg_match( '/Manual\:Hooks\/([a-zA-Z0-9- :]+)/', $page['title'], $matches );
+ if ( $found ) {
+ $hook = str_replace( ' ', '_', $matches[1] );
+ $removed[] = $hook;
}
- return array_diff( $allhooks, $removed );
+ }
+
+ return array_diff( $allhooks, $removed );
}
/**
}
closedir( $dh );
}
+
return $hooks;
}
foreach ( $m[0] as $match ) {
$list[] = $match . "(" . $file . ")";
}
+
return $list;
}
}
closedir( $dh );
}
+
return $hooks;
}
if ( !$res->numRows() ) {
$this->output( "No double redirects found.\n" );
+
return;
}