Source for file updater.php
Documentation is available at updater.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.filesystem.folder');
jimport('joomla.utilities.arrayhelper');
* @package Joomla.Platform
* @var JUpdater JUpdater instance container.
protected static $instance;
// Adapter base path, class prefix
* Returns a reference to the global Installer object, only creating it
* if it doesn't already exist.
* @return object An installer object
if (!isset
(self::$instance))
self::$instance =
new JUpdater;
* Finds an update for an extension
* @param integer $eid Extension Identifier; if zero use all sites
* @param integer $cacheTimeout How many seconds to cache update information; if zero, force reload the update information
* @return boolean True if there are updates
public function findUpdates($eid =
0, $cacheTimeout =
0)
$query =
'SELECT DISTINCT update_site_id, type, location, last_check_timestamp FROM #__update_sites WHERE enabled = 1';
$query =
'SELECT DISTINCT update_site_id, type, location, last_check_timestamp FROM #__update_sites' .
' WHERE update_site_id IN' .
' (SELECT update_site_id FROM #__update_sites_extensions WHERE extension_id IN (' .
implode(',', $eid) .
'))';
$results =
$db->loadAssocList();
$result_count =
count($results);
for ($i =
0; $i <
$result_count; $i++
)
if (!isset
($this->_adapters[$result['type']]))
// Ignore update sites requiring adapters we don't have installed
if (isset
($result['last_check_timestamp']) &&
($now -
$result['last_check_timestamp'] <=
$cacheTimeout))
// Ignore update sites whose information we have fetched within
$update_result =
$this->_adapters[$result['type']]->findUpdate($result);
$result_count =
count($results);
for ($k =
0, $count =
count($update_result['updates']); $k <
$count; $k++
)
$current_update =
&$update_result['updates'][$k];
'element' =>
strtolower($current_update->get('element')), 'type' =>
strtolower($current_update->get('type')),
'client_id' =>
strtolower($current_update->get('client_id')),
'folder' =>
strtolower($current_update->get('folder'))
'element' =>
strtolower($current_update->get('element')), 'type' =>
strtolower($current_update->get('type')),
'client_id' =>
strtolower($current_update->get('client_id')),
'folder' =>
strtolower($current_update->get('folder'))
// We have an installed extension, check the update is actually newer
$current_update->extension_id =
$eid;
$current_update->store();
// A potentially new extension to be installed
$current_update->store();
// If there is an update, check that the version is newer then replaces
$current_update->store();
// Finally, update the last update check timestamp
$query =
$db->getQuery(true)
->update($db->quoteName('#__update_sites'))
->set($db->quoteName('last_check_timestamp') .
' = ' .
$db->quote($now))
->where($db->quoteName('update_site_id') .
' = ' .
$db->quote($result['update_site_id']));
* Finds an update for an extension
* @param integer $id Id of the extension
if ($update->loadFromXML($updaterow->detailsurl))
return $update->install();
Documentation generated on Tue, 19 Nov 2013 15:16:12 +0100 by phpDocumentor 1.4.3