diff --git a/administrator/components/com_admin/sql/updates/mysql/4.0.0-2017-06-03.sql b/administrator/components/com_admin/sql/updates/mysql/4.0.0-2017-06-03.sql
new file mode 100644
index 0000000000000..2166de7eb35be
--- /dev/null
+++ b/administrator/components/com_admin/sql/updates/mysql/4.0.0-2017-06-03.sql
@@ -0,0 +1,2 @@
+ALTER TABLE `#__extensions` ADD COLUMN `changelogurl` text AFTER `element`;
+ALTER TABLE `#__updates` ADD COLUMN `changelogurl` text AFTER `infourl`;
diff --git a/administrator/components/com_admin/sql/updates/postgresql/4.0.0-2017-06-03.sql b/administrator/components/com_admin/sql/updates/postgresql/4.0.0-2017-06-03.sql
new file mode 100644
index 0000000000000..01461657441e8
--- /dev/null
+++ b/administrator/components/com_admin/sql/updates/postgresql/4.0.0-2017-06-03.sql
@@ -0,0 +1,2 @@
+ALTER TABLE "#__extensions" ADD COLUMN "changelogurl" text AFTER "element";
+ALTER TABLE "#__updates" ADD COLUMN "changelogurl" text AFTER `infourl`;
diff --git a/administrator/components/com_installer/Controller/ManageController.php b/administrator/components/com_installer/Controller/ManageController.php
index 4dcc9a936bde9..1ec20d234a310 100644
--- a/administrator/components/com_installer/Controller/ManageController.php
+++ b/administrator/components/com_installer/Controller/ManageController.php
@@ -10,9 +10,14 @@
defined('_JEXEC') or die;
+use Joomla\CMS\Application\CMSApplication;
+use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\BaseController;
-use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
+use Joomla\CMS\Response\JsonResponse;
+use Joomla\CMS\Router\Route;
+use Joomla\CMS\Session\Session;
+use Joomla\Utilities\ArrayHelper;
/**
* Installer Manage Controller
@@ -45,12 +50,14 @@ public function __construct($config = array(), MVCFactoryInterface $factory = nu
*
* @return void
*
+ * @throws \Exception
+ *
* @since 1.6
*/
public function publish()
{
// Check for request forgeries.
- \JSession::checkToken() or jexit(\JText::_('JINVALID_TOKEN'));
+ Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
$ids = $this->input->get('cid', array(), 'array');
$values = array('publish' => 1, 'unpublish' => 0);
@@ -59,7 +66,7 @@ public function publish()
if (empty($ids))
{
- $this->setMessage(\JText::_('COM_INSTALLER_ERROR_NO_EXTENSIONS_SELECTED'), 'warning');
+ $this->setMessage(Text::_('COM_INSTALLER_ERROR_NO_EXTENSIONS_SELECTED'), 'warning');
}
else
{
@@ -82,11 +89,11 @@ public function publish()
$ntext = 'COM_INSTALLER_N_EXTENSIONS_UNPUBLISHED';
}
- $this->setMessage(\JText::plural($ntext, count($ids)));
+ $this->setMessage(Text::plural($ntext, count($ids)));
}
}
- $this->setRedirect(\JRoute::_('index.php?option=com_installer&view=manage', false));
+ $this->setRedirect(Route::_('index.php?option=com_installer&view=manage', false));
}
/**
@@ -94,12 +101,14 @@ public function publish()
*
* @return void
*
+ * @throws \Exception
+ *
* @since 1.5
*/
public function remove()
{
// Check for request forgeries.
- \JSession::checkToken() or jexit(\JText::_('JINVALID_TOKEN'));
+ Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
/* @var \Joomla\Component\Installer\Administrator\Model\ManageModel $model */
$model = $this->getModel('manage');
@@ -107,7 +116,7 @@ public function remove()
$eid = $this->input->get('cid', array(), 'array');
$eid = ArrayHelper::toInteger($eid, array());
$model->remove($eid);
- $this->setRedirect(\JRoute::_('index.php?option=com_installer&view=manage', false));
+ $this->setRedirect(Route::_('index.php?option=com_installer&view=manage', false));
}
/**
@@ -122,7 +131,7 @@ public function remove()
public function refresh()
{
// Check for request forgeries.
- \JSession::checkToken() or jexit(\JText::_('JINVALID_TOKEN'));
+ Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
/* @var \Joomla\Component\Installer\Administrator\Model\ManageModel $model */
$model = $this->getModel('manage');
@@ -130,6 +139,30 @@ public function refresh()
$uid = $this->input->get('cid', array(), 'array');
$uid = ArrayHelper::toInteger($uid, array());
$model->refresh($uid);
- $this->setRedirect(\JRoute::_('index.php?option=com_installer&view=manage', false));
+ $this->setRedirect(Route::_('index.php?option=com_installer&view=manage', false));
+ }
+
+ /**
+ * Load the changelog for a given extension.
+ *
+ * @return void
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ public function loadChangelog()
+ {
+ /* @var \Joomla\Component\Installer\Administrator\Model\ManageModel $model */
+ $model = $this->getModel('manage');
+
+ $eid = $this->input->get('eid', 0, 'int');
+
+ if (!$eid)
+ {
+ return;
+ }
+
+ $output = $model->loadChangelog($eid);
+
+ echo (new JsonResponse($output));
}
}
diff --git a/administrator/components/com_installer/Model/ManageModel.php b/administrator/components/com_installer/Model/ManageModel.php
index 8cea3bcdbe08e..cd8cb5911e627 100644
--- a/administrator/components/com_installer/Model/ManageModel.php
+++ b/administrator/components/com_installer/Model/ManageModel.php
@@ -10,7 +10,13 @@
defined('_JEXEC') or die;
+use Joomla\CMS\Factory;
+use Joomla\CMS\Http\HttpFactory;
+use Joomla\CMS\Installer\Installer;
+use Joomla\CMS\Language\Text;
+use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
+use Joomla\CMS\Table\Extension;
use Joomla\Component\Templates\Administrator\Table\StyleTable;
use Joomla\Database\DatabaseQuery;
@@ -59,11 +65,13 @@ public function __construct($config = array(), MVCFactoryInterface $factory = nu
*
* @return void
*
+ * @throws \Exception
+ *
* @since 1.6
*/
protected function populateState($ordering = 'name', $direction = 'asc')
{
- $app = \JFactory::getApplication();
+ $app = Factory::getApplication();
// Load the filter state.
$this->setState('filter.search', $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search', '', 'string'));
@@ -89,13 +97,15 @@ protected function populateState($ordering = 'name', $direction = 'asc')
*
* @return boolean True on success
*
+ * @throws \Exception
+ *
* @since 1.5
*/
public function publish(&$eid = array(), $value = 1)
{
- if (!\JFactory::getUser()->authorise('core.edit.state', 'com_installer'))
+ if (!Factory::getUser()->authorise('core.edit.state', 'com_installer'))
{
- \JFactory::getApplication()->enqueueMessage(\JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'), 'error');
+ Factory::getApplication()->enqueueMessage(Text::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'), 'error');
return false;
}
@@ -112,7 +122,7 @@ public function publish(&$eid = array(), $value = 1)
}
// Get a table object for the extension type
- $table = new \Joomla\CMS\Table\Extension($this->getDbo());
+ $table = new Extension($this->getDbo());
// Enable the extension in the table and store it in the database
foreach ($eid as $i => $id)
@@ -125,7 +135,7 @@ public function publish(&$eid = array(), $value = 1)
if ($style->load(array('template' => $table->element, 'client_id' => $table->client_id, 'home' => 1)))
{
- \JFactory::getApplication()->enqueueMessage(\JText::_('COM_INSTALLER_ERROR_DISABLE_DEFAULT_TEMPLATE_NOT_PERMITTED'), 'notice');
+ Factory::getApplication()->enqueueMessage(Text::_('COM_INSTALLER_ERROR_DISABLE_DEFAULT_TEMPLATE_NOT_PERMITTED'), 'notice');
unset($eid[$i]);
continue;
}
@@ -134,7 +144,7 @@ public function publish(&$eid = array(), $value = 1)
if ($table->protected == 1)
{
$result = false;
- \JFactory::getApplication()->enqueueMessage(\JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'), 'error');
+ Factory::getApplication()->enqueueMessage(Text::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'), 'error');
}
else
{
@@ -162,7 +172,7 @@ public function publish(&$eid = array(), $value = 1)
/**
* Refreshes the cached manifest information for an extension.
*
- * @param int $eid extension identifier (key in #__extensions)
+ * @param array|integer $eid extension identifier (key in #__extensions)
*
* @return boolean result of refresh
*
@@ -176,7 +186,7 @@ public function refresh($eid)
}
// Get an installer object for the extension type
- $installer = \JInstaller::getInstance();
+ $installer = Installer::getInstance();
$result = 0;
// Uninstall the chosen extensions
@@ -195,13 +205,15 @@ public function refresh($eid)
*
* @return boolean True on success
*
+ * @throws \Exception
+ *
* @since 1.5
*/
public function remove($eid = array())
{
- if (!\JFactory::getUser()->authorise('core.delete', 'com_installer'))
+ if (!Factory::getUser()->authorise('core.delete', 'com_installer'))
{
- \JFactory::getApplication()->enqueueMessage(\JText::_('JERROR_CORE_DELETE_NOT_PERMITTED'), 'error');
+ Factory::getApplication()->enqueueMessage(Text::_('JERROR_CORE_DELETE_NOT_PERMITTED'), 'error');
return false;
}
@@ -216,11 +228,11 @@ public function remove($eid = array())
}
// Get an installer object for the extension type
- $installer = \JInstaller::getInstance();
- $row = new \Joomla\CMS\Table\Extension($this->getDbo());
+ $installer = Installer::getInstance();
+ $row = new Extension($this->getDbo());
// Uninstall the chosen extensions
- $msgs = array();
+ $msgs = array();
$result = false;
foreach ($eid as $id)
@@ -230,7 +242,7 @@ public function remove($eid = array())
$result = false;
$langstring = 'COM_INSTALLER_TYPE_TYPE_' . strtoupper($row->type);
- $rowtype = \JText::_($langstring);
+ $rowtype = Text::_($langstring);
if (strpos($rowtype, $langstring) !== false)
{
@@ -245,24 +257,24 @@ public function remove($eid = array())
if ($result === false)
{
// There was an error in uninstalling the package
- $msgs[] = \JText::sprintf('COM_INSTALLER_UNINSTALL_ERROR', $rowtype);
+ $msgs[] = Text::sprintf('COM_INSTALLER_UNINSTALL_ERROR', $rowtype);
continue;
}
// Package uninstalled successfully
- $msgs[] = \JText::sprintf('COM_INSTALLER_UNINSTALL_SUCCESS', $rowtype);
+ $msgs[] = Text::sprintf('COM_INSTALLER_UNINSTALL_SUCCESS', $rowtype);
$result = true;
continue;
}
// There was an error in uninstalling the package
- $msgs[] = \JText::sprintf('COM_INSTALLER_UNINSTALL_ERROR', $rowtype);
+ $msgs[] = Text::sprintf('COM_INSTALLER_UNINSTALL_ERROR', $rowtype);
}
$msg = implode('
', $msgs);
- $app = \JFactory::getApplication();
+ $app = Factory::getApplication();
$app->enqueueMessage($msg);
$this->setState('action', 'remove');
$this->setState('name', $installer->get('name'));
@@ -371,4 +383,86 @@ protected function getListQuery()
return $query;
}
+
+ /**
+ * Load the changelog details for a given extension.
+ *
+ * @param integer $eid The extension ID
+ *
+ * @return string The output to show in the modal.
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ public function loadChangelog($eid)
+ {
+ // Get the changelog URL
+ $db = $this->getDbo();
+ $query = $db->getQuery(true)
+ ->select(
+ $db->quoteName(
+ array(
+ 'element',
+ 'type',
+ 'changelogurl'
+ )
+ )
+ )
+ ->from($db->quoteName('#__extensions'))
+ ->where($db->quoteName('extension_id') . ' = ' . (int) $eid);
+ $db->setQuery($query);
+
+ $extension = $db->loadObject();
+
+ if (!$extension->changelogurl)
+ {
+ return '';
+ }
+
+ // Get the changelog details
+ $http = HttpFactory::getHttp([], array('curl', 'stream'));
+ $result = $http->get($extension->changelogurl);
+
+ if ($result->code !== 200)
+ {
+ return '';
+ }
+
+ $xml = new \SimpleXMLElement($result->body);
+
+ // Check if there is a changelog section
+ if (!$xml->changelog)
+ {
+ return '';
+ }
+
+ // Get the changelog
+ $changelog = $xml->changelog;
+
+ // Validate the extension
+ if ((string) $changelog->element !== $extension->element && (string) $changelog->type !== $extension->type)
+ {
+ return '';
+ }
+
+ // Read all the entries
+ $entries = array(
+ 'security' => array(),
+ 'fix' => array(),
+ 'addition' => array(),
+ 'change' => array(),
+ 'removed' => array(),
+ 'language' => array(),
+ 'note' => array()
+ );
+
+ foreach ((array) $changelog->entries as $changeType => $item)
+ {
+ $entries[(string) $changeType] = array_values((array) $item->item);
+ }
+
+ $layout = new FileLayout('joomla.installer.changelog');
+ $output = $layout->render($entries);
+
+ return $output;
+ }
}
diff --git a/administrator/components/com_installer/tmpl/manage/default.php b/administrator/components/com_installer/tmpl/manage/default.php
index c8679430d13d3..a46961112caa2 100644
--- a/administrator/components/com_installer/tmpl/manage/default.php
+++ b/administrator/components/com_installer/tmpl/manage/default.php
@@ -9,13 +9,15 @@
defined('_JEXEC') or die;
-JHtml::_('behavior.multiselect');
+use Joomla\CMS\HTML\HTMLHelper;
+use Joomla\CMS\Language\Text;
+use Joomla\CMS\Router\Route;
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
?>
+
\ No newline at end of file
diff --git a/administrator/components/com_installer/tmpl/update/default.php b/administrator/components/com_installer/tmpl/update/default.php
index 9e1fabcaa2f60..230d9ecc329c5 100644
--- a/administrator/components/com_installer/tmpl/update/default.php
+++ b/administrator/components/com_installer/tmpl/update/default.php
@@ -9,13 +9,16 @@
defined('_JEXEC') or die;
-JHtml::_('behavior.multiselect');
+use Joomla\CMS\HTML\HTMLHelper;
+use Joomla\CMS\Language\Text;
+use Joomla\CMS\Layout\LayoutHelper;
+use Joomla\CMS\Router\Route;
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
?>
diff --git a/administrator/language/en-GB/en-GB.com_installer.ini b/administrator/language/en-GB/en-GB.com_installer.ini
index 15f448e06251f..b9d4541065596 100644
--- a/administrator/language/en-GB/en-GB.com_installer.ini
+++ b/administrator/language/en-GB/en-GB.com_installer.ini
@@ -6,6 +6,14 @@
COM_INSTALLER="Installer"
COM_INSTALLER_AUTHOR_INFORMATION="Author Information"
COM_INSTALLER_CACHETIMEOUT_LABEL="Updates Caching (in hours)"
+COM_INSTALLER_CHANGELOG="Changelog"
+COM_INSTALLER_CHANGELOG_ADDITION="New Features"
+COM_INSTALLER_CHANGELOG_CHANGE="Changes"
+COM_INSTALLER_CHANGELOG_FIX="Bug Fixes"
+COM_INSTALLER_CHANGELOG_LANGUAGE="Language"
+COM_INSTALLER_CHANGELOG_NOTE="Notes"
+COM_INSTALLER_CHANGELOG_REMOVED="Removed Features"
+COM_INSTALLER_CHANGELOG_SECURITY="Security Fixes"
COM_INSTALLER_CONFIGURATION="Installer: Options"
COM_INSTALLER_CONFIRM_UNINSTALL="Are you sure you want to uninstall? Confirming will permanently delete the selected item(s)!"
COM_INSTALLER_CURRENT_VERSION="Installed"
diff --git a/installation/sql/mysql/joomla.sql b/installation/sql/mysql/joomla.sql
index be4b8e9a19a07..4e8346926b127 100644
--- a/installation/sql/mysql/joomla.sql
+++ b/installation/sql/mysql/joomla.sql
@@ -480,6 +480,7 @@ CREATE TABLE IF NOT EXISTS `#__extensions` (
`name` varchar(100) NOT NULL,
`type` varchar(20) NOT NULL,
`element` varchar(100) NOT NULL,
+ `changelogurl` text,
`folder` varchar(100) NOT NULL,
`client_id` tinyint(3) NOT NULL,
`enabled` tinyint(3) NOT NULL DEFAULT 0,
@@ -1681,6 +1682,7 @@ CREATE TABLE IF NOT EXISTS `#__updates` (
`data` text NOT NULL,
`detailsurl` text NOT NULL,
`infourl` text NOT NULL,
+ `changelogurl` text,
`extra_query` varchar(1000) DEFAULT '',
PRIMARY KEY (`update_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci COMMENT='Available Updates';
diff --git a/installation/sql/postgresql/joomla.sql b/installation/sql/postgresql/joomla.sql
index dd27873d2895e..db77b0138e96c 100644
--- a/installation/sql/postgresql/joomla.sql
+++ b/installation/sql/postgresql/joomla.sql
@@ -493,6 +493,7 @@ CREATE TABLE IF NOT EXISTS "#__extensions" (
"name" varchar(100) NOT NULL,
"type" varchar(20) NOT NULL,
"element" varchar(100) NOT NULL,
+ "changelogurl" text,
"folder" varchar(100) NOT NULL,
"client_id" smallint NOT NULL,
"enabled" smallint DEFAULT 0 NOT NULL,
@@ -1688,6 +1689,7 @@ CREATE TABLE IF NOT EXISTS "#__updates" (
"data" text NOT NULL,
"detailsurl" text NOT NULL,
"infourl" text NOT NULL,
+ "changelogurl" text,
"extra_query" varchar(1000) DEFAULT '',
PRIMARY KEY ("update_id")
);
diff --git a/layouts/joomla/installer/changelog.php b/layouts/joomla/installer/changelog.php
new file mode 100644
index 0000000000000..4d65f8888c21b
--- /dev/null
+++ b/layouts/joomla/installer/changelog.php
@@ -0,0 +1,58 @@
+ $items)
+{
+ switch ($changeType)
+ {
+ case 'security':
+ $class = 'badge-danger';
+ break;
+ case 'fix':
+ $class = 'badge-dark';
+ break;
+ case 'language':
+ $class = 'badge-jlanguage';
+ break;
+ case 'addition':
+ $class = 'badge-success';
+ break;
+ case 'change':
+ $class = 'badge-warning';
+ break;
+ case 'removed':
+ $class = 'badge-light';
+ break;
+ default:
+ case 'note':
+ $class = 'badge-info';
+ break;
+ }
+
+ $output .= '';
+ $output .= '
' . Text::_('COM_INSTALLER_CHANGELOG_' . $changeType) . '
';
+ $output .= '
';
+
+ foreach ($items as $item)
+ {
+ $output .= '- ' . $item . '
';
+ }
+
+ $output .= '
';
+ $output .= '
';
+ $output .= '';
+}
+
+echo $output;
\ No newline at end of file
diff --git a/libraries/src/Installer/Adapter/ComponentAdapter.php b/libraries/src/Installer/Adapter/ComponentAdapter.php
index fb64fedd5ce7f..dbc52729da0e8 100644
--- a/libraries/src/Installer/Adapter/ComponentAdapter.php
+++ b/libraries/src/Installer/Adapter/ComponentAdapter.php
@@ -13,6 +13,8 @@
use Joomla\CMS\Application\ApplicationHelper;
use Joomla\CMS\Installer\Installer;
use Joomla\CMS\Installer\InstallerAdapter;
+use Joomla\CMS\Language\Text;
+use Joomla\CMS\Log\Log;
use Joomla\CMS\Table\Asset;
use Joomla\CMS\Table\Extension;
use Joomla\CMS\Table\Table;
@@ -587,11 +589,11 @@ public function prepareDiscoverInstall()
$db = $this->db;
$query = $db->getQuery(true)
- ->select($db->qn('extension_id'))
- ->from($db->qn('#__extensions'))
- ->where($db->qn('name') . ' = ' . $db->q($this->extension->name))
- ->where($db->qn('type') . ' = ' . $db->q($this->extension->type))
- ->where($db->qn('element') . ' = ' . $db->q($this->extension->element));
+ ->select($db->quoteName('extension_id'))
+ ->from($db->quoteName('#__extensions'))
+ ->where($db->quoteName('name') . ' = ' . $db->quote($this->extension->name))
+ ->where($db->quoteName('type') . ' = ' . $db->quote($this->extension->type))
+ ->where($db->quoteName('element') . ' = ' . $db->quote($this->extension->element));
$db->setQuery($query);
@@ -763,9 +765,10 @@ protected function storeExtension($deleteExisting = false)
}
// Add or update an entry to the extension table
- $this->extension->name = $this->name;
- $this->extension->type = 'component';
- $this->extension->element = $this->element;
+ $this->extension->name = $this->name;
+ $this->extension->type = 'component';
+ $this->extension->element = $this->element;
+ $this->extension->changelogurl = $this->changelogurl;
// If we are told to delete existing extension entries then do so.
if ($deleteExisting)
@@ -773,11 +776,11 @@ protected function storeExtension($deleteExisting = false)
$db = $this->parent->getDbo();
$query = $db->getQuery(true)
- ->select($db->qn('extension_id'))
- ->from($db->qn('#__extensions'))
- ->where($db->qn('name') . ' = ' . $db->q($this->extension->name))
- ->where($db->qn('type') . ' = ' . $db->q($this->extension->type))
- ->where($db->qn('element') . ' = ' . $db->q($this->extension->element));
+ ->select($db->quoteName('extension_id'))
+ ->from($db->quoteName('#__extensions'))
+ ->where($db->quoteName('name') . ' = ' . $db->quote($this->extension->name))
+ ->where($db->quoteName('type') . ' = ' . $db->quote($this->extension->type))
+ ->where($db->quoteName('element') . ' = ' . $db->quote($this->extension->element));
$db->setQuery($query);
@@ -819,7 +822,7 @@ protected function storeExtension($deleteExisting = false)
{
// Install failed, roll back changes
throw new \RuntimeException(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ABORT_COMP_INSTALL_ROLLBACK',
$this->extension->getError()
)
@@ -845,18 +848,27 @@ protected function storeExtension($deleteExisting = false)
protected function _buildAdminMenus($component_id = null)
{
$db = $this->parent->getDbo();
-
$option = $this->element;
// If a component exists with this option in the table within the protected menutype 'main' then we don't need to add menus
$query = $db->getQuery(true)
- ->select('m.id, e.extension_id')
- ->from('#__menu AS m')
- ->join('LEFT', '#__extensions AS e ON m.component_id = e.extension_id')
- ->where('m.parent_id = 1')
- ->where('m.client_id = 1')
- ->where('m.menutype = ' . $db->quote('main'))
- ->where('e.element = ' . $db->quote($option));
+ ->select(
+ $db->quoteName(
+ array(
+ 'm.id',
+ 'e.extension_id'
+ )
+ )
+ )
+ ->from($db->quoteName('#__menu', 'm'))
+ ->leftJoin(
+ $db->quoteName('#__extensions', 'e')
+ . ' ON ' . $db->quoteName('m.component_id') . ' = ' . $db->quoteName('e.extension_id')
+ )
+ ->where($db->quoteName('m.parent_id') . ' = 1')
+ ->where($db->quoteName('m.client_id') . ' = 1')
+ ->where($db->quoteName('m.menutype') . ' = ' . $db->quote('main'))
+ ->where($db->quoteName('e.element') . ' = ' . $db->quote($option));
$db->setQuery($query);
@@ -889,10 +901,10 @@ protected function _buildAdminMenus($component_id = null)
{
// Lets find the extension id
$query->clear()
- ->select('e.extension_id')
- ->from('#__extensions AS e')
- ->where('e.type = ' . $db->quote('component'))
- ->where('e.element = ' . $db->quote($option));
+ ->select($db->quoteName('e.extension_id'))
+ ->from($db->quoteName('#__extensions', 'e'))
+ ->where($db->quoteName('e.type') . ' = ' . $db->quote('component'))
+ ->where($db->quoteName('e.element') . ' = ' . $db->quote($option));
$db->setQuery($query);
$component_id = $db->loadResult();
@@ -919,37 +931,37 @@ protected function _buildAdminMenus($component_id = null)
if ($menuElement)
{
// I have a menu element, use this information
- $data['menutype'] = 'main';
- $data['client_id'] = 1;
- $data['title'] = (string) trim($menuElement);
- $data['alias'] = (string) $menuElement;
- $data['link'] = 'index.php?option=' . $option;
- $data['type'] = 'component';
- $data['published'] = 1;
- $data['parent_id'] = 1;
+ $data['menutype'] = 'main';
+ $data['client_id'] = 1;
+ $data['title'] = (string) trim($menuElement);
+ $data['alias'] = (string) $menuElement;
+ $data['link'] = 'index.php?option=' . $option;
+ $data['type'] = 'component';
+ $data['published'] = 1;
+ $data['parent_id'] = 1;
$data['component_id'] = $component_id;
- $data['img'] = ((string) $menuElement->attributes()->img) ?: 'class:component';
- $data['home'] = 0;
- $data['path'] = '';
- $data['params'] = '';
+ $data['img'] = ((string) $menuElement->attributes()->img) ?: 'class:component';
+ $data['home'] = 0;
+ $data['path'] = '';
+ $data['params'] = '';
}
else
{
// No menu element was specified, Let's make a generic menu item
- $data = array();
- $data['menutype'] = 'main';
- $data['client_id'] = 1;
- $data['title'] = $option;
- $data['alias'] = $option;
- $data['link'] = 'index.php?option=' . $option;
- $data['type'] = 'component';
- $data['published'] = 1;
- $data['parent_id'] = 1;
+ $data = array();
+ $data['menutype'] = 'main';
+ $data['client_id'] = 1;
+ $data['title'] = $option;
+ $data['alias'] = $option;
+ $data['link'] = 'index.php?option=' . $option;
+ $data['type'] = 'component';
+ $data['published'] = 1;
+ $data['parent_id'] = 1;
$data['component_id'] = $component_id;
- $data['img'] = 'class:component';
- $data['home'] = 0;
- $data['path'] = '';
- $data['params'] = '';
+ $data['img'] = 'class:component';
+ $data['home'] = 0;
+ $data['path'] = '';
+ $data['params'] = '';
}
// Try to create the menu item in the database
@@ -972,17 +984,17 @@ protected function _buildAdminMenus($component_id = null)
foreach ($this->getManifest()->administration->submenu->menu as $child)
{
- $data = array();
- $data['menutype'] = 'main';
- $data['client_id'] = 1;
- $data['title'] = (string) trim($child);
- $data['alias'] = (string) $child;
- $data['type'] = 'component';
- $data['published'] = 1;
- $data['parent_id'] = $parent_id;
+ $data = array();
+ $data['menutype'] = 'main';
+ $data['client_id'] = 1;
+ $data['title'] = (string) trim($child);
+ $data['alias'] = (string) $child;
+ $data['type'] = 'component';
+ $data['published'] = 1;
+ $data['parent_id'] = $parent_id;
$data['component_id'] = $component_id;
- $data['img'] = ((string) $child->attributes()->img) ?: 'class:component';
- $data['home'] = 0;
+ $data['img'] = ((string) $child->attributes()->img) ?: 'class:component';
+ $data['home'] = 0;
// Set the sub menu link
if ((string) $child->attributes()->link)
@@ -1023,7 +1035,7 @@ protected function _buildAdminMenus($component_id = null)
$request[] = 'sub=' . $child->attributes()->sub;
}
- $qstring = count($request) ? '&' . implode('&', $request) : '';
+ $qstring = count($request) ? '&' . implode('&', $request) : '';
$data['link'] = 'index.php?option=' . $option . $qstring;
}
@@ -1051,6 +1063,8 @@ protected function _buildAdminMenus($component_id = null)
*
* @return boolean True if successful.
*
+ * @throws \Exception
+ *
* @since 3.1
*/
protected function _removeAdminMenus($id)
@@ -1062,16 +1076,15 @@ protected function _removeAdminMenus($id)
// Get the ids of the menu items
$query = $db->getQuery(true)
- ->select('id')
- ->from('#__menu')
+ ->select($db->quoteName('id'))
+ ->from($db->quoteName('#__menu'))
->where($db->quoteName('client_id') . ' = 1')
- ->where($db->quoteName('menutype') . ' = ' . $db->q('main'))
+ ->where($db->quoteName('menutype') . ' = ' . $db->quote('main'))
->where($db->quoteName('component_id') . ' = ' . (int) $id);
$db->setQuery($query);
- $ids = $db->loadColumn();
-
+ $ids = $db->loadColumn();
$result = true;
// Check for error
@@ -1128,12 +1141,12 @@ protected function _updateMenus($component_id, $clientId = null)
// Update all menu items which contain 'index.php?option=com_extension' or 'index.php?option=com_extension&...'
// to use the new component id.
$query = $db->getQuery(true)
- ->update('#__menu')
- ->set('component_id = ' . $db->quote($component_id))
- ->where('type = ' . $db->quote('component'))
+ ->update($db->quoteName('#__menu'))
+ ->set($db->quoteName('component_id') . ' = ' . $db->quote($component_id))
+ ->where($db->quoteName('type') . ' = ' . $db->quote('component'))
->where('('
- . 'link LIKE ' . $db->quote('index.php?option=' . $option) . ' OR '
- . 'link LIKE ' . $db->q($db->escape('index.php?option=' . $option . '&') . '%', false)
+ . $db->quoteName('link') . ' LIKE ' . $db->quote('index.php?option=' . $option) . ' OR '
+ . $db->quoteName('link') . ' LIKE ' . $db->quote($db->escape('index.php?option=' . $option . '&') . '%', false)
. ')');
if (isset($clientId))
@@ -1163,6 +1176,8 @@ protected function _updateMenus($component_id, $clientId = null)
*
* @return boolean True on success
*
+ * @throws \Exception
+ *
* @since 3.1
*/
protected function _rollback_menu($step)
@@ -1179,8 +1194,8 @@ protected function _rollback_menu($step)
*/
public function discover()
{
- $results = array();
- $site_components = \JFolder::folders(JPATH_SITE . '/components');
+ $results = array();
+ $site_components = \JFolder::folders(JPATH_SITE . '/components');
$admin_components = \JFolder::folders(JPATH_ADMINISTRATOR . '/components');
foreach ($site_components as $component)
@@ -1239,16 +1254,16 @@ public function discover()
public function refreshManifestCache()
{
// Need to find to find where the XML file is since we don't store this normally
- $client = ApplicationHelper::getClientInfo($this->parent->extension->client_id);
- $short_element = str_replace('com_', '', $this->parent->extension->element);
- $manifestPath = $client->path . '/components/' . $this->parent->extension->element . '/' . $short_element . '.xml';
+ $client = ApplicationHelper::getClientInfo($this->parent->extension->client_id);
+ $short_element = str_replace('com_', '', $this->parent->extension->element);
+ $manifestPath = $client->path . '/components/' . $this->parent->extension->element . '/' . $short_element . '.xml';
$this->parent->manifest = $this->parent->isManifest($manifestPath);
$this->parent->setPath('manifest', $manifestPath);
- $manifest_details = Installer::parseXMLInstallFile($this->parent->getPath('manifest'));
+ $manifest_details = Installer::parseXMLInstallFile($this->parent->getPath('manifest'));
$this->parent->extension->manifest_cache = json_encode($manifest_details);
- $this->parent->extension->name = $manifest_details['name'];
- $this->parent->extension->namespace = $manifest_details['namespace'];
+ $this->parent->extension->name = $manifest_details['name'];
+ $this->parent->extension->namespace = $manifest_details['namespace'];
try
{
@@ -1256,7 +1271,7 @@ public function refreshManifestCache()
}
catch (\RuntimeException $e)
{
- \JLog::add(\JText::_('JLIB_INSTALLER_ERROR_COMP_REFRESH_MANIFEST_CACHE'), \JLog::WARNING, 'jerror');
+ Log::add(Text::_('JLIB_INSTALLER_ERROR_COMP_REFRESH_MANIFEST_CACHE'), Log::WARNING, 'jerror');
return false;
}
@@ -1269,6 +1284,10 @@ public function refreshManifestCache()
* @param integer $parentId The parent menu item ID
*
* @return bool|int Menu item ID on success, false on failure
+ *
+ * @throws \Exception
+ *
+ * @since 3.1
*/
protected function _createAdminMenuItem(array &$data, $parentId)
{
@@ -1294,12 +1313,12 @@ protected function _createAdminMenuItem(array &$data, $parentId)
$query = $db->getQuery(true)
->select('id')
->from('#__menu')
- ->where('menutype = ' . $db->q($data['menutype']))
+ ->where('menutype = ' . $db->quote($data['menutype']))
->where('client_id = 1')
- ->where('link = ' . $db->q($data['link']))
- ->where('type = ' . $db->q($data['type']))
- ->where('parent_id = ' . $db->q($data['parent_id']))
- ->where('home = ' . $db->q($data['home']));
+ ->where('link = ' . $db->quote($data['link']))
+ ->where('type = ' . $db->quote($data['type']))
+ ->where('parent_id = ' . $db->quote($data['parent_id']))
+ ->where('home = ' . $db->quote($data['home']));
$db->setQuery($query);
$menu_id = $db->loadResult();
diff --git a/libraries/src/Installer/Adapter/FileAdapter.php b/libraries/src/Installer/Adapter/FileAdapter.php
index 6d93b2a16aacc..4a0541056cfff 100644
--- a/libraries/src/Installer/Adapter/FileAdapter.php
+++ b/libraries/src/Installer/Adapter/FileAdapter.php
@@ -12,6 +12,8 @@
use Joomla\CMS\Installer\Installer;
use Joomla\CMS\Installer\InstallerAdapter;
+use Joomla\CMS\Language\Text;
+use Joomla\CMS\Log\Log;
use Joomla\CMS\Table\Table;
\JLoader::import('joomla.filesystem.folder');
@@ -62,7 +64,7 @@ protected function copyBaseFiles()
if (!$created = \JFolder::create($folder))
{
throw new \RuntimeException(
- \JText::sprintf('JLIB_INSTALLER_ABORT_FILE_INSTALL_FAIL_SOURCE_DIRECTORY', $folder)
+ Text::sprintf('JLIB_INSTALLER_ABORT_FILE_INSTALL_FAIL_SOURCE_DIRECTORY', $folder)
);
}
@@ -112,7 +114,7 @@ protected function finaliseInstall()
if (!$this->parent->copyFiles(array($manifest), true))
{
// Install failed, rollback changes
- throw new \RuntimeException(\JText::_('JLIB_INSTALLER_ABORT_FILE_INSTALL_COPY_SETUP'));
+ throw new \RuntimeException(Text::_('JLIB_INSTALLER_ABORT_FILE_INSTALL_COPY_SETUP'));
}
// If there is a manifest script, let's copy it.
@@ -133,9 +135,9 @@ protected function finaliseInstall()
{
// Install failed, rollback changes
throw new \RuntimeException(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ABORT_MANIFEST',
- \JText::_('JLIB_INSTALLER_' . strtoupper($this->route))
+ Text::_('JLIB_INSTALLER_' . strtoupper($this->route))
)
);
}
@@ -338,7 +340,7 @@ protected function setupUninstall()
// Remove this row entry since its invalid
$this->extension->delete($this->extension->extension_id);
- throw new \RuntimeException(\JText::_('JLIB_INSTALLER_ERROR_FILE_UNINSTALL_INVALID_NOTFOUND_MANIFEST'));
+ throw new \RuntimeException(Text::_('JLIB_INSTALLER_ERROR_FILE_UNINSTALL_INVALID_NOTFOUND_MANIFEST'));
}
// Set the files root path
@@ -352,13 +354,13 @@ protected function setupUninstall()
// If we cannot load the XML file return null
if (!$xml)
{
- throw new \RuntimeException(\JText::_('JLIB_INSTALLER_ERROR_FILE_UNINSTALL_LOAD_MANIFEST'));
+ throw new \RuntimeException(Text::_('JLIB_INSTALLER_ERROR_FILE_UNINSTALL_LOAD_MANIFEST'));
}
// Check for a valid XML root tag.
if ($xml->getName() != 'extension')
{
- throw new \RuntimeException(\JText::_('JLIB_INSTALLER_ERROR_FILE_UNINSTALL_INVALID_MANIFEST'));
+ throw new \RuntimeException(Text::_('JLIB_INSTALLER_ERROR_FILE_UNINSTALL_INVALID_MANIFEST'));
}
$this->setManifest($xml);
@@ -392,9 +394,9 @@ protected function storeExtension()
{
// Install failed, roll back changes
throw new \RuntimeException(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ABORT_ROLLBACK',
- \JText::_('JLIB_INSTALLER_' . strtoupper($this->route)),
+ Text::_('JLIB_INSTALLER_' . strtoupper($this->route)),
$this->extension->getError()
)
);
@@ -403,9 +405,10 @@ protected function storeExtension()
else
{
// Add an entry to the extension table with a whole heap of defaults
- $this->extension->name = $this->name;
- $this->extension->type = 'file';
- $this->extension->element = $this->element;
+ $this->extension->name = $this->name;
+ $this->extension->type = 'file';
+ $this->extension->element = $this->element;
+ $this->extension->changelogurl = $this->changelogurl;
// There is no folder for files so leave it blank
$this->extension->folder = '';
@@ -422,9 +425,9 @@ protected function storeExtension()
{
// Install failed, roll back changes
throw new \RuntimeException(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ABORT_ROLLBACK',
- \JText::_('JLIB_INSTALLER_' . strtoupper($this->route)),
+ Text::_('JLIB_INSTALLER_' . strtoupper($this->route)),
$this->extension->getError()
)
);
@@ -529,7 +532,7 @@ protected function populateFilesAndFolderList()
// Check if source folder exists
if (!\JFolder::exists($sourceFolder))
{
- \JLog::add(\JText::sprintf('JLIB_INSTALLER_ABORT_FILE_INSTALL_FAIL_SOURCE_DIRECTORY', $sourceFolder), \JLog::WARNING, 'jerror');
+ Log::add(Text::sprintf('JLIB_INSTALLER_ABORT_FILE_INSTALL_FAIL_SOURCE_DIRECTORY', $sourceFolder), Log::WARNING, 'jerror');
// If installation fails, rollback
$this->parent->abort();
@@ -596,7 +599,7 @@ public function refreshManifestCache()
}
catch (\RuntimeException $e)
{
- \JLog::add(\JText::_('JLIB_INSTALLER_ERROR_PACK_REFRESH_MANIFEST_CACHE'), \JLog::WARNING, 'jerror');
+ Log::add(Text::_('JLIB_INSTALLER_ERROR_PACK_REFRESH_MANIFEST_CACHE'), Log::WARNING, 'jerror');
return false;
}
diff --git a/libraries/src/Installer/Adapter/LanguageAdapter.php b/libraries/src/Installer/Adapter/LanguageAdapter.php
index 0b3031db048a7..87569f4a19799 100644
--- a/libraries/src/Installer/Adapter/LanguageAdapter.php
+++ b/libraries/src/Installer/Adapter/LanguageAdapter.php
@@ -16,6 +16,8 @@
use Joomla\CMS\Installer\InstallerAdapter;
use Joomla\CMS\Language\Language;
use Joomla\CMS\Language\LanguageHelper;
+use Joomla\CMS\Language\Text;
+use Joomla\CMS\Log\Log;
use Joomla\CMS\Table\Table;
use Joomla\CMS\Table\Update;
use Joomla\Registry\Registry;
@@ -158,7 +160,7 @@ protected function finaliseUninstall(): bool
if (!empty($count))
{
- \JLog::add(\JText::plural('JLIB_INSTALLER_NOTICE_LANG_RESET_USERS', $count), \JLog::NOTICE, 'jerror');
+ Log::add(Text::plural('JLIB_INSTALLER_NOTICE_LANG_RESET_USERS', $count), Log::NOTICE, 'jerror');
}
// Remove the extension table entry
@@ -185,7 +187,7 @@ protected function removeExtensionFiles()
if (!\JFolder::delete($path))
{
// If deleting failed we'll leave the extension entry in tact just in case
- \JLog::add(\JText::_('JLIB_INSTALLER_ERROR_LANG_UNINSTALL_DIRECTORY'), \JLog::WARNING, 'jerror');
+ Log::add(Text::_('JLIB_INSTALLER_ERROR_LANG_UNINSTALL_DIRECTORY'), Log::WARNING, 'jerror');
$this->ignoreUninstallQueries = true;
}
@@ -218,7 +220,7 @@ protected function setupUninstall()
// Check the element isn't blank to prevent nuking the languages directory...just in case
if (empty($this->extension->element))
{
- throw new \RuntimeException(\JText::_('JLIB_INSTALLER_ERROR_LANG_UNINSTALL_ELEMENT_EMPTY'));
+ throw new \RuntimeException(Text::_('JLIB_INSTALLER_ERROR_LANG_UNINSTALL_ELEMENT_EMPTY'));
}
// Verify that it's not the default language for that client
@@ -226,7 +228,7 @@ protected function setupUninstall()
if ($params->get($client->name) === $this->extension->element)
{
- throw new \RuntimeException(\JText::_('JLIB_INSTALLER_ERROR_LANG_UNINSTALL_DEFAULT'));
+ throw new \RuntimeException(Text::_('JLIB_INSTALLER_ERROR_LANG_UNINSTALL_DEFAULT'));
}
// Construct the path from the client, the language and the extension element name
@@ -241,7 +243,7 @@ protected function setupUninstall()
// If the folder doesn't exist lets just nuke the row as well and presume the user killed it for us
$this->extension->delete();
- throw new \RuntimeException(\JText::_('JLIB_INSTALLER_ERROR_LANG_UNINSTALL_PATH_EMPTY'));
+ throw new \RuntimeException(Text::_('JLIB_INSTALLER_ERROR_LANG_UNINSTALL_PATH_EMPTY'));
}
// We do findManifest to avoid problem when uninstalling a list of extension: getManifest cache its manifest file
@@ -296,7 +298,7 @@ public function install()
if ($client === null)
{
- $this->parent->abort(\JText::sprintf('JLIB_INSTALLER_ABORT', \JText::sprintf('JLIB_INSTALLER_ERROR_UNKNOWN_CLIENT_TYPE', $cname)));
+ $this->parent->abort(Text::sprintf('JLIB_INSTALLER_ABORT', Text::sprintf('JLIB_INSTALLER_ERROR_UNKNOWN_CLIENT_TYPE', $cname)));
return false;
}
@@ -345,7 +347,7 @@ protected function _install($cname, $basePath, $clientId, &$element)
// Check if we found the tag - if we didn't, we may be trying to install from an older language package
if (!$tag)
{
- $this->parent->abort(\JText::sprintf('JLIB_INSTALLER_ABORT', \JText::_('JLIB_INSTALLER_ERROR_NO_LANGUAGE_TAG')));
+ $this->parent->abort(Text::sprintf('JLIB_INSTALLER_ABORT', Text::_('JLIB_INSTALLER_ERROR_NO_LANGUAGE_TAG')));
return false;
}
@@ -379,9 +381,9 @@ protected function _install($cname, $basePath, $clientId, &$element)
{
$this->parent
->abort(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ABORT',
- \JText::sprintf('JLIB_INSTALLER_ERROR_CREATE_FOLDER_FAILED', $this->parent->getPath('extension_site'))
+ Text::sprintf('JLIB_INSTALLER_ERROR_CREATE_FOLDER_FAILED', $this->parent->getPath('extension_site'))
)
);
@@ -406,19 +408,19 @@ protected function _install($cname, $basePath, $clientId, &$element)
if (file_exists($this->parent->getPath('extension_site')))
{
// If the site exists say so.
- \JLog::add(
- \JText::sprintf('JLIB_INSTALLER_ABORT', \JText::sprintf('JLIB_INSTALLER_ERROR_FOLDER_IN_USE', $this->parent->getPath('extension_site'))),
- \JLog::WARNING, 'jerror'
+ Log::add(
+ Text::sprintf('JLIB_INSTALLER_ABORT', Text::sprintf('JLIB_INSTALLER_ERROR_FOLDER_IN_USE', $this->parent->getPath('extension_site'))),
+ Log::WARNING, 'jerror'
);
}
else
{
// If the admin exists say so.
- \JLog::add(
- \JText::sprintf('JLIB_INSTALLER_ABORT',
- \JText::sprintf('JLIB_INSTALLER_ERROR_FOLDER_IN_USE', $this->parent->getPath('extension_administrator'))
+ Log::add(
+ Text::sprintf('JLIB_INSTALLER_ABORT',
+ Text::sprintf('JLIB_INSTALLER_ERROR_FOLDER_IN_USE', $this->parent->getPath('extension_administrator'))
),
- \JLog::WARNING, 'jerror'
+ Log::WARNING, 'jerror'
);
}
@@ -467,7 +469,7 @@ protected function _install($cname, $basePath, $clientId, &$element)
if ($description)
{
- $this->parent->set('message', \JText::_($description));
+ $this->parent->set('message', Text::_($description));
}
else
{
@@ -479,6 +481,7 @@ protected function _install($cname, $basePath, $clientId, &$element)
$row->set('name', $this->name);
$row->set('type', 'language');
$row->set('element', $this->tag);
+ $row->set('changelogurl', (string) $this->getManifest()->changelogurl);
// There is no folder for languages
$row->set('folder', '');
@@ -492,7 +495,7 @@ protected function _install($cname, $basePath, $clientId, &$element)
if (!$row->check() || !$row->store())
{
// Install failed, roll back changes
- $this->parent->abort(\JText::sprintf('JLIB_INSTALLER_ABORT', $row->getError()));
+ $this->parent->abort(Text::sprintf('JLIB_INSTALLER_ABORT', $row->getError()));
return false;
}
@@ -561,9 +564,9 @@ protected function _install($cname, $basePath, $clientId, &$element)
if (!$tableLanguage->bind($languageData) || !$tableLanguage->check() || !$tableLanguage->store() || !$tableLanguage->reorder())
{
- \JLog::add(
- \JText::sprintf('JLIB_INSTALLER_WARNING_UNABLE_TO_INSTALL_CONTENT_LANGUAGE', $siteLanguageManifest['name'], $tableLanguage->getError()),
- \JLog::NOTICE,
+ Log::add(
+ Text::sprintf('JLIB_INSTALLER_WARNING_UNABLE_TO_INSTALL_CONTENT_LANGUAGE', $siteLanguageManifest['name'], $tableLanguage->getError()),
+ Log::NOTICE,
'jerror'
);
}
@@ -646,7 +649,7 @@ public function update()
if ($client === null || (empty($cname) && $cname !== 0))
{
- $this->parent->abort(\JText::sprintf('JLIB_INSTALLER_ABORT', \JText::sprintf('JLIB_INSTALLER_ERROR_UNKNOWN_CLIENT_TYPE', $cname)));
+ $this->parent->abort(Text::sprintf('JLIB_INSTALLER_ABORT', Text::sprintf('JLIB_INSTALLER_ERROR_UNKNOWN_CLIENT_TYPE', $cname)));
return false;
}
@@ -666,7 +669,7 @@ public function update()
// Check if we found the tag - if we didn't, we may be trying to install from an older language package
if (!$tag)
{
- $this->parent->abort(\JText::sprintf('JLIB_INSTALLER_ABORT', \JText::_('JLIB_INSTALLER_ERROR_NO_LANGUAGE_TAG')));
+ $this->parent->abort(Text::sprintf('JLIB_INSTALLER_ABORT', Text::_('JLIB_INSTALLER_ERROR_NO_LANGUAGE_TAG')));
return false;
}
@@ -758,6 +761,7 @@ public function update()
$row->set('type', 'language');
$row->set('element', $this->tag);
$row->set('manifest_cache', $this->parent->generateManifestCache());
+ $row->set('changelogurl', (string) $this->getManifest()->changelogurl);
// Clean installed languages cache.
\JFactory::getCache()->clean('com_languages');
@@ -765,7 +769,7 @@ public function update()
if (!$row->check() || !$row->store())
{
// Install failed, roll back changes
- $this->parent->abort(\JText::sprintf('JLIB_INSTALLER_ABORT', $row->getError()));
+ $this->parent->abort(Text::sprintf('JLIB_INSTALLER_ABORT', $row->getError()));
return false;
}
@@ -783,8 +787,8 @@ public function update()
*/
public function discover()
{
- $results = array();
- $site_languages = \JFolder::folders(JPATH_SITE . '/language');
+ $results = array();
+ $site_languages = \JFolder::folders(JPATH_SITE . '/language');
$admin_languages = \JFolder::folders(JPATH_ADMINISTRATOR . '/language');
foreach ($site_languages as $language)
@@ -837,18 +841,18 @@ public function discover()
public function discover_install()
{
// Need to find to find where the XML file is since we don't store this normally
- $client = ApplicationHelper::getClientInfo($this->parent->extension->client_id);
- $short_element = $this->parent->extension->element;
- $manifestPath = $client->path . '/language/' . $short_element . '/' . $short_element . '.xml';
+ $client = ApplicationHelper::getClientInfo($this->parent->extension->client_id);
+ $short_element = $this->parent->extension->element;
+ $manifestPath = $client->path . '/language/' . $short_element . '/' . $short_element . '.xml';
$this->parent->manifest = $this->parent->isManifest($manifestPath);
$this->parent->setPath('manifest', $manifestPath);
$this->parent->setPath('source', $client->path . '/language/' . $short_element);
$this->parent->setPath('extension_root', $this->parent->getPath('source'));
- $manifest_details = Installer::parseXMLInstallFile($this->parent->getPath('manifest'));
+ $manifest_details = Installer::parseXMLInstallFile($this->parent->getPath('manifest'));
$this->parent->extension->manifest_cache = json_encode($manifest_details);
- $this->parent->extension->state = 0;
- $this->parent->extension->name = $manifest_details['name'];
- $this->parent->extension->enabled = 1;
+ $this->parent->extension->state = 0;
+ $this->parent->extension->name = $manifest_details['name'];
+ $this->parent->extension->enabled = 1;
// @todo remove code: $this->parent->extension->params = $this->parent->getParams();
try
@@ -858,7 +862,7 @@ public function discover_install()
}
catch (\RuntimeException $e)
{
- \JLog::add(\JText::_('JLIB_INSTALLER_ERROR_LANG_DISCOVER_STORE_DETAILS'), \JLog::WARNING, 'jerror');
+ Log::add(Text::_('JLIB_INSTALLER_ERROR_LANG_DISCOVER_STORE_DETAILS'), Log::WARNING, 'jerror');
return false;
}
@@ -878,23 +882,21 @@ public function discover_install()
*/
public function refreshManifestCache()
{
- $client = ApplicationHelper::getClientInfo($this->parent->extension->client_id);
- $manifestPath = $client->path . '/language/' . $this->parent->extension->element . '/' . $this->parent->extension->element . '.xml';
+ $client = ApplicationHelper::getClientInfo($this->parent->extension->client_id);
+ $manifestPath = $client->path . '/language/' . $this->parent->extension->element . '/' . $this->parent->extension->element . '.xml';
$this->parent->manifest = $this->parent->isManifest($manifestPath);
$this->parent->setPath('manifest', $manifestPath);
- $manifest_details = Installer::parseXMLInstallFile($this->parent->getPath('manifest'));
+ $manifest_details = Installer::parseXMLInstallFile($this->parent->getPath('manifest'));
$this->parent->extension->manifest_cache = json_encode($manifest_details);
- $this->parent->extension->name = $manifest_details['name'];
+ $this->parent->extension->name = $manifest_details['name'];
if ($this->parent->extension->store())
{
return true;
}
- else
- {
- \JLog::add(\JText::_('JLIB_INSTALLER_ERROR_MOD_REFRESH_MANIFEST_CACHE'), \JLog::WARNING, 'jerror');
- return false;
- }
+ Log::add(Text::_('JLIB_INSTALLER_ERROR_MOD_REFRESH_MANIFEST_CACHE'), Log::WARNING, 'jerror');
+
+ return false;
}
}
diff --git a/libraries/src/Installer/Adapter/LibraryAdapter.php b/libraries/src/Installer/Adapter/LibraryAdapter.php
index 0b3ebe3502db2..c2c2c9cecbd12 100644
--- a/libraries/src/Installer/Adapter/LibraryAdapter.php
+++ b/libraries/src/Installer/Adapter/LibraryAdapter.php
@@ -10,9 +10,14 @@
defined('JPATH_PLATFORM') or die;
+use Joomla\CMS\Filesystem\File;
+use Joomla\CMS\Filesystem\Path;
+use Joomla\CMS\Filter\InputFilter;
use Joomla\CMS\Installer\Installer;
use Joomla\CMS\Installer\InstallerAdapter;
use Joomla\CMS\Installer\Manifest\LibraryManifest;
+use Joomla\CMS\Language\Text;
+use Joomla\CMS\Log\Log;
use Joomla\CMS\Table\Table;
use Joomla\CMS\Table\Update;
@@ -55,7 +60,7 @@ protected function checkExtensionInFilesystem()
else
{
// Abort the install, no upgrade possible
- throw new \RuntimeException(\JText::_('JLIB_INSTALLER_ABORT_LIB_INSTALL_ALREADY_INSTALLED'));
+ throw new \RuntimeException(Text::_('JLIB_INSTALLER_ABORT_LIB_INSTALL_ALREADY_INSTALLED'));
}
}
}
@@ -72,7 +77,7 @@ protected function copyBaseFiles()
{
if ($this->parent->parseFiles($this->getManifest()->files, -1) === false)
{
- throw new \RuntimeException(\JText::_('JLIB_INSTALLER_ABORT_LIB_COPY_FILES'));
+ throw new \RuntimeException(Text::_('JLIB_INSTALLER_ABORT_LIB_COPY_FILES'));
}
}
@@ -89,10 +94,10 @@ protected function finaliseInstall()
// Clobber any possible pending updates
/** @var Update $update */
$update = Table::getInstance('update');
- $uid = $update->find(
+ $uid = $update->find(
array(
'element' => $this->element,
- 'type' => $this->type,
+ 'type' => $this->type,
)
);
@@ -104,20 +109,20 @@ protected function finaliseInstall()
// Lastly, we will copy the manifest file to its appropriate place.
if ($this->route !== 'discover_install')
{
- $manifest = array();
- $manifest['src'] = $this->parent->getPath('manifest');
+ $manifest = array();
+ $manifest['src'] = $this->parent->getPath('manifest');
$manifest['dest'] = JPATH_MANIFESTS . '/libraries/' . basename($this->parent->getPath('manifest'));
if (!$this->parent->copyFiles(array($manifest), true))
{
// Install failed, rollback changes
- throw new \RuntimeException(\JText::_('JLIB_INSTALLER_ABORT_LIB_INSTALL_COPY_SETUP'));
+ throw new \RuntimeException(Text::_('JLIB_INSTALLER_ABORT_LIB_INSTALL_COPY_SETUP'));
}
// If there is a manifest script, let's copy it.
if ($this->manifest_script)
{
- $path['src'] = $this->parent->getPath('source') . '/' . $this->manifest_script;
+ $path['src'] = $this->parent->getPath('source') . '/' . $this->manifest_script;
$path['dest'] = $this->parent->getPath('extension_root') . '/' . $this->manifest_script;
if ($this->parent->isOverwrite() || !file_exists($path['dest']))
@@ -126,9 +131,9 @@ protected function finaliseInstall()
{
// Install failed, rollback changes
throw new \RuntimeException(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ABORT_MANIFEST',
- \JText::_('JLIB_INSTALLER_' . strtoupper($this->route))
+ Text::_('JLIB_INSTALLER_' . strtoupper($this->route))
)
);
}
@@ -151,10 +156,9 @@ protected function finaliseUninstall(): bool
// Remove the schema version
$query = $db->getQuery(true)
- ->delete('#__schemas')
- ->where('extension_id = ' . $this->extension->extension_id);
- $db->setQuery($query);
- $db->execute();
+ ->delete($db->quoteName('#__schemas'))
+ ->where($db->quoteName('extension_id') . ' = ' . (int) $this->extension->extension_id);
+ $db->setQuery($query)->execute();
// Clobber any possible pending updates
$update = Table::getInstance('update');
@@ -188,7 +192,7 @@ public function getElement($element = null)
{
if (!$element)
{
- $manifestPath = \JPath::clean($this->parent->getPath('manifest'));
+ $manifestPath = Path::clean($this->parent->getPath('manifest'));
$element = preg_replace('/\.xml/', '', basename($manifestPath));
}
@@ -213,9 +217,9 @@ public function loadLanguage($path = null)
$this->parent->setPath('source', JPATH_PLATFORM . '/' . $this->getElement());
}
- $extension = 'lib_' . $this->getElement();
+ $extension = 'lib_' . $this->getElement();
$librarypath = (string) $this->getManifest()->libraryname;
- $source = $path ?: JPATH_PLATFORM . '/' . $librarypath;
+ $source = $path ?: JPATH_PLATFORM . '/' . $librarypath;
$this->doLoadLanguage($extension, $source, JPATH_SITE);
}
@@ -242,7 +246,7 @@ protected function parseOptionalTags()
*/
public function prepareDiscoverInstall()
{
- $manifestPath = JPATH_MANIFESTS . '/libraries/' . $this->extension->element . '.xml';
+ $manifestPath = JPATH_MANIFESTS . '/libraries/' . $this->extension->element . '.xml';
$this->parent->manifest = $this->parent->isManifest($manifestPath);
$this->parent->setPath('manifest', $manifestPath);
$this->setManifest($this->parent->getManifest());
@@ -294,7 +298,7 @@ protected function setupInstallPaths()
if (!$group)
{
- throw new \RuntimeException(\JText::_('JLIB_INSTALLER_ABORT_LIB_INSTALL_NOFILE'));
+ throw new \RuntimeException(Text::_('JLIB_INSTALLER_ABORT_LIB_INSTALL_NOFILE'));
}
$this->parent->setPath('extension_root', JPATH_PLATFORM . '/' . implode(DIRECTORY_SEPARATOR, explode('/', $group)));
@@ -317,7 +321,7 @@ protected function setupUninstall()
// Remove this row entry since its invalid
$this->extension->delete($this->extension->extension_id);
- throw new \RuntimeException(\JText::_('JLIB_INSTALLER_ERROR_LIB_UNINSTALL_INVALID_NOTFOUND_MANIFEST'));
+ throw new \RuntimeException(Text::_('JLIB_INSTALLER_ERROR_LIB_UNINSTALL_INVALID_NOTFOUND_MANIFEST'));
}
$manifest = new LibraryManifest($manifestFile);
@@ -333,13 +337,13 @@ protected function setupUninstall()
// If we cannot load the XML file return null
if (!$xml)
{
- throw new \RuntimeException(\JText::_('JLIB_INSTALLER_ERROR_LIB_UNINSTALL_LOAD_MANIFEST'));
+ throw new \RuntimeException(Text::_('JLIB_INSTALLER_ERROR_LIB_UNINSTALL_LOAD_MANIFEST'));
}
// Check for a valid XML root tag.
if ($xml->getName() !== 'extension')
{
- throw new \RuntimeException(\JText::_('JLIB_INSTALLER_ERROR_LIB_UNINSTALL_INVALID_MANIFEST'));
+ throw new \RuntimeException(Text::_('JLIB_INSTALLER_ERROR_LIB_UNINSTALL_INVALID_MANIFEST'));
}
$this->setManifest($xml);
@@ -364,23 +368,24 @@ protected function storeExtension()
$manifest_details = Installer::parseXMLInstallFile($this->parent->getPath('manifest'));
$this->extension->manifest_cache = json_encode($manifest_details);
- $this->extension->state = 0;
- $this->extension->name = $manifest_details['name'];
- $this->extension->enabled = 1;
- $this->extension->params = $this->parent->getParams();
+ $this->extension->state = 0;
+ $this->extension->name = $manifest_details['name'];
+ $this->extension->enabled = 1;
+ $this->extension->params = $this->parent->getParams();
if (!$this->extension->store())
{
// Install failed, roll back changes
- throw new \RuntimeException(\JText::_('JLIB_INSTALLER_ERROR_LIB_DISCOVER_STORE_DETAILS'));
+ throw new \RuntimeException(Text::_('JLIB_INSTALLER_ERROR_LIB_DISCOVER_STORE_DETAILS'));
}
return;
}
- $this->extension->name = $this->name;
- $this->extension->type = 'library';
- $this->extension->element = $this->element;
+ $this->extension->name = $this->name;
+ $this->extension->type = 'library';
+ $this->extension->element = $this->element;
+ $this->extension->changelogurl = $this->changelogurl;
// There is no folder for libraries
$this->extension->folder = '';
@@ -397,7 +402,7 @@ protected function storeExtension()
{
// Install failed, roll back changes
throw new \RuntimeException(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ABORT_LIB_INSTALL_ROLLBACK',
$this->extension->getError()
)
@@ -436,8 +441,8 @@ public function update()
*/
// Set the extensions name
- $name = (string) $this->getManifest()->name;
- $name = \JFilterInput::getInstance()->clean($name, 'string');
+ $name = (string) $this->getManifest()->name;
+ $name = InputFilter::getInstance()->clean($name, 'string');
$element = str_replace('.xml', '', basename($this->parent->getPath('manifest')));
$this->name = $name;
@@ -445,8 +450,8 @@ public function update()
// We don't want to compromise this instance!
$installer = new Installer;
- $db = $this->parent->getDbo();
- $query = $db->getQuery(true)
+ $db = $this->parent->getDbo();
+ $query = $db->getQuery(true)
->select($db->quoteName('extension_id'))
->from($db->quoteName('#__extensions'))
->where($db->quoteName('type') . ' = ' . $db->quote('library'))
@@ -462,7 +467,7 @@ public function update()
// Clear the cached data
$this->currentExtensionId = null;
- $this->extension = Table::getInstance('Extension', 'JTable', array('dbo' => $this->db));
+ $this->extension = Table::getInstance('Extension', 'JTable', array('dbo' => $this->db));
}
// Now create the new files
@@ -484,8 +489,8 @@ public function discover()
foreach ($file_list as $file)
{
$manifest_details = Installer::parseXMLInstallFile(JPATH_MANIFESTS . '/libraries/' . $file);
- $file = \JFile::stripExt($file);
- $extension = Table::getInstance('extension');
+ $file = File::stripExt($file);
+ $extension = Table::getInstance('extension');
$extension->set('type', 'library');
$extension->set('client_id', 0);
$extension->set('element', $file);
@@ -510,13 +515,13 @@ public function discover()
public function refreshManifestCache()
{
// Need to find to find where the XML file is since we don't store this normally
- $manifestPath = JPATH_MANIFESTS . '/libraries/' . $this->parent->extension->element . '.xml';
+ $manifestPath = JPATH_MANIFESTS . '/libraries/' . $this->parent->extension->element . '.xml';
$this->parent->manifest = $this->parent->isManifest($manifestPath);
$this->parent->setPath('manifest', $manifestPath);
- $manifest_details = Installer::parseXMLInstallFile($this->parent->getPath('manifest'));
+ $manifest_details = Installer::parseXMLInstallFile($this->parent->getPath('manifest'));
$this->parent->extension->manifest_cache = json_encode($manifest_details);
- $this->parent->extension->name = $manifest_details['name'];
+ $this->parent->extension->name = $manifest_details['name'];
try
{
@@ -524,7 +529,7 @@ public function refreshManifestCache()
}
catch (\RuntimeException $e)
{
- \JLog::add(\JText::_('JLIB_INSTALLER_ERROR_LIB_REFRESH_MANIFEST_CACHE'), \JLog::WARNING, 'jerror');
+ Log::add(Text::_('JLIB_INSTALLER_ERROR_LIB_REFRESH_MANIFEST_CACHE'), Log::WARNING, 'jerror');
return false;
}
diff --git a/libraries/src/Installer/Adapter/ModuleAdapter.php b/libraries/src/Installer/Adapter/ModuleAdapter.php
index 035520836d5d2..677af341dd388 100644
--- a/libraries/src/Installer/Adapter/ModuleAdapter.php
+++ b/libraries/src/Installer/Adapter/ModuleAdapter.php
@@ -13,6 +13,8 @@
use Joomla\CMS\Application\ApplicationHelper;
use Joomla\CMS\Installer\Installer;
use Joomla\CMS\Installer\InstallerAdapter;
+use Joomla\CMS\Language\Text;
+use Joomla\CMS\Log\Log;
use Joomla\CMS\Table\Table;
use Joomla\Utilities\ArrayHelper;
@@ -65,9 +67,9 @@ protected function checkExistingExtension()
{
// Install failed, roll back changes
throw new \RuntimeException(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ABORT_ROLLBACK',
- \JText::_('JLIB_INSTALLER_' . $this->route),
+ Text::_('JLIB_INSTALLER_' . $this->route),
$e->getMessage()
),
$e->getCode(),
@@ -89,7 +91,7 @@ protected function copyBaseFiles()
// Copy all necessary files
if ($this->parent->parseFiles($this->getManifest()->files, -1) === false)
{
- throw new \RuntimeException(\JText::_('JLIB_INSTALLER_ABORT_MOD_COPY_FILES'));
+ throw new \RuntimeException(Text::_('JLIB_INSTALLER_ABORT_MOD_COPY_FILES'));
}
// If there is a manifest script, let's copy it.
@@ -103,7 +105,7 @@ protected function copyBaseFiles()
if (!$this->parent->copyFiles(array($path)))
{
// Install failed, rollback changes
- throw new \RuntimeException(\JText::_('JLIB_INSTALLER_ABORT_MOD_INSTALL_MANIFEST'));
+ throw new \RuntimeException(Text::_('JLIB_INSTALLER_ABORT_MOD_INSTALL_MANIFEST'));
}
}
}
@@ -196,7 +198,7 @@ protected function finaliseInstall()
if (!$this->parent->copyManifest(-1))
{
// Install failed, rollback changes
- throw new \RuntimeException(\JText::_('JLIB_INSTALLER_ABORT_MOD_INSTALL_COPY_SETUP'));
+ throw new \RuntimeException(Text::_('JLIB_INSTALLER_ABORT_MOD_INSTALL_COPY_SETUP'));
}
}
}
@@ -257,7 +259,7 @@ protected function finaliseUninstall(): bool
}
catch (\RuntimeException $e)
{
- \JLog::add(\JText::sprintf('JLIB_INSTALLER_ERROR_MOD_UNINSTALL_EXCEPTION', $e->getMessage()), \JLog::WARNING, 'jerror');
+ Log::add(Text::sprintf('JLIB_INSTALLER_ERROR_MOD_UNINSTALL_EXCEPTION', $e->getMessage()), Log::WARNING, 'jerror');
$retval = false;
}
@@ -271,7 +273,7 @@ protected function finaliseUninstall(): bool
if (!$module->delete())
{
- \JLog::add(\JText::sprintf('JLIB_INSTALLER_ERROR_MOD_UNINSTALL_EXCEPTION', $module->getError()), \JLog::WARNING, 'jerror');
+ Log::add(Text::sprintf('JLIB_INSTALLER_ERROR_MOD_UNINSTALL_EXCEPTION', $module->getError()), Log::WARNING, 'jerror');
$retval = false;
}
}
@@ -430,7 +432,7 @@ public function refreshManifestCache()
}
else
{
- \JLog::add(\JText::_('JLIB_INSTALLER_ERROR_MOD_REFRESH_MANIFEST_CACHE'), \JLog::WARNING, 'jerror');
+ Log::add(Text::_('JLIB_INSTALLER_ERROR_MOD_REFRESH_MANIFEST_CACHE'), Log::WARNING, 'jerror');
return false;
}
@@ -471,9 +473,9 @@ protected function setupInstallPaths()
if ($client === false)
{
throw new \RuntimeException(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ABORT_MOD_UNKNOWN_CLIENT',
- \JText::_('JLIB_INSTALLER_' . $this->route),
+ Text::_('JLIB_INSTALLER_' . $this->route),
$client->name
)
);
@@ -493,9 +495,9 @@ protected function setupInstallPaths()
if (empty($this->element))
{
throw new \RuntimeException(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ABORT_MOD_INSTALL_NOFILE',
- \JText::_('JLIB_INSTALLER_' . $this->route)
+ Text::_('JLIB_INSTALLER_' . $this->route)
)
);
}
@@ -519,7 +521,7 @@ protected function setupUninstall()
if ($client === false)
{
throw new \RuntimeException(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ERROR_MOD_UNINSTALL_UNKNOWN_CLIENT',
$this->extension->client_id
)
@@ -563,7 +565,7 @@ protected function storeExtension()
if (!$this->extension->store())
{
// Install failed, roll back changes
- throw new \RuntimeException(\JText::_('JLIB_INSTALLER_ERROR_MOD_DISCOVER_STORE_DETAILS'));
+ throw new \RuntimeException(Text::_('JLIB_INSTALLER_ERROR_MOD_DISCOVER_STORE_DETAILS'));
}
return;
@@ -576,9 +578,9 @@ protected function storeExtension()
{
// Install failed, roll back changes
throw new \RuntimeException(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ABORT_MOD_INSTALL_ALLREADY_EXISTS',
- \JText::_('JLIB_INSTALLER_' . $this->route),
+ Text::_('JLIB_INSTALLER_' . $this->route),
$this->name
)
);
@@ -600,9 +602,9 @@ protected function storeExtension()
{
// Install failed, roll back changes
throw new \RuntimeException(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ABORT_MOD_ROLLBACK',
- \JText::_('JLIB_INSTALLER_' . $this->route),
+ Text::_('JLIB_INSTALLER_' . $this->route),
$this->extension->getError()
)
);
@@ -610,10 +612,11 @@ protected function storeExtension()
}
else
{
- $this->extension->name = $this->name;
- $this->extension->type = 'module';
- $this->extension->element = $this->element;
- $this->extension->namespace = (string) $this->manifest->namespace;
+ $this->extension->name = $this->name;
+ $this->extension->type = 'module';
+ $this->extension->element = $this->element;
+ $this->extension->namespace = (string) $this->manifest->namespace;
+ $this->extension->changelogurl = $this->changelogurl;
// There is no folder for modules
$this->extension->folder = '';
@@ -630,9 +633,9 @@ protected function storeExtension()
{
// Install failed, roll back changes
throw new \RuntimeException(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ABORT_MOD_ROLLBACK',
- \JText::_('JLIB_INSTALLER_' . $this->route),
+ Text::_('JLIB_INSTALLER_' . $this->route),
$this->extension->getError()
)
);
@@ -648,7 +651,7 @@ protected function storeExtension()
);
// Create unpublished module
- $name = preg_replace('#[\*?]#', '', \JText::_($this->name));
+ $name = preg_replace('#[\*?]#', '', Text::_($this->name));
/** @var \JTableModule $module */
$module = Table::getInstance('module');
diff --git a/libraries/src/Installer/Adapter/PackageAdapter.php b/libraries/src/Installer/Adapter/PackageAdapter.php
index e27936796663f..bd551c4cf51a0 100644
--- a/libraries/src/Installer/Adapter/PackageAdapter.php
+++ b/libraries/src/Installer/Adapter/PackageAdapter.php
@@ -15,6 +15,8 @@
use Joomla\CMS\Installer\InstallerAdapter;
use Joomla\CMS\Installer\InstallerHelper;
use Joomla\CMS\Installer\Manifest\PackageManifest;
+use Joomla\CMS\Language\Text;
+use Joomla\CMS\Log\Log;
use Joomla\CMS\Table\Table;
use Joomla\CMS\Table\Update;
use Joomla\Event\Event;
@@ -86,9 +88,9 @@ protected function checkExtensionInFilesystem()
{
// We didn't have overwrite set, find an update function or find an update tag so lets call it safe
throw new \RuntimeException(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ABORT_DIRECTORY',
- \JText::_('JLIB_INSTALLER_' . $this->route),
+ Text::_('JLIB_INSTALLER_' . $this->route),
$this->type,
$this->parent->getPath('extension_root')
)
@@ -119,8 +121,8 @@ protected function copyBaseFiles()
if (!count($this->getManifest()->files->children()))
{
throw new \RuntimeException(
- \JText::sprintf('JLIB_INSTALLER_ABORT_PACK_INSTALL_NO_FILES',
- \JText::_('JLIB_INSTALLER_' . strtoupper($this->route))
+ Text::sprintf('JLIB_INSTALLER_ABORT_PACK_INSTALL_NO_FILES',
+ Text::_('JLIB_INSTALLER_' . strtoupper($this->route))
)
);
}
@@ -156,9 +158,9 @@ protected function copyBaseFiles()
if (!$installResult)
{
throw new \RuntimeException(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ABORT_PACK_INSTALL_ERROR_EXTENSION',
- \JText::_('JLIB_INSTALLER_' . strtoupper($this->route)),
+ Text::_('JLIB_INSTALLER_' . strtoupper($this->route)),
basename($file)
)
);
@@ -227,7 +229,7 @@ protected function finaliseInstall()
}
catch (\JDatabaseExceptionExecuting $e)
{
- \JLog::add(\JText::_('JLIB_INSTALLER_ERROR_PACK_SETTING_PACKAGE_ID'), \JLog::WARNING, 'jerror');
+ Log::add(Text::_('JLIB_INSTALLER_ERROR_PACK_SETTING_PACKAGE_ID'), Log::WARNING, 'jerror');
}
}
@@ -240,9 +242,9 @@ protected function finaliseInstall()
{
// Install failed, rollback changes
throw new \RuntimeException(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ABORT_PACK_INSTALL_COPY_SETUP',
- \JText::_('JLIB_INSTALLER_ABORT_PACK_INSTALL_NO_FILES')
+ Text::_('JLIB_INSTALLER_ABORT_PACK_INSTALL_NO_FILES')
)
);
}
@@ -256,9 +258,9 @@ protected function finaliseInstall()
if (!\JFolder::create($this->parent->getPath('extension_root')))
{
throw new \RuntimeException(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ABORT_CREATE_DIRECTORY',
- \JText::_('JLIB_INSTALLER_' . $this->route),
+ Text::_('JLIB_INSTALLER_' . $this->route),
$this->parent->getPath('extension_root')
)
);
@@ -286,7 +288,7 @@ protected function finaliseInstall()
if (!$this->parent->copyFiles(array($path)))
{
// Install failed, rollback changes
- throw new \RuntimeException(\JText::_('JLIB_INSTALLER_ABORT_PACKAGE_INSTALL_MANIFEST'));
+ throw new \RuntimeException(Text::_('JLIB_INSTALLER_ABORT_PACKAGE_INSTALL_MANIFEST'));
}
}
}
@@ -429,12 +431,12 @@ protected function removeExtensionFiles()
if (!$tmpInstaller->uninstall($extension->type, $id))
{
$error = true;
- \JLog::add(\JText::sprintf('JLIB_INSTALLER_ERROR_PACK_UNINSTALL_NOT_PROPER', basename($extension->filename)), \JLog::WARNING, 'jerror');
+ Log::add(Text::sprintf('JLIB_INSTALLER_ERROR_PACK_UNINSTALL_NOT_PROPER', basename($extension->filename)), Log::WARNING, 'jerror');
}
}
else
{
- \JLog::add(\JText::_('JLIB_INSTALLER_ERROR_PACK_UNINSTALL_UNKNOWN_EXTENSION'), \JLog::WARNING, 'jerror');
+ Log::add(Text::_('JLIB_INSTALLER_ERROR_PACK_UNINSTALL_UNKNOWN_EXTENSION'), Log::WARNING, 'jerror');
}
}
@@ -444,7 +446,7 @@ protected function removeExtensionFiles()
// Clean up manifest file after we're done if there were no errors
if ($error)
{
- throw new \RuntimeException(\JText::_('JLIB_INSTALLER_ERROR_PACK_UNINSTALL_MANIFEST_NOT_REMOVED'));
+ throw new \RuntimeException(Text::_('JLIB_INSTALLER_ERROR_PACK_UNINSTALL_MANIFEST_NOT_REMOVED'));
}
}
@@ -463,9 +465,9 @@ protected function setupInstallPaths()
if (empty($packagepath))
{
throw new \RuntimeException(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ABORT_PACK_INSTALL_NO_PACK',
- \JText::_('JLIB_INSTALLER_' . strtoupper($this->route))
+ Text::_('JLIB_INSTALLER_' . strtoupper($this->route))
)
);
}
@@ -494,20 +496,20 @@ protected function setupUninstall()
// Because packages may not have their own folders we cannot use the standard method of finding an installation manifest
if (!file_exists($manifestFile))
{
- throw new \RuntimeException(\JText::_('JLIB_INSTALLER_ERROR_PACK_UNINSTALL_MISSINGMANIFEST'));
+ throw new \RuntimeException(Text::_('JLIB_INSTALLER_ERROR_PACK_UNINSTALL_MISSINGMANIFEST'));
}
$xml = simplexml_load_file($manifestFile);
if (!$xml)
{
- throw new \RuntimeException(\JText::_('JLIB_INSTALLER_ERROR_PACK_UNINSTALL_LOAD_MANIFEST'));
+ throw new \RuntimeException(Text::_('JLIB_INSTALLER_ERROR_PACK_UNINSTALL_LOAD_MANIFEST'));
}
// Check for a valid XML root tag.
if ($xml->getName() !== 'extension')
{
- throw new \RuntimeException(\JText::_('JLIB_INSTALLER_ERROR_PACK_UNINSTALL_INVALID_MANIFEST'));
+ throw new \RuntimeException(Text::_('JLIB_INSTALLER_ERROR_PACK_UNINSTALL_INVALID_MANIFEST'));
}
$this->setManifest($xml);
@@ -532,9 +534,9 @@ protected function storeExtension()
{
// Install failed, roll back changes
throw new \RuntimeException(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ABORT_ALREADY_EXISTS',
- \JText::_('JLIB_INSTALLER_' . $this->route),
+ Text::_('JLIB_INSTALLER_' . $this->route),
$this->name
)
);
@@ -545,9 +547,10 @@ protected function storeExtension()
}
else
{
- $this->extension->name = $this->name;
- $this->extension->type = 'package';
- $this->extension->element = $this->element;
+ $this->extension->name = $this->name;
+ $this->extension->type = 'package';
+ $this->extension->element = $this->element;
+ $this->extension->changelogurl = $this->changelogurl;
// There is no folder for packages
$this->extension->folder = '';
@@ -565,7 +568,7 @@ protected function storeExtension()
{
// Install failed, roll back changes
throw new \RuntimeException(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ABORT_PACK_INSTALL_ROLLBACK',
$this->extension->getError()
)
@@ -601,9 +604,9 @@ protected function triggerManifestScript($method)
{
// The script failed, rollback changes
throw new \RuntimeException(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ABORT_INSTALL_CUSTOM_INSTALL_FAILURE',
- \JText::_('JLIB_INSTALLER_' . $this->route)
+ Text::_('JLIB_INSTALLER_' . $this->route)
)
);
}
@@ -626,9 +629,9 @@ protected function triggerManifestScript($method)
{
// The script failed, rollback changes
throw new \RuntimeException(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ABORT_INSTALL_CUSTOM_INSTALL_FAILURE',
- \JText::_('JLIB_INSTALLER_' . $this->route)
+ Text::_('JLIB_INSTALLER_' . $this->route)
)
);
}
@@ -667,10 +670,10 @@ protected function _getExtensionId($type, $id, $client, $group)
$db = $this->parent->getDbo();
$query = $db->getQuery(true)
- ->select('extension_id')
- ->from('#__extensions')
- ->where('type = ' . $db->quote($type))
- ->where('element = ' . $db->quote($id));
+ ->select($db->quoteName('extension_id'))
+ ->from($db->quoteName('#__extensions'))
+ ->where($db->quoteName('type') . ' = ' . $db->quote($type))
+ ->where($db->quoteName('element') . ' = ' . $db->quote($id));
switch ($type)
{
@@ -727,7 +730,7 @@ public function refreshManifestCache()
}
catch (\RuntimeException $e)
{
- \JLog::add(\JText::_('JLIB_INSTALLER_ERROR_PACK_REFRESH_MANIFEST_CACHE'), \JLog::WARNING, 'jerror');
+ Log::add(Text::_('JLIB_INSTALLER_ERROR_PACK_REFRESH_MANIFEST_CACHE'), Log::WARNING, 'jerror');
return false;
}
diff --git a/libraries/src/Installer/Adapter/PluginAdapter.php b/libraries/src/Installer/Adapter/PluginAdapter.php
index 4421e966cde95..a0128cc41bd85 100644
--- a/libraries/src/Installer/Adapter/PluginAdapter.php
+++ b/libraries/src/Installer/Adapter/PluginAdapter.php
@@ -13,6 +13,8 @@
use Joomla\CMS\Application\ApplicationHelper;
use Joomla\CMS\Installer\Installer;
use Joomla\CMS\Installer\InstallerAdapter;
+use Joomla\CMS\Language\Text;
+use Joomla\CMS\Log\Log;
use Joomla\CMS\Table\Table;
use Joomla\CMS\Table\Update;
@@ -61,9 +63,9 @@ protected function checkExistingExtension()
{
// Install failed, roll back changes
throw new \RuntimeException(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ABORT_ROLLBACK',
- \JText::_('JLIB_INSTALLER_' . $this->route),
+ Text::_('JLIB_INSTALLER_' . $this->route),
$e->getMessage()
),
$e->getCode(),
@@ -86,9 +88,9 @@ protected function copyBaseFiles()
if ($this->parent->parseFiles($this->getManifest()->files, -1, $this->oldFiles) === false)
{
throw new \RuntimeException(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ABORT_PLG_COPY_FILES',
- \JText::_('JLIB_INSTALLER_' . $this->route)
+ Text::_('JLIB_INSTALLER_' . $this->route)
)
);
}
@@ -105,9 +107,9 @@ protected function copyBaseFiles()
{
// Install failed, rollback changes
throw new \RuntimeException(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ABORT_PLG_INSTALL_MANIFEST',
- \JText::_('JLIB_INSTALLER_' . $this->route)
+ Text::_('JLIB_INSTALLER_' . $this->route)
)
);
}
@@ -178,9 +180,9 @@ protected function finaliseInstall()
{
// Install failed, rollback changes
throw new \RuntimeException(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ABORT_PLG_INSTALL_COPY_SETUP',
- \JText::_('JLIB_INSTALLER_' . $this->route)
+ Text::_('JLIB_INSTALLER_' . $this->route)
)
);
}
@@ -201,10 +203,9 @@ protected function finaliseUninstall(): bool
// Remove the schema version
$query = $db->getQuery(true)
- ->delete('#__schemas')
- ->where('extension_id = ' . $this->extension->extension_id);
- $db->setQuery($query);
- $db->execute();
+ ->delete($db->quoteName('#__schemas'))
+ ->where($db->quoteName('extension_id') . ' = ' . $this->extension->extension_id);
+ $db->setQuery($query)->execute();
// Now we will no longer need the plugin object, so let's delete it
$this->extension->delete($this->extension->extension_id);
@@ -382,9 +383,9 @@ protected function setupInstallPaths()
if (empty($this->element) && empty($this->group))
{
throw new \RuntimeException(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ABORT_PLG_INSTALL_NO_FILE',
- \JText::_('JLIB_INSTALLER_' . $this->route)
+ Text::_('JLIB_INSTALLER_' . $this->route)
)
);
}
@@ -404,7 +405,7 @@ protected function setupUninstall()
// Get the plugin folder so we can properly build the plugin path
if (trim($this->extension->folder) === '')
{
- throw new \RuntimeException(\JText::_('JLIB_INSTALLER_ERROR_PLG_UNINSTALL_FOLDER_FIELD_EMPTY'));
+ throw new \RuntimeException(Text::_('JLIB_INSTALLER_ERROR_PLG_UNINSTALL_FOLDER_FIELD_EMPTY'));
}
// Set the plugin root path
@@ -437,15 +438,15 @@ protected function storeExtension()
$manifest_details = Installer::parseXMLInstallFile($this->parent->getPath('manifest'));
$this->extension->manifest_cache = json_encode($manifest_details);
- $this->extension->state = 0;
- $this->extension->name = $manifest_details['name'];
- $this->extension->enabled = 'editors' === $this->extension->folder ? 1 : 0;
- $this->extension->params = $this->parent->getParams();
+ $this->extension->state = 0;
+ $this->extension->name = $manifest_details['name'];
+ $this->extension->enabled = 'editors' === $this->extension->folder ? 1 : 0;
+ $this->extension->params = $this->parent->getParams();
if (!$this->extension->store())
{
// Install failed, roll back changes
- throw new \RuntimeException(\JText::_('JLIB_INSTALLER_ERROR_PLG_DISCOVER_STORE_DETAILS'));
+ throw new \RuntimeException(Text::_('JLIB_INSTALLER_ERROR_PLG_DISCOVER_STORE_DETAILS'));
}
return;
@@ -458,9 +459,9 @@ protected function storeExtension()
{
// Install failed, roll back changes
throw new \RuntimeException(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ABORT_PLG_INSTALL_ALLREADY_EXISTS',
- \JText::_('JLIB_INSTALLER_' . $this->route),
+ Text::_('JLIB_INSTALLER_' . $this->route),
$this->name
)
);
@@ -476,16 +477,17 @@ protected function storeExtension()
else
{
// Store in the extensions table (1.6)
- $this->extension->name = $this->name;
- $this->extension->type = 'plugin';
- $this->extension->ordering = 0;
- $this->extension->element = $this->element;
- $this->extension->folder = $this->group;
- $this->extension->enabled = 0;
- $this->extension->protected = 0;
- $this->extension->access = 1;
- $this->extension->client_id = 0;
- $this->extension->params = $this->parent->getParams();
+ $this->extension->name = $this->name;
+ $this->extension->type = 'plugin';
+ $this->extension->ordering = 0;
+ $this->extension->element = $this->element;
+ $this->extension->folder = $this->group;
+ $this->extension->enabled = 0;
+ $this->extension->protected = 0;
+ $this->extension->access = 1;
+ $this->extension->client_id = 0;
+ $this->extension->params = $this->parent->getParams();
+ $this->extension->changelogurl = $this->changelogurl;
// Update the manifest cache for the entry
$this->extension->manifest_cache = $this->parent->generateManifestCache();
@@ -500,9 +502,9 @@ protected function storeExtension()
{
// Install failed, roll back changes
throw new \RuntimeException(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ABORT_PLG_INSTALL_ROLLBACK',
- \JText::_('JLIB_INSTALLER_' . $this->route),
+ Text::_('JLIB_INSTALLER_' . $this->route),
$this->extension->getError()
)
);
@@ -623,7 +625,7 @@ public function refreshManifestCache()
}
else
{
- \JLog::add(\JText::_('JLIB_INSTALLER_ERROR_PLG_REFRESH_MANIFEST_CACHE'), \JLog::WARNING, 'jerror');
+ Log::add(Text::_('JLIB_INSTALLER_ERROR_PLG_REFRESH_MANIFEST_CACHE'), Log::WARNING, 'jerror');
return false;
}
diff --git a/libraries/src/Installer/Adapter/TemplateAdapter.php b/libraries/src/Installer/Adapter/TemplateAdapter.php
index 799cc587b4ade..8f6730fff9d77 100644
--- a/libraries/src/Installer/Adapter/TemplateAdapter.php
+++ b/libraries/src/Installer/Adapter/TemplateAdapter.php
@@ -13,6 +13,8 @@
use Joomla\CMS\Application\ApplicationHelper;
use Joomla\CMS\Installer\Installer;
use Joomla\CMS\Installer\InstallerAdapter;
+use Joomla\CMS\Language\Text;
+use Joomla\CMS\Log\Log;
use Joomla\CMS\Table\Table;
use Joomla\CMS\Table\Update;
@@ -57,9 +59,9 @@ protected function checkExistingExtension()
{
// Install failed, roll back changes
throw new \RuntimeException(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ABORT_ROLLBACK',
- \JText::_('JLIB_INSTALLER_' . $this->route),
+ Text::_('JLIB_INSTALLER_' . $this->route),
$e->getMessage()
),
$e->getCode(),
@@ -82,7 +84,7 @@ protected function copyBaseFiles()
if ($this->parent->parseFiles($this->getManifest()->files, -1) === false)
{
throw new \RuntimeException(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ABORT_TPL_INSTALL_COPY_FILES',
'files'
)
@@ -92,7 +94,7 @@ protected function copyBaseFiles()
if ($this->parent->parseFiles($this->getManifest()->images, -1) === false)
{
throw new \RuntimeException(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ABORT_TPL_INSTALL_COPY_FILES',
'images'
)
@@ -102,7 +104,7 @@ protected function copyBaseFiles()
if ($this->parent->parseFiles($this->getManifest()->css, -1) === false)
{
throw new \RuntimeException(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ABORT_TPL_INSTALL_COPY_FILES',
'css'
)
@@ -120,9 +122,9 @@ protected function copyBaseFiles()
if (!$this->parent->copyFiles(array($path)))
{
throw new \RuntimeException(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ABORT_MANIFEST',
- \JText::_('JLIB_INSTALLER_' . strtoupper($this->getRoute()))
+ Text::_('JLIB_INSTALLER_' . strtoupper($this->getRoute()))
)
);
}
@@ -163,7 +165,7 @@ protected function finaliseInstall()
if (!$this->parent->copyManifest(-1))
{
// Install failed, rollback changes
- throw new \RuntimeException(\JText::_('JLIB_INSTALLER_ABORT_TPL_INSTALL_COPY_SETUP'));
+ throw new \RuntimeException(Text::_('JLIB_INSTALLER_ABORT_TPL_INSTALL_COPY_SETUP'));
}
}
}
@@ -305,7 +307,7 @@ protected function parseQueries()
$values = array(
$db->quote($this->extension->element), $this->extension->client_id, $db->quote(0),
- $db->quote(\JText::sprintf('JLIB_INSTALLER_DEFAULT_STYLE', \JText::_($this->extension->name))),
+ $db->quote(Text::sprintf('JLIB_INSTALLER_DEFAULT_STYLE', Text::_($this->extension->name))),
$db->quote($this->extension->params),
);
@@ -331,8 +333,8 @@ protected function parseQueries()
*/
public function prepareDiscoverInstall()
{
- $client = ApplicationHelper::getClientInfo($this->extension->client_id);
- $manifestPath = $client->path . '/templates/' . $this->extension->element . '/templateDetails.xml';
+ $client = ApplicationHelper::getClientInfo($this->extension->client_id);
+ $manifestPath = $client->path . '/templates/' . $this->extension->element . '/templateDetails.xml';
$this->parent->manifest = $this->parent->isManifest($manifestPath);
$this->parent->setPath('manifest', $manifestPath);
$this->setManifest($this->parent->getManifest());
@@ -359,7 +361,7 @@ protected function removeExtensionFiles()
}
else
{
- \JLog::add(\JText::_('JLIB_INSTALLER_ERROR_TPL_UNINSTALL_TEMPLATE_DIRECTORY'), \JLog::WARNING, 'jerror');
+ Log::add(Text::_('JLIB_INSTALLER_ERROR_TPL_UNINSTALL_TEMPLATE_DIRECTORY'), Log::WARNING, 'jerror');
}
}
@@ -383,16 +385,16 @@ protected function setupInstallPaths()
if ($client === false)
{
- throw new \RuntimeException(\JText::sprintf('JLIB_INSTALLER_ABORT_TPL_INSTALL_UNKNOWN_CLIENT', $cname));
+ throw new \RuntimeException(Text::sprintf('JLIB_INSTALLER_ABORT_TPL_INSTALL_UNKNOWN_CLIENT', $cname));
}
- $basePath = $client->path;
+ $basePath = $client->path;
$this->clientId = $client->id;
}
else
{
// No client attribute was found so we assume the site as the client
- $basePath = JPATH_SITE;
+ $basePath = JPATH_SITE;
$this->clientId = 0;
}
@@ -400,9 +402,9 @@ protected function setupInstallPaths()
if (empty($this->element))
{
throw new \RuntimeException(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ABORT_MOD_INSTALL_NOFILE',
- \JText::_('JLIB_INSTALLER_' . strtoupper($this->route))
+ Text::_('JLIB_INSTALLER_' . strtoupper($this->route))
)
);
}
@@ -427,7 +429,7 @@ protected function setupUninstall()
// For a template the id will be the template name which represents the subfolder of the templates folder that the template resides in.
if (!$name)
{
- throw new \RuntimeException(\JText::_('JLIB_INSTALLER_ERROR_TPL_UNINSTALL_TEMPLATE_ID_EMPTY'));
+ throw new \RuntimeException(Text::_('JLIB_INSTALLER_ERROR_TPL_UNINSTALL_TEMPLATE_ID_EMPTY'));
}
// Deny remove default template
@@ -441,7 +443,7 @@ protected function setupUninstall()
if ($db->loadResult() != 0)
{
- throw new \RuntimeException(\JText::_('JLIB_INSTALLER_ERROR_TPL_UNINSTALL_TEMPLATE_DEFAULT'));
+ throw new \RuntimeException(Text::_('JLIB_INSTALLER_ERROR_TPL_UNINSTALL_TEMPLATE_DEFAULT'));
}
// Get the template root path
@@ -449,7 +451,7 @@ protected function setupUninstall()
if (!$client)
{
- throw new \RuntimeException(\JText::_('JLIB_INSTALLER_ERROR_TPL_UNINSTALL_INVALID_CLIENT'));
+ throw new \RuntimeException(Text::_('JLIB_INSTALLER_ERROR_TPL_UNINSTALL_INVALID_CLIENT'));
}
$this->parent->setPath('extension_root', $client->path . '/templates/' . strtolower($name));
@@ -467,7 +469,7 @@ protected function setupUninstall()
// Make sure we delete the folders
\JFolder::delete($this->parent->getPath('extension_root'));
- throw new \RuntimeException(\JText::_('JLIB_INSTALLER_ERROR_TPL_UNINSTALL_INVALID_NOTFOUND_MANIFEST'));
+ throw new \RuntimeException(Text::_('JLIB_INSTALLER_ERROR_TPL_UNINSTALL_INVALID_NOTFOUND_MANIFEST'));
}
// Attempt to load the language file; might have uninstall strings
@@ -498,7 +500,7 @@ protected function storeExtension()
if (!$this->extension->store())
{
// Install failed, roll back changes
- throw new \RuntimeException(\JText::_('JLIB_INSTALLER_ERROR_TPL_DISCOVER_STORE_DETAILS'));
+ throw new \RuntimeException(Text::_('JLIB_INSTALLER_ERROR_TPL_DISCOVER_STORE_DETAILS'));
}
return;
@@ -511,7 +513,7 @@ protected function storeExtension()
{
// Install failed, roll back changes
throw new \RuntimeException(
- \JText::_('JLIB_INSTALLER_ABORT_TPL_INSTALL_ALREADY_INSTALLED')
+ Text::_('JLIB_INSTALLER_ABORT_TPL_INSTALL_ALREADY_INSTALLED')
);
}
@@ -538,13 +540,15 @@ protected function storeExtension()
// Update the manifest cache for the entry
$this->extension->manifest_cache = $this->parent->generateManifestCache();
+ $this->extension->changelogurl = $this->changelogurl;
+
if (!$this->extension->store())
{
// Install failed, roll back changes
throw new \RuntimeException(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ABORT_ROLLBACK',
- \JText::_('JLIB_INSTALLER_' . strtoupper($this->route)),
+ Text::_('JLIB_INSTALLER_' . strtoupper($this->route)),
$this->extension->getError()
)
);
@@ -558,10 +562,10 @@ protected function storeExtension()
*/
public function discover()
{
- $results = array();
- $site_list = \JFolder::folders(JPATH_SITE . '/templates');
+ $results = array();
+ $site_list = \JFolder::folders(JPATH_SITE . '/templates');
$admin_list = \JFolder::folders(JPATH_ADMINISTRATOR . '/templates');
- $site_info = ApplicationHelper::getClientInfo('site', true);
+ $site_info = ApplicationHelper::getClientInfo('site', true);
$admin_info = ApplicationHelper::getClientInfo('administrator', true);
foreach ($site_list as $template)
@@ -575,7 +579,7 @@ public function discover()
}
$manifest_details = Installer::parseXMLInstallFile(JPATH_SITE . "/templates/$template/templateDetails.xml");
- $extension = Table::getInstance('extension');
+ $extension = Table::getInstance('extension');
$extension->set('type', 'template');
$extension->set('client_id', $site_info->id);
$extension->set('element', $template);
@@ -599,7 +603,7 @@ public function discover()
}
$manifest_details = Installer::parseXMLInstallFile(JPATH_ADMINISTRATOR . "/templates/$template/templateDetails.xml");
- $extension = Table::getInstance('extension');
+ $extension = Table::getInstance('extension');
$extension->set('type', 'template');
$extension->set('client_id', $admin_info->id);
$extension->set('element', $template);
@@ -625,14 +629,14 @@ public function discover()
public function refreshManifestCache()
{
// Need to find to find where the XML file is since we don't store this normally.
- $client = ApplicationHelper::getClientInfo($this->parent->extension->client_id);
- $manifestPath = $client->path . '/templates/' . $this->parent->extension->element . '/templateDetails.xml';
+ $client = ApplicationHelper::getClientInfo($this->parent->extension->client_id);
+ $manifestPath = $client->path . '/templates/' . $this->parent->extension->element . '/templateDetails.xml';
$this->parent->manifest = $this->parent->isManifest($manifestPath);
$this->parent->setPath('manifest', $manifestPath);
- $manifest_details = Installer::parseXMLInstallFile($this->parent->getPath('manifest'));
+ $manifest_details = Installer::parseXMLInstallFile($this->parent->getPath('manifest'));
$this->parent->extension->manifest_cache = json_encode($manifest_details);
- $this->parent->extension->name = $manifest_details['name'];
+ $this->parent->extension->name = $manifest_details['name'];
try
{
@@ -640,7 +644,7 @@ public function refreshManifestCache()
}
catch (\RuntimeException $e)
{
- \JLog::add(\JText::_('JLIB_INSTALLER_ERROR_TPL_REFRESH_MANIFEST_CACHE'), \JLog::WARNING, 'jerror');
+ Log::add(Text::_('JLIB_INSTALLER_ERROR_TPL_REFRESH_MANIFEST_CACHE'), Log::WARNING, 'jerror');
return false;
}
diff --git a/libraries/src/Installer/InstallerAdapter.php b/libraries/src/Installer/InstallerAdapter.php
index 86f3cf744d08a..151aff3b42eeb 100644
--- a/libraries/src/Installer/InstallerAdapter.php
+++ b/libraries/src/Installer/InstallerAdapter.php
@@ -9,6 +9,8 @@
namespace Joomla\CMS\Installer;
use Joomla\CMS\Installer\Manifest\PackageManifest;
+use Joomla\CMS\Language\Text;
+use Joomla\CMS\Log\Log;
use Joomla\CMS\Table\Extension;
use Joomla\CMS\Table\Table;
use Joomla\CMS\Table\TableInterface;
@@ -22,6 +24,14 @@
*/
abstract class InstallerAdapter
{
+ /**
+ * Changelog URL of extensions
+ *
+ * @var string
+ * @since __DEPLOY_VERSION__
+ * */
+ protected $changelogurl = null;
+
/**
* ID for the currently installed extension if present
*
@@ -215,9 +225,9 @@ protected function checkExistingExtension()
{
// Install failed, roll back changes
throw new \RuntimeException(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ABORT_ROLLBACK',
- \JText::_('JLIB_INSTALLER_' . $this->route),
+ Text::_('JLIB_INSTALLER_' . $this->route),
$e->getMessage()
),
$e->getCode(),
@@ -259,9 +269,9 @@ protected function checkExtensionInFilesystem()
{
// We didn't have overwrite set, find an update function or find an update tag so lets call it safe
throw new \RuntimeException(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ABORT_DIRECTORY',
- \JText::_('JLIB_INSTALLER_' . $this->route),
+ Text::_('JLIB_INSTALLER_' . $this->route),
$this->type,
$this->parent->getPath('extension_root')
)
@@ -298,9 +308,9 @@ protected function createExtensionRoot()
if (!$created = \JFolder::create($this->parent->getPath('extension_root')))
{
throw new \RuntimeException(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ABORT_CREATE_DIRECTORY',
- \JText::_('JLIB_INSTALLER_' . $this->route),
+ Text::_('JLIB_INSTALLER_' . $this->route),
$this->parent->getPath('extension_root')
)
);
@@ -338,7 +348,7 @@ public function discover_install()
if ($description)
{
- $this->parent->message = \JText::_($description);
+ $this->parent->message = Text::_($description);
}
else
{
@@ -487,7 +497,7 @@ protected function doDatabaseTransactions()
// Only rollback if installing
if ($route === 'install')
{
- throw new \RuntimeException(\JText::_('JLIB_INSTALLER_ABORT_INSTALL_ABORTED'));
+ throw new \RuntimeException(Text::_('JLIB_INSTALLER_ABORT_INSTALL_ABORTED'));
}
return false;
@@ -661,19 +671,17 @@ public function install()
{
// Get the extension's description
$description = (string) $this->getManifest()->description;
+ $this->parent->message = '';
if ($description)
{
- $this->parent->message = \JText::_($description);
- }
- else
- {
- $this->parent->message = '';
+ $this->parent->message = Text::_($description);
}
// Set the extension's name and element
- $this->name = $this->getName();
- $this->element = $this->getElement();
+ $this->name = $this->getName();
+ $this->element = $this->getElement();
+ $this->changelogurl = (string) $this->getManifest()->changelogurl;
/*
* ---------------------------------------------------------------------------------------------
@@ -884,7 +892,7 @@ protected function parseQueries()
// This method may throw an exception, but it is caught by the parent caller
if (!$this->doDatabaseTransactions())
{
- throw new \RuntimeException(\JText::_('JLIB_INSTALLER_ABORT_INSTALL_ABORTED'));
+ throw new \RuntimeException(Text::_('JLIB_INSTALLER_ABORT_INSTALL_ABORTED'));
}
// Set the schema version to be the latest update version
@@ -902,7 +910,7 @@ protected function parseQueries()
if ($result === false)
{
// Install failed, rollback changes
- throw new \RuntimeException(\JText::_('JLIB_INSTALLER_ABORT_INSTALL_ABORTED'));
+ throw new \RuntimeException(Text::_('JLIB_INSTALLER_ABORT_INSTALL_ABORTED'));
}
}
}
@@ -1076,9 +1084,9 @@ protected function triggerManifestScript($method)
// The script failed, rollback changes
throw new \RuntimeException(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ABORT_INSTALL_CUSTOM_INSTALL_FAILURE',
- \JText::_('JLIB_INSTALLER_' . $this->route)
+ Text::_('JLIB_INSTALLER_' . $this->route)
)
);
}
@@ -1098,9 +1106,9 @@ protected function triggerManifestScript($method)
// The script failed, rollback changes
throw new \RuntimeException(
- \JText::sprintf(
+ Text::sprintf(
'JLIB_INSTALLER_ABORT_INSTALL_CUSTOM_INSTALL_FAILURE',
- \JText::_('JLIB_INSTALLER_' . $this->route)
+ Text::_('JLIB_INSTALLER_' . $this->route)
)
);
}
@@ -1134,7 +1142,7 @@ public function uninstall($id)
{
if (!$this->extension->load((int) $id))
{
- \JLog::add(\JText::_('JLIB_INSTALLER_ERROR_UNKNOWN_EXTENSION'), \JLog::WARNING, 'jerror');
+ Log::add(Text::_('JLIB_INSTALLER_ERROR_UNKNOWN_EXTENSION'), Log::WARNING, 'jerror');
return false;
}
@@ -1142,7 +1150,7 @@ public function uninstall($id)
// Protected extensions cannot be removed
if ($this->extension->protected)
{
- \JLog::add(\JText::_('JLIB_INSTALLER_ERROR_UNINSTALL_PROTECTED_EXTENSION'), \JLog::WARNING, 'jerror');
+ Log::add(Text::_('JLIB_INSTALLER_ERROR_UNINSTALL_PROTECTED_EXTENSION'), Log::WARNING, 'jerror');
return false;
}
@@ -1153,9 +1161,9 @@ public function uninstall($id)
*/
if ($this->extension->package_id && !$this->parent->isPackageUninstall() && !$this->canUninstallPackageChild($this->extension->package_id))
{
- \JLog::add(
- \JText::sprintf('JLIB_INSTALLER_ERROR_CANNOT_UNINSTALL_CHILD_OF_PACKAGE', $this->extension->name),
- \JLog::WARNING,
+ Log::add(
+ Text::sprintf('JLIB_INSTALLER_ERROR_CANNOT_UNINSTALL_CHILD_OF_PACKAGE', $this->extension->name),
+ Log::WARNING,
'jerror'
);
@@ -1169,7 +1177,7 @@ public function uninstall($id)
}
catch (\RuntimeException $e)
{
- \JLog::add($e->getMessage(), \JLog::WARNING, 'jerror');
+ Log::add($e->getMessage(), Log::WARNING, 'jerror');
return false;
}
@@ -1192,7 +1200,7 @@ public function uninstall($id)
}
catch (\RuntimeException $e)
{
- \JLog::add($e->getMessage(), \JLog::WARNING, 'jerror');
+ Log::add($e->getMessage(), Log::WARNING, 'jerror');
return false;
}
@@ -1221,7 +1229,7 @@ public function uninstall($id)
}
catch (\RuntimeException $e)
{
- \JLog::add($e->getMessage(), \JLog::WARNING, 'jerror');
+ Log::add($e->getMessage(), Log::WARNING, 'jerror');
$retval = false;
}
@@ -1238,7 +1246,7 @@ public function uninstall($id)
}
catch (\RuntimeException $e)
{
- \JLog::add($e->getMessage(), \JLog::WARNING, 'jerror');
+ Log::add($e->getMessage(), Log::WARNING, 'jerror');
$retval = false;
}
@@ -1255,7 +1263,7 @@ public function uninstall($id)
}
catch (\RuntimeException $e)
{
- \JLog::add($e->getMessage(), \JLog::WARNING, 'jerror');
+ Log::add($e->getMessage(), Log::WARNING, 'jerror');
$retval = false;
}
@@ -1267,7 +1275,7 @@ public function uninstall($id)
}
catch (\RuntimeException $e)
{
- \JLog::add($e->getMessage(), \JLog::WARNING, 'jerror');
+ Log::add($e->getMessage(), Log::WARNING, 'jerror');
$retval = false;
}
diff --git a/libraries/src/Updater/UpdateAdapter.php b/libraries/src/Updater/UpdateAdapter.php
index 7fdad743ac849..e4a28e16703c6 100644
--- a/libraries/src/Updater/UpdateAdapter.php
+++ b/libraries/src/Updater/UpdateAdapter.php
@@ -55,7 +55,7 @@ abstract class UpdateAdapter extends \JAdapterInstance
* @var array
* @since 12.1
*/
- protected $updatecols = array('NAME', 'ELEMENT', 'TYPE', 'FOLDER', 'CLIENT', 'VERSION', 'DESCRIPTION', 'INFOURL', 'EXTRA_QUERY');
+ protected $updatecols = array('NAME', 'ELEMENT', 'TYPE', 'FOLDER', 'CLIENT', 'VERSION', 'DESCRIPTION', 'INFOURL', 'CHANGELOGURL', 'EXTRA_QUERY');
/**
* Should we try appending a .xml extension to the update site's URL?