Пример #1
1
 /**
  * @return string
  */
 protected function getInput()
 {
     $file_cache = new JCache(array('defaultgroup' => 'rokbooster', 'caching' => true, 'checkTime' => true, 'storage' => 'file', 'cachebase' => JPATH_SITE . '/cache'));
     $files = $file_cache->getAll();
     $filecount = 0;
     if (is_array($files) && array_key_exists('rokbooster', $files)) {
         $filecount = $files['rokbooster']->count;
     }
     return '<div class="clearcache btn btn-primary" data-action="clearCache"><i>' . JText::_('ROKBOOSTER_BUTTON_CLEAR_CACHE') . '<span class="count">' . $filecount . '</span></i></div>';
 }
Пример #2
0
 /**
  * @return string
  */
 protected function getInput()
 {
     if (!self::$assets_loaded) {
         $doc = JFactory::getDocument();
         $doc->addStyleSheet(JURI::root(true) . '/plugins/system/rokbooster/fields/assets/clearcache/css/clearcache.css');
         $doc->addScript(JURI::root(true) . '/plugins/system/rokbooster/fields/assets/clearcache/js/RokBooster.js');
         self::$assets_loaded = true;
     }
     $file_cache = new JCache(array('defaultgroup' => 'rokbooster', 'caching' => true, 'checkTime' => true, 'storage' => 'file', 'cachebase' => JPATH_SITE . '/cache'));
     $files = $file_cache->getAll();
     $filecount = 0;
     if (is_array($files) && array_key_exists('rokbooster', $files)) {
         $filecount = $files['rokbooster']->count;
     }
     return '<div class="clearcache btn btn-primary" data-action="clearCache"><i>' . JText::_('ROKBOOSTER_BUTTON_CLEAR_CACHE') . '<span class="count">' . $filecount . '</span></i></div>';
 }
Пример #3
0
 /**
  * Display the application.
  */
 public function render()
 {
     $user = JFactory::getUser();
     $conf = JFactory::getConfig();
     if ($user->id != 0) {
         // generate and empty object
         $plgParams = new JRegistry();
         // get plugin details
         $plugin = JPluginHelper::getPlugin('system', 'rokbooster');
         // load params into our params object
         if ($plugin && isset($plugin->params)) {
             $plgParams->loadString($plugin->params);
         }
         if ($user->authorise('core.admin', 'com_cache')) {
             $file_cache = new JCache(array('defaultgroup' => 'rokbooster', 'caching' => true, 'checkTime' => true, 'storage' => 'file', 'cachebase' => JPATH_CACHE));
             $file_info_cache = new JCache(array('defaultgroup' => 'rokbooster', 'caching' => true, 'checkTime' => false));
             $generator_state_cache = new JCache(array('cachebase' => $conf->get('cache_path', JPATH_CACHE), 'lifetime' => 120, 'storage' => $conf->get('cache_handler', 'file'), 'defaultgroup' => 'rokbooster', 'locking' => true, 'locktime' => 15, 'checkTime' => true, 'caching' => true));
             $generator_state_cache->clean();
             $file_cache->clean();
             $file_info_cache->clean();
             $files = $file_cache->getAll();
             $filecount = 0;
             if (is_array($files) && array_key_exists('rokbooster', $files)) {
                 $filecount = $files['rokbooster']->count;
             }
             if ($plgParams->get('data_storage', 'default') == 'apc' && function_exists('apc_store')) {
                 $config = JFactory::getConfig();
                 $hash = preg_quote(md5($config->get('secret')));
                 if (class_exists('APCIterator')) {
                     $entries = new APCIterator('user', "/^{$hash}-rokbooster-dataentry-/");
                     apc_delete($entries);
                 } else {
                     $info = apc_cache_info('user');
                     foreach ($info['cache_list'] as $apc_cache_entry) {
                         if (strpos($apc_cache_entry['info'], "{$hash}-rokbooster-dataentry-") === 0) {
                             apc_delete($apc_cache_entry['info']);
                         }
                     }
                 }
             }
             echo sprintf('{"status":"success","message":"%d"}', $filecount);
         } else {
             echo '{"status": "error","message":"You do not have permissions to clear cache."}';
         }
     }
 }
Пример #4
0
 /**
  * Display the application.
  */
 public function render()
 {
     $user = JFactory::getUser();
     $conf = JFactory::getConfig();
     if ($user->id != 0) {
         if ($user->authorise('core.admin', 'com_cache')) {
             $file_cache = new JCache(array('defaultgroup' => 'rokbooster', 'caching' => true, 'checkTime' => true, 'storage' => 'file', 'cachebase' => JPATH_CACHE));
             $file_info_cache = new JCache(array('defaultgroup' => 'rokbooster', 'caching' => true, 'checkTime' => false));
             $generator_state_cache = new JCache(array('cachebase' => $conf->get('cache_path', JPATH_CACHE), 'lifetime' => 120, 'storage' => $conf->get('cache_handler', 'file'), 'defaultgroup' => 'rokbooster', 'locking' => true, 'locktime' => 15, 'checkTime' => true, 'caching' => true));
             $generator_state_cache->clean();
             $file_cache->clean();
             $file_info_cache->clean();
             $files = $file_cache->getAll();
             $filecount = 0;
             if (is_array($files) && array_key_exists('rokbooster', $files)) {
                 $filecount = $files['rokbooster']->count;
             }
             echo sprintf('{"status":"success","message":"%d"}', $filecount);
         } else {
             echo '{"status": "error","message":"You do not have permissions to clear cache."}';
         }
     }
 }