Skip to content
This repository has been archived by the owner on Nov 26, 2017. It is now read-only.

Commit

Permalink
[#23837] *Installation unexpectedly terminated: Method not supported …
Browse files Browse the repository at this point in the history
…for this extension type: template +

--HG--
extra : convert_revision : svn%3A6f6e1ebd-4c2b-0410-823f-f34bde69bce9/development/trunk/libraries%4020030
  • Loading branch information
chdemko committed Dec 30, 2010
1 parent 1cc43bc commit 9589e50
Show file tree
Hide file tree
Showing 10 changed files with 160 additions and 18 deletions.
8 changes: 5 additions & 3 deletions joomla/installer/adapters/component.php
Expand Up @@ -1418,7 +1418,7 @@ protected function _rollback_menu()
* @return array A list of extensions.
* @since 1.6
*/
function discover()
public function discover()
{
$results = array();
$site_components = JFolder::folders(JPATH_SITE.DS.'components');
Expand Down Expand Up @@ -1460,7 +1460,7 @@ function discover()
* @return mixed
* @since 1.6
*/
function discover_install()
public function discover_install()
{
// Need to find to find where the XML file is since we don't store this normally
$client = JApplicationHelper::getClientInfo($this->parent->extension->client_id);
Expand Down Expand Up @@ -1715,6 +1715,8 @@ function discover_install()
}

/**
* Refreshes the extension table cache
* @return boolean result of operation, true if updated, false on failure
* @since 1.6
*/
public function refreshManifestCache()
Expand All @@ -1727,7 +1729,7 @@ public function refreshManifestCache()
$this->parent->setPath('manifest', $manifestPath);

$manifest_details = JApplicationHelper::parseXMLInstallFile($this->parent->getPath('manifest'));
$this->parent->extension->manifest_cache = serialize($manifest_details);
$this->parent->extension->manifest_cache = json_encode($manifest_details);
$this->parent->extension->name = $manifest_details['name'];

try {
Expand Down
32 changes: 29 additions & 3 deletions joomla/installer/adapters/file.php
Expand Up @@ -40,14 +40,15 @@ public function loadLanguage($path)
|| $lang->load($extension . '.sys', $source, $lang->getDefault(), false, false)
|| $lang->load($extension . '.sys', JPATH_SITE, $lang->getDefault(), false, false);
}

/**
* Custom install method
*
* @access public
* @return boolean True on success
* @since 1.5
*/
function install()
public function install()
{
// Get the extension manifest object
$this->manifest = $this->parent->getManifest();
Expand Down Expand Up @@ -245,7 +246,7 @@ function install()
* @return boolean True on success
* @since 1.5
*/
function update()
public function update()
{
// set the overwrite setting
$this->parent->setOverwrite(true);
Expand All @@ -265,7 +266,7 @@ function update()
* @return boolean True on success
* @since 1.5
*/
function uninstall($id)
public function uninstall($id)
{
// Initialise variables.
$row = JTable::getInstance('extension');
Expand Down Expand Up @@ -487,4 +488,29 @@ private function populateFilesAndFolderList()
}
}
}

/**
* Refreshes the extension table cache
* @return boolean result of operation, true if updated, false on failure
* @since 1.6
*/
public function refreshManifestCache()
{
// Need to find to find where the XML file is since we don't store this normally
$manifestPath = JPATH_MANIFESTS.DS.'files'. DS.$this->parent->extension->element.'.xml';
$this->parent->manifest = $this->parent->isManifest($manifestPath);
$this->parent->setPath('manifest', $manifestPath);

$manifest_details = JApplicationHelper::parseXMLInstallFile($this->parent->getPath('manifest'));
$this->parent->extension->manifest_cache = json_encode($manifest_details);
$this->parent->extension->name = $manifest_details['name'];

try {
return $this->parent->extension->store();
}
catch(JException $e) {
JError::raiseWarning(101, JText::_('JLIB_INSTALLER_ERROR_PACK_REFRESH_MANIFEST_CACHE'));
return false;
}
}
}
27 changes: 26 additions & 1 deletion joomla/installer/adapters/language.php
Expand Up @@ -540,7 +540,7 @@ public function discover()
* Custom discover install method
* Basically updates the manifest cache and leaves everything alone
*/
function discover_install()
public function discover_install()
{
// Need to find to find where the XML file is since we don't store this normally
$client = JApplicationHelper::getClientInfo($this->parent->extension->client_id);
Expand All @@ -566,4 +566,29 @@ function discover_install()
}
return $this->parent->extension->get('extension_id');
}

