CoreFiles by mySites.guru
updatecachetime.php57 lines, 1,448 bytes, from Joomla_4.0.0-alpha9-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha8
md5
84d75a22c942e55bcab4eda78b2d1044
sha1
d85e232ea4810bde49c53a7bb93ec9d42141ec81
sha256
b5bf0e6eac80e8cd38a8906a166370e047f533f9ccb9e6e90d6f836717846df1
<?php
/**
 * @package     Joomla.Plugin
 * @subpackage  System.updatenotification
 *
 * @copyright   Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

use Joomla\CMS\Factory;

/**
 * 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
		Factory::getApplication()->enqueueMessage($table->getError(), 'error');
	}
}

The same content is in 2 releases, Joomla 4.0.0-alpha8 to 4.0.0-alpha9. See them all, or every version of this file.