Merge "Fixed many small spelling mistakes and php docs, var decl."

This commit is contained in:
jenkins-bot 2013-03-11 14:17:08 +00:00 committed by Gerrit Code Review
commit 493b766fdb
25 changed files with 54 additions and 28 deletions

View file

@ -189,7 +189,7 @@ abstract class ApiBase extends ContextSource {
* @return ApiResult
*/
public function getResult() {
// Main module has getResult() method overriden
// Main module has getResult() method overridden
// Safety - avoid infinite loop:
if ( $this->isMain() ) {
ApiBase::dieDebug( __METHOD__, 'base method was called on main module. ' );
@ -582,7 +582,7 @@ abstract class ApiBase extends ContextSource {
* The array can also contain a boolean under the key PROP_LIST,
* indicating whether the result is a list.
*
* Don't call this functon directly: use getFinalResultProperties() to
* Don't call this function directly: use getFinalResultProperties() to
* allow hooks to modify descriptions as needed.
*
* @return array|bool False on no properties
@ -795,7 +795,7 @@ abstract class ApiBase extends ContextSource {
}
/**
* Callback function used in requireOnlyOneParameter to check whether reequired parameters are set
* Callback function used in requireOnlyOneParameter to check whether required parameters are set
*
* @param $x object Parameter to check is not null/false
* @return bool
@ -838,7 +838,7 @@ abstract class ApiBase extends ContextSource {
if ( $userWatching ) {
return true;
}
# If no user option was passed, use watchdefault or watchcreation
# If no user option was passed, use watchdefault or watchcreations
if ( is_null( $userOption ) ) {
$userOption = $titleObj->exists()
? 'watchdefault' : 'watchcreations';
@ -1274,7 +1274,7 @@ abstract class ApiBase extends ContextSource {
'badipaddress' => array( 'code' => 'invalidip', 'info' => "Invalid IP address specified" ),
'ipb_expiry_invalid' => array( 'code' => 'invalidexpiry', 'info' => "Invalid expiry time" ),
'ipb_already_blocked' => array( 'code' => 'alreadyblocked', 'info' => "The user you tried to block was already blocked" ),
'ipb_blocked_as_range' => array( 'code' => 'blockedasrange', 'info' => "IP address \"\$1\" was blocked as part of range \"\$2\". You can't unblock the IP invidually, but you can unblock the range as a whole." ),
'ipb_blocked_as_range' => array( 'code' => 'blockedasrange', 'info' => "IP address \"\$1\" was blocked as part of range \"\$2\". You can't unblock the IP individually, but you can unblock the range as a whole." ),
'ipb_cant_unblock' => array( 'code' => 'cantunblock', 'info' => "The block you specified was not found. It may have been unblocked already" ),
'mailnologin' => array( 'code' => 'cantsend', 'info' => "You are not logged in, you do not have a confirmed email address, or you are not allowed to send email to other users, so you cannot send email" ),
'ipbblocked' => array( 'code' => 'ipbblocked', 'info' => 'You cannot block or unblock users while you are yourself blocked' ),

View file

@ -58,6 +58,8 @@ class ApiEditPage extends ApiBase {
// array_shift( $titles );
$redirValues = array();
/** @var $newTitle Title */
foreach ( $titles as $id => $newTitle ) {
if ( !isset( $titles[$id - 1] ) ) {
@ -304,6 +306,7 @@ class ApiEditPage extends ApiBase {
$articleContext->setWikiPage( $pageObj );
$articleContext->setUser( $this->getUser() );
/** @var $articleObject Article */
$articleObject = Article::newFromWikiPage( $pageObj, $articleContext );
$ep = new EditPage( $articleObject );
@ -393,6 +396,7 @@ class ApiEditPage extends ApiBase {
case EditPage::AS_SUCCESS_NEW_ARTICLE:
$r['new'] = '';
// fall-through
case EditPage::AS_SUCCESS_UPDATE:
$r['result'] = 'Success';
@ -632,10 +636,8 @@ class ApiEditPage extends ApiBase {
public function getExamples() {
return array(
'api.php?action=edit&title=Test&summary=test%20summary&text=article%20content&basetimestamp=20070824123454&token=%2B\\'
=> 'Edit a page (anonymous user)',
'api.php?action=edit&title=Test&summary=NOTOC&minor=&prependtext=__NOTOC__%0A&basetimestamp=20070824123454&token=%2B\\'
=> 'Prepend __NOTOC__ to a page (anonymous user)',
'api.php?action=edit&title=Test&undo=13585&undoafter=13579&basetimestamp=20070824123454&token=%2B\\'

View file

@ -85,7 +85,7 @@ class ApiFormatJson extends ApiFormatBase {
public function getDescription() {
if ( $this->mIsRaw ) {
return 'Output data with the debuging elements in JSON format' . parent::getDescription();
return 'Output data with the debugging elements in JSON format' . parent::getDescription();
} else {
return 'Output data in JSON format' . parent::getDescription();
}

View file

@ -38,7 +38,7 @@ class ApiLogin extends ApiBase {
/**
* Executes the log-in attempt using the parameters passed. If
* the log-in succeeeds, it attaches a cookie to the session
* the log-in succeeds, it attaches a cookie to the session
* and outputs the user id, username, and session token. If a
* log-in fails, as the result of a bad password, a nonexistent
* user, or any other reason, the host is cached with an expiry

View file

@ -69,7 +69,7 @@ class ApiParamInfo extends ApiBase {
* @param array $params user parameters array
* @param string $type parameter name
* @param array $res store results in this array
* @param array $resultObj results object to set indexed tag.
* @param ApiResult $resultObj results object to set indexed tag.
*/
private function addModulesInfo( $params, $type, &$res, $resultObj ) {
if ( !is_array( $params[$type] ) ) {
@ -291,7 +291,7 @@ class ApiParamInfo extends ApiBase {
$retval['props'][] = $propResult;
}
// default is true for query modules, false for other modules, overriden by ApiBase::PROP_LIST
// default is true for query modules, false for other modules, overridden by ApiBase::PROP_LIST
if ( $listResult === true || ( $listResult !== false && $obj instanceof ApiQueryBase ) ) {
$retval['listresult'] = '';
}

View file

@ -174,7 +174,7 @@ class ApiProtect extends ApiBase {
'token' => 'A protect token previously retrieved through prop=info',
'protections' => '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.',
'Use \'infinite\', \'indefinite\' or \'never\', for a neverexpiring protection.' ),
'Use \'infinite\', \'indefinite\' or \'never\', for a never-expiring protection.' ),
'reason' => 'Reason for (un)protecting',
'cascade' => array( 'Enable cascading protection (i.e. protect pages included in this page)',
'Ignored if not all protection levels are \'sysop\' or \'protect\'' ),

View file

@ -507,6 +507,7 @@ class ApiQuery extends ApiBase {
);
}
// Report special pages
/** @var $title Title */
foreach ( $pageSet->getSpecialTitles() as $fakeId => $title ) {
$vals = array();
ApiQueryBase::addTitleInfo( $vals, $title );
@ -576,6 +577,7 @@ class ApiQuery extends ApiBase {
$titles = $pageSet->getGoodTitles();
if ( count( $titles ) ) {
$user = $this->getUser();
/** @var $title Title */
foreach ( $titles as $title ) {
if ( $title->userCan( 'read', $user ) ) {
$exportTitles[] = $title;

View file

@ -42,7 +42,7 @@ class ApiQueryAllImages extends ApiQueryGeneratorBase {
/**
* Override parent method to make sure the repo's DB is used
* which may not necesarilly be the same as the local DB.
* which may not necessarily be the same as the local DB.
*
* TODO: allow querying non-local repos.
* @return DatabaseBase

View file

@ -347,7 +347,7 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase {
'Show info about 4 pages starting at the letter "T"',
),
'api.php?action=query&generator=allpages&gaplimit=2&gapfilterredir=nonredirects&gapfrom=Re&prop=revisions&rvprop=content' => array(
'Show content of first 2 non-redirect pages begining at "Re"',
'Show content of first 2 non-redirect pages beginning at "Re"',
)
);
}

View file

@ -188,6 +188,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
$titleWhere = array();
$allRedirNs = array();
$allRedirDBkey = array();
/** @var $t Title */
foreach ( $this->redirTitles as $t ) {
$redirNs = $t->getNamespace();
$redirDBkey = $t->getDBkey();
@ -201,6 +202,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
if ( !is_null( $this->redirID ) ) {
$op = $this->params['dir'] == 'descending' ? '<' : '>';
/** @var $first Title */
$first = $this->redirTitles[0];
$title = $db->addQuotes( $first->getDBkey() );
$ns = $first->getNamespace();

View file

@ -48,6 +48,7 @@ class ApiQueryCategoryInfo extends ApiQueryBase {
$this->getPageSet()->getMissingTitles();
$cattitles = array();
foreach ( $categories as $c ) {
/** @var $t Title */
$t = $titles[$c];
$cattitles[$c] = $t->getDBkey();
}

View file

@ -92,6 +92,7 @@ class ApiQueryDuplicateFiles extends ApiQueryGeneratorBase {
$sha1s = array();
foreach ( $files as $file ) {
/** @var $file File */
$sha1s[$file->getName()] = $file->getSha1();
}
@ -113,6 +114,7 @@ class ApiQueryDuplicateFiles extends ApiQueryGeneratorBase {
if( $params['dir'] == 'descending' ) {
$dupFiles = array_reverse( $dupFiles );
}
/** @var $dupFile File */
foreach ( $dupFiles as $dupFile ) {
$dupName = $dupFile->getName();
if( $image == $dupName && $dupFile->isLocal() ) {

View file

@ -90,6 +90,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
continue;
}
/** @var $img File */
$img = $images[$title];
if ( self::getTransformCount() >= self::TRANSFORM_LIMIT ) {
@ -158,6 +159,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
// Get one more to facilitate query-continue functionality
$count = ( $gotOne ? 1 : 0 );
$oldies = $img->getHistory( $params['limit'] - $count + 1, $start, $params['end'] );
/** @var $oldie File */
foreach ( $oldies as $oldie ) {
if ( ++$count > $params['limit'] ) {
// We've reached the extra one which shows that there are additional pages to be had. Stop here...
@ -452,6 +454,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
/**
* @param $img File
* @param null|string $start
* @return string
*/
protected function getContinueStr( $img, $start = null ) {
@ -516,6 +519,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
/**
* Returns array key value pairs of properties and their descriptions
*
* @param string $modulePrefix
* @return array
*/
private static function getProperties( $modulePrefix = '' ) {
@ -710,7 +714,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
array( 'code' => "{$p}urlwidth", 'info' => "{$p}urlheight cannot be used without {$p}urlwidth" ),
array( 'code' => 'urlparam', 'info' => "Invalid value for {$p}urlparam" ),
array( 'code' => 'urlparam_no_width', 'info' => "{$p}urlparam requires {$p}urlwidth" ),
array( 'code' => 'urlparam_urlwidth_mismatch', 'info' => "The width set in {$p}urlparm doesnt't " .
array( 'code' => 'urlparam_urlwidth_mismatch', 'info' => "The width set in {$p}urlparm doesn't " .
"match the one in {$p}urlwidth" ),
) );
}

View file

@ -321,6 +321,7 @@ class ApiQueryInfo extends ApiQueryBase {
$this->getDisplayTitle();
}
/** @var $title Title */
foreach ( $this->everything as $pageid => $title ) {
$pageInfo = $this->extractPageInfo( $pageid, $title );
$fit = $result->addValue( array(
@ -462,6 +463,7 @@ class ApiQueryInfo extends ApiQueryBase {
$res = $this->select( __METHOD__ );
foreach ( $res as $row ) {
/** @var $title Title */
$title = $this->titles[$row->pr_page];
$a = array(
'type' => $row->pr_type,
@ -597,6 +599,7 @@ class ApiQueryInfo extends ApiQueryBase {
private function getTSIDs() {
$getTitles = $this->talkids = $this->subjectids = array();
/** @var $t Title */
foreach ( $this->everything as $t ) {
if ( MWNamespace::isTalk( $t->getNamespace() ) ) {
if ( $this->fld_subjectid ) {

View file

@ -25,7 +25,7 @@
*/
/**
* A query module to list all langlinks (links to correspanding foreign language pages).
* A query module to list all langlinks (links to corresponding foreign language pages).
*
* @ingroup API
*/

View file

@ -451,7 +451,7 @@ class ApiQueryLogEvents extends ApiQueryBase {
' timestamp - Adds the timestamp for the event',
' comment - Adds the comment of the event',
' parsedcomment - Adds the parsed comment of the event',
' details - Lists addtional details about the event',
' details - Lists additional details about the event',
' tags - Lists tags for the event',
),
'type' => 'Filter log entries to only this type',

View file

@ -75,6 +75,7 @@ class ApiQueryQueryPage extends ApiQueryGeneratorBase {
$params = $this->extractRequestParams();
$result = $this->getResult();
/** @var $qp QueryPage */
$qp = new $this->qpMap[$params['page']]();
if ( !$qp->userCanExecute( $this->getUser() ) ) {
$this->dieUsageMsg( 'specialpage-cantexecute' );
@ -141,6 +142,7 @@ class ApiQueryQueryPage extends ApiQueryGeneratorBase {
}
public function getCacheMode( $params ) {
/** @var $qp QueryPage */
$qp = new $this->qpMap[$params['page']]();
if ( $qp->getRestriction() != '' ) {
return 'private';

View file

@ -33,6 +33,8 @@
class ApiQueryRandom extends ApiQueryGeneratorBase {
private $pageIDs;
public function __construct( $query, $moduleName ) {
parent::__construct( $query, $moduleName, 'rn' );
}

View file

@ -335,7 +335,7 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
/**
* Extracts from a single sql row the data needed to describe one recent change.
*
* @param $row The row from which to extract the data.
* @param mixed $row The row from which to extract the data.
* @return array An array mapping strings (descriptors) to their respective string values.
* @access public
*/

View file

@ -196,6 +196,7 @@ class ApiQueryRevisions extends ApiQueryBase {
if ( isset( $prop['content'] ) || !is_null( $this->difftotext ) ) {
// For each page we will request, the user must have read rights for that page
$user = $this->getUser();
/** @var $title Title */
foreach ( $pageSet->getGoodTitles() as $title ) {
if ( !$title->userCan( 'read', $user ) ) {
$this->dieUsage(

View file

@ -442,7 +442,7 @@ class ApiQueryContributions extends ApiQueryBase {
'end' => 'The end timestamp to return to',
'continue' => 'When more results are available, use this to continue',
'user' => 'The users to retrieve contributions for',
'userprefix' => "Retrieve contibutions for all users whose names begin with this value. Overrides {$p}user",
'userprefix' => "Retrieve contributions for all users whose names begin with this value. Overrides {$p}user",
'dir' => $this->getDirectionDescription( $p ),
'namespace' => 'Only list contributions in these namespaces',
'prop' => array(

View file

@ -513,7 +513,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
'api.php?action=query&list=watchlist&wlallrev=&wlprop=ids|title|timestamp|user|comment',
'api.php?action=query&generator=watchlist&prop=info',
'api.php?action=query&generator=watchlist&gwlallrev=&prop=revisions&rvprop=timestamp|user',
'api.php?action=query&list=watchlist&wlowner=Bob_Smith&wltoken=d8d562e9725ea1512894cdab28e5ceebc7f20237'
'api.php?action=query&list=watchlist&wlowner=Bob_Smith&wltoken=123ABC'
);
}

View file

@ -36,8 +36,8 @@
* There are two special key values that change how XML output is generated:
* '_element' This key sets the tag name for the rest of the elements in the current array.
* It is only inserted if the formatter returned true for getNeedsRawData()
* '*' This key has special meaning only to the XML formatter, and is outputed as is
* for all others. In XML it becomes the content of the current element.
* '*' This key has special meaning only to the XML formatter, and is outputted as is
* for all others. In XML it becomes the content of the current element.
*
* @ingroup API
*/

View file

@ -133,6 +133,7 @@ class ApiSetNotificationTimestamp extends ApiBase {
}
// Now, put the valid titles into the result
/** @var $title Title */
foreach ( $pageSet->getTitles() as $title ) {
$ns = $title->getNamespace();
$dbkey = $title->getDBkey();
@ -283,9 +284,9 @@ class ApiSetNotificationTimestamp extends ApiBase {
public function getExamples() {
return array(
'api.php?action=setnotificationtimestamp&entirewatchlist=&token=ABC123' => 'Reset the notification status for the entire watchlist',
'api.php?action=setnotificationtimestamp&titles=Main_page&token=ABC123' => 'Reset the notification status for "Main page"',
'api.php?action=setnotificationtimestamp&titles=Main_page&timestamp=2012-01-01T00:00:00Z&token=ABC123' => 'Set the notification timestamp for "Main page" so all edits since 1 January 2012 are unviewed',
'api.php?action=setnotificationtimestamp&entirewatchlist=&token=123ABC' => 'Reset the notification status for the entire watchlist',
'api.php?action=setnotificationtimestamp&titles=Main_page&token=123ABC' => 'Reset the notification status for "Main page"',
'api.php?action=setnotificationtimestamp&titles=Main_page&timestamp=2012-01-01T00:00:00Z&token=123ABC' => 'Set the notification timestamp for "Main page" so all edits since 1 January 2012 are unviewed',
);
}

View file

@ -71,6 +71,7 @@ class ApiUpload extends ApiBase {
$this->checkPermissions( $user );
// Fetch the file (usually a no-op)
/** @var $status Status */
$status = $this->mUpload->fetchFile();
if ( !$status->isGood() ) {
$errors = $status->getErrorsArray();
@ -116,13 +117,13 @@ class ApiUpload extends ApiBase {
}
/**
* Get an uplaod result based on upload context
* Get an upload result based on upload context
* @return array
*/
private function getContextResult() {
$warnings = $this->getApiWarnings();
if ( $warnings && !$this->mParams['ignorewarnings'] ) {
// Get warnings formated in result array format
// Get warnings formatted in result array format
return $this->getWarningsResult( $warnings );
} elseif ( $this->mParams['chunk'] ) {
// Add chunk, and get result
@ -137,7 +138,7 @@ class ApiUpload extends ApiBase {
}
/**
* Get Stash Result, throws an expetion if the file could not be stashed.
* Get Stash Result, throws an exception if the file could not be stashed.
* @param $warnings array Array of Api upload warnings
* @return array
*/
@ -197,6 +198,7 @@ class ApiUpload extends ApiBase {
$filekey = $this->performStash();
} else {
$filekey = $this->mParams['filekey'];
/** @var $status Status */
$status = $this->mUpload->addChunk(
$chunkPath, $chunkSize, $this->mParams['offset'] );
if ( !$status->isGood() ) {
@ -565,6 +567,7 @@ class ApiUpload extends ApiBase {
$this->mParams['text'] = $this->mParams['comment'];
}
/** @var $file File */
$file = $this->mUpload->getLocalFile();
$watch = $this->getWatchlistValue( $this->mParams['watchlist'], $file->getTitle() );
@ -603,6 +606,7 @@ class ApiUpload extends ApiBase {
"Failed to start PublishStashedFile.php", 'publishfailed' );
}
} else {
/** @var $status Status */
$status = $this->mUpload->performUpload( $this->mParams['comment'],
$this->mParams['text'], $watch, $this->getUser() );