Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Simplify JInstaller a tiny bit. #1396

Closed
wants to merge 4 commits into from

3 participants

@realityking
Collaborator

No description provided.

@realityking
Collaborator

@pasamio @mbabker Could one of you review this? Thanks.

@LouisLandry

@realityking I'm really feeling like we need to move the installer and updater libraries to legacy en route to the CMS tree. Given that I'm not inclined to really merge this change, but would rather suggest you run with it in the CMS tree. I'm happy to be overridden by @pasamio if he wants to run with it here, but that's my feeling.

Incidentally either way it is no longer mergeable and needs to be rebased if we were to merge it. I'm closing it for now until it is mergeable again. If you guys want to get it into the platform I'll leave it up to you.

@LouisLandry LouisLandry closed this
@pasamio

I'd much rather this shift to CMS sooner rather than later and we can build a new mechanism built around JController tasks that we join together to build coherent pieces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
95 libraries/joomla/installer/adapter.php
@@ -0,0 +1,95 @@
+<?php
+/**
+ * @package Joomla.Platform
+ * @subpackage Installer
+ *
+ * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
+ * @license GNU General Public License version 2 or later; see LICENSE
+ */
+
+defined('JPATH_PLATFORM') or die;
+
+jimport('joomla.base.adapterinstance');
+
+/**
+ * Abstract adapter for the installer.
+ *
+ * @package Joomla.Platform
+ * @subpackage Installer
+ * @since 12.2
+ */
+abstract class JInstallerAdapter extends JAdapterInstance
+{
+ /**
+ * The unique identifier for the extension (e.g. mod_login)
+ *
+ * @var string
+ * @since 12.2
+ * */
+ protected $element = null;
+
+ /**
+ * Copy of the XML manifest file
+ *
+ * @var string
+ * @since 12.2
+ */
+ protected $manifest = null;
+
+ /**
+ * Name of the extension
+ *
+ * @var string
+ * @since 12.2
+ * */
+ protected $name = null;
+
+ /**
+ * Load language files
+ *
+ * @param string $extension Name of the extension
+ * @param string $source Location of the extension on the filesystem
+ *
+ * @return void
+ *
+ * @since 12.2
+ */
+ protected function doLoadLanguage($extension, $source)
+ {
+ $lang = JFactory::getLanguage();
+ $lang->load($extension . '.sys', $source, null, false, false)
+ || $lang->load($extension . '.sys', JPATH_SITE, null, false, false)
+ || $lang->load($extension . '.sys', $source, $lang->getDefault(), false, false)
+ || $lang->load($extension . '.sys', JPATH_SITE, $lang->getDefault(), false, false);
+ }
+
+ /**
+ * Generic install method for extensions.
+ * This is not a fully functioning method and needs to be extended.
+ *
+ * @return boolean True on success
+ *
+ * @since 12.2
+ */
+ public function install()
+ {
+ // Get the extension manifest object
+ $this->manifest = $this->parent->getManifest();
+
+ // Set the extensions name
+ $name = (string) $this->manifest->name;
+ $name = JFilterInput::getInstance()->clean($name, 'string');
+ $this->name = $name;
+
+ // Get the component description
+ $description = (string) $this->manifest->description;
+ if ($description)
+ {
+ $this->parent->set('message', JText::_($description));
+ }
+ else
+ {
+ $this->parent->set('message', '');
+ }
+ }
+}
View
78 libraries/joomla/installer/adapters/component.php
@@ -9,8 +9,6 @@
defined('JPATH_PLATFORM') or die;
-jimport('joomla.base.adapterinstance');
-
/**
* Component installer
*
@@ -18,33 +16,9 @@
* @subpackage Installer
* @since 11.1
*/
-class JInstallerComponent extends JAdapterInstance
+class JInstallerComponent extends JInstallerAdapter
{
/**
- * Copy of the XML manifest file
- *
- * @var string
- * @since 11.1
- */
- protected $manifest = null;
-
- /**
- * Name of the extension
- *
- * @var string
- * @since 11.1
- * */
- protected $name = null;
-
- /**
- * The unique identifier for the extension (e.g. mod_login)
- *
- * @var string
- * @since 11.1
- * */
- protected $element = null;
-
- /**
* The list of current files fo the Joomla! CMS administrator that are installed and is read
* from the manifest on disk in the update area to handle doing a diff
* and deleting files that are in the old files list and not in the new
@@ -85,7 +59,7 @@ class JInstallerComponent extends JAdapterInstance
protected $install_script = null;
/**
- * Custom loadLanguage method
+ * Load language from a path
*
* @param string $path The path language files are on.
*
@@ -119,7 +93,6 @@ public function loadLanguage($path = null)
$extension = 'com_' . $name;
}
- $lang = JFactory::getLanguage();
$source = $path ? $path : ($this->parent->extension->client_id ? JPATH_ADMINISTRATOR : JPATH_SITE) . '/components/' . $extension;
if ($this->manifest->administration->files)
@@ -144,9 +117,7 @@ public function loadLanguage($path = null)
$source = $path . '/' . $folder;
}
}
- $lang->load($extension . '.sys', $source, null, false, false) || $lang->load($extension . '.sys', JPATH_ADMINISTRATOR, null, false, false)
- || $lang->load($extension . '.sys', $source, $lang->getDefault(), false, false)
- || $lang->load($extension . '.sys', JPATH_ADMINISTRATOR, $lang->getDefault(), false, false);
+ $this->doLoadLanguage($extension, $source);
}
/**
@@ -158,20 +129,17 @@ public function loadLanguage($path = null)
*/
public function install()
{
+ parent::install();
+
// Get a database connector object
$db = $this->parent->getDbo();
- // Get the extension manifest object
- $this->manifest = $this->parent->getManifest();
-
/*
* ---------------------------------------------------------------------------------------------
* Manifest Document Setup Section
* ---------------------------------------------------------------------------------------------
*/
- // Set the extension's name
- $name = strtolower(JFilterInput::getInstance()->clean((string) $this->manifest->name, 'cmd'));
if (substr($name, 0, 4) == 'com_')
{
$element = $name;
@@ -180,12 +148,7 @@ public function install()
{
$element = 'com_' . $name;
}
-
- $this->set('name', $name);
- $this->set('element', $element);
-
- // Get the component description
- $this->parent->set('message', JText::_((string) $this->manifest->description));
+ $this->element = $element;
// Set the installation target paths
$this->parent->setPath('extension_site', JPath::clean(JPATH_SITE . '/components/' . $this->get('element')));
@@ -573,8 +536,11 @@ public function update()
* ---------------------------------------------------------------------------------------------
*/
- // Set the extension's name
- $name = strtolower(JFilterInput::getInstance()->clean((string) $this->manifest->name, 'cmd'));
+ // Set the extensions name
+ $name = (string) $this->manifest->name;
+ $name = JFilterInput::getInstance()->clean($name, 'string');
+ $this->name = $name;
+
if (substr($name, 0, 4) == 'com_')
{
$element = $name;
@@ -583,9 +549,7 @@ public function update()
{
$element = 'com_' . $name;
}
-
- $this->set('name', $name);
- $this->set('element', $element);
+ $this->element = $element;
// Get the component description
$description = (string) $this->manifest->description;
@@ -1014,7 +978,10 @@ public function uninstall($id)
}
// Set the extensions name
- $name = strtolower(JFilterInput::getInstance()->clean((string) $this->manifest->name, 'cmd'));
+ $name = (string) $this->manifest->name;
+ $name = JFilterInput::getInstance()->clean($name, 'string');
+ $this->name = $name;
+
if (substr($name, 0, 4) == 'com_')
{
$element = $name;
@@ -1023,9 +990,7 @@ public function uninstall($id)
{
$element = 'com_' . $name;
}
-
- $this->set('name', $name);
- $this->set('element', $element);
+ $this->element = $element;
// Attempt to load the admin language file; might have uninstall strings
$this->loadLanguage(JPATH_ADMINISTRATOR . '/components/' . $element);
@@ -1573,7 +1538,10 @@ public function discover_install()
*/
// Set the extensions name
- $name = strtolower(JFilterInput::getInstance()->clean((string) $this->manifest->name, 'cmd'));
+ $name = (string) $this->manifest->name;
+ $name = JFilterInput::getInstance()->clean($name, 'string');
+ $this->name = $name;
+
if (substr($name, 0, 4) == 'com_')
{
$element = $name;
@@ -1582,9 +1550,7 @@ public function discover_install()
{
$element = 'com_' . $name;
}
-
- $this->set('name', $name);
- $this->set('element', $element);
+ $this->element = $element;
// Get the component description
$description = (string) $this->manifest->description;
View
38 libraries/joomla/installer/adapters/file.php
@@ -10,7 +10,6 @@
defined('JPATH_PLATFORM') or die;
jimport('joomla.installer.filemanifest');
-jimport('joomla.base.adapterinstance');
/**
* File installer
@@ -19,14 +18,14 @@
* @subpackage Installer
* @since 11.1
*/
-class JInstallerFile extends JAdapterInstance
+class JInstallerFile extends JInstallerAdapter
{
protected $route = 'install';
/**
- * Custom loadLanguage method
+ * Load language from a path
*
- * @param string $path The path on which to find language files.
+ * @param string $path The path language files are on.
*
* @return void
*
@@ -36,12 +35,7 @@ public function loadLanguage($path)
{
$this->manifest = $this->parent->getManifest();
$extension = 'files_' . str_replace('files_', '', strtolower(JFilterInput::getInstance()->clean((string) $this->manifest->name, 'cmd')));
- $lang = JFactory::getLanguage();
- $source = $path;
- $lang->load($extension . '.sys', $source, null, false, false)
- || $lang->load($extension . '.sys', JPATH_SITE, null, false, false)
- || $lang->load($extension . '.sys', $source, $lang->getDefault(), false, false)
- || $lang->load($extension . '.sys', JPATH_SITE, $lang->getDefault(), false, false);
+ $this->doLoadLanguage($extension, $path);
}
/**
@@ -53,8 +47,7 @@ public function loadLanguage($path)
*/
public function install()
{
- // Get the extension manifest object
- $this->manifest = $this->parent->getManifest();
+ parent::install();
/*
* ---------------------------------------------------------------------------------------------
@@ -62,25 +55,10 @@ public function install()
* ---------------------------------------------------------------------------------------------
*/
- // Set the extension's name
- $name = JFilterInput::getInstance()->clean((string) $this->manifest->name, 'string');
- $this->set('name', $name);
-
// Set element
$manifestPath = JPath::clean($this->parent->getPath('manifest'));
$element = preg_replace('/\.xml/', '', basename($manifestPath));
- $this->set('element', $element);
-
- // Get the component description
- $description = (string) $this->manifest->description;
- if ($description)
- {
- $this->parent->set('message', JText::_($description));
- }
- else
- {
- $this->parent->set('message', '');
- }
+ $this->element = $element;
// Check if the extension by the same name is already installed
if ($this->extensionExistsInSystem($element))
@@ -410,9 +388,11 @@ public function update()
// Set the overwrite setting
$this->parent->setOverwrite(true);
$this->parent->setUpgrade(true);
+
+ // Set the route for the install
$this->route = 'update';
- // ...and adds new files
+ // Go to install which handles updates properly
return $this->install();
}
View
54 libraries/joomla/installer/adapters/language.php
@@ -9,8 +9,6 @@
defined('JPATH_PLATFORM') or die;
-jimport('joomla.base.adapterinstance');
-
/**
* Language installer
*
@@ -18,17 +16,9 @@
* @subpackage Installer
* @since 11.1
*/
-class JInstallerLanguage extends JAdapterInstance
+class JInstallerLanguage extends JInstallerAdapter
{
/**
- * Core language pack flag
- *
- * @var boolean
- * @since 12.1
- */
- protected $core = false;
-
- /**
* Custom install method
*
* Note: This behaves badly due to hacks made in the middle of 1.5.x to add
@@ -97,10 +87,10 @@ protected function _install($cname, $basePath, $clientId, &$element)
{
$this->manifest = $this->parent->getManifest();
- // Get the language name
// Set the extensions name
- $name = JFilterInput::getInstance()->clean((string) $this->manifest->name, 'cmd');
- $this->set('name', $name);
+ $name = (string) $this->manifest->name;
+ $name = JFilterInput::getInstance()->clean($name, 'string');
+ $this->name = $name;
// Get the Language tag [ISO tag, eg. en-GB]
$tag = (string) $this->manifest->tag;
@@ -112,25 +102,11 @@ protected function _install($cname, $basePath, $clientId, &$element)
return false;
}
- $this->set('tag', $tag);
+ $this->tag = $tag;
// Set the language installation path
$this->parent->setPath('extension_site', $basePath . '/language/' . $tag);
- // Do we have a meta file in the file list? In other words... is this a core language pack?
- if ($element && count($element->children()))
- {
- $files = $element->children();
- foreach ($files as $file)
- {
- if ((string) $file->attributes()->file == 'meta')
- {
- $this->core = true;
- break;
- }
- }
- }
-
// If the language directory does not exist, let's create it
$created = false;
if (!file_exists($this->parent->getPath('extension_site')))
@@ -283,11 +259,10 @@ public function update()
$basePath = $client->path;
$clientId = $client->id;
- // Get the language name
// Set the extensions name
$name = (string) $this->manifest->name;
- $name = JFilterInput::getInstance()->clean($name, 'cmd');
- $this->set('name', $name);
+ $name = JFilterInput::getInstance()->clean($name, 'string');
+ $this->name = $name;
// Get the Language tag [ISO tag, eg. en-GB]
$tag = (string) $xml->tag;
@@ -299,25 +274,12 @@ public function update()
return false;
}
- $this->set('tag', $tag);
+ $this->tag = $tag;
$folder = $tag;
// Set the language installation path
$this->parent->setPath('extension_site', $basePath . '/language/' . $this->get('tag'));
- // Do we have a meta file in the file list? In other words... is this a core language pack?
- if (count($xml->files->children()))
- {
- foreach ($xml->files->children() as $file)
- {
- if ((string) $file->attributes()->file == 'meta')
- {
- $this->core = true;
- break;
- }
- }
- }
-
// Copy all the necessary files
if ($this->parent->parseFiles($xml->files) === false)
{
View
37 libraries/joomla/installer/adapters/library.php
@@ -10,7 +10,6 @@
defined('JPATH_PLATFORM') or die;
jimport('joomla.installer.librarymanifest');
-jimport('joomla.base.adapterinstance');
/**
* Library installer
@@ -19,12 +18,12 @@
* @subpackage Installer
* @since 11.1
*/
-class JInstallerLibrary extends JAdapterInstance
+class JInstallerLibrary extends JInstallerAdapter
{
/**
- * Custom loadLanguage method
+ * Load language from a path
*
- * @param string $path The path where to find language files.
+ * @param string $path The path language files are on.
*
* @return void
*
@@ -40,12 +39,9 @@ public function loadLanguage($path = null)
$this->manifest = $this->parent->getManifest();
$extension = 'lib_' . strtolower(JFilterInput::getInstance()->clean((string) $this->manifest->name, 'cmd'));
$name = strtolower((string) $this->manifest->libraryname);
- $lang = JFactory::getLanguage();
+
$source = $path ? $path : JPATH_PLATFORM . "/$name";
- $lang->load($extension . '.sys', $source, null, false, false)
- || $lang->load($extension . '.sys', JPATH_SITE, null, false, false)
- || $lang->load($extension . '.sys', $source, $lang->getDefault(), false, false)
- || $lang->load($extension . '.sys', JPATH_SITE, $lang->getDefault(), false, false);
+ $this->doLoadLanguage($extension, $source);
}
/**
@@ -57,8 +53,7 @@ public function loadLanguage($path = null)
*/
public function install()
{
- // Get the extension manifest object
- $this->manifest = $this->parent->getManifest();
+ parent::install();
/*
* ---------------------------------------------------------------------------------------------
@@ -67,10 +62,8 @@ public function install()
*/
// Set the extension's name
- $name = JFilterInput::getInstance()->clean((string) $this->manifest->name, 'string');
$element = str_replace('.xml', '', basename($this->parent->getPath('manifest')));
- $this->set('name', $name);
- $this->set('element', $element);
+ $this->element = $element;
$db = $this->parent->getDbo();
$query = $db->getQuery(true);
@@ -97,17 +90,6 @@ public function install()
}
}
- // Get the library's description
- $description = (string) $this->manifest->description;
- if ($description)
- {
- $this->parent->set('message', JText::_($description));
- }
- else
- {
- $this->parent->set('message', '');
- }
-
// Set the installation path
$group = (string) $this->manifest->libraryname;
if (!$group)
@@ -226,9 +208,10 @@ public function update()
// Set the extensions name
$name = (string) $this->manifest->name;
$name = JFilterInput::getInstance()->clean($name, 'string');
+ $this->name = $name;
+
$element = str_replace('.xml', '', basename($this->parent->getPath('manifest')));
- $this->set('name', $name);
- $this->set('element', $element);
+ $this->element = $element;
// We don't want to compromise this instance!
$installer = new JInstaller;
View
63 libraries/joomla/installer/adapters/module.php
@@ -9,8 +9,6 @@
defined('JPATH_PLATFORM') or die;
-jimport('joomla.base.adapterinstance');
-
/**
* Module installer
*
@@ -18,7 +16,7 @@
* @subpackage Installer
* @since 11.1
*/
-class JInstallerModule extends JAdapterInstance
+class JInstallerModule extends JInstallerAdapter
{
/**
* Install function routing
@@ -32,38 +30,18 @@ class JInstallerModule extends JAdapterInstance
* @var
* @since 11.1
*/
- protected $manifest = null;
-
- /**
- * @var
- * @since 11.1
- */
protected $manifest_script = null;
/**
- * Extension name
- *
- * @var
- * @since 11.1
- */
- protected $name = null;
-
- /**
- * @var
- * @since 11.1
- */
- protected $element = null;
-
- /**
* @var string
* @since 11.1
*/
protected $scriptElement = null;
/**
- * Custom loadLanguage method
+ * Load language from a path
*
- * @param string $path The path where we find language files
+ * @param string $path The path language files are on.
*
* @return void
*
@@ -103,7 +81,6 @@ public function loadLanguage($path = null)
if ($extension)
{
- $lang = JFactory::getLanguage();
$source = $path ? $path : ($this->parent->extension->client_id ? JPATH_ADMINISTRATOR : JPATH_SITE) . '/modules/' . $extension;
$folder = (string) $element->attributes()->folder;
@@ -113,10 +90,7 @@ public function loadLanguage($path = null)
}
$client = (string) $this->manifest->attributes()->client;
- $lang->load($extension . '.sys', $source, null, false, false)
- || $lang->load($extension . '.sys', constant('JPATH_' . strtoupper($client)), null, false, false)
- || $lang->load($extension . '.sys', $source, $lang->getDefault(), false, false)
- || $lang->load($extension . '.sys', constant('JPATH_' . strtoupper($client)), $lang->getDefault(), false, false);
+ $this->doLoadLanguage($extension, $source);
}
}
}
@@ -130,34 +104,11 @@ public function loadLanguage($path = null)
*/
public function install()
{
+ parent::install();
+
// Get a database connector object
$db = $this->parent->getDbo();
- // Get the extension manifest object
- $this->manifest = $this->parent->getManifest();
-
- /*
- * ---------------------------------------------------------------------------------------------
- * Manifest Document Setup Section
- * ---------------------------------------------------------------------------------------------
- */
-
- // Set the extensions name
- $name = (string) $this->manifest->name;
- $name = JFilterInput::getInstance()->clean($name, 'string');
- $this->set('name', $name);
-
- // Get the module description
- $description = (string) $this->manifest->description;
- if ($description)
- {
- $this->parent->set('message', JText::_($description));
- }
- else
- {
- $this->parent->set('message', '');
- }
-
/*
* ---------------------------------------------------------------------------------------------
* Target Application Section
@@ -197,7 +148,7 @@ public function install()
if ((string) $file->attributes()->module)
{
$element = (string) $file->attributes()->module;
- $this->set('element', $element);
+ $this->element = $element;
break;
}
View
34 libraries/joomla/installer/adapters/package.php
@@ -9,7 +9,6 @@
defined('JPATH_PLATFORM') or die;
-jimport('joomla.base.adapterinstance');
jimport('joomla.installer.packagemanifest');
/**
@@ -19,7 +18,7 @@
* @subpackage Installer
* @since 11.1
*/
-class JInstallerPackage extends JAdapterInstance
+class JInstallerPackage extends JInstallerAdapter
{
/**
* Method of system
@@ -33,7 +32,7 @@ class JInstallerPackage extends JAdapterInstance
/**
* Load language from a path
*
- * @param string $path The path of the language.
+ * @param string $path The path language files are on.
*
* @return void
*
@@ -43,12 +42,7 @@ public function loadLanguage($path)
{
$this->manifest = $this->parent->getManifest();
$extension = 'pkg_' . strtolower(JFilterInput::getInstance()->clean((string) $this->manifest->packagename, 'cmd'));
- $lang = JFactory::getLanguage();
- $source = $path;
- $lang->load($extension . '.sys', $source, null, false, false)
- || $lang->load($extension . '.sys', JPATH_SITE, null, false, false)
- || $lang->load($extension . '.sys', $source, $lang->getDefault(), false, false)
- || $lang->load($extension . '.sys', JPATH_SITE, $lang->getDefault(), false, false);
+ $this->doLoadLanguage($extension, $path);
}
/**
@@ -60,8 +54,7 @@ public function loadLanguage($path)
*/
public function install()
{
- // Get the extension manifest object
- $this->manifest = $this->parent->getManifest();
+ parent::install();
/*
* ---------------------------------------------------------------------------------------------
@@ -69,25 +62,8 @@ public function install()
* ---------------------------------------------------------------------------------------------
*/
- // Set the extensions name
- $filter = JFilterInput::getInstance();
- $name = (string) $this->manifest->packagename;
- $name = $filter->clean($name, 'cmd');
- $this->set('name', $name);
-
$element = 'pkg_' . $filter->clean($this->manifest->packagename, 'cmd');
- $this->set('element', $element);
-
- // Get the component description
- $description = (string) $this->manifest->description;
- if ($description)
- {
- $this->parent->set('message', JText::_($description));
- }
- else
- {
- $this->parent->set('message', '');
- }
+ $this->element = $element;
// Set the installation path
$files = $this->manifest->files;
View
62 libraries/joomla/installer/adapters/plugin.php
@@ -9,8 +9,6 @@
defined('JPATH_PLATFORM') or die;
-jimport('joomla.base.adapterinstance');
-
/**
* Plugin installer
*
@@ -18,7 +16,7 @@
* @subpackage Installer
* @since 11.1
*/
-class JInstallerPlugin extends JAdapterInstance
+class JInstallerPlugin extends JInstallerAdapter
{
/**
* Install function routing
@@ -29,14 +27,6 @@ class JInstallerPlugin extends JAdapterInstance
protected $route = 'install';
/**
- * The installation manifest XML object
- *
- * @var
- * @since 11.1
- * */
- protected $manifest = null;
-
- /**
* A path to the PHP file that the scriptfile declaration in
* the manifest refers to.
*
@@ -46,14 +36,6 @@ class JInstallerPlugin extends JAdapterInstance
protected $manifest_script = null;
/**
- * Name of the extension
- *
- * @var
- * @since 11.1
- * */
- protected $name = null;
-
- /**
*
*
* @var
@@ -68,9 +50,9 @@ class JInstallerPlugin extends JAdapterInstance
protected $oldFiles = null;
/**
- * Custom loadLanguage method
+ * Load language from a path
*
- * @param string $path The path where to find language files.
+ * @param string $path The path language files are on.
*
* @return void
*
@@ -110,10 +92,7 @@ public function loadLanguage($path = null)
{
$source = "$path/$folder";
}
- $lang->load($extension . '.sys', $source, null, false, false)
- || $lang->load($extension . '.sys', JPATH_ADMINISTRATOR, null, false, false)
- || $lang->load($extension . '.sys', $source, $lang->getDefault(), false, false)
- || $lang->load($extension . '.sys', JPATH_ADMINISTRATOR, $lang->getDefault(), false, false);
+ $this->doLoadLanguage($extension, $source);
}
}
}
@@ -127,12 +106,11 @@ public function loadLanguage($path = null)
*/
public function install()
{
+ parent::install();
+
// Get a database connector object
$db = $this->parent->getDbo();
- // Get the extension manifest object
- $this->manifest = $this->parent->getManifest();
-
$xml = $this->manifest;
/*
@@ -141,22 +119,6 @@ public function install()
* ---------------------------------------------------------------------------------------------
*/
- // Set the extension name
- $name = (string) $xml->name;
- $name = JFilterInput::getInstance()->clean($name, 'string');
- $this->set('name', $name);
-
- // Get the plugin description
- $description = (string) $xml->description;
- if ($description)
- {
- $this->parent->set('message', JText::_($description));
- }
- else
- {
- $this->parent->set('message', '');
- }
-
/*
* Backward Compatibility
* @todo Deprecate in future version
@@ -718,12 +680,6 @@ public function discover()
$manifest_details = JInstaller::parseXMLInstallFile(JPATH_SITE . '/plugins/' . $folder . '/' . $file);
$file = JFile::stripExt($file);
- // Ignore example plugins
- if ($file == 'example')
- {
- continue;
- }
-
$extension = JTable::getInstance('extension');
$extension->set('type', 'plugin');
$extension->set('client_id', 0);
@@ -745,12 +701,6 @@ public function discover()
);
$file = JFile::stripExt($file);
- if ($file == 'example')
- {
- continue;
- }
-
- // Ignore example plugins
$extension = JTable::getInstance('extension');
$extension->set('type', 'plugin');
$extension->set('client_id', 0);
View
50 libraries/joomla/installer/adapters/template.php
@@ -10,7 +10,6 @@
defined('JPATH_PLATFORM') or die;
jimport('joomla.installer.extension');
-jimport('joomla.base.adapterinstance');
/**
* Template installer
@@ -19,33 +18,9 @@
* @subpackage Installer
* @since 11.1
*/
-class JInstallerTemplate extends JAdapterInstance
+class JInstallerTemplate extends JInstallerAdapter
{
/**
- * Copy of the XML manifest file
- *
- * @var string
- * @since 11.1
- */
- protected $manifest = null;
-
- /**
- * Name of the extension
- *
- * @var string
- * @since 11.1
- * */
- protected $name = null;
-
- /**
- * The unique identifier for the extension (e.g. mod_login)
- *
- * @var string
- * @since 11.1
- * */
- protected $element = null;
-
- /**
* Method of system
*
* @var string
@@ -55,11 +30,11 @@ class JInstallerTemplate extends JAdapterInstance
protected $route = 'install';
/**
- * Custom loadLanguage method
+ * Load language from a path
*
- * @param string $path The path where to find language files.
+ * @param string $path The path language files are on.
*
- * @return JInstallerTemplate
+ * @return void
*
* @since 11.1
*/
@@ -87,12 +62,8 @@ public function loadLanguage($path = null)
}
$extension = "tpl_$name";
- $lang = JFactory::getLanguage();
$source = $path ? $path : ($this->parent->extension->client_id ? JPATH_ADMINISTRATOR : JPATH_SITE) . '/templates/' . $name;
- $lang->load($extension . '.sys', $source, null, false, false)
- || $lang->load($extension . '.sys', constant('JPATH_' . strtoupper($client)), null, false, false)
- || $lang->load($extension . '.sys', $source, $lang->getDefault(), false, false)
- || $lang->load($extension . '.sys', constant('JPATH_' . strtoupper($client)), $lang->getDefault(), false, false);
+ $this->doLoadLanguage($extension, $source);
}
/**
@@ -104,6 +75,8 @@ public function loadLanguage($path = null)
*/
public function install()
{
+ parent::install();
+
// Get a database connector object
$db = $this->parent->getDbo();
@@ -131,12 +104,8 @@ public function install()
$clientId = 0;
}
- // Set the extension's name
- $name = JFilterInput::getInstance()->clean((string) $xml->name, 'cmd');
-
$element = strtolower(str_replace(" ", "_", $name));
- $this->set('name', $name);
- $this->set('element', $element);
+ $this->element = $element;
// Check to see if a template by the same name is already installed.
$query = $db->getQuery(true);
@@ -253,9 +222,6 @@ public function install()
$this->parent->parseMedia($xml->media);
$this->parent->parseLanguages($xml->languages, $clientId);
- // Get the template description
- $this->parent->set('message', JText::_((string) $xml->description));
-
// Lastly, we will copy the manifest file to its appropriate place.
if (!$this->parent->copyManifest(-1))
{
Something went wrong with that request. Please try again.