/**
* Refreshes the extension table cache
* @return boolean result of operation, true if updated, false on failure
* @since 1.6
*/
public function refreshManifestCache()
{
$client = JApplicationHelper::getClientInfo($this->parent->extension->client_id);
$manifestPath = $client->path . DS . 'language'. DS . $this->parent->extension->element . DS . $this->parent->extension->element . '.xml';
$this->parent->manifest = $this->parent->isManifest($manifestPath);
$this->parent->setPath('manifest', $manifestPath);
$manifest_details = JApplicationHelper::parseXMLInstallFile($this->parent->getPath('manifest'));
$this->parent->extension->manifest_cache = json_encode($manifest_details);
$this->parent->extension->name = $manifest_details['name'];

if ($this->parent->extension->store()) {
return true;
}
else {
JError::raiseWarning(101, JText::_('JLIB_INSTALLER_ERROR_MOD_REFRESH_MANIFEST_CACHE'));

return false;
}
}
}
36 changes: 31 additions & 5 deletions joomla/installer/adapters/library.php
Expand Up @@ -43,14 +43,15 @@ public function loadLanguage($path=null)
|| $lang->load($extension . '.sys', $source, $lang->getDefault(), false, false)
|| $lang->load($extension . '.sys', JPATH_SITE, $lang->getDefault(), false, false);
}

/**
* Custom install method
*
* @access public
* @return boolean True on success
* @since 1.5
*/
function install()
public function install()
{
// Get the extension manifest object
$this->manifest = $this->parent->getManifest();
Expand Down Expand Up @@ -195,7 +196,7 @@ function install()
* @return boolean True on success
* @since 1.5
*/
function update()
public function update()
{
// since this is just files, an update removes old files
// Get the extension manifest object
Expand Down Expand Up @@ -233,7 +234,7 @@ function update()
* @return boolean True on success
* @since 1.5
*/
function uninstall($id)
public function uninstall($id)
{
// Initialise variables.
$retval = true;
Expand Down Expand Up @@ -325,7 +326,7 @@ function uninstall($id)
* @return array(JExtension) list of extensions available
* @since 1.6
*/
function discover()
public function discover()
{
$results = Array();
$file_list = JFolder::files(JPATH_MANIFESTS.DS.'libraries','\.xml$');
Expand Down Expand Up @@ -353,7 +354,7 @@ function discover()
* @return void
* @since 1.6
*/
function discover_install()
public function discover_install()
{
/* Libraries are a strange beast, they are actually references to files
* There are two parts to a library which are disjunct in their locations
Expand Down Expand Up @@ -384,4 +385,29 @@ function discover_install()
return false;
}
}

/**
* Refreshes the extension table cache
* @return boolean result of operation, true if updated, false on failure
* @since 1.6
*/
public function refreshManifestCache()
{
// Need to find to find where the XML file is since we don't store this normally
$manifestPath = JPATH_MANIFESTS.DS.'libraries'. DS.$this->parent->extension->element.'.xml';
$this->parent->manifest = $this->parent->isManifest($manifestPath);
$this->parent->setPath('manifest', $manifestPath);

$manifest_details = JApplicationHelper::parseXMLInstallFile($this->parent->getPath('manifest'));
$this->parent->extension->manifest_cache = json_encode($manifest_details);
$this->parent->extension->name = $manifest_details['name'];

try {
return $this->parent->extension->store();
}
catch(JException $e) {
JError::raiseWarning(101, JText::_('JLIB_INSTALLER_ERROR_LIB_REFRESH_MANIFEST_CACHE'));
return false;
}
}
}
9 changes: 7 additions & 2 deletions joomla/installer/adapters/module.php
Expand Up @@ -545,14 +545,19 @@ function discover_install()
}
}

function refreshManifestCache()
/**
* Refreshes the extension table cache
* @return boolean result of operation, true if updated, false on failure
* @since 1.6
*/
public function refreshManifestCache()
{
$client = JApplicationHelper::getClientInfo($this->parent->extension->client_id);
$manifestPath = $client->path . DS . 'modules'. DS . $this->parent->extension->element . DS . $this->parent->extension->element . '.xml';
$this->parent->manifest = $this->parent->isManifest($manifestPath);
$this->parent->setPath('manifest', $manifestPath);
$manifest_details = JApplicationHelper::parseXMLInstallFile($this->parent->getPath('manifest'));
$this->parent->extension->manifest_cache = serialize($manifest_details);
$this->parent->extension->manifest_cache = json_encode($manifest_details);
$this->parent->extension->name = $manifest_details['name'];

if ($this->parent->extension->store()) {
Expand Down
26 changes: 26 additions & 0 deletions joomla/installer/adapters/package.php
Expand Up @@ -326,4 +326,30 @@ private function _getExtensionID($type, $id, $client, $group)
// this means they come out the same way they came in
return $result;
}


/**
* Refreshes the extension table cache
* @return boolean result of operation, true if updated, false on failure
* @since 1.6
*/
public function refreshManifestCache()
{
// Need to find to find where the XML file is since we don't store this normally
$manifestPath = JPATH_MANIFESTS.DS.'packages'. DS.$this->parent->extension->element.'.xml';
$this->parent->manifest = $this->parent->isManifest($manifestPath);
$this->parent->setPath('manifest', $manifestPath);

$manifest_details = JApplicationHelper::parseXMLInstallFile($this->parent->getPath('manifest'));
$this->parent->extension->manifest_cache = json_encode($manifest_details);
$this->parent->extension->name = $manifest_details['name'];

try {
return $this->parent->extension->store();
}
catch(JException $e) {
JError::raiseWarning(101, JText::_('JLIB_INSTALLER_ERROR_PACK_REFRESH_MANIFEST_CACHE'));
return false;
}
}
}
9 changes: 7 additions & 2 deletions joomla/installer/adapters/plugin.php
Expand Up @@ -731,7 +731,12 @@ function discover_install()
}
}

