if ( isset( $params['continue'] ) ) {
$cont = explode( '|', $params['continue'] );
- if ( count( $cont ) != 2 ) {
- $this->dieUsage( "Invalid continue param. You should pass the " .
- "original value returned by the previous query", "_badcontinue" );
- }
+ $this->dieContinueUsageIf( count( $cont ) != 2 );
$ns = intval( $cont[0] );
+ $this->dieContinueUsageIf( strval( $ns ) !== $cont[0] );
$title = $this->getDB()->addQuotes( $cont[1] );
$op = $params['dir'] == 'ascending' ? '>' : '<';
$this->addWhere(
$this->addOption( 'ORDER BY', array(
'wl_namespace' . $sort,
'wl_title' . $sort
- ));
+ ) );
}
$this->addOption( 'LIMIT', $params['limit'] + 1 );
$res = $this->select( __METHOD__ );
$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;
}
if ( is_null( $resultPageSet ) ) {
$vals = array();
ApiQueryBase::addTitleInfo( $vals, $t );
- if ( isset( $prop['changed'] ) && !is_null( $row->wl_notificationtimestamp ) )
- {
+ if ( isset( $prop['changed'] ) && !is_null( $row->wl_notificationtimestamp ) ) {
$vals['changed'] = wfTimestamp( TS_ISO_8601, $row->wl_notificationtimestamp );
}
$fit = $this->getResult()->addValue( $this->getModuleName(), null, $vals );
),
'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',
);
}
}
public function getDescription() {
- return "Get all pages on the logged in user's watchlist";
+ return "Get all pages on the logged in user's watchlist.";
}
public function getPossibleErrors() {
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'
+ ),
) );
}
);
}
- public function getVersion() {
- return __CLASS__ . ': $Id$';
+ public function getHelpUrls() {
+ return 'https://www.mediawiki.org/wiki/API:Watchlistraw';
}
}