/** * This function will upgrade configs */ public function action_11() { // build array with new (missing) configs $configs = array(array('config_key' => 'thanks_page', 'group_name' => 'payment', 'config_value' => ''), array('config_key' => 'blog', 'group_name' => 'general', 'config_value' => '0'), array('config_key' => 'blog_disqus', 'group_name' => 'general', 'config_value' => '')); // returns TRUE if some config is saved $return_conf = Model_Config::config_array($configs); }
/** * This function will upgrade configs that didn't existed in versions prior to 2.0.3 */ public function action_203() { // build array with new (missing) configs $configs = array(array('config_key' => 'watermark', 'group_name' => 'image', 'config_value' => '0'), array('config_key' => 'watermark_path', 'group_name' => 'image', 'config_value' => ''), array('config_key' => 'watermark_position', 'group_name' => 'image', 'config_value' => '0'), array('config_key' => 'ads_in_home', 'group_name' => 'advertisement', 'config_value' => '0')); $contents = array(array('order' => '0', 'title' => 'Hello [USER.NAME]!', 'seotitle' => 'user-profile-contact', 'description' => "User [EMAIL.SENDER] [EMAIL.FROM], have a message for you: \n\n [EMAIL.SUBJECT] \n\n[EMAIL.BODY]. \n\n Regards!", 'from_email' => core::config('email.notify_email'), 'type' => 'email', 'status' => '1')); // returns TRUE if some config is saved $return_conf = Model_Config::config_array($configs); $return_cont = Model_Content::content_array($contents); }
/** * This function will upgrate DB that didn't existed in verisons below 2.0.7 * changes added: config for advanced search by description */ public function action_21() { $prefix = Database::instance()->table_prefix(); $config_db = Kohana::$config->load('database'); $charset = $config_db['default']['charset']; mysql_query("ALTER TABLE `" . $prefix . "users` ADD `hybridauth_provider_name` VARCHAR( 40 ) NULL DEFAULT NULL ,ADD `hybridauth_provider_uid` VARCHAR( 245 ) NULL DEFAULT NULL"); mysql_query("create unique index " . $prefix . "users_UK_provider_AND_uid on " . $prefix . "users (hybridauth_provider_name, hybridauth_provider_uid)"); mysql_query("CREATE TABLE IF NOT EXISTS `" . $prefix . "posts` (\n `id_post` int(10) unsigned NOT NULL AUTO_INCREMENT,\n `id_user` int(10) unsigned NOT NULL,\n `title` varchar(245) NOT NULL,\n `seotitle` varchar(245) NOT NULL,\n `description` text NOT NULL,\n `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\n `status` tinyint(1) NOT NULL DEFAULT '0',\n PRIMARY KEY (`id_post`) USING BTREE,\n UNIQUE KEY `" . $prefix . "posts_UK_seotitle` (`seotitle`)\n ) ENGINE=InnoDB DEFAULT CHARSET=" . $charset . ";"); // build array with new (missing) configs $configs = array(array('config_key' => 'search_by_description', 'group_name' => 'general', 'config_value' => 0), array('config_key' => 'blog', 'group_name' => 'general', 'config_value' => 0), array('config_key' => 'minify', 'group_name' => 'general', 'config_value' => 0), array('config_key' => 'parent_category', 'group_name' => 'advertisement', 'config_value' => 1), array('config_key' => 'blog_disqus', 'group_name' => 'general', 'config_value' => ''), array('config_key' => 'upload_images_mobile', 'group_name' => 'general', 'config_value' => 0), array('config_key' => 'config', 'group_name' => 'social', 'config_value' => '{"debug_mode":"0","providers":{ "OpenID":{"enabled":"1"}, "Yahoo":{"enabled":"0","keys":{"id":"","secret":""}}, "AOL":{"enabled":"1"} ,"Google":{"enabled":"0","keys":{"id":"","secret":""}}, "Facebook":{"enabled":"0","keys":{"id":"","secret":""}}, "Twitter":{"enabled":"0","keys":{"key":"","secret":""}}, "Live":{"enabled":"0","keys":{"id":"","secret":""}}, "MySpace":{"enabled":"0","keys":{"key":"","secret":""}}, "LinkedIn":{"enabled":"0","keys":{"key":"","secret":""}}, "Foursquare":{"enabled":"0","keys":{"id":"","secret":""}}}, "base_url":"", "debug_file":""}')); // returns TRUE if some config is saved $return_conf = Model_Config::config_array($configs); //call update actions 203,205,206,207 $this->action_203(); $this->action_205(); $this->action_206(); $this->action_207(); //clean cache Cache::instance()->delete_all(); Theme::delete_minified(); Alert::set(Alert::SUCCESS, __('Updated')); $this->request->redirect(Route::url('oc-panel', array('controller' => 'update', 'action' => 'index'))); }