Jdlrobson has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/196283

Change subject: Hygiene: Remove unused api module
......................................................................

Hygiene: Remove unused api module

This is confusing me lots! Let's get rid of it since it's not being
used.

Change-Id: Ic97683ae36344eb8b70f6ff423c7d6637722886e
---
M Gather.php
M extension.json
D includes/api/CollectionsListApi.php
3 files changed, 1 insertion(+), 110 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Gather 
refs/changes/83/196283/1

diff --git a/Gather.php b/Gather.php
index 31b8898..43061d4 100644
--- a/Gather.php
+++ b/Gather.php
@@ -67,7 +67,6 @@
 
        'Gather\api\ApiEditList' => 'api/ApiEditList',
        'Gather\api\ApiQueryLists' => 'api/ApiQueryLists',
-       'Gather\api\CollectionsListApi' => 'api/CollectionsListApi',
        'Gather\api\ApiQueryListPages' => 'api/ApiQueryListPages',
 
 );
@@ -93,7 +92,6 @@
 $wgHooks['LoadExtensionSchemaUpdates'][] = 
'Gather\UpdaterHooks::onLoadExtensionSchemaUpdates';
 
 // Api
-$wgAPIModules['gather'] = 'Gather\api\CollectionsListApi';
 $wgAPIModules['editlist'] = 'Gather\api\ApiEditList';
 $wgAPIListModules['lists'] = 'Gather\api\ApiQueryLists';
 $wgAPIListModules['listpages'] = 'Gather\api\ApiQueryListPages';
diff --git a/extension.json b/extension.json
index 209a1e9..ebc3750 100644
--- a/extension.json
+++ b/extension.json
@@ -15,9 +15,6 @@
        "SpecialPages": {
                "Gather": "Gather\\SpecialGather"
        },
-       "APIModules": {
-               "gather": "Gather\\api\\CollectionsListApi"
-       },
        "MessagesDirs": {
                "Gather": [
                        "i18n"
@@ -55,14 +52,12 @@
                "Gather\\views\\CollectionsListItemCard": 
"includes/views/CollectionsListItemCard.php",
                "Gather\\views\\helpers\\CSS": "includes/views/helpers/CSS.php",
                "Gather\\SpecialGather": "includes/specials/SpecialGather.php",
-               "Gather\\api\\CollectionsListApi": 
"includes/api/CollectionsListApi.php",
                "Gather\\api\\ApiEditList": "includes/api/ApiEditList.php",
                "Gather\\api\\ApiQueryLists": "includes/api/ApiQueryLists.php",
                "Gather\\api\\ApiQueryListPages": 
"includes/api/ApiQueryListPages.php"
        },
        "APIModules": {
-               "editlist": "Gather\\api\\ApiEditList",
-               "gather": "Gather\\api\\CollectionsListApi"
+               "editlist": "Gather\\api\\ApiEditList"
        },
        "APIListModules": {
                "lists": "Gather\\api\\ApiQueryLists",
diff --git a/includes/api/CollectionsListApi.php 
b/includes/api/CollectionsListApi.php
deleted file mode 100644
index b4d86a9..0000000
--- a/includes/api/CollectionsListApi.php
+++ /dev/null
@@ -1,102 +0,0 @@
-<?php
-
-/**
- * CollectionsListApi.php
- */
-
-namespace Gather\api;
-
-use Gather\stores;
-use Gather\models;
-use ApiBase;
-use User;
-
-// FIXME: ApiQueryGeneratorBase should be used here in future.
-class CollectionsListApi extends ApiBase {
-       /**
-        * Execute the requested api actions
-        */
-       public function execute() {
-               $this->getMain()->setCacheMode( 'anon-public-user-private' );
-               $params = $this->extractRequestParams();
-               $action = $params['gather'];
-
-               // Get the list of collections for a user
-               if ( $action === 'list' ) {
-                       // If an owner wasn't specified, then get the 
collections of the current user
-                       $owner = isset( $params['owner'] ) ?
-                               User::newFromName( $params['owner'] ) : 
$this->getUser();
-                       // If the name is invalid – it contains illegal 
characters then this'll return false
-                       if ( $owner !== false ) {
-                               $collections = $this->getCollectionsList( 
$owner );
-                               $res = array();
-                               foreach ( $collections as $collection ) {
-                                       $res[] = $collection->toArray();
-                               }
-                               $this->addResult( $res, 'collection' );
-                       }
-               }
-       }
-
-       /**
-        * Add a result to the response
-        * @param string $result result in json to add to the response
-        * @param string $tagName xml tagName in case it needs to be set
-        */
-       private function addResult( $result, $tagName = null ) {
-               $apiResult = $this->getResult();
-               if ( $tagName !== null ) {
-                       $apiResult->setIndexedTagName( $result, $tagName );
-                       $apiResult->setIndexedTagName_recursive( $result, 
$tagName );
-               }
-               $apiResult->addValue( null, $this->getModuleName(), $result );
-       }
-
-       /**
-        * Get the list of collections for a user
-        * @param User $owner Owner of the collections
-        * @return models\Collection[]
-        */
-       protected function getCollectionsList( $owner ) {
-               $ownsCollection = $this->getUser()->getName() === 
$owner->getName();
-               return stores\UserPageCollectionsList::newFromUser( $owner, 
$ownsCollection );
-       }
-
-       /**
-        * Returns usage examples for this module.
-        * @see ApiBase::getExamplesMessages()
-        * @todo Fill up examples
-        */
-       protected function getExamplesMessages() {
-               return array(
-                       'action=gather&owner=john' => 
'gather-apihelp-list-example-1',
-               );
-       }
-
-       /**
-        * Returns the help url for this API
-        * @return string
-        * @todo Add specific section for the api to Extension:Gather in mw.org
-        */
-       public function getHelpUrls() {
-               return 'https://www.mediawiki.org/wiki/Extension:Gather';
-       }
-
-       /**
-        * Get allowed API parameters
-        * @return array
-        */
-       public function getAllowedParams() {
-               return array(
-                       'gather' => array(
-                               ApiBase::PARAM_DFLT => 'list',
-                               ApiBase::PARAM_TYPE => array(
-                                       'list'
-                               )
-                       ),
-                       'owner' => array(
-                               ApiBase::PARAM_TYPE => 'user'
-                       )
-               );
-       }
-}

-- 
To view, visit https://gerrit.wikimedia.org/r/196283
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic97683ae36344eb8b70f6ff423c7d6637722886e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Gather
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <jrob...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to