API: Minor cleanup for r59258, general whitespace cleanup
authorRoan Kattouw <catrope@users.mediawiki.org>
Wed, 2 Dec 2009 12:28:27 +0000 (12:28 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Wed, 2 Dec 2009 12:28:27 +0000 (12:28 +0000)
includes/api/ApiQueryInfo.php
includes/api/ApiUpload.php

index b43b215..7381679 100644 (file)
@@ -331,6 +331,7 @@ class ApiQueryInfo extends ApiQueryBase {
                // Get normal protections for existing titles
                if(count($this->titles))
                {
+                       $this->resetQueryParams();
                        $this->addTables(array('page_restrictions', 'page'));
                        $this->addWhere('page_id=pr_page');
                        $this->addFields(array('pr_page', 'pr_type', 'pr_level',
@@ -505,8 +506,8 @@ class ApiQueryInfo extends ApiQueryBase {
        }
 
        /**
-       * Get information about watched status and put it in $watched
-       */
+        * Get information about watched status and put it in $watched
+        */
        private function getWatchedInfo()
        {
                global $wgUser;
@@ -519,12 +520,15 @@ class ApiQueryInfo extends ApiQueryBase {
 
                $lb = new LinkBatch($this->titles);
 
+               $this->resetQueryParams();
                $this->addTables(array('page', 'watchlist'));
                $this->addFields(array('page_title', 'page_namespace'));
-               $this->addWhere($lb->constructSet('page', $db));
-               $this->addWhere('wl_title=page_title');
-               $this->addWhere('wl_namespace=page_namespace');
-               $this->addWhereFld('wl_user',  $wgUser->getID());
+               $this->addWhere(array(
+                       $lb->constructSet('page', $db),
+                       'wl_namespace=page_namespace',
+                       'wl_title=page_title',
+                       'wl_user' => $wgUser->getID()
+               ));
 
                $res = $this->select(__METHOD__);
 
index dbced92..4aac35e 100644 (file)
@@ -68,7 +68,7 @@ class ApiUpload extends ApiBase {
                         */
                        // Check the session key
                        if( !isset( $_SESSION['wsUploadData'][$this->mParams['sessionkey']] ) )
-                                       return $this->dieUsageMsg( array( 'invalid-session-key' ) );
+                               return $this->dieUsageMsg( array( 'invalid-session-key' ) );
                        
                        $this->mUpload = new UploadFromStash();
                        $this->mUpload->initialize( $this->mParams['filename'],
@@ -246,7 +246,7 @@ class ApiUpload extends ApiBase {
 
                // Append imageinfo to the result
                $imParam = ApiQueryImageInfo::getPropertyNames();
-        $result['imageinfo'] = ApiQueryImageInfo::getInfo( $file,
+               $result['imageinfo'] = ApiQueryImageInfo::getInfo( $file,
                                array_flip( $imParam ), $this->getResult() );
 
                return $result;
@@ -322,5 +322,3 @@ class ApiUpload extends ApiBase {
                return __CLASS__ . ': $Id: ApiUpload.php 51812 2009-06-12 23:45:20Z dale $';
        }
 }
-
-