* (bug 32384) Allow descending order for list=watchlistraw.
* (bug 31883) Limit of bkusers of list=blocks and titles of action=query is not documented in API help.
* (bug 32492) API now allows editing using pageid
+* (bug 32497) API now allows changing of protection level using pageid
=== Languages updated in 1.20 ===
*
* @param $user User: the user to check, or null to use the context user
* @throws ErrorPageError
+ * @return bool True on success
*/
protected function checkCanExecute( User $user ) {
$right = $this->getRestriction();
if ( $this->requiresWrite() && wfReadOnly() ) {
throw new ReadOnlyError();
}
+ return true;
}
/**
*/
class DumpPipeOutput extends DumpFileOutput {
protected $command, $filename;
- private $procOpenResource = false;
+ protected $procOpenResource = false;
function __construct( $command, $file = null ) {
if ( !is_null( $file ) ) {
* Returns a valid placeholder object if the file does not exist.
*
* @param $title Title|String
- * @return File|null A File, or null if passed an invalid Title
+ * @return LocalFile|null A File, or null if passed an invalid Title
*/
function wfLocalFile( $title ) {
return RepoGroup::singleton()->getLocalRepo()->newFile( $title );
* @param $callback Callback: function to call on each match
* @param $subject String
* @param $flags String: regular expression flags
+ * @throws MWException
* @return string
*/
static function delimiterReplaceCallback( $startDelim, $endDelim, $callback, $subject, $flags = '' ) {
* StringUtils::delimiterReplaceCallback()
*/
class Replacer {
+
+ /**
+ * @return array
+ */
function cb() {
return array( &$this, 'replace' );
}
*/
class RegexlikeReplacer extends Replacer {
var $r;
+
+ /**
+ * @param $r string
+ */
function __construct( $r ) {
$this->r = $r;
}
+ /**
+ * @param $matches array
+ * @return string
+ */
function replace( $matches ) {
$pairs = array();
foreach ( $matches as $i => $match ) {
* Class to perform secondary replacement within each replacement string
*/
class DoubleReplacer extends Replacer {
+
+ /**
+ * @param $from
+ * @param $to
+ * @param $index int
+ */
function __construct( $from, $to, $index = 0 ) {
$this->from = $from;
$this->to = $to;
$this->index = $index;
}
+ /**
+ * @param $matches array
+ * @return mixed
+ */
function replace( $matches ) {
return str_replace( $this->from, $this->to, $matches[$this->index] );
}
class HashtableReplacer extends Replacer {
var $table, $index;
+ /**
+ * @param $table
+ * @param $index int
+ */
function __construct( $table, $index = 0 ) {
$this->table = $table;
$this->index = $index;
}
+ /**
+ * @param $matches array
+ * @return mixed
+ */
function replace( $matches ) {
return $this->table[$matches[$this->index]];
}
/**
* Create an object with the specified replacement array
* The array should have the same form as the replacement array for strtr()
+ * @param array $data
*/
function __construct( $data = array() ) {
$this->data = $data;
}
+ /**
+ * @return array
+ */
function __sleep() {
return array( 'data' );
}
$this->fss = false;
}
+ /**
+ * @return array|bool
+ */
function getArray() {
return $this->data;
}
/**
* Set an element of the replacement array
+ * @param $from string
+ * @param $to stromg
*/
function setPair( $from, $to ) {
$this->data[$from] = $to;
$this->fss = false;
}
+ /**
+ * @param $data array
+ */
function mergeArray( $data ) {
$this->data = array_merge( $this->data, $data );
$this->fss = false;
}
+ /**
+ * @param $other
+ */
function merge( $other ) {
$this->data = array_merge( $this->data, $other->data );
$this->fss = false;
}
+ /**
+ * @param $from string
+ */
function removePair( $from ) {
unset($this->data[$from]);
$this->fss = false;
}
+ /**
+ * @param $data array
+ */
function removeArray( $data ) {
- foreach( $data as $from => $to )
+ foreach( $data as $from => $to ) {
$this->removePair( $from );
+ }
$this->fss = false;
}
+ /**
+ * @param $subject string
+ * @return string
+ */
function replace( $subject ) {
if ( function_exists( 'fss_prep_replace' ) ) {
wfProfileIn( __METHOD__.'-fss' );
// The current token
var $current;
- /**
+ /**
* Construct a DelimIterator
+ * @param $delim string
+ * @param $s string
*/
function __construct( $delim, $s ) {
$this->subject = $s;
$this->refreshCurrent();
}
-
function refreshCurrent() {
if ( $this->curPos === false ) {
$this->current = false;
return $this->curPos;
}
+ /**
+ * @return string
+ */
function next() {
if ( $this->endPos === false ) {
$this->curPos = false;
return $this->current;
}
+ /**
+ * @return bool
+ */
function valid() {
return $this->curPos !== false;
}
}
-
}
public function setSessionData( $key, $data ) {
- return $this->base->setSessionData( $key, $data );
+ $this->base->setSessionData( $key, $data );
}
public function getAcceptLang() {
-<?php
+<?php
/**
*
*
global $wgMaxArticleSize;
return array_merge( parent::getPossibleErrors(),
- $this->getRequireOnlyOneParameterErrorMessages( 'title', 'pageid' ),
+ $this->getRequireOnlyOneParameterErrorMessages( array( 'title', 'pageid' ) ),
array(
array( 'nosuchpageid', 'pageid' ),
array( 'missingtext' ),
$p = $this->getModulePrefix();
return array(
'title' => "Title of the page you want to edit. Cannot be used together with {$p}pageid",
- 'pageid' => "Page ID of the page you want to edit. Cannot be used together with {$p}title,
+ 'pageid' => "Page ID of the page you want to edit. Cannot be used together with {$p}title",
'section' => 'Section number. 0 for the top section, \'new\' for a new section',
'sectiontitle' => 'The title for a new section',
'text' => 'Page content',
global $wgRestrictionLevels;
$params = $this->extractRequestParams();
- $titleObj = Title::newFromText( $params['title'] );
- if ( !$titleObj ) {
- $this->dieUsageMsg( array( 'invalidtitle', $params['title'] ) );
+ $this->requireOnlyOneParameter( $params, 'title', 'pageid' );
+
+ if ( isset( $params['title'] ) ) {
+ $titleObj = Title::newFromText( $params['title'] );
+ if ( !$titleObj ) {
+ $this->dieUsageMsg( array( 'invalidtitle', $params['title'] ) );
+ }
+ } elseif ( isset( $params['pageid'] ) ) {
+ $titleObj = Title::newFromID( $params['pageid'] );
+ if ( !$titleObj ) {
+ $this->dieUsageMsg( array( 'nosuchpageid', $params['pageid'] ) );
+ }
}
$errors = $titleObj->getUserPermissionsErrors( 'protect', $this->getUser() );
return array(
'title' => array(
ApiBase::PARAM_TYPE => 'string',
- ApiBase::PARAM_REQUIRED => true
+ ),
+ 'pageid' => array(
+ ApiBase::PARAM_TYPE => 'integer',
),
'token' => null,
'protections' => array(
}
public function getParamDescription() {
+ $p = $this->getModulePrefix();
return array(
- 'title' => 'Title of the page you want to (un)protect',
+ 'title' => "Title of the page you want to (un)protect. Cannot be used together with {$p}pageid",
+ 'pageid' => "ID of the page you want to (un)protect. Cannot be used together with {$p}title",
'token' => 'A protect token previously retrieved through prop=info',
'protections' => 'Pipe-separated list of protection levels, formatted action=group (e.g. edit=sysop)',
'expiry' => array( 'Expiry timestamps. If only one timestamp is set, it\'ll be used for all protections.',
}
public function getPossibleErrors() {
- return array_merge( parent::getPossibleErrors(), array(
- array( 'invalidtitle', 'title' ),
- array( 'toofewexpiries', 'noofexpiries', 'noofprotections' ),
- array( 'create-titleexists' ),
- array( 'missingtitle-createonly' ),
- array( 'protect-invalidaction', 'action' ),
- array( 'protect-invalidlevel', 'level' ),
- array( 'invalidexpiry', 'expiry' ),
- array( 'pastexpiry', 'expiry' ),
- ) );
+ return array_merge( parent::getPossibleErrors(),
+ $this->getRequireOnlyOneParameterErrorMessages( array( 'title', 'pageid' ) ),
+ array(
+ array( 'invalidtitle', 'title' ),
+ array( 'nosuchpageid', 'pageid' ),
+ array( 'toofewexpiries', 'noofexpiries', 'noofprotections' ),
+ array( 'create-titleexists' ),
+ array( 'missingtitle-createonly' ),
+ array( 'protect-invalidaction', 'action' ),
+ array( 'protect-invalidlevel', 'level' ),
+ array( 'invalidexpiry', 'expiry' ),
+ array( 'pastexpiry', 'expiry' ),
+ )
+ );
}
public function needsToken() {
/**#@-*/
+ /**
+ * @var LocalRepo
+ */
+ var $repo;
+
protected $repoClass = 'LocalRepo';
/**
'fa_deleted_user' => $encUserId,
'fa_deleted_timestamp' => $encTimestamp,
'fa_deleted_reason' => $encReason,
- 'fa_deleted' => $this->suppress ? $bitfield : 'oi_deleted',
+ 'fa_deleted' => $this->suppress ? $bitfield : 'oi_deleted',
'fa_name' => 'oi_name',
'fa_archive_name' => 'oi_archive_name',
'fa_user' => 'oi_user',
'fa_user_text' => 'oi_user_text',
'fa_timestamp' => 'oi_timestamp',
- 'fa_deleted' => $bitfield
), $where, __METHOD__ );
}
}
/**
* Helper function to convert charset for iptc values.
- * @param $data Mixed String or Array: The iptc string
+ * @param $data string|array The iptc string
* @param $charset String: The charset
*
- * @return string
+ * @return string|array
*/
private static function convIPTC ( $data, $charset ) {
if ( is_array( $data ) ) {
global $wgVersion;
wfProfileIn( __METHOD__ );
- if( $gitVersion = self::getVersionLinkedGit() ) {
+ $gitVersion = self::getVersionLinkedGit();
+ if( $gitVersion ) {
$v = $gitVersion;
- } elseif( $svnVersion = self::getVersionLinkedSvn() ) {
- $v = $svnVersion;
} else {
- $v = $wgVersion; // fallback
+ $svnVersion = self::getVersionLinkedSvn();
+ if( $svnVersion ) {
+ $v = $svnVersion;
+ } else {
+ $v = $wgVersion; // fallback
+ }
}
wfProfileOut( __METHOD__ );
}
/**
- * @return string wgVersion + a link to subversion revision of svn BASE
+ * @return string wgVersion + a link to subversion revision of svn BASE
*/
private static function getVersionLinkedSvn() {
global $wgVersion, $IP;
*/
function getVariantname( $code, $usemsg = true ) {
$msg = "variantname-$code";
- list( $rootCode ) = explode( '-', $code );
if ( $usemsg && wfMessage( $msg )->exists() ) {
return $this->getMessageFromDB( $msg );
}
# # Punctuation
'/#|No\./' => '№',
# # Şç
- '/ŞÇʹ/u' => 'ЩЬ', '/Şçʹ/u' => 'Щь', '/Şçʹ/u' => 'Щь',
+ '/ŞÇʹ/u' => 'ЩЬ', '/Şçʹ/u' => 'Щь',
'/Ş[Çç]/u' => 'Щ', '/şç/u' => 'щ',
# # soft and hard signs
'/([' . KK_L_UC . '])ʺ([' . KK_L_UC . '])/u' => '$1Ъ$2',
'h' => 'ه', 'j' => 'ژ', 'k' => 'ک', 'l' => 'ل',
'm' => 'م', 'n' => 'ن', 'p' => 'پ', 'q' => 'ق', 'r' => 'ر', 's' => 'س', 'ş' => 'ش',
't' => 'ت', 'v' => 'ڤ',
- 'x' => 'خ', 'y' => 'ی', 'z' => 'ز',
-
+ 'x' => 'خ', 'y' => 'ی', 'z' => 'ز',
'B' => 'ب', 'C' => 'ج', 'Ç' => 'چ', 'D' => 'د', 'F' => 'ف', 'G' => 'گ', 'H' => 'ھ',
'H' => 'ہ', 'H' => 'ه', 'H' => 'ح', 'J' => 'ژ', 'K' => 'ك', 'K' => 'ک', 'L' => 'ل',
'ns-specialprotected' => 'Special pages cannot be edited.',
'titleprotected' => 'This title has been protected from creation by [[User:$1|$1]].
The reason given is "\'\'$2\'\'".',
-'filereadonlyerror' => 'Unable to modify the file "$1" because the file repository "$2" is in read-only mode.
-
-The reason given is "\'\'$3\'\'".',
# Virus scanner
'virus-badscanner' => "Bad configuration: Unknown virus scanner: ''$1''",
'$1_تالقىلاۋى' => NS_PROJECT_TALK,
'سۋرەت' => NS_FILE,
'سۋرەت_تالقىلاۋى' => NS_FILE_TALK,
- 'مەدياۋيكي' => NS_MEDIAWIKI,
- 'مەدياۋيكي_تالقىلاۋى' => NS_MEDIAWIKI_TALK,
- 'ٷلگٸ' => NS_TEMPLATE,
- 'ٷلگٸ_تالقىلاۋى' => NS_TEMPLATE_TALK,
'انىقتاما' => NS_HELP,
'انىقتاما_تالقىلاۋى' => NS_HELP_TALK,
'سانات' => NS_CATEGORY,
'$1_تالقىلاۋى' => NS_PROJECT_TALK,
'سۋرەت' => NS_FILE,
'سۋرەت_تالقىلاۋى' => NS_FILE_TALK,
- 'مەدياۋيكي' => NS_MEDIAWIKI,
- 'مەدياۋيكي_تالقىلاۋى' => NS_MEDIAWIKI_TALK,
- 'ٷلگٸ' => NS_TEMPLATE,
- 'ٷلگٸ_تالقىلاۋى' => NS_TEMPLATE_TALK,
'انىقتاما' => NS_HELP,
'انىقتاما_تالقىلاۋى' => NS_HELP_TALK,
'سانات' => NS_CATEGORY,
'Cows_Restren' => NS_FILE_TALK,
'Keskows_Restren' => NS_FILE_TALK,
'Cows_MediaWiki' => NS_MEDIAWIKI_TALK,
- 'Cows_MediaWiki' => NS_MEDIAWIKI_TALK,
'Keskows_MediaWiki' => NS_MEDIAWIKI_TALK,
'Cows_Scantlyn' => NS_TEMPLATE_TALK,
'Skantlyn' => NS_TEMPLATE,
'Diskussión_de_Xabblón' => NS_MEDIAWIKI_TALK,
'Xabblón' => NS_TEMPLATE,
'Diskusyón_de_Xabblón' => NS_TEMPLATE_TALK,
- 'Plantilla_Discusión' => NS_TEMPLATE_TALK,
'Diskussión_de_Ayudo' => NS_HELP_TALK,
'Kateggoría' => NS_CATEGORY,
'Diskussión_de_Kateggoría' => NS_CATEGORY_TALK,
'$1_Discussão' => NS_PROJECT_TALK,
'Ficheiro' => NS_FILE,
'Ficheiro_Discussão' => NS_FILE_TALK,
- 'Imagem_Discussão' => NS_FILE,
+ 'Imagem' => NS_FILE,
'Imagem_Discussão' => NS_FILE_TALK,
'MediaWiki_Discussão' => NS_MEDIAWIKI_TALK,
'Predefinição' => NS_TEMPLATE,
'Categorie' => NS_CATEGORY,
'Overleg_categorie' => NS_CATEGORY_TALK,
'Kattegerie' => NS_CATEGORY,
- 'Overleg_categorie' => NS_CATEGORY_TALK,
'Overleg_kattegerie' => NS_HELP_TALK,
);
'బొమ్మపై_చర్చ' => NS_FILE_TALK,
'ఫైలు' => NS_FILE,
'ఫైలుపై_చర్చ' => NS_FILE_TALK,
- 'బొమ్మపై_చర్చ' => NS_FILE_TALK,
'సహాయము' => NS_HELP,
'సహాయము_చర్చ' => NS_HELP_TALK,
);
* @ingroup Dump Maintenance
*/
class DumpDBZip2Output extends DumpPipeOutput {
- function DumpDBZip2Output( $file ) {
+ function __construct( $file ) {
parent::__construct( "dbzip2", $file );
}
}
var $php = "php";
var $spawn = false;
+
+ /**
+ * @var bool|resource
+ */
var $spawnProc = false;
+
+ /**
+ * @var bool|resource
+ */
var $spawnWrite = false;
+
+ /**
+ * @var bool|resource
+ */
var $spawnRead = false;
+
+ /**
+ * @var bool|resource
+ */
var $spawnErr = false;
var $xmlwriterobj = false;
$extDb->freeResult( $res );
// Print errors for missing blobs rows
- foreach ( $oldIds as $blobId => $oldIds ) {
- $this->error( 'restore text', "Error: missing target $cluster/$blobId for two-part ES URL", $oldIds );
+ foreach ( $oldIds as $blobId => $oldIds2 ) {
+ $this->error( 'restore text', "Error: missing target $cluster/$blobId for two-part ES URL", $oldIds2 );
}
}
}