CoreFiles by mySites.guru
updatecachetime.php55 lines, 1,424 bytes, from Joomla_3.7.2-Stable-Full_Package.zip
Raw History Compare with 3.7.1
md5
639f3a08bb2e9495e8e27e63f65df8ab
sha1
7a4e7e50b4d3a057ad7b7aae295adbb6c8a5edf0
sha256
0979744733f9ac9418109dba70503f5b548630a95c158e6ce9dc782adb248bf5
<?php
/**
 * @package     Joomla.Plugin
 * @subpackage  System.updatenotification
 *
 * @copyright   Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

/**
 * Checks if the com_installer config for the cache Hours are eq 0 and the updatenotification Plugin is enabled
 *
 * @return  boolean
 *
 * @since   3.6.3
 */
function updatecachetime_postinstall_condition()
{
	$cacheTimeout = (int) JComponentHelper::getComponent('com_installer')->params->get('cachetimeout', 6);

	// Check if cachetimeout is eq zero
	if ($cacheTimeout == 0 && JPluginHelper::isEnabled('system', 'updatenotification'))
	{
		return true;
	}

	return false;
}

/**
 * Sets the cachtimeout back to the default (6 hours)
 *
 * @return  void
 *
 * @since   3.6.3
 */
function updatecachetime_postinstall_action()
{
	$installer = JComponentHelper::getComponent('com_installer');

	// Sets the cachtimeout back to the default (6 hours)
	$installer->params->set('cachetimeout', 6);
	
	// Save the new parameters back to com_installer
	$table = JTable::getInstance('extension');
	$table->load($installer->id);
	$table->bind(array('params' => $installer->params->toString()));

	// Store the changes
	if (!$table->store())
	{
		// If there is an error show it to the admin
		JFactory::getApplication()->enqueueMessage($table->getError(), 'error');
	}
}

The same content is in 14 releases, Joomla 3.7.0-alpha2 to 3.7.2. See them all, or every version of this file.