Source for file manage.php
Documentation is available at manage.php
* @package Joomla.Administrator
* @subpackage com_installer
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
require_once __DIR__ .
'/extension.php';
* @package Joomla.Administrator
* @subpackage com_installer
* @param array $config An optional associative array of configuration settings.
if (empty($config['filter_fields']))
$config['filter_fields'] =
array('name', 'client_id', 'status', 'type', 'folder', 'extension_id',);
* Method to auto-populate the model state.
* Note. Calling getState in this method will result in recursion.
* @param string $ordering An optional ordering field.
* @param string $direction An optional direction (asc|desc).
protected function populateState($ordering =
null, $direction =
null)
// Load the filter state.
$this->setState('filter.search', $search);
$this->setState('filter.client_id', $clientId);
$this->setState('filter.status', $status);
$this->setState('filter.type', $categoryId);
$this->setState('filter.group', $group);
$this->setState('message', $app->getUserState('com_installer.message'));
$this->setState('extension_message', $app->getUserState('com_installer.extension_message'));
$app->setUserState('com_installer.message', '');
$app->setUserState('com_installer.extension_message', '');
parent::populateState('name', 'asc');
* Enable/Disable an extension.
* @param array &$eid Extension ids to un/publish
* @param int $value Publish value
* @return boolean True on success
public function publish(&$eid =
array(), $value =
1)
if ($user->authorise('core.edit.state', 'com_installer'))
* Ensure eid is an array of extension ids
* TODO: If it isn't an array do we want to set an error and fail?
// Get a table object for the extension type
// Enable the extension in the table and store it in the database
foreach ($eid as $i =>
$id)
if ($table->type ==
'template')
if ($style->load(array('template' =>
$table->element, 'client_id' =>
$table->client_id, 'home' =>
1)))
if ($table->protected ==
1)
$table->enabled =
$value;
* Refreshes the cached manifest information for an extension.
* @param int $eid extension identifier (key in #__extensions)
* @return boolean result of refresh
// Get an installer object for the extension type
// Uninstall the chosen extensions
$result |=
$installer->refreshManifestCache($id);
* Remove (uninstall) an extension
* @param array $eid An array of identifiers
* @return boolean True on success
public function remove($eid =
array())
if ($user->authorise('core.delete', 'com_installer'))
* Ensure eid is an array of extension ids in the form id => client_id
* TODO: If it isn't an array do we want to set an error and fail?
// Get an installer object for the extension type
// Uninstall the chosen extensions
$langstring =
'COM_INSTALLER_TYPE_TYPE_' .
strtoupper($row->type);
$rowtype =
JText::_($langstring);
if (strpos($rowtype, $langstring) !==
false)
if ($row->type &&
$row->type !=
'language')
$result =
$installer->uninstall($row->type, $id);
// Build an array of extensions that failed to uninstall
// There was an error in uninstalling the package
$msgs[] =
JText::sprintf('COM_INSTALLER_UNINSTALL_ERROR', $rowtype);
// Package uninstalled sucessfully
$msgs[] =
JText::sprintf('COM_INSTALLER_UNINSTALL_SUCCESS', $rowtype);
if ($row->type ==
'language')
// One should always uninstall a language package, not a single language
$msgs[] =
JText::_('COM_INSTALLER_UNINSTALL_LANGUAGE');
// There was an error in uninstalling the package
$msgs[] =
JText::sprintf('COM_INSTALLER_UNINSTALL_ERROR', $rowtype);
$app->enqueueMessage($msg);
$this->setState('name', $installer->get('name'));
$app->setUserState('com_installer.message', $installer->message);
$app->setUserState('com_installer.extension_message', $installer->get('extension_message'));
* Method to get the database query
* @return JDatabaseQuery The database query
$status =
$this->getState('filter.status');
$client =
$this->getState('filter.client_id');
$group =
$this->getState('filter.group');
->select('2*protected+(1-protected)*enabled as status')
$query->where('protected = 1');
$query->where('protected = 0');
$query->where('protected = 0')
->where('enabled=' . (int)
$status);
$query->where('type=' .
$this->_db->quote($type));
$query->where('client_id=' . (int)
$client);
if ($group !=
'' &&
in_array($type, array('plugin', 'library', '')))
$query->where('folder=' .
$this->_db->quote($group ==
'*' ?
'' :
$group));
// Filter by search in id
$search =
$this->getState('filter.search');
if (!empty($search) &&
stripos($search, 'id:') ===
0)
$query->where('extension_id = ' . (int)
substr($search, 3));
Documentation generated on Tue, 19 Nov 2013 15:07:33 +0100 by phpDocumentor 1.4.3