' rights - Lists all the rights the user(s) has',
' editcount - Adds the user\'s edit count',
' registration - Adds the user\'s registration timestamp',
- ' emailable - Tags if the user can and wants to receive email through [[Special:Emailuser]]',
+ ' emailable - Tags if the user can and wants to receive ' .
+ 'email through [[Special:Emailuser]]',
' gender - Tags the gender of the user. Returns "male", "female", or "unknown"',
),
'users' => 'A list of users to obtain the same information for',
$this->run( $resultPageSet );
}
- private $fld_ids = false, $fld_title = false, $fld_patrol = false, $fld_flags = false,
- $fld_timestamp = false, $fld_user = false, $fld_comment = false, $fld_parsedcomment = false, $fld_sizes = false,
- $fld_notificationtimestamp = false, $fld_userid = false, $fld_loginfo = false;
+ private $fld_ids = false, $fld_title = false, $fld_patrol = false,
+ $fld_flags = false, $fld_timestamp = false, $fld_user = false,
+ $fld_comment = false, $fld_parsedcomment = false, $fld_sizes = false,
+ $fld_notificationtimestamp = false, $fld_userid = false,
+ $fld_loginfo = false;
/**
* @param $resultPageSet ApiPageSet
$this->addFieldsIf( 'rc_patrolled', $this->fld_patrol );
$this->addFieldsIf( array( 'rc_old_len', 'rc_new_len' ), $this->fld_sizes );
$this->addFieldsIf( 'wl_notificationtimestamp', $this->fld_notificationtimestamp );
- $this->addFieldsIf( array( 'rc_logid', 'rc_log_type', 'rc_log_action', 'rc_params' ), $this->fld_loginfo );
+ $this->addFieldsIf(
+ array( 'rc_logid', 'rc_log_type', 'rc_log_action', 'rc_params' ),
+ $this->fld_loginfo
+ );
} elseif ( $params['allrev'] ) {
$this->addFields( 'rc_this_oldid' );
} else {
if ( isset( $show['patrolled'] ) || isset( $show['!patrolled'] ) ) {
$user = $this->getUser();
if ( !$user->useRCPatrol() && !$user->useNPPatrol() ) {
- $this->dieUsage( 'You need the patrol right to request the patrolled flag', 'permissiondenied' );
+ $this->dieUsage(
+ 'You need the patrol right to request the patrolled flag',
+ 'permissiondenied'
+ );
}
}
}
// This is an index optimization for mysql, as done in the Special:Watchlist page
- $this->addWhereIf( "rc_timestamp > ''", !isset( $params['start'] ) && !isset( $params['end'] ) && $db->getType() == 'mysql' );
+ $this->addWhereIf(
+ "rc_timestamp > ''",
+ !isset( $params['start'] ) && !isset( $params['end'] ) && $db->getType() == 'mysql'
+ );
$this->addOption( 'LIMIT', $params['limit'] + 1 );
foreach ( $res as $row ) {
if ( ++$count > $params['limit'] ) {
- // We've reached the one extra which shows that there are additional pages to be had. Stop here...
- $this->setContinueEnumParameter( 'start', wfTimestamp( TS_ISO_8601, $row->rc_timestamp ) );
+ // We've reached the one extra which shows that there are
+ // additional pages to be had. Stop here...
+ $this->setContinueEnumParameter(
+ 'start',
+ wfTimestamp( TS_ISO_8601, $row->rc_timestamp )
+ );
break;
}
}
if ( is_null( $resultPageSet ) ) {
- $this->getResult()->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'item' );
+ $this->getResult()->setIndexedTagName_internal(
+ array( 'query', $this->getModuleName() ),
+ 'item'
+ );
} elseif ( $params['allrev'] ) {
$resultPageSet->populateFromRevisionIDs( $ids );
} else {
' log - Log entries',
),
'owner' => 'The name of the user whose watchlist you\'d like to access',
- 'token' => 'Give a security token (settable in preferences) to allow access to another user\'s watchlist'
+ 'token' => 'Give a security token (settable in preferences) to ' .
+ 'allow access to another user\'s watchlist'
);
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array(
array( 'code' => 'bad_wlowner', 'info' => 'Specified user does not exist' ),
- array( 'code' => 'bad_wltoken', 'info' => 'Incorrect watchlist token provided -- please set a correct token in Special:Preferences' ),
+ array(
+ 'code' => 'bad_wltoken',
+ 'info' => 'Incorrect watchlist token provided -- ' .
+ 'please set a correct token in Special:Preferences'
+ ),
array( 'code' => 'notloggedin', 'info' => 'You must be logged-in to have a watchlist' ),
array( 'code' => 'patrol', 'info' => 'patrol property is not available' ),
array( 'show' ),
- array( 'code' => 'permissiondenied', 'info' => 'You need the patrol right to request the patrolled flag' ),
+ array(
+ 'code' => 'permissiondenied',
+ 'info' => 'You need the patrol right to request the patrolled flag'
+ ),
array( 'code' => 'user-excludeuser', 'info' => 'user and excludeuser cannot be used together' ),
) );
}
$count = 0;
foreach ( $res as $row ) {
if ( ++$count > $params['limit'] ) {
- // We've reached the one extra which shows that there are additional pages to be had. Stop here...
+ // We've reached the one extra which shows that there are
+ // additional pages to be had. Stop here...
$this->setContinueEnumParameter( 'continue', $row->wl_namespace . '|' . $row->wl_title );
break;
}
),
'show' => 'Only list items that meet these criteria',
'owner' => 'The name of the user whose watchlist you\'d like to access',
- 'token' => 'Give a security token (settable in preferences) to allow access to another user\'s watchlist',
+ 'token' => 'Give a security token (settable in preferences) to allow ' .
+ 'access to another user\'s watchlist',
'dir' => 'Direction to sort the titles and namespaces in',
);
}
array( 'code' => 'notloggedin', 'info' => 'You must be logged-in to have a watchlist' ),
array( 'show' ),
array( 'code' => 'bad_wlowner', 'info' => 'Specified user does not exist' ),
- array( 'code' => 'bad_wltoken', 'info' => 'Incorrect watchlist token provided -- please set a correct token in Special:Preferences' ),
+ array(
+ 'code' => 'bad_wltoken',
+ 'info' => 'Incorrect watchlist token provided -- ' .
+ 'please set a correct token in Special:Preferences'
+ ),
) );
}
/**
* This class represents the result of the API operations.
- * It simply wraps a nested array() structure, adding some functions to simplify array's modifications.
- * As various modules execute, they add different pieces of information to this result,
- * structuring it as it will be given to the client.
+ * It simply wraps a nested array() structure, adding some functions to simplify
+ * array's modifications. As various modules execute, they add different pieces
+ * of information to this result, structuring it as it will be given to the client.
*
* Each subarray may either be a dictionary - key-value pairs with unique keys,
* or lists, where the items are added using $data[] = $value notation.
* @param array $arr to add $value to
* @param string $name Index of $arr to add $value at
* @param $value mixed
- * @param int $flags Zero or more OR-ed flags like OVERRIDE | ADD_ON_TOP. This parameter used to be
- * boolean, and the value of OVERRIDE=1 was specifically chosen so that it would be backwards
- * compatible with the new method signature.
+ * @param int $flags Zero or more OR-ed flags like OVERRIDE | ADD_ON_TOP.
+ * This parameter used to be boolean, and the value of OVERRIDE=1 was
+ * specifically chosen so that it would be backwards compatible with the
+ * new method signature.
*
* @since 1.21 int $flags replaced boolean $override
*/
public static function setElement( &$arr, $name, $value, $flags = 0 ) {
- if ( $arr === null || $name === null || $value === null || !is_array( $arr ) || is_array( $name ) ) {
+ if ( $arr === null || $name === null || $value === null
+ || !is_array( $arr ) || is_array( $name )
+ ) {
ApiBase::dieDebug( __METHOD__, 'Bad parameter' );
}
ApiBase::dieDebug( __METHOD__, "Attempting to merge element $name" );
}
} else {
- ApiBase::dieDebug( __METHOD__, "Attempting to add element $name=$value, existing value is {$arr[$name]}" );
+ ApiBase::dieDebug(
+ __METHOD__,
+ "Attempting to add element $name=$value, existing value is {$arr[$name]}"
+ );
}
}
* @param $path array|string|null
* @param $name string
* @param $value mixed
- * @param int $flags Zero or more OR-ed flags like OVERRIDE | ADD_ON_TOP. This parameter used to be
- * boolean, and the value of OVERRIDE=1 was specifically chosen so that it would be backwards
- * compatible with the new method signature.
+ * @param int $flags Zero or more OR-ed flags like OVERRIDE | ADD_ON_TOP. This
+ * parameter used to be boolean, and the value of OVERRIDE=1 was specifically
+ * chosen so that it would be backwards compatible with the new method
+ * signature.
* @return bool True if $value fits in the result, false if not
*
* @since 1.21 int $flags replaced boolean $override
$pageObj = WikiPage::factory( $titleObj );
$summary = $params['summary'];
$details = array();
- $retval = $pageObj->doRollback( $this->getRbUser(), $summary, $params['token'], $params['markbot'], $details, $this->getUser() );
+ $retval = $pageObj->doRollback(
+ $this->getRbUser(),
+ $summary,
+ $params['token'],
+ $params['markbot'],
+ $details,
+ $this->getUser()
+ );
if ( $retval ) {
// We don't care about multiple errors, just report one of them
public function getParamDescription() {
return array(
'title' => 'Title of the page you want to rollback.',
- 'user' => 'Name of the user whose edits are to be rolled back. If set incorrectly, you\'ll get a badtoken error.',
- 'token' => "A rollback token previously retrieved through {$this->getModulePrefix()}prop=revisions",
+ 'user' => 'Name of the user whose edits are to be rolled back. If ' .
+ 'set incorrectly, you\'ll get a badtoken error.',
+ 'token' => 'A rollback token previously retrieved through ' .
+ "{$this->getModulePrefix()}prop=revisions",
'summary' => 'Custom edit summary. If empty, default summary will be used',
'markbot' => 'Mark the reverted edits and the revert as bot edits',
- 'watchlist' => 'Unconditionally add or remove the page from your watchlist, use preferences or do not change watch',
+ 'watchlist' => 'Unconditionally add or remove the page from your watchlist, ' .
+ 'use preferences or do not change watch',
);
}
public function getDescription() {
return array(
- 'Undo the last edit to the page. If the last user who edited the page made multiple edits in a row,',
- 'they will all be rolled back'
+ 'Undo the last edit to the page. If the last user who edited the page made',
+ 'multiple edits in a row, they will all be rolled back'
);
}
public function getExamples() {
return array(
'api.php?action=rollback&title=Main%20Page&user=Catrope&token=123ABC',
- 'api.php?action=rollback&title=Main%20Page&user=217.121.114.116&token=123ABC&summary=Reverting%20vandalism&markbot=1'
+ 'api.php?action=rollback&title=Main%20Page&user=217.121.114.116&' .
+ 'token=123ABC&summary=Reverting%20vandalism&markbot=1'
);
}
$pageSet = $this->getPageSet();
if ( $params['entirewatchlist'] && $pageSet->getDataSource() !== null ) {
- $this->dieUsage( "Cannot use 'entirewatchlist' at the same time as '{$pageSet->getDataSource()}'", 'multisource' );
+ $this->dieUsage(
+ "Cannot use 'entirewatchlist' at the same time as '{$pageSet->getDataSource()}'",
+ 'multisource'
+ );
}
$dbw = wfGetDB( DB_MASTER, 'api' );
__METHOD__
);
- $result['notificationtimestamp'] = ( is_null( $timestamp ) ? '' : wfTimestamp( TS_ISO_8601, $timestamp ) );
+ $result['notificationtimestamp'] = is_null( $timestamp )
+ ? ''
+ : wfTimestamp( TS_ISO_8601, $timestamp );
} else {
// First, log the invalid titles
foreach ( $pageSet->getInvalidTitles() as $title ) {
// Query the results of our update
$timestamps = array();
- $res = $dbw->select( 'watchlist', array( 'wl_namespace', 'wl_title', 'wl_notificationtimestamp' ),
+ $res = $dbw->select(
+ 'watchlist',
+ array( 'wl_namespace', 'wl_title', 'wl_notificationtimestamp' ),
array( 'wl_user' => $user->getID(), $lb->constructSet( 'wl', $dbw ) ),
__METHOD__
);
$this->getRequireOnlyOneParameterErrorMessages(
array_merge( array( 'entirewatchlist' ), array_keys( $ps->getFinalParams() ) ) ),
array(
- array( 'code' => 'notloggedin', 'info' => 'Anonymous users cannot use watchlist change notifications' ),
+ array( 'code' => 'notloggedin', 'info'
+ => 'Anonymous users cannot use watchlist change notifications' ),
array( 'code' => 'multpages', 'info' => 'torevid may only be used with a single page' ),
array( 'code' => 'multpages', 'info' => 'newerthanrevid may only be used with a single page' ),
)
public function getExamples() {
return array(
- '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×tamp=2012-01-01T00:00:00Z&token=123ABC' => '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',
);
}
$p = $this->getModulePrefix();
return array(
- 'id' => "ID of the block you want to unblock (obtained through list=blocks). Cannot be used together with {$p}user",
- 'user' => "Username, IP address or IP range you want to unblock. Cannot be used together with {$p}id",
+ 'id' => "ID of the block you want to unblock (obtained through list=blocks). ' .
+ 'Cannot be used together with {$p}user",
+ 'user' => "Username, IP address or IP range you want to unblock. ' .
+ 'Cannot be used together with {$p}id",
'token' => "An unblock token previously obtained through prop=info",
'reason' => 'Reason for unblock',
);
'title' => 'Title of the page you want to restore',
'token' => 'An undelete token previously retrieved through list=deletedrevs',
'reason' => 'Reason for restoring',
- 'timestamps' => 'Timestamps of the revisions to restore. If not set, all revisions will be restored.',
- 'watchlist' => 'Unconditionally add or remove the page from your watchlist, use preferences or do not change watch',
+ 'timestamps' => 'Timestamps of the revisions to restore. If not set, all ' .
+ 'revisions will be restored.',
+ 'watchlist' => 'Unconditionally add or remove the page from your ' .
+ 'watchlist, use preferences or do not change watch',
);
}
public function getDescription() {
return array(
- 'Restore certain revisions of a deleted page. A list of deleted revisions (including timestamps) can be',
- 'retrieved through list=deletedrevs'
+ 'Restore certain revisions of a deleted page. A list of deleted revisions ',
+ '(including timestamps) can be retrieved through list=deletedrevs'
);
}
if ( isset( $warnings['exists'] ) ) {
$warning = $warnings['exists'];
unset( $warnings['exists'] );
- $localFile = isset( $warning['normalizedFile'] ) ? $warning['normalizedFile'] : $warning['file'];
+ $localFile = isset( $warning['normalizedFile'] )
+ ? $warning['normalizedFile']
+ : $warning['file'];
$warnings[$warning['warning']] = $localFile->getName();
}
}
$params = array(
'filename' => 'Target filename',
'token' => 'Edit token. You can get one of these through prop=info',
- 'comment' => 'Upload comment. Also used as the initial page text for new files if "text" is not specified',
+ 'comment' => 'Upload comment. Also used as the initial page text for new ' .
+ 'files if "text" is not specified',
'text' => 'Initial page text for new files',
'watch' => 'Watch the page',
- 'watchlist' => 'Unconditionally add or remove the page from your watchlist, use preferences or do not change watch',
+ 'watchlist' => 'Unconditionally add or remove the page from your watchlist, ' .
+ 'use preferences or do not change watch',
'ignorewarnings' => 'Ignore any warnings',
'file' => 'File contents',
'url' => 'URL to fetch the file from',
'filekey' => 'Key that identifies a previous upload that was stashed temporarily.',
'sessionkey' => 'Same as filekey, maintained for backward compatibility.',
- 'stash' => 'If set, the server will not add the file to the repository and stash it temporarily.',
+ 'stash' => 'If set, the server will not add the file to the repository ' .
+ 'and stash it temporarily.',
'chunk' => 'Chunk contents',
'offset' => 'Offset of chunk in bytes',
public function getExamples() {
return array(
- 'api.php?action=upload&filename=Wiki.png&url=http%3A//upload.wikimedia.org/wikipedia/en/b/bc/Wiki.png'
+ 'api.php?action=upload&filename=Wiki.png' .
+ '&url=http%3A//upload.wikimedia.org/wikipedia/en/b/bc/Wiki.png'
=> 'Upload from a URL',
'api.php?action=upload&filename=Wiki.png&filekey=filekey&ignorewarnings=1'
=> 'Complete an upload that failed due to warnings',
$res = array( 'title' => $title->getPrefixedText() );
- // Currently unnecessary, code to act as a safeguard against any change in current behavior of uselang
+ // Currently unnecessary, code to act as a safeguard against any change
+ // in current behavior of uselang.
// Copy from ApiParse
$oldLang = null;
- if ( isset( $params['uselang'] ) && $params['uselang'] != $this->getContext()->getLanguage()->getCode() ) {
+ if ( isset( $params['uselang'] ) &&
+ $params['uselang'] != $this->getContext()->getLanguage()->getCode()
+ ) {
$oldLang = $this->getContext()->getLanguage(); // Backup language
$this->getContext()->setLanguage( Language::factory( $params['uselang'] ) );
}
if ( $params['unwatch'] ) {
$res['unwatched'] = '';
- $res['message'] = $this->msg( 'removedwatchtext', $title->getPrefixedText() )->title( $title )->parseAsBlock();
+ $res['message'] = $this->msg( 'removedwatchtext', $title->getPrefixedText() )
+ ->title( $title )->parseAsBlock();
$status = UnwatchAction::doUnwatch( $title, $user );
} else {
$res['watched'] = '';
- $res['message'] = $this->msg( 'addedwatchtext', $title->getPrefixedText() )->title( $title )->parseAsBlock();
+ $res['message'] = $this->msg( 'addedwatchtext', $title->getPrefixedText() )
+ ->title( $title )->parseAsBlock();
$status = WatchAction::doWatch( $title, $user );
}