Beispiel #1
0
 /**
  * This function will upgrate DB that didn't existed in verisons below 2.0.5 
  * changes added: subscription widget, new email content, map zoom, paypal seller etc..  
  */
 public function action_205()
 {
     // build array with new (missing) configs
     $configs = array(array('config_key' => 'paypal_seller', 'group_name' => 'payment', 'config_value' => '0'), array('config_key' => 'map_zoom', 'group_name' => 'advertisement', 'config_value' => '16'), array('config_key' => 'center_lon', 'group_name' => 'advertisement', 'config_value' => '3'), array('config_key' => 'center_lat', 'group_name' => 'advertisement', 'config_value' => '40'), array('config_key' => 'new_ad_notify', 'group_name' => 'email', 'config_value' => '0'));
     $contents = array(array('order' => '0', 'title' => 'Advertisement `[AD.TITLE]` is created on [SITE.NAME]!', 'seotitle' => 'ads.subscribers', 'description' => "Hello [USER.NAME],\n\nYou may be interested in this one [AD.TITLE]!\n\nYou can visit this link to see advertisement [URL.AD]", 'from_email' => core::config('email.notify_email'), 'type' => 'email', 'status' => '1'), array('order' => '0', 'title' => 'Advertisement `[AD.TITLE]` is created on [SITE.NAME]!', 'seotitle' => 'ads.to_admin', 'description' => "Click here to visit [URL.AD]", '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);
     $prefix = Database::instance()->table_prefix();
     $config_db = Kohana::$config->load('database');
     $charset = $config_db['default']['charset'];
     /*
       @todo NOT DINAMIC, get charset
     */
     mysql_query("CREATE TABLE IF NOT EXISTS `" . $prefix . "subscribers` (\n                    `id_subscribe` int(10) unsigned NOT NULL AUTO_INCREMENT,\n                    `id_user` int(10) unsigned NOT NULL,\n                    `id_category` int(10) unsigned NOT NULL DEFAULT '0',\n                    `id_location` int(10) unsigned NOT NULL DEFAULT '0',\n                    `min_price` decimal(14,3) NOT NULL DEFAULT '0',\n                    `max_price` decimal(14,3) NOT NULL DEFAULT '0',\n                    `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n                    PRIMARY KEY (`id_subscribe`)\n                  ) ENGINE=MyISAM DEFAULT CHARSET=" . $charset . ";");
     // remove INDEX from content table
     mysql_query("ALTER TABLE `" . $prefix . "content` DROP INDEX `" . $prefix . "content_UK_seotitle`");
 }
Beispiel #2
0
 /**
  * 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);
 }
Beispiel #3
0
 /**
  * This function will upgrade configs  
  */
 public function action_12()
 {
     //coupons product
     try {
         DB::query(Database::UPDATE, "ALTER TABLE  `" . self::$db_prefix . "coupons` ADD  `id_product` INT NULL DEFAULT NULL AFTER  `id_coupon`")->execute();
     } catch (exception $e) {
     }
     try {
         DB::query(Database::UPDATE, "ALTER TABLE  `" . self::$db_prefix . "orders` ADD  `notes` VARCHAR( 245 ) NULL DEFAULT NULL")->execute();
     } catch (exception $e) {
     }
     try {
         DB::query(Database::UPDATE, "ALTER TABLE  `" . self::$db_prefix . "users` ADD  `signature` VARCHAR( 245 ) NULL DEFAULT NULL")->execute();
     } catch (exception $e) {
     }
     try {
         DB::query(Database::UPDATE, "ALTER TABLE  `" . self::$db_prefix . "visits` DROP  `contacted`")->execute();
     } catch (exception $e) {
     }
     try {
         DB::query(Database::UPDATE, "ALTER TABLE  `" . self::$db_prefix . "posts` ADD  `id_post_parent` INT NULL DEFAULT NULL AFTER  `id_user`")->execute();
     } catch (exception $e) {
     }
     try {
         DB::query(Database::UPDATE, "ALTER TABLE  `" . self::$db_prefix . "posts` ENGINE = MYISAM ")->execute();
     } catch (exception $e) {
     }
     try {
         DB::query(Database::UPDATE, "ALTER TABLE  `" . self::$db_prefix . "products` ADD `rate` FLOAT( 4, 2 ) NULL DEFAULT NULL ;")->execute();
     } catch (exception $e) {
     }
     DB::query(Database::UPDATE, "CREATE TABLE IF NOT EXISTS  `" . self::$db_prefix . "forums` (\n                      `id_forum` int(10) unsigned NOT NULL AUTO_INCREMENT,\n                      `name` varchar(145) NOT NULL,\n                      `order` int(2) unsigned NOT NULL DEFAULT '0',\n                      `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n                      `id_forum_parent` int(10) unsigned NOT NULL DEFAULT '0',\n                      `parent_deep` int(2) unsigned NOT NULL DEFAULT '0',\n                      `seoname` varchar(145) NOT NULL,\n                      `description` varchar(255) NULL,\n                      PRIMARY KEY (`id_forum`) USING BTREE,\n                      UNIQUE KEY `" . self::$db_prefix . "forums_IK_seo_name` (`seoname`)\n                    ) ENGINE=MyISAM")->execute();
     DB::query(Database::UPDATE, "CREATE TABLE IF NOT EXISTS " . self::$db_prefix . "reviews (\n                    id_review int(10) unsigned NOT NULL AUTO_INCREMENT,\n                    id_user int(10) unsigned NOT NULL,\n                    id_order int(10) unsigned NOT NULL,\n                    id_product int(10) unsigned NOT NULL,\n                    rate int(2) unsigned NOT NULL DEFAULT '0',\n                    description varchar(1000) NOT NULL,\n                    created timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\n                    ip_address float DEFAULT NULL,\n                    status tinyint(1) NOT NULL DEFAULT '0',\n                    PRIMARY KEY (id_review) USING BTREE,\n                    KEY " . self::$db_prefix . "reviews_IK_id_user (id_user),\n                    KEY " . self::$db_prefix . "reviews_IK_id_order (id_order),\n                    KEY " . self::$db_prefix . "reviews_IK_id_product (id_product)\n                    ) ENGINE=MyISAM;")->execute();
     // build array with new (missing) configs
     $configs = array(array('config_key' => 'minify', 'group_name' => 'general', 'config_value' => '0'), array('config_key' => 'stripe_public', 'group_name' => 'payment', 'config_value' => ''), array('config_key' => 'stripe_private', 'group_name' => 'payment', 'config_value' => ''), array('config_key' => 'stripe_address', 'group_name' => 'payment', 'config_value' => '0'), array('config_key' => 'alternative', 'group_name' => 'payment', 'config_value' => ''), array('config_key' => 'related', 'group_name' => 'product', 'config_value' => '5'), array('config_key' => 'faq', 'group_name' => 'general', 'config_value' => '0'), array('config_key' => 'faq_disqus', 'group_name' => 'general', 'config_value' => ''), array('config_key' => 'forums', 'group_name' => 'general', 'config_value' => '0'), array('config_key' => 'reviews', 'group_name' => 'product', 'config_value' => '0'), array('config_key' => 'demo_theme', 'group_name' => 'product', 'config_value' => 'yeti'), array('config_key' => 'demo_resize', 'group_name' => 'product', 'config_value' => '1'));
     $contents = array(array('order' => '0', 'title' => '[EMAIL.SENDER] wants to contact you!', 'seotitle' => 'contact-admin', 'description' => "Hello Admin,\n\n [EMAIL.SENDER]: [EMAIL.FROM], have a message for you:\n\n [EMAIL.BODY] \n\n Regards!", 'from_email' => core::config('email.notify_email'), 'type' => 'email', 'status' => '1'), array('order' => '0', 'title' => 'Ticket assigned to you: [TITLE]', 'seotitle' => 'assign-agent', 'description' => '[URL.QL]\\n\\n[DESCRIPTION]', 'from_email' => core::config('email.notify_email'), 'type' => 'email', 'status' => '1'), array('order' => '0', 'title' => 'New review for [TITLE] [RATE]', 'seotitle' => 'review-product', 'description' => '[URL.QL]\\n\\n[RATE]\\n\\n[DESCRIPTION]', 'from_email' => core::config('email.notify_email'), 'type' => 'email', 'status' => '1'), array('order' => '0', 'title' => 'New support ticket created `[TITLE]`', 'seotitle' => 'new-ticket', 'description' => 'We have received your support inquiry. We will try to answer you within the next 24 working hours, thank you for your patience.\\n\\n[URL.QL]', '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);
 }