rge_opcache')) { Cache\Joomla::purgeOPcache(); } // Purge expired cache if (self::passType('purge')) { Cache\Joomla::purgeExpired(); } // Purge update cache if (self::passType('purge_updates')) { Cache\Joomla::purgeUpdates(); } // Global check-in if (self::passType('checkin')) { Cache\Joomla::checkIn(); } if (self::passType('query_url') && ! empty($params->query_url_selection)) { self::queryUrl(); } // Refresh versionable assets cache JFactory::getApplication()->flushAssets(); self::updateLog(); return self::getResult(); } public static function writeToLog($file_name, $error) { $params = Params::get(); // Write current time to text file jimport('joomla.filesystem.file'); jimport('joomla.filesystem.folder'); $file_path = str_replace('//', '/', JPATH_SITE . '/' . str_replace('\\', '/', $params->log_path . '/')); if ( ! JFolder::exists($file_path)) { $file_path = JPATH_PLUGINS . '/system/cachecleaner/'; } $time = time(); JFile::append( $file_path . 'cachecleaner_' . $file_name . '.log', '[' . date('Y-m-d H:i:s') . '] ' . $error ); } private static function getCleanType() { $params = Params::get(); $cleancache = trim(JFactory::getApplication()->input->getString('cleancache')); // Clean via url if ( ! empty($cleancache)) { // Return if on frontend and no secret url key is given if (RL_Document::isClient('site') && $cleancache != $params->frontend_secret) { return ''; } $user = JFactory::getApplication()->getIdentity() ?: JFactory::getUser(); // Return if on login page if (RL_Document::isClient('administrator') && $user->get('guest')) { return ''; } if (JFactory::getApplication()->input->getWord('src') == 'button') { return 'button'; } self::$show_message = true; if (RL_Document::isClient('site') && $cleancache == $params->frontend_secret) { self::$show_message = $params->frontend_secret_msg; } return 'clean'; } // Clean via save task if (self::passTask()) { return 'save'; } // Clean via interval if (self::passInterval()) { return 'interval'; } return ''; } private static function passInterval() { $params = Params::get(); if ( (RL_Document::isClient('administrator') && ! $params->auto_interval_admin) || (RL_Document::isClient('site') && ! $params->auto_interval_front) ) { return false; } $user = JFactory::getApplication()->getIdentity() ?: JFactory::getUser(); if (RL_Document::isClient('administrator') && $user->get('guest')) { return false; } $file_path = str_replace('//', '/', JPATH_SITE . '/' . str_replace('\\', '/', $params->log_path . '/')); if ( ! JFolder::exists($file_path)) { $file_path = JPATH_PLUGINS . '/system/cachecleaner/'; } $file = $file_path . '/cachecleaner_lastclean.log'; $secs = RL_Document::isClient('site') ? $params->auto_interval_front_secs : $params->auto_interval_admin_secs; // Return false if last clean is within interval if ( file_exists($file) && ($lastclean = file_get_contents($file)) && $lastclean > (time() - $secs) ) { return false; } self::$show_message = RL_Document::isClient('site') ? $params->auto_interval_front_msg : $params->auto_interval_admin_msg; return true; } private static function passTask() { $params = Params::get(); if ( ! $task = JFactory::getApplication()->input->get('task')) { return false; } $task = explode('.', $task, 2); $task = $task[1] ?? $task[0]; if (strpos($task, 'save') === 0) { $task = 'save'; } $tasks = array_diff(array_map('trim', explode(',', $params->auto_save_tasks)), ['']); if (empty($tasks) || ! in_array($task, $tasks)) { return false; } if (RL_Document::isClient('administrator') && $params->auto_save_admin) { self::$show_message = $params->auto_save_admin_msg; return true; } if (RL_Document::isClient('site') && $params->auto_save_front) { self::$show_message = $params->auto_save_front_msg; return true; } return false; } private static function passType($type) { $params = Params::get(); if (empty($params->{$type})) { return false; } if ($params->{$type} == 2 && self::getCleanType() != 'button') { return false; } return true; } private static function purgeThirdPartyCache($thirdparty) { switch ($thirdparty) { case 'jotcache': return Cache\JotCache::purge(); case 'siteground': return Cache\SiteGround::purge(); case 'keycdn': return Cache\KeyCDN::purge(); case 'cdn77': return Cache\CDN77::purge(); case 'cloudflare': return Cache\CloudFlare::purge(); } return ''; } private static function purgeThirdPartyCacheByUrl() { $purged = false; // Return if not in administrator if ( ! RL_Document::isAdmin(true)) { return; } foreach (self::$thirdparties as $thirdparty) { if ( ! JFactory::getApplication()->input->getInt('purge_' . $thirdparty)) { continue; } if (self::purgeThirdPartyCache($thirdparty) < 0) { self::addError('(' . JText::_('CC_SAVE_SETTINGS_FIRST') . ')'); } $purged = true; } if ($purged) { echo self::getError() ?: '+' . Cache\Cache::getMessage(); die; } } private static function purgeThirdPartyCaches() { foreach (self::$thirdparties as $thirdparty) { if ( ! self::passType('clean_' . $thirdparty)) { continue; } self::purgeThirdPartyCache($thirdparty); } } private static function queryUrl() { $params = Params::get(); try { $http = JHttpFactory::getHttp()->get($params->query_url_selection, [], max(1, $params->query_url_timeout)); if ($http->code != 200) { self::setError(JText::sprintf('CC_ERROR_QUERY_URL_FAILED', $params->query_url_selection)); } } catch (RuntimeException $e) { self::setError(JText::sprintf('CC_ERROR_QUERY_URL_FAILED', $params->query_url_selection)); } } private static function updateLog() { $params = Params::get(); // Write current time to text file jimport('joomla.filesystem.file'); jimport('joomla.filesystem.folder'); $file_path = str_replace('//', '/', JPATH_SITE . '/' . str_replace('\\', '/', $params->log_path . '/')); if ( ! JFolder::exists($file_path)) { $file_path = JPATH_PLUGINS . '/system/cachecleaner/'; } $time = time(); JFile::write($file_path . 'cachecleaner_lastclean.log', $time); } } 0 Class 'RegularLabs\Plugin\System\CacheCleaner\Cache' not found

Contact

mail@gemini-theme.com
+ 001 0231 123 32

Follow

Info

All demo content is for sample purposes only, intended to represent a live site. Please use the RocketLauncher to install an equivalent of the demo, all images will be replaced with sample images.

0 Class 'RegularLabs\Plugin\System\CacheCleaner\Cache' not found