aboutsummaryrefslogtreecommitdiffstats
path: root/includes/api/ApiQueryBase.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/api/ApiQueryBase.php')
-rw-r--r--includes/api/ApiQueryBase.php26
1 files changed, 25 insertions, 1 deletions
diff --git a/includes/api/ApiQueryBase.php b/includes/api/ApiQueryBase.php
index 5f4d9f9ce7b4..e36109a2d3d7 100644
--- a/includes/api/ApiQueryBase.php
+++ b/includes/api/ApiQueryBase.php
@@ -375,6 +375,19 @@ abstract class ApiQueryBase extends ApiBase {
}
/**
+ * Die with the $prefix.'badcontinue' error. This call is common enough to make it into the base method.
+ * @param $condition boolean will only die if this value is true
+ * @since 1.21
+ */
+ protected function dieContinueUsageIf( $condition ) {
+ if ( $condition ) {
+ $this->dieUsage(
+ 'Invalid continue param. You should pass the original value returned by the previous query',
+ 'badcontinue' );
+ }
+ }
+
+ /**
* Get the Query database connection (read-only)
* @return DatabaseBase
*/
@@ -549,10 +562,21 @@ abstract class ApiQueryBase extends ApiBase {
* @return array
*/
public function getPossibleErrors() {
- return array_merge( parent::getPossibleErrors(), array(
+ $errors = parent::getPossibleErrors();
+ $errors = array_merge( $errors, array(
array( 'invalidtitle', 'title' ),
array( 'invalidtitle', 'key' ),
) );
+ $params = $this->getFinalParams();
+ if ( array_key_exists( 'continue', $params ) ) {
+ $errors = array_merge( $errors, array(
+ array(
+ 'code' => 'badcontinue',
+ 'info' => 'Invalid continue param. You should pass the original value returned by the previous query'
+ ),
+ ) );
+ }
+ return $errors;
}
/**