function refreshManifestCache()
/**
* Refreshes the extension table cache
* @return boolean result of operation, true if updated, false on failure
* @since 1.6
*/
public function refreshManifestCache()
{
// Plugins use the extensions table as their primary store
// Similar to modules and templates, rather easy
Expand All @@ -741,7 +746,7 @@ function refreshManifestCache()
$this->parent->manifest = $this->parent->isManifest($manifestPath);
$this->parent->setPath('manifest', $manifestPath);
$manifest_details = JApplicationHelper::parseXMLInstallFile($this->parent->getPath('manifest'));
$this->parent->extension->manifest_cache = serialize($manifest_details);
$this->parent->extension->manifest_cache = json_encode($manifest_details);

$this->parent->extension->name = $manifest_details['name'];
if ($this->parent->extension->store()) {
Expand Down
27 changes: 27 additions & 0 deletions joomla/installer/adapters/template.php
Expand Up @@ -470,4 +470,31 @@ function discover_install()
return false;
}
}


/**
* Refreshes the extension table cache
* @return boolean result of operation, true if updated, false on failure
* @since 1.6
*/
public function refreshManifestCache()
{
// Need to find to find where the XML file is since we don't store this normally
$client = JApplicationHelper::getClientInfo($this->parent->extension->client_id);
$manifestPath = $client->path.DS.'templates'. DS.$this->parent->extension->element.DS.'templateDetails.xml';
$this->parent->manifest = $this->parent->isManifest($manifestPath);
$this->parent->setPath('manifest', $manifestPath);

$manifest_details = JApplicationHelper::parseXMLInstallFile($this->parent->getPath('manifest'));
$this->parent->extension->manifest_cache = json_encode($manifest_details);
$this->parent->extension->name = $manifest_details['name'];

try {
return $this->parent->extension->store();
}
catch(JException $e) {
JError::raiseWarning(101, JText::_('JLIB_INSTALLER_ERROR_TPL_REFRESH_MANIFEST_CACHE'));
return false;
}
}
}
2 changes: 1 addition & 1 deletion joomla/installer/installer.php
Expand Up @@ -1690,7 +1690,7 @@ public function isManifest($file)
*/
public function generateManifestCache()
{
return serialize(JApplicationHelper::parseXMLInstallFile($this->getPath('manifest')));
return json_encode(JApplicationHelper::parseXMLInstallFile($this->getPath('manifest')));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion joomla/updater/updater.php
Expand Up @@ -104,7 +104,7 @@ public function findUpdates($eid=0) {
{
// we have an installed extension, check the update is actually newer
$extension->load($eid);
$data = unserialize($extension->manifest_cache);
$data = json_decode($extension->manifest_cache);
if(version_compare($current_update->version, $data['version'], '>') == 1)
{
$current_update->extension_id = $eid;
Expand Down

0 comments on commit 9589e50

Please sign in to comment.