/** * Executes the command cache:purge. * * Purge the cache (including permissions) and increment the asset_version number * * @param InputInterface $input An InputInterface instance * @param OutputInterface $output An OutputInterface instance * * @return null */ protected function execute(InputInterface $input, OutputInterface $output) { $this->config->increment('assets_version', 1); $this->cache->purge(); // Clear permissions $this->auth->acl_clear_prefetch(); src_cache_moderators($this->db, $this->cache, $this->auth); $this->log->add('admin', ANONYMOUS, '', 'LOG_PURGE_CACHE', time(), array()); $output->writeln($this->user->lang('PURGE_CACHE_SUCCESS')); }
/** * Show style details */ protected function action_details() { $id = $this->request->variable('id', 0); if (!$id) { trigger_error($this->user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); } // Get all styles $styles = $this->get_styles(); usort($styles, array($this, 'sort_styles')); // Find current style $style = false; foreach ($styles as $row) { if ($row['style_id'] == $id) { $style = $row; break; } } if ($style === false) { trigger_error($this->user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); } // Find all available parent styles $list = $this->find_possible_parents($styles, $id); // Add form key $form_key = 'acp_styles'; add_form_key($form_key); // Change data if ($this->request->variable('update', false)) { if (!check_form_key($form_key)) { trigger_error($this->user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); } $update = array('style_name' => trim($this->request->variable('style_name', $style['style_name'])), 'style_parent_id' => $this->request->variable('style_parent', (int) $style['style_parent_id']), 'style_active' => $this->request->variable('style_active', (int) $style['style_active'])); $update_action = $this->u_action . '&action=details&id=' . $id; // Check style name if ($update['style_name'] != $style['style_name']) { if (!strlen($update['style_name'])) { trigger_error($this->user->lang['STYLE_ERR_STYLE_NAME'] . adm_back_link($update_action), E_USER_WARNING); } foreach ($styles as $row) { if ($row['style_name'] == $update['style_name']) { trigger_error($this->user->lang['STYLE_ERR_NAME_EXIST'] . adm_back_link($update_action), E_USER_WARNING); } } } else { unset($update['style_name']); } // Check parent style id if ($update['style_parent_id'] != $style['style_parent_id']) { if ($update['style_parent_id'] != 0) { $found = false; foreach ($list as $row) { if ($row['style_id'] == $update['style_parent_id']) { $found = true; $update['style_parent_tree'] = ($row['style_parent_tree'] != '' ? $row['style_parent_tree'] . '/' : '') . $row['style_path']; break; } } if (!$found) { trigger_error($this->user->lang['STYLE_ERR_INVALID_PARENT'] . adm_back_link($update_action), E_USER_WARNING); } } else { $update['style_parent_tree'] = ''; } } else { unset($update['style_parent_id']); } // Check style_active if ($update['style_active'] != $style['style_active']) { if (!$update['style_active'] && $this->default_style == $style['style_id']) { trigger_error($this->user->lang['DEACTIVATE_DEFAULT'] . adm_back_link($update_action), E_USER_WARNING); } } else { unset($update['style_active']); } // Update data if (count($update)) { $sql = 'UPDATE ' . STYLES_TABLE . ' SET ' . $this->db->sql_build_array('UPDATE', $update) . "\n\t\t\t\t\tWHERE style_id = {$id}"; $this->db->sql_query($sql); $style = array_merge($style, $update); if (isset($update['style_parent_id'])) { // Update styles tree $styles = $this->get_styles(); if ($this->update_styles_tree($styles, $style)) { // Something was changed in styles tree, purge all cache $this->cache->purge(); } } add_log('admin', 'LOG_STYLE_EDIT_DETAILS', $style['style_name']); } // Update default style $default = $this->request->variable('style_default', 0); if ($default) { if (!$style['style_active']) { trigger_error($this->user->lang['STYLE_DEFAULT_CHANGE_INACTIVE'] . adm_back_link($update_action), E_USER_WARNING); } set_config('default_style', $id); $this->cache->purge(); } // Show styles list $this->frontend(); return; } // Show page title $this->welcome_message('ACP_STYLES', null); // Show parent styles foreach ($list as $row) { $this->template->assign_block_vars('parent_styles', array('STYLE_ID' => $row['style_id'], 'STYLE_NAME' => htmlspecialchars($row['style_name']), 'LEVEL' => $row['level'], 'SPACER' => str_repeat(' ', $row['level']))); } // Show style details $this->template->assign_vars(array('S_STYLE_DETAILS' => true, 'STYLE_ID' => $style['style_id'], 'STYLE_NAME' => htmlspecialchars($style['style_name']), 'STYLE_PATH' => htmlspecialchars($style['style_path']), 'STYLE_COPYRIGHT' => strip_tags($style['style_copyright']), 'STYLE_PARENT' => $style['style_parent_id'], 'S_STYLE_ACTIVE' => $style['style_active'], 'S_STYLE_DEFAULT' => $style['style_id'] == $this->default_style)); }