From a0999b5835019d123a4179c8c1f096d3014c50b6 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Thu, 25 Mar 2010 22:12:28 +0000 Subject: [PATCH] Revert my api changes to pre r64815 --- includes/api/ApiDelete.php | 5 ----- includes/api/ApiMove.php | 6 ------ includes/api/ApiProtect.php | 10 ---------- includes/api/ApiRollback.php | 19 ++----------------- includes/api/ApiUndelete.php | 21 ++------------------- includes/api/ApiUpload.php | 11 ----------- 6 files changed, 4 insertions(+), 68 deletions(-) diff --git a/includes/api/ApiDelete.php b/includes/api/ApiDelete.php index bb9e972137..9689c97c85 100644 --- a/includes/api/ApiDelete.php +++ b/includes/api/ApiDelete.php @@ -52,10 +52,6 @@ class ApiDelete extends ApiBase { $params = $this->extractRequestParams(); $this->requireOnlyOneParameter( $params, 'title', 'pageid' ); - - if ( isset( $params['watch'] ) && isset( $params['unwatch'] ) ) { - $this->dieUsageMsg( array( 'show' ) ); - } if ( isset( $params['title'] ) ) { $titleObj = Title::newFromText( $params['title'] ); @@ -231,7 +227,6 @@ class ApiDelete extends ApiBase { array( 'nosuchpageid', 'pageid' ), array( 'notanarticle' ), array( 'hookaborted', 'error' ), - array( 'show' ), ) ); } diff --git a/includes/api/ApiMove.php b/includes/api/ApiMove.php index f7836fa505..3b2fe9999b 100644 --- a/includes/api/ApiMove.php +++ b/includes/api/ApiMove.php @@ -39,11 +39,6 @@ class ApiMove extends ApiBase { public function execute() { global $wgUser; $params = $this->extractRequestParams(); - - if ( isset( $params['watch'] ) && isset( $params['unwatch'] ) ) { - $this->dieUsageMsg( array( 'show' ) ); - } - if ( is_null( $params['reason'] ) ) { $params['reason'] = ''; } @@ -216,7 +211,6 @@ class ApiMove extends ApiBase { array( 'notanarticle' ), array( 'invalidtitle', 'to' ), array( 'sharedfile-exists' ), - array( 'show' ), ) ); } diff --git a/includes/api/ApiProtect.php b/includes/api/ApiProtect.php index dc5197a38c..3c9b423eb8 100644 --- a/includes/api/ApiProtect.php +++ b/includes/api/ApiProtect.php @@ -39,10 +39,6 @@ class ApiProtect extends ApiBase { public function execute() { global $wgUser, $wgRestrictionTypes, $wgRestrictionLevels; $params = $this->extractRequestParams(); - - if ( isset( $params['watch'] ) && isset( $params['unwatch'] ) ) { - $this->dieUsageMsg( array( 'show' ) ); - } $titleObj = null; if ( !isset( $params['title'] ) ) { @@ -119,10 +115,7 @@ class ApiProtect extends ApiBase { $articleObj = new Article( $titleObj ); if ( $params['watch'] ) { $articleObj->doWatch(); - } elseif ( $params['unwatch'] ) { - $articleObj->doUnwatch(); } - if ( $titleObj->exists() ) { $ok = $articleObj->updateRestrictions( $protections, $params['reason'], $cascade, $expiryarray ); } else { @@ -168,7 +161,6 @@ class ApiProtect extends ApiBase { 'reason' => '', 'cascade' => false, 'watch' => false, - 'unwatch' => false, ); } @@ -183,7 +175,6 @@ class ApiProtect extends ApiBase { 'cascade' => array( 'Enable cascading protection (i.e. protect pages included in this page)', 'Ignored if not all protection levels are \'sysop\' or \'protect\'' ), 'watch' => 'If set, add the page being (un)protected to your watchlist', - 'unwatch' => 'Remove the page being (un)protected from your watchlist', ); } @@ -205,7 +196,6 @@ class ApiProtect extends ApiBase { array( 'protect-invalidlevel', 'level' ), array( 'invalidexpiry', 'expiry' ), array( 'pastexpiry', 'expiry' ), - array( 'show' ), ) ); } diff --git a/includes/api/ApiRollback.php b/includes/api/ApiRollback.php index 5220e7240c..d4b3d81ce1 100644 --- a/includes/api/ApiRollback.php +++ b/includes/api/ApiRollback.php @@ -38,10 +38,6 @@ class ApiRollback extends ApiBase { public function execute() { $params = $this->extractRequestParams(); - - if ( isset( $params['watch'] ) && isset( $params['unwatch'] ) ) { - $this->dieUsageMsg( array( 'show' ) ); - } $titleObj = null; if ( !isset( $params['title'] ) ) { @@ -76,12 +72,6 @@ class ApiRollback extends ApiBase { // We don't care about multiple errors, just report one of them $this->dieUsageMsg( reset( $retval ) ); } - - if ( $params['watch'] || $wgUser->getOption( 'watchdeletion' ) ) { - $articleObj->doWatch(); - } elseif ( $params['unwatch'] ) { - $articleObj->doUnwatch(); - } $info = array( 'title' => $titleObj->getPrefixedText(), @@ -109,9 +99,7 @@ class ApiRollback extends ApiBase { 'user' => null, 'token' => null, 'summary' => null, - 'markbot' => false, - 'watch' => false, - 'unwatch' => false, + 'markbot' => false ); } @@ -121,9 +109,7 @@ class ApiRollback extends ApiBase { '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 prop=revisions', 'summary' => 'Custom edit summary. If not set, default summary will be used.', - 'markbot' => 'Mark the reverted edits and the revert as bot edits', - 'watch' => 'Add the page to your watchlist', - 'unwatch' => 'Remove the page from your watchlist', + 'markbot' => 'Mark the reverted edits and the revert as bot edits' ); } @@ -141,7 +127,6 @@ class ApiRollback extends ApiBase { array( 'invalidtitle', 'title' ), array( 'notanarticle' ), array( 'invaliduser', 'user' ), - array( 'show' ), ) ); } diff --git a/includes/api/ApiUndelete.php b/includes/api/ApiUndelete.php index dcc79d06ce..b4abec7dca 100644 --- a/includes/api/ApiUndelete.php +++ b/includes/api/ApiUndelete.php @@ -39,10 +39,6 @@ class ApiUndelete extends ApiBase { public function execute() { global $wgUser; $params = $this->extractRequestParams(); - - if ( isset( $params['watch'] ) && isset( $params['unwatch'] ) ) { - $this->dieUsageMsg( array( 'show' ) ); - } $titleObj = null; if ( !isset( $params['title'] ) ) { @@ -81,14 +77,6 @@ class ApiUndelete extends ApiBase { $this->dieUsageMsg( array( 'cannotundelete' ) ); } - if ( $params['watch'] ) { - $articleObj = new Article( $titleObj ); - $articleObj->doWatch(); - } elseif ( $params['unwatch'] ) { - $articleObj = new Article( $titleObj ); - $articleObj->doUnwatch(); - } - if ( $retval[1] ) { wfRunHooks( 'FileUndeleteComplete', array( $titleObj, array(), $wgUser, $params['reason'] ) ); @@ -116,9 +104,7 @@ class ApiUndelete extends ApiBase { 'reason' => '', 'timestamps' => array( ApiBase::PARAM_ISMULTI => true - ), - 'watch' => false, - 'unwatch' => false, + ) ); } @@ -127,9 +113,7 @@ class ApiUndelete extends ApiBase { 'title' => 'Title of the page you want to restore.', 'token' => 'An undelete token previously retrieved through list=deletedrevs', 'reason' => 'Reason for restoring (optional)', - 'timestamps' => 'Timestamps of the revisions to restore. If not set, all revisions will be restored.', - 'watch' => 'Add the page to your watchlist', - 'unwatch' => 'Remove the page from your watchlist', + 'timestamps' => 'Timestamps of the revisions to restore. If not set, all revisions will be restored.' ); } @@ -147,7 +131,6 @@ class ApiUndelete extends ApiBase { array( 'blockedtext' ), array( 'invalidtitle', 'title' ), array( 'cannotundelete' ), - array( 'show' ), ) ); } diff --git a/includes/api/ApiUpload.php b/includes/api/ApiUpload.php index 89b18d8f06..7f0d857c1c 100644 --- a/includes/api/ApiUpload.php +++ b/includes/api/ApiUpload.php @@ -47,10 +47,6 @@ class ApiUpload extends ApiBase { $this->mParams = $this->extractRequestParams(); $request = $this->getMain()->getRequest(); - - if ( isset( $this->mParams['watch'] ) && isset( $this->mParams['unwatch'] ) ) { - $this->dieUsageMsg( array( 'show' ) ); - } // Add the uploaded file to the params array $this->mParams['file'] = $request->getFileName( 'file' ); @@ -226,10 +222,6 @@ class ApiUpload extends ApiBase { // No errors, no warnings: do the upload $status = $this->mUpload->performUpload( $this->mParams['comment'], $this->mParams['text'], $this->mParams['watch'], $wgUser ); - - if ( $this->mParams['unwatch'] ) { - $wgUser->removeWatch( $file->getTitle() ); - } if ( !$status->isGood() ) { $error = $status->getErrorsArray(); @@ -263,7 +255,6 @@ class ApiUpload extends ApiBase { 'text' => null, 'token' => null, 'watch' => false, - 'unwatch' => false, 'ignorewarnings' => false, 'file' => null, 'url' => null, @@ -279,7 +270,6 @@ class ApiUpload extends ApiBase { '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', - 'watch' => 'Unwatch the page', 'ignorewarnings' => 'Ignore any warnings', 'file' => 'File contents', 'url' => 'Url to fetch the file from', @@ -312,7 +302,6 @@ class ApiUpload extends ApiBase { array( 'mustbeloggedin', 'upload' ), array( 'badaccess-groups' ), array( 'badaccess-groups' ), - array( 'show' ), array( 'code' => 'fetchfileerror', 'info' => '' ), array( 'code' => 'nomodule', 'info' => 'No upload module set' ), array( 'code' => 'empty-file', 'info' => 'The file you submitted was empty' ), -- 2.20.1