From 618048c5fb61f84848cf37abe3972cd509cdac04 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 31 Oct 2009 18:12:14 +0000 Subject: [PATCH] SQLs improved, verbose listing for SQLs fixed --- inc/extensions-functions.php | 4 ++-- inc/extensions/ext-autopurge.php | 2 +- inc/extensions/ext-beg.php | 2 +- inc/extensions/ext-bonus.php | 4 +--- inc/extensions/ext-network.php | 12 +++++++++++- inc/extensions/ext-nickname.php | 2 +- inc/extensions/ext-refback.php | 2 +- inc/extensions/ext-sponsor.php | 2 +- inc/modules/admin/overview-inc.php | 2 +- 9 files changed, 20 insertions(+), 12 deletions(-) diff --git a/inc/extensions-functions.php b/inc/extensions-functions.php index dfa79d8fb9..990c04ce79 100644 --- a/inc/extensions-functions.php +++ b/inc/extensions-functions.php @@ -676,9 +676,9 @@ function addExtensionVerboseSqlTable ($title = '', $dashed = '', $switch = false $SW = 2; // Get all SQLs - foreach (getExtensionSqls() as $idx => $sqls) { + foreach (getExtensionSqls() as $sqls) { // New array format is recursive - foreach ($sqls as $sql) { + foreach ($sqls as $idx => $sql) { // Trim out spaces $sql = trim($sql); diff --git a/inc/extensions/ext-autopurge.php b/inc/extensions/ext-autopurge.php index 50fbd19c09..c2514e9397 100644 --- a/inc/extensions/ext-autopurge.php +++ b/inc/extensions/ext-autopurge.php @@ -65,7 +65,7 @@ switch (getExtensionMode()) { if (isExtensionActive('bonus')) { addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_bonus` MODIFY data_type ENUM('NEW','QUEUE','SEND') NOT NULL DEFAULT 'NEW'"); } - addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE what IN('config_autopurge','list_autopurge')"); + addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what` IN('config_autopurge','list_autopurge')"); addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` DROP ap_notified"); break; diff --git a/inc/extensions/ext-beg.php b/inc/extensions/ext-beg.php index bbaf8b2a5d..389917ad35 100644 --- a/inc/extensions/ext-beg.php +++ b/inc/extensions/ext-beg.php @@ -86,7 +86,7 @@ PRIMARY KEY (id) case 'deactivate': // Do stuff when admin deactivates this extension // SQL commands to run addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_guest_menu` SET `visible`='N', `locked`='Y' WHERE `what`='beg' LIMIT 1"); - addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='N', `locked`='Y' WHERE what IN('beg','beg2') LIMIT 2"); + addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='N', `locked`='Y' WHERE `what` IN('beg','beg2') LIMIT 2"); addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_mod_reg` SET `locked`='Y' WHERE `module`='beg' LIMIT 1"); break; diff --git a/inc/extensions/ext-bonus.php b/inc/extensions/ext-bonus.php index f8650b319d..fe73b15347 100644 --- a/inc/extensions/ext-bonus.php +++ b/inc/extensions/ext-bonus.php @@ -80,11 +80,9 @@ PRIMARY KEY (id) case 'remove': // Do stuff when removing extension // SQL commands to run - addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE what IN ('bonus','config_bonus','send_bonus','list_bonus','list_notifications')"); + addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what` IN ('bonus','config_bonus','send_bonus','list_bonus','list_notifications')"); addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='bonus'"); addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `action`='bonus'"); - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_links` MODIFY link_type ENUM('NORMAL') NOT NULL DEFAULT 'NORMAL'"); - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_links` DROP bonus_id"); addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_bonus`"); addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_bonus_urls`"); addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_bonus_customer`"); diff --git a/inc/extensions/ext-network.php b/inc/extensions/ext-network.php index 7a3f7ba086..5bb4e739c9 100644 --- a/inc/extensions/ext-network.php +++ b/inc/extensions/ext-network.php @@ -39,7 +39,7 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); -} +} // END - if // Version number setThisExtensionVersion('0.0'); @@ -50,10 +50,20 @@ setExtensionVersionHistory(array('0.0')); switch (getExtensionMode()) { case 'register': // Do stuff when installation is running (modules.php?module=admin is called) // SQL commands to run + addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_config`"); + addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_config` ( +`network_id` BIGINT(20) NOT NULL AUTO_INCREMENT, +`network_name` VARCHAR(255) NOT NULL DEFAULT '', +`network_title` VARCHAR(255) NOT NULL DEFAULT '', +`network_reflink` VARCHAR(255) NOT NULL DEFAULT '', +UNIQUE (`network_name`), +PRIMARY KEY (`network_id`) +) TYPE={?_TABLE_TYPE?} COMMENT='Network data'"); break; case 'remove': // Do stuff when removing extension // SQL commands to run + addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_config`"); break; case 'activate': // Do stuff when admin activates this extension diff --git a/inc/extensions/ext-nickname.php b/inc/extensions/ext-nickname.php index 0118114431..8ca9f150f2 100644 --- a/inc/extensions/ext-nickname.php +++ b/inc/extensions/ext-nickname.php @@ -58,7 +58,7 @@ switch (getExtensionMode()) { case 'remove': // Do stuff when removing extension // SQL commands to run addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='nickname'"); - addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE what IN ('config_nickname','list_nickname')"); + addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what` IN ('config_nickname','list_nickname')"); addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_nickname_history`"); break; diff --git a/inc/extensions/ext-refback.php b/inc/extensions/ext-refback.php index cd653a6498..22e30a9edb 100644 --- a/inc/extensions/ext-refback.php +++ b/inc/extensions/ext-refback.php @@ -74,7 +74,7 @@ KEY (`refid`) // SQL commands to run addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_refs`"); addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='refback'"); - addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE what IN('config_refback','list_refback')"); + addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what` IN('config_refback','list_refback')"); addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_refsystem` SET level=level-1"); break; diff --git a/inc/extensions/ext-sponsor.php b/inc/extensions/ext-sponsor.php index 8741bf8146..a5d137761a 100644 --- a/inc/extensions/ext-sponsor.php +++ b/inc/extensions/ext-sponsor.php @@ -384,7 +384,7 @@ PRIMARY KEY (`id`) addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_sponsor_campaign_assigns`"); addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_sponsor_admin_data`"); addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_sponsor_display_data`"); - addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='sponsor' OR what IN('repr_sponsor','sponsor_medit','sponsor_madd')"); + addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='sponsor' OR `what` IN('repr_sponsor','sponsor_medit','sponsor_madd')"); addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `action`='sponsor'"); addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='sponsor'"); break; diff --git a/inc/modules/admin/overview-inc.php b/inc/modules/admin/overview-inc.php index 2a09cb95a0..ebd9c8377b 100644 --- a/inc/modules/admin/overview-inc.php +++ b/inc/modules/admin/overview-inc.php @@ -48,7 +48,7 @@ function outputStandardOverview (&$result_tasks) { array(getCurrentAdminId()), __FILE__, __LINE__); // We currently don't want to install an extension so let's find out if we need... - setExtensionMode('register'); + setExtensionMode('test'); $jobsDone = true; // Open the extension directory -- 2.39.5