- md5
- 80a5ec39339d984e2183f5153bfa8ba5
- sha1
- 645bbce9440cdd4416a2349008fedf95f0b625bb
- sha256
- e9a0b6b2947fb583eb4b3dcc8c15c21a6712b6731dbd2ee9afed652e22e02f7c
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
* @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License, see LICENSE.php
*/
// No direct access
defined('_JEXEC') or die;
/**
* @package Joomla.Administrator
* @subpackage com_installer
*/
class InstallerControllerUpdate extends JController {
/**
* Update a set of extensions.
*
* @since 1.6
*/
function update()
{
// Check for request forgeries
JRequest::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$model = $this->getModel('update');
$uid = JRequest::getVar('cid', array(), '', 'array');
JArrayHelper::toInteger($uid, array());
if ($model->update($uid)) {
$cache = JFactory::getCache('mod_menu');
$cache->clean();
}
$app = JFactory::getApplication();
$redirect_url = $app->getUserState('com_installer.redirect_url');
if(empty($redirect_url)) {
$redirect_url = JRoute::_('index.php?option=com_installer&view=update', false);
} else
{
// wipe out the user state when we're going to redirect
$app->setUserState('com_installer.redirect_url', '');
$app->setUserState('com_installer.message', '');
$app->setUserState('com_installer.extension_message', '');
}
$this->setRedirect($redirect_url);
}
/**
* Find new updates.
*
* @since 1.6
*/
function find()
{
// Check for request forgeries
JRequest::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
// Get the caching duration
jimport('joomla.application.component.helper');
$component = JComponentHelper::getComponent('com_installer');
$params = $component->params;
$cache_timeout = $params->get('cachetimeout', 6, 'int');
$cache_timeout = 3600 * $cache_timeout;
// Find updates
$model = $this->getModel('update');
$result = $model->findUpdates(0, $cache_timeout);
$this->setRedirect(JRoute::_('index.php?option=com_installer&view=update', false));
//$view->display();
}
/**
* Purges updates.
*
* @since 1.6
*/
function purge()
{
// Purge updates
// Check for request forgeries
JRequest::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$model = $this->getModel('update');
$model->purge();
$model->enableSites();
$this->setRedirect(JRoute::_('index.php?option=com_installer&view=update', false), $model->_message);
}
/**
* Fetch and report updates in JSON format, for AJAX requests
*
* @return void
*
* @since 2.5
*/
function ajax()
{
// Note: we don't do a token check as we're fetching information
// asynchronously. This means that between requests the token might
// change, making it impossible for AJAX to work.
$eid = JRequest::getInt('eid', 0);
$skip = JRequest::getVar('skip', array(), 'default', 'array');
$cache_timeout = JRequest::getInt('cache_timeout', 0);
if($cache_timeout == 0) {
jimport('joomla.application.component.helper');
$component = JComponentHelper::getComponent('com_installer');
$params = $component->params;
$cache_timeout = $params->get('cachetimeout', 6, 'int');
$cache_timeout = 3600 * $cache_timeout;
}
$model = $this->getModel('update');
$result = $model->findUpdates($eid, $cache_timeout);
$model->setState('list.start', 0);
$model->setState('list.limit', 0);
if($eid != 0) {
$model->setState('filter.extension_id', $eid);
}
$updates = $model->getItems();
if(!empty($skip)) {
$unfiltered_updates = $updates;
$updates = array();
foreach($unfiltered_updates as $update) {
if(!in_array($update->extension_id, $skip)) $updates[] = $update;
}
}
echo json_encode($updates);
JFactory::getApplication()->close();
}
}
The same content is in 4 releases, Joomla 2.5.0 to 2.5.3. See them all, or every version of this file.