Merge "Return user ID as userid in watchlist API module"
[lhc/web/wiklou.git] / includes / api / ApiWatch.php
index 275275e..3e51299 100644 (file)
  */
 class ApiWatch extends ApiBase {
 
-       public function __construct( $main, $action ) {
-               parent::__construct( $main, $action );
-       }
-
        public function execute() {
                $user = $this->getUser();
                if ( !$user->isLoggedIn() ) {
@@ -44,13 +40,13 @@ class ApiWatch extends ApiBase {
                $params = $this->extractRequestParams();
                $title = Title::newFromText( $params['title'] );
 
-               if ( !$title || $title->getNamespace() < 0 ) {
+               if ( !$title || $title->isExternal() || !$title->canExist() ) {
                        $this->dieUsageMsg( array( 'invalidtitle', $params['title'] ) );
                }
 
                $res = array( 'title' => $title->getPrefixedText() );
 
-               // Currently unnecessary, code to act as a safeguard against any change in current behaviour 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() ) {
@@ -151,8 +147,4 @@ class ApiWatch extends ApiBase {
        public function getHelpUrls() {
                return 'https://www.mediawiki.org/wiki/API:Watch';
        }
-
-       public function getVersion() {
-               return __CLASS__ . ': $Id$';
-       }
 }