/** * Method to get cache instance * * @return object */ public function cache() { $handler = App::get('config')->get('cache_handler'); $client = ClientManager::client($this->state('clientId')); App::get('config')->set($handler, array('cachebase' => PATH_APP . '/cache/' . (isset($client->alias) ? $client->alias : $client->name))); $cache = new \Hubzero\Cache\Manager(\App::getRoot()); $cache->storage($handler); return $cache; }
/** * Save changes to the registration * * @return void */ public function saveTask() { // Check for request forgeries Request::checkToken(); $settings = Request::getVar('settings', array(), 'post'); if (!is_array($settings) || empty($settings)) { App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller, false), Lang::txt('COM_MEMBERS_REGISTRATION_ERROR_MISSING_DATA'), 'error'); return; } $arr = array(); $component = new \JTableExtension($this->database); $component->load($component->find(array('element' => $this->_option, 'type' => 'component'))); $params = new \Hubzero\Config\Registry($component->params); foreach ($settings as $name => $value) { $r = $value['create'] . $value['proxy'] . $value['update'] . $value['edit']; $params->set('registration' . trim($name), trim($r)); } $component->params = $params->toString(); $component->store(); if (App::get('config')->get('caching')) { $handler = App::get('config')->get('cache_handler'); App::get('config')->set($handler, array('cachebase' => PATH_APP . '/cache/site')); $cache = new \Hubzero\Cache\Manager(\App::getRoot()); $cache->storage($handler); $cache->clean('_system'); } App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller, false), Lang::txt('COM_MEMBERS_REGISTRATION_SAVED')); }
/** * Clean the cache * * @param string $group The cache group * @param integer $client_id The ID of the client * * @return void * * @since 11.1 */ protected function cleanCache($group = null, $client_id = 0) { // Initialise variables; $conf = JFactory::getConfig(); $dispatcher = JDispatcher::getInstance(); $options = array('defaultgroup' => $group ? $group : (isset($this->option) ? $this->option : JRequest::getCmd('option')), 'cachebase' => $client_id ? PATH_APP . '/cache/admin' : $conf->get('cache_path', PATH_APP . '/cache/site')); /* [!] HUBzero - Changed to use Hubzero Cache $cache = JCache::getInstance('callback', $options); $cache->clean(); */ $handler = \App::get('config')->get('cache_handler'); $client = \Hubzero\Base\ClientManager::client((int) $client_id); $app = \App::getRoot(); $app->get('config')->set($handler, array('cachebase' => PATH_APP . '/cache/' . (isset($client->alias) ? $client->alias : $client->name))); $cache = new \Hubzero\Cache\Manager($app); $cache->storage($handler); $cache->clean($group); // Trigger the onContentCleanCache event. $dispatcher->trigger($this->event_clean_cache, $options); }