Skip to content

Commit

Permalink
[4.0][webservice][com_installer] "list of installed extensions" webse…
Browse files Browse the repository at this point in the history
…rvice (#26765)
  • Loading branch information
stefanoel committed Jun 30, 2020
1 parent deb1e25 commit e00148e
Show file tree
Hide file tree
Showing 13 changed files with 142 additions and 119 deletions.
@@ -0,0 +1,2 @@
INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `manifest_cache`, `params`, `checked_out`, `checked_out_time`, `ordering`, `state`) VALUES
(0, 'plg_webservices_installer', 'plugin', 'installer', 'webservices', 0, 1, 1, 0, '', '{}', 0, NULL, 0, 0);
@@ -0,0 +1,2 @@
INSERT INTO "#__extensions" ("package_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "manifest_cache", "params", "checked_out", "checked_out_time", "ordering", "state") VALUES
(0, 'plg_webservices_installer', 'plugin', 'installer', 'webservices', 0, 1, 1, 0, '', '{}', 0, NULL, 0, 0);
Expand Up @@ -328,11 +328,11 @@ protected function getListQuery()
->where('state = 0');

// Process select filters.
$status = $this->getState('filter.status');
$status = $this->getState('filter.status', '');
$type = $this->getState('filter.type');
$clientId = $this->getState('filter.client_id');
$clientId = $this->getState('filter.client_id', '');
$folder = $this->getState('filter.folder');
$core = $this->getState('filter.core');
$core = $this->getState('filter.core', '');

if ($status !== '')
{
Expand Down Expand Up @@ -366,7 +366,7 @@ protected function getListQuery()
->bind(':clientid', $clientId, ParameterType::INTEGER);
}

if ($folder !== '')
if ($folder)
{
$folder = $folder === '*' ? '' : $folder;
$query->where($db->quoteName('folder') . ' = :folder')
Expand Down
7 changes: 7 additions & 0 deletions administrator/language/en-GB/plg_webservices_installer.ini
@@ -0,0 +1,7 @@
; Joomla! Project
; Copyright (C) 2005 - 2019 Open Source Matters. All rights reserved.
; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
; Note : All ini files need to be saved as UTF-8

PLG_WEBSERVICES_INSTALLER="Web Services - Installer"
PLG_WEBSERVICES_INSTALLER_XML_DESCRIPTION="Add installer routes to the API for your website."
@@ -0,0 +1,7 @@
; Joomla! Project
; Copyright (C) 2005 - 2019 Open Source Matters. All rights reserved.
; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
; Note : All ini files need to be saved as UTF-8

PLG_WEBSERVICES_INSTALLER="Web Services - Installer"
PLG_WEBSERVICES_INSTALLER_XML_DESCRIPTION="Add installer routes to the API for your website."
106 changes: 0 additions & 106 deletions api/components/com_installer/src/Controller/LanguagesController.php

This file was deleted.

38 changes: 38 additions & 0 deletions api/components/com_installer/src/Controller/ManageController.php
@@ -0,0 +1,38 @@
<?php
/**
* @package Joomla.API
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

namespace Joomla\Component\Installer\Api\Controller;

\defined('_JEXEC') or die;

use Joomla\CMS\MVC\Controller\ApiController;

/**
* The manage controller
*
* @since 4.0.0
*/
class ManageController extends ApiController
{
/**
* The content type of the item.
*
* @var string
* @since 4.0.0
*/
protected $contentType = 'manage';

/**
* The default view for the display method.
*
* @var string
* @since __DEPLOY_VERSION__
*/
protected $default_view = 'manage';
}
Expand Up @@ -3,25 +3,25 @@
* @package Joomla.API
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

namespace Joomla\Component\Installer\Api\View\Languages;
namespace Joomla\Component\Installer\Api\View\Manage;

\defined('_JEXEC') or die;

use Joomla\CMS\MVC\View\JsonApiView as BaseApiView;

/**
* The languages view
* The manage view
*
* @since 4.0.0
*/
class JsonapiView extends BaseApiView
{
/**
* The fields to render items in the documents
* The fields to render item in the documents
*
* @var array
* @since 4.0.0
Expand All @@ -31,8 +31,9 @@ class JsonapiView extends BaseApiView
'name',
'type',
'version',
'version',
'detailsurl',
'folder',
'status',
'client_id',
];

/**
Expand All @@ -46,9 +47,9 @@ class JsonapiView extends BaseApiView
*/
protected function prepareItem($item)
{
$item->id = $item->element;
unset($item->element);
$item->id = $item->extension_id;
unset($item->extension_id);

return parent::prepareItem($item);
return $item;
}
}
1 change: 1 addition & 0 deletions installation/sql/mysql/base.sql
Expand Up @@ -341,6 +341,7 @@ INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`,
(0, 'plg_webservices_config', 'plugin', 'config', 'webservices', 0, 1, 1, 0, 1, '', '{}', 0, 0),
(0, 'plg_webservices_contact', 'plugin', 'contact', 'webservices', 0, 1, 1, 0, 1, '', '{}', 0, 0),
(0, 'plg_webservices_content', 'plugin', 'content', 'webservices', 0, 1, 1, 0, 1, '', '{}', 0, 0),
(0, 'plg_webservices_installer', 'plugin', 'installer', 'webservices', 0, 1, 1, 0, 1, '', '{}', 0, 0),
(0, 'plg_webservices_languages', 'plugin', 'languages', 'webservices', 0, 1, 1, 0, 1, '', '{}', 0, 0),
(0, 'plg_webservices_menus', 'plugin', 'menus', 'webservices', 0, 1, 1, 0, 1, '', '{}', 0, 0),
(0, 'plg_webservices_messages', 'plugin', 'messages', 'webservices', 0, 1, 1, 0, 1, '', '{}', 0, 0),
Expand Down
1 change: 1 addition & 0 deletions installation/sql/postgresql/base.sql
Expand Up @@ -347,6 +347,7 @@ INSERT INTO "#__extensions" ("package_id", "name", "type", "element", "folder",
(0, 'plg_webservices_config', 'plugin', 'config', 'webservices', 0, 1, 1, 0, 1, '', '{}', 0, 0),
(0, 'plg_webservices_contact', 'plugin', 'contact', 'webservices', 0, 1, 1, 0, 1, '', '{}', 0, 0),
(0, 'plg_webservices_content', 'plugin', 'content', 'webservices', 0, 1, 1, 0, 1, '', '{}', 0, 0),
(0, 'plg_webservices_installer', 'plugin', 'installer', 'webservices', 0, 1, 1, 0, 1, '', '{}', 0, 0),
(0, 'plg_webservices_languages', 'plugin', 'languages', 'webservices', 0, 1, 1, 0, 1, '', '{}', 0, 0),
(0, 'plg_webservices_menus', 'plugin', 'menus', 'webservices', 0, 1, 1, 0, 1, '', '{}', 0, 0),
(0, 'plg_webservices_messages', 'plugin', 'messages', 'webservices', 0, 1, 1, 0, 1, '', '{}', 0, 0),
Expand Down
1 change: 1 addition & 0 deletions libraries/src/Extension/ExtensionHelper.php
Expand Up @@ -308,6 +308,7 @@ class ExtensionHelper
array('plugin', 'config', 'webservices', 0),
array('plugin', 'contact', 'webservices', 0),
array('plugin', 'content', 'webservices', 0),
array('plugin', 'installer', 'webservices', 0),
array('plugin', 'languages', 'webservices', 0),
array('plugin', 'menus', 'webservices', 0),
array('plugin', 'messages', 'webservices', 0),
Expand Down
50 changes: 50 additions & 0 deletions plugins/webservices/installer/installer.php
@@ -0,0 +1,50 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Webservices.Installer
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('_JEXEC') or die;

use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Router\ApiRouter;
use Joomla\Router\Route;

/**
* Web Services adapter for com_installer.
*
* @since 4.0.0
*/
class PlgWebservicesInstaller extends CMSPlugin
{
/**
* Load the language file on instantiation.
*
* @var boolean
* @since 4.0.0
*/
protected $autoloadLanguage = true;

/**
* Registers com_installer's API's routes in the application
*
* @param ApiRouter &$router The API Routing object
*
* @return void
*
* @since 4.0.0
*/
public function onBeforeApiRoute(&$router)
{
$defaults = ['component' => 'com_installer', 'public' => false];

$routes = [
new Route(['GET'], 'v1/installer/manage', 'manage.displayList', [], $defaults)
];

$router->addRoutes($routes);
}
}
19 changes: 19 additions & 0 deletions plugins/webservices/installer/installer.xml
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<extension version="4.0" type="plugin" group="webservices" method="upgrade">
<name>plg_webservices_installer</name>
<author>Joomla! Project</author>
<creationDate>October 2019</creationDate>
<copyright>(C) 2005 - 2019 Open Source Matters. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>4.0.0</version>
<description>PLG_WEBSERVICES_INSTALLER_XML_DESCRIPTION</description>
<files>
<filename plugin="installer">installer.php</filename>
</files>
<languages>
<language tag="en-GB">language/en-GB/plg_webservices_installer.ini</language>
<language tag="en-GB">language/en-GB/plg_webservices_installer.sys.ini</language>
</languages>
</extension>

0 comments on commit e00148e

Please sign in to comment.