Source for file collection.php
Documentation is available at collection.php
* @package Joomla.Platform
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
jimport('joomla.updater.updateadapter');
* Collection Update Adapter Class
* @package Joomla.Platform
* Used to control if an item has a child or not
* @var array A list of discovered update sites
* A list of discovered updates
* Gets the reference to the current direct parent
* @param object $parser Parser object
* @param string $name Name of element that is opened
* @param array $attrs Array of attributes for the element
if (isset
($attrs['REF']))
$this->update_sites[] =
array('type' =>
'collection', 'location' =>
$attrs['REF'], 'update_site_id' =>
$this->updateSiteId);
// This item will have children, so prepare to attach them
// Reset the values if it doesn't exist
$attrs['CLIENT_ID'] =
$client->id;
// Lower case all of the fields
foreach ($attrs as $key =>
$attr)
// Only add the update if it is on the same platform and release as we are
// Lower case and remove the exclamation mark
* Set defaults, the extension file should clarify in case but it may be only available in one version
* This allows an update site to specify a targetplatform
* targetplatformversion can be a regexp, so 1.[56] would be valid for an extension that supports 1.5 and 1.6
* Note: Whilst the version is a regexp here, the targetplatform is not (new extension per platform)
* Additionally, the version is a regexp here and it may also be in an extension file if the extension is
* compatible against multiple versions of the same platform (e.g. a library)
if (!isset
($values['targetplatform']))
$values['targetplatform'] =
$product;
// Set this to ourself as a default
if (!isset
($values['targetplatformversion']))
$values['targetplatformversion'] =
$ver->RELEASE;
// Set this to ourself as a default
// validate that we can install the extension
if ($product ==
$values['targetplatform'] &&
preg_match('/' .
$values['targetplatformversion'] .
'/', $ver->RELEASE))
* Note: This is a protected function though has to be exposed externally as a callback
* @param object $parser Parser object
* @param string $name Name of the element closing
// Note: we don't care about char data in collection because there should be none
* @param array $options Options to use: update_site_id: the unique ID of the update site to look at
* @return array Update_sites and updates discovered
$url =
$options['location'];
if (substr($url, -
4) !=
'.xml')
$this->base =
new stdClass;
$db =
$this->parent->getDBO();
$response =
$http->get($url);
// JHttp transport throws an exception when there's no reponse.
$response =
$http->get($url);
if (!isset
($response) ||
200 !=
$response->code)
$query =
$db->getQuery(true)
->update('#__update_sites')
JLog::add("Error parsing url: " .
$url, JLog::WARNING, 'updater');
$app->enqueueMessage(JText::sprintf('JLIB_UPDATER_ERROR_COLLECTION_OPEN_URL', $url), 'warning');
JLog::add("Error parsing url: " .
$url, JLog::WARNING, 'updater');
$app->enqueueMessage(JText::sprintf('JLIB_UPDATER_ERROR_COLLECTION_PARSE_URL', $url), 'warning');
// TODO: Decrement the bad counter if non-zero
Documentation generated on Tue, 19 Nov 2013 14:56:04 +0100 by phpDocumentor 1.4.3