From 23415170cb8e8c923c540bca84345bfb8f9e92c3 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Tue, 20 Sep 2011 18:04:18 +0100 Subject: [PATCH] [feature/remove-db-styles] Removing unused methods from acp_style. These got left behind in 6854d47. PHPBB3-9741 --- phpBB/includes/acp/acp_styles.php | 176 ------------------------------ 1 file changed, 176 deletions(-) diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index 8bd75c6ab9..7ab2061141 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -2684,180 +2684,4 @@ version = {VERSION} return false; } - - /** - * Moves a template set and its subtemplates to the database - * - * @access public - * @param string $mode The component to move - only template is supported - * @param int $id The template id - */ - function store_in_db($mode, $id) - { - global $db, $user; - - $error = array(); - $l_type = strtoupper($mode); - if ($super = $this->get_super($mode, $id)) - { - $error[] = (sprintf($user->lang["{$l_type}_INHERITS"], $super['template_name'])); - return $error; - } - - $sql = "SELECT {$mode}_id, {$mode}_name, {$mode}_path - FROM " . STYLES_TEMPLATE_TABLE . ' - WHERE template_id = ' . (int) $id; - - $result = $db->sql_query_limit($sql, 1); - if ($row = $db->sql_fetchrow($result)) - { - $db->sql_freeresult($result); - $subs = $this->check_inheritance($mode, $id); - - $this->_store_in_db($mode, $id, $row["{$mode}_path"]); - if ($subs && sizeof($subs)) - { - foreach ($subs as $sub_id => $sub) - { - if ($err = $this->_store_in_db($mode, $sub["{$mode}_id"], $sub["{$mode}_path"])) - { - $error[] = $err; - } - } - } - } - if (sizeof($error)) - { - return $error; - } - - return false; - } - - /** - * Moves a template set to the database - * - * @access private - * @param string $mode The component to move - only template is supported - * @param int $id The template id - * @param string $path TThe path to the template files - */ - function _store_in_db($mode, $id, $path) - { - global $phpbb_root_path, $db; - - $filelist = filelist("{$phpbb_root_path}styles/{$path}/template", '', 'html'); - $this->store_templates('insert', $id, $path, $filelist); - - // Okay, we do the query here -shouldn't be triggered often. - $sql = 'UPDATE ' . STYLES_TEMPLATE_TABLE . ' - SET template_storedb = 1 - WHERE template_id = ' . $id; - $db->sql_query($sql); - } - - /** - * Moves a template set and its subtemplates to the filesystem - * - * @access public - * @param string $mode The component to move - only template is supported - * @param int $id The template id - */ - function store_in_fs($mode, $id) - { - global $db, $user; - - $error = array(); - $l_type = strtoupper($mode); - if ($super = $this->get_super($mode, $id)) - { - $error[] = (sprintf($user->lang["{$l_type}_INHERITS"], $super['template_name'])); - return($error); - } - - $sql = "SELECT {$mode}_id, {$mode}_name, {$mode}_path - FROM " . STYLES_TEMPLATE_TABLE . ' - WHERE template_id = ' . (int) $id; - - $result = $db->sql_query_limit($sql, 1); - if ($row = $db->sql_fetchrow($result)) - { - $db->sql_freeresult($result); - if (!sizeof($error)) - { - $subs = $this->check_inheritance($mode, $id); - - $this->_store_in_fs($mode, $id, $row["{$mode}_path"]); - - if ($subs && sizeof($subs)) - { - foreach ($subs as $sub_id => $sub) - { - $this->_store_in_fs($mode, $sub["{$mode}_id"], $sub["{$mode}_path"]); - } - } - } - if (sizeof($error)) - { - $this->store_in_db($id, $mode); - return $error; - } - } - return false; - } - - /** - * Moves a template set to the filesystem - * - * @access private - * @param string $mode The component to move - only template is supported - * @param int $id The template id - * @param string $path The path to the template - */ - function _store_in_fs($mode, $id, $path) - { - global $phpbb_root_path, $db, $user, $safe_mode; - - $store_db = 0; - $error = array(); - if (!$safe_mode && phpbb_is_writable("{$phpbb_root_path}styles/{$path}/template")) - { - $sql = 'SELECT * - FROM ' . STYLES_TEMPLATE_DATA_TABLE . " - WHERE template_id = $id"; - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) - { - if (!($fp = @fopen("{$phpbb_root_path}styles/{$path}/template/" . $row['template_filename'], 'wb'))) - { - $store_db = 1; - $error[] = $user->lang['EDIT_TEMPLATE_STORED_DB']; - break; - } - - fwrite($fp, $row['template_data']); - fclose($fp); - } - $db->sql_freeresult($result); - - if (!$store_db) - { - $sql = 'DELETE FROM ' . STYLES_TEMPLATE_DATA_TABLE . " - WHERE template_id = $id"; - $db->sql_query($sql); - } - } - if (sizeof($error)) - { - return $error; - } - $sql = 'UPDATE ' . STYLES_TEMPLATE_TABLE . ' - SET template_storedb = 0 - WHERE template_id = ' . $id; - $db->sql_query($sql); - - return false; - } - }