File manager - Edit - /home/ferretapmx/public_html/com_cache.tar
Back
config.xml 0000644 00000000526 15231065343 0006540 0 ustar 00 <?xml version="1.0" encoding="UTF-8"?> <config> <help key="Cache:_Options"/> <fieldset name="permissions" label="JCONFIG_PERMISSIONS_LABEL" > <field name="rules" type="rules" label="JCONFIG_PERMISSIONS_LABEL" filter="rules" validate="rules" component="com_cache" section="component" /> </fieldset> </config> cache.xml 0000644 00000002112 15231065343 0006327 0 ustar 00 <?xml version="1.0" encoding="UTF-8"?> <extension type="component" method="upgrade"> <name>com_cache</name> <author>Joomla! Project</author> <creationDate>2006-04</creationDate> <copyright>(C) 2006 Open Source Matters, Inc.</copyright> <license>GNU General Public License version 2 or later; see LICENSE.txt</license> <authorEmail>admin@joomla.org</authorEmail> <authorUrl>www.joomla.org</authorUrl> <version>4.0.0</version> <description>COM_CACHE_XML_DESCRIPTION</description> <namespace path="src">Joomla\Component\Cache</namespace> <media destination="com_cache" folder="media"> <folder>js</folder> </media> <administration> <files folder="admin"> <filename>access.xml</filename> <filename>cache.xml</filename> <filename>config.xml</filename> <folder>forms</folder> <folder>services</folder> <folder>src</folder> <folder>tmpl</folder> </files> <languages folder="admin"> <language tag="en-GB">language/en-GB/com_cache.ini</language> <language tag="en-GB">language/en-GB/com_cache.sys.ini</language> </languages> </administration> </extension> src/Model/CacheModel.php 0000644 00000016322 15231065343 0011076 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_cache * * @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Cache\Administrator\Model; use Joomla\CMS\Cache\Cache; use Joomla\CMS\Cache\CacheController; use Joomla\CMS\Cache\Exception\CacheConnectingException; use Joomla\CMS\Cache\Exception\UnsupportedCacheException; use Joomla\CMS\Event\Cache\AfterPurgeEvent; use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Factory\MVCFactoryInterface; use Joomla\CMS\MVC\Model\ListModel; use Joomla\CMS\Pagination\Pagination; use Joomla\Utilities\ArrayHelper; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Cache Model * * @since 1.6 */ class CacheModel extends ListModel { /** * An Array of CacheItems indexed by cache group ID * * @var array */ protected $_data = []; /** * Group total * * @var integer */ protected $_total = null; /** * Pagination object * * @var object */ protected $_pagination = null; /** * Constructor. * * @param array $config An optional associative array of configuration settings. * @param ?MVCFactoryInterface $factory The factory. * * @since 3.5 */ public function __construct($config = [], ?MVCFactoryInterface $factory = null) { if (empty($config['filter_fields'])) { $config['filter_fields'] = [ 'group', 'count', 'size', 'client_id', ]; } parent::__construct($config, $factory); } /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @param string $ordering Field for ordering. * @param string $direction Direction of ordering. * * @return void * * @since 1.6 */ protected function populateState($ordering = 'group', $direction = 'asc') { parent::populateState($ordering, $direction); } /** * Method to get a store id based on model configuration state. * * This is necessary because the model is used by the component and * different modules that might need different sets of data or different * ordering requirements. * * @param string $id A prefix for the store id. * * @return string A store id. * * @since 3.5 */ protected function getStoreId($id = '') { // Compile the store id. $id .= ':' . $this->getState('filter.search'); return parent::getStoreId($id); } /** * Method to get cache data * * @return array */ public function getData() { if (empty($this->_data)) { try { $cache = $this->getCache(); $data = $cache->getAll(); if ($data && \count($data) > 0) { // Process filter by search term. if ($search = $this->getState('filter.search')) { foreach ($data as $key => $cacheItem) { if (stripos($cacheItem->group, $search) === false) { unset($data[$key]); } } } // Process ordering. $listOrder = $this->getState('list.ordering', 'group'); $listDirn = $this->getState('list.direction', 'ASC'); $this->_data = ArrayHelper::sortObjects($data, $listOrder, strtolower($listDirn) === 'desc' ? -1 : 1, true, true); // Process pagination. $limit = (int) $this->getState('list.limit', 25); if ($limit !== 0) { $start = (int) $this->getState('list.start', 0); return \array_slice($this->_data, $start, $limit); } } else { $this->_data = []; } } catch (CacheConnectingException) { $this->setError(Text::_('COM_CACHE_ERROR_CACHE_CONNECTION_FAILED')); $this->_data = []; } catch (UnsupportedCacheException) { $this->setError(Text::_('COM_CACHE_ERROR_CACHE_DRIVER_UNSUPPORTED')); $this->_data = []; } } return $this->_data; } /** * Method to get cache instance. * * @return CacheController */ public function getCache() { $app = Factory::getApplication(); $options = [ 'defaultgroup' => '', 'storage' => $app->get('cache_handler', ''), 'caching' => true, 'cachebase' => $app->get('cache_path', JPATH_CACHE), ]; return Cache::getInstance('', $options); } /** * Get the number of current Cache Groups. * * @return integer */ public function getTotal() { if (empty($this->_total)) { $this->_total = \count($this->getData()); } return $this->_total; } /** * Method to get a pagination object for the cache. * * @return Pagination */ public function getPagination() { if (empty($this->_pagination)) { $this->_pagination = new Pagination($this->getTotal(), $this->getState('list.start'), $this->getState('list.limit')); } return $this->_pagination; } /** * Clean out a cache group as named by param. * If no param is passed clean all cache groups. * * @param string $group Cache group name. * * @return boolean True on success, false otherwise */ public function clean($group = '') { try { $this->getCache()->clean($group); } catch (CacheConnectingException) { return false; } catch (UnsupportedCacheException) { return false; } $this->getDispatcher()->dispatch('onAfterPurge', new AfterPurgeEvent('onAfterPurge', ['subject' => $group])); return true; } /** * Purge an array of cache groups. * * @param array $array Array of cache group names. * * @return array Array with errors, if they exist. */ public function cleanlist($array) { $errors = []; foreach ($array as $group) { if (!$this->clean($group)) { $errors[] = $group; } } return $errors; } /** * Purge all cache items. * * @return boolean True if successful; false otherwise. */ public function purge() { try { Factory::getCache('')->gc(); } catch (CacheConnectingException) { return false; } catch (UnsupportedCacheException) { return false; } $this->getDispatcher()->dispatch('onAfterPurge', new AfterPurgeEvent('onAfterPurge')); return true; } } src/Model/.htaccess 0000555 00000000355 15231065343 0010177 0 ustar 00 <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>