New wrapper functions introduced, some one-line parameter monsters killed:
authorRoland Häder <roland@mxchange.org>
Thu, 27 Jan 2011 00:50:40 +0000 (00:50 +0000)
committerRoland Häder <roland@mxchange.org>
Thu, 27 Jan 2011 00:50:40 +0000 (00:50 +0000)
- New function addDropTableSql introduced which wraps a DROP TABLE statement
- New (cached) function isSqlTableCreated introduced which checks if the given
  table is created
- New (cached) function isSqlTableIndexAdded introduced which checks on a 'mode'
  condition (see source code) if the table index is created
- In two admin what-modules there was a one/multi-line parameter monster which
  is now dead and resurrected as a human-readable multi-line creature ... ;-)
- TODOs.txt updated

37 files changed:
DOCS/TODOs.txt
inc/db/lib-mysql3.php
inc/extensions-functions.php
inc/extensions/ext-admins.php
inc/extensions/ext-bank.php
inc/extensions/ext-beg.php
inc/extensions/ext-birthday.php
inc/extensions/ext-bonus.php
inc/extensions/ext-booking.php
inc/extensions/ext-country.php
inc/extensions/ext-debug.php
inc/extensions/ext-doubler.php
inc/extensions/ext-forced.php
inc/extensions/ext-holiday.php
inc/extensions/ext-imprint.php
inc/extensions/ext-mediadata.php
inc/extensions/ext-network.php
inc/extensions/ext-newsletter.php
inc/extensions/ext-nickname.php
inc/extensions/ext-online.php
inc/extensions/ext-optimize.php
inc/extensions/ext-order.php
inc/extensions/ext-payout.php
inc/extensions/ext-primera.php
inc/extensions/ext-rallye.php
inc/extensions/ext-refback.php
inc/extensions/ext-register.php
inc/extensions/ext-sponsor.php
inc/extensions/ext-sql_patches.php
inc/extensions/ext-surfbar.php
inc/extensions/ext-theme.php
inc/extensions/ext-transfer.php
inc/extensions/ext-user.php
inc/extensions/ext-wernis.php
inc/extensions/ext-yoomedia.php
inc/modules/admin/what-list_bank_package.php
inc/modules/admin/what-list_surfbar_urls.php

index 0aa233a..17ef26b 100644 (file)
@@ -35,7 +35,7 @@
 ./inc/extensions/ext-network.php:37: * @TODO Yoo!Media: What is LayerAd compared to Layer click?            *
 ./inc/extensions/ext-network.php:91:           // @TODO network_type_handle is an internal name and needs documentation
 ./inc/extensions/ext-newsletter.php:218:               // @TODO Move these into configuration
-./inc/extensions/ext-order.php:335:            // @TODO This should be moved out to inc/daily/
+./inc/extensions/ext-order.php:336:            // @TODO This should be moved out to inc/daily/
 ./inc/extensions/ext-rallye.php:329:           // @TODO Move this code into rallye_functions.php
 ./inc/extensions/ext-rallye.php:92:            // @TODO Fix config_rallye_prices to list_rallye_prices
 ./inc/extensions/ext-yoomedia.php:121:         // @TODO Can this be moved into a database table?
index 701506b..80e3a1d 100644 (file)
@@ -430,7 +430,7 @@ function SQL_ALTER_TABLE ($sql, $F, $L, $enableCodes = true) {
                                logDebugMessage(__FUNCTION__, __LINE__, 'Possible problem: ' . $sql . ',hasZeroNums=' . intval(SQL_HASZERONUMS($result)) . '');
                        }
                } // END - foreach
-       } elseif ((getConfig('_TABLE_TYPE') == 'InnoDB') && (strpos($sql, 'FULLTEXT') !== false)) {
+       } elseif ((getTableType() == 'InnoDB') && (strpos($sql, 'FULLTEXT') !== false)) {
                // Skip this query silently
                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Skipped FULLTEXT: sql=%s,tableName=%s,hasZeroNums=%d,file=%s,line=%s", $sql, $tableName, intval((is_bool($result)) ? 0 : SQL_HASZERONUMS($result)), $F, $L));
        } elseif ($noIndex === false) {
@@ -456,41 +456,8 @@ function SQL_ALTER_TABLE ($sql, $F, $L, $enableCodes = true) {
                        } // END while
                } // END - if
 
-               // Show indexes
-               $result = SQL_QUERY_ESC("SHOW INDEX FROM `%s`", array($tableName), __FUNCTION__, __LINE__);
-
-               // Non-skipping is default for ADD
-               $skip = false;
-
-               // But should we DROP?
-               if ($tableArray[3] == 'DROP') {
-                       // Then skip if nothing found
-                       $skip = true;
-                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Going to drop key ' . $keyName);
-               } // END - if
-
-               // Walk through all
-               while ($content = SQL_FETCHARRAY($result)) {
-                       // Is it found?
-                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'columnName='.$keyName.',content=<pre>' . print_r($content, true) . '</pre>');
-                       if (($content['Key_name'] == $keyName) && ($tableArray[3] == 'ADD')) {
-                               // Skip this query!
-                               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("ADD: Skiped: %s", $sql));
-                               $skip = true;
-                               break;
-                       } elseif (($content['Key_name'] == $keyName) && ($tableArray[3] == 'DROP')) {
-                               // Don't skip this!
-                               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("DROP: Not skiped: %s", $sql));
-                               $skip = false;
-                               break;
-                       }
-               } // END - while
-
-               // Free result
-               SQL_FREERESULT($result);
-
                // Shall we run it?
-               if ($skip === false) {
+               if (!isSqlTableIndexAdded($tableName, $tableArray[3])) {
                        // Send it to the SQL_QUERY() function
                        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $sql);
                        $result = SQL_QUERY($sql, $F, $L, $enableCodes);
@@ -531,7 +498,7 @@ function SQL_SET_LINK ($link) {
                return;
        } elseif ((!is_resource($link)) && (!is_null($link))) {
                // This should never happen!
-               debug_report_bug(__FUNCTION__, __LINE__, sprintf("link is not resource or null. Type: %s", gettype($link)));
+               debug_report_bug(__FUNCTION__, __LINE__, sprintf("Type of link is not resource or null, type=%s", gettype($link)));
        } // END - if
 
        // Set it
@@ -587,5 +554,63 @@ function SQL_PREPARE_SQL_STRING ($sqlString, $enableCodes = true) {
        return $GLOBALS['sql_strings'][$sqlString];
 }
 
+// Check if there is a SQL table created
+function isSqlTableCreated ($table) {
+       // Do we have cache?
+       if (!isset($GLOBALS[__FUNCTION__][$table])) {
+               // Check if the table is there
+               $result = SQL_QUERY_ESC("SHOW TABLES FROM `{?__DB_NAME?}` WHERE `Tables_in_{?__DB_NAME?}`='{?_MYSQL_PREFIX?}_%s' LIMIT 1",
+                       array($table), __FILE__, __LINE__);
+
+               // Is there an entry?
+               $GLOBALS[__FUNCTION__][$table] = (SQL_NUMROWS($result) == 1);
+       } // END - if
+
+       // Return cache
+       return $GLOBALS[__FUNCTION__][$table];
+}
+
+// Checks depending on the mode if the table is there
+function isSqlTableIndexAdded ($tableName, $mode) {
+       // Do we have cache?
+       if (!isset($GLOBALS[__FUNCTION__][$tableName][$mode])) {
+               // Show indexes
+               $result = SQL_QUERY_ESC("SHOW INDEX FROM `%s`", array($tableName), __FUNCTION__, __LINE__);
+
+               // Non-skipping is default for ADD
+               $GLOBALS[__FUNCTION__][$tableName][$mode] = false;
+
+               // But should we DROP?
+               if ($mode == 'DROP') {
+                       // Then skip if nothing found
+                       $GLOBALS[__FUNCTION__][$tableName][$mode] = true;
+                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Going to drop key ' . $keyName);
+               } // END - if
+
+               // Walk through all
+               while ($content = SQL_FETCHARRAY($result)) {
+                       // Is it found?
+                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'columnName='.$keyName.',content=<pre>' . print_r($content, true) . '</pre>');
+                       if (($content['Key_name'] == $keyName) && ($mode == 'ADD')) {
+                               // Skip this query!
+                               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("ADD: Skiped: %s", $sql));
+                               $GLOBALS[__FUNCTION__][$tableName][$mode] = true;
+                               break;
+                       } elseif (($content['Key_name'] == $keyName) && ($mode == 'DROP')) {
+                               // Don't skip this!
+                               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("DROP: Not skiped: %s", $sql));
+                               $GLOBALS[__FUNCTION__][$tableName][$mode] = false;
+                               break;
+                       }
+               } // END - while
+
+               // Free result
+               SQL_FREERESULT($result);
+       } // END - if
+
+       // Return cache
+       return $GLOBALS[__FUNCTION__][$tableName][$mode];
+}
+
 // [EOF]
 ?>
index 3581bf0..7e5895c 100644 (file)
@@ -1736,6 +1736,16 @@ function isExtensionFunctionFileReadable ($ext_name) {
        return ($GLOBALS['cache_array']['extension']['ext_func'][$ext_name] == 'Y');
 }
 
+// Adds a DROP TABLE statement if the requested tabled is there
+function addDropTableSql ($table) {
+       // Is the table there?
+       if (isSqlTableCreated($table)) {
+               // Then add it, non-existing tables can be ignored because it will
+               // happen with every newly installed extension.
+               addExtensionSql('DROP TABLE `{?_MYSQL_PREFIX?}_' . $table . '`');
+       } // END - if
+}
+
 // Adds an admin menu to the SQL queue of the menu entry is not found
 function addAdminMenuSql ($action, $what, $title, $descr, $sort) {
        // Now check if this menu is there
index ae5943e..8fb79f2 100644 (file)
@@ -60,8 +60,8 @@ switch (getExtensionMode()) {
        case 'remove': // Do stuff when removing extension
                // SQL commands to run
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='admins'");
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_admins_acls`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_admins_mails`');
+               addDropTableSql('admins_acls');
+               addDropTableSql('admins_mails');
                addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_admins` DROP `default_acl`");
 
                // Remove filters
@@ -102,7 +102,7 @@ switch (getExtensionMode()) {
 
                                // But allow current admin everything (THIS SHALL BE YOU!)
                                addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_admins` SET `default_acl`='allow' WHERE `id`=".bigintval(getCurrentAdminId())." LIMIT 1");
-                               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_admins_acls`');
+                               addDropTableSql('admins_acls');
                                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_admins_acls` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `admin_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -122,7 +122,7 @@ PRIMARY KEY (`id`)
                                break;
 
                        case '0.4.0': // SQL queries for v0.4.0
-                               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_admins_mails`');
+                               addDropTableSql('admins_mails');
                                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_admins_mails` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `admin_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
index a6f05bb..be9151b 100644 (file)
@@ -52,7 +52,7 @@ enableExtensionProductive(false);
 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?}_bank_accounts`');
+               addDropTableSql('bank_accounts');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_bank_accounts` (
 id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 userid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -79,7 +79,7 @@ INDEX (account_created),
 INDEX (account_locked),
 INDEX (last_tan_stamp)
 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci");
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_bank_transfers`');
+               addDropTableSql('bank_transfers');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_bank_transfers` (
 id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 to_account_id BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -92,7 +92,7 @@ PRIMARY KEY (id),
 INDEX (to_account_id, from_account_id),
 INDEX (day_bookkeeping, day_available)
 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci");
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_bank_packages`');
+               addDropTableSql('bank_packages');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_bank_packages` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `title` VARCHAR(255) NOT NULL DEFAULT '',
@@ -116,7 +116,7 @@ PRIMARY KEY (`id`)
                // what the member shall get for the specified income. output_system_mode
                // must be extended with the mode you get for free: output_system_mode:LOGIN
                // should be fine. More than one entry and not DISABLED ;) are not supported.
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_bank_tanlist`');
+               addDropTableSql('bank_tanlist');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_bank_tanlist` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `idx` TINYINT(3) UNSIGNED NOT NULL DEFAULT 0,
@@ -156,10 +156,10 @@ UNIQUE (`account_id`, `tan`)
 
        case 'remove': // Do stuff when removing extension
                // SQL commands to run
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_bank_accounts`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_bank_transfers`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_bank_packages`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_bank_tanlist`');
+               addDropTableSql('bank_accounts');
+               addDropTableSql('bank_transfers');
+               addDropTableSql('bank_packages');
+               addDropTableSql('bank_tanlist');
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='bank'");
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `action`='bank'");
                break;
index c9f38be..86cf1b2 100644 (file)
@@ -56,7 +56,7 @@ switch (getExtensionMode()) {
                addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `beg_userid_timeout` BIGINT(20) UNSIGNED NOT NULL DEFAULT 1800");
                addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `beg_points` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00100");
                addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `beg_clicks` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_beg_ips`');
+               addDropTableSql('beg_ips');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_beg_ips` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -70,8 +70,8 @@ PRIMARY KEY (`id`)
 
        case 'remove': // Do stuff when removing extension
                // SQL commands to run
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_beg_ips`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_beg_referals`');
+               addDropTableSql('beg_ips');
+               addDropTableSql('beg_referals');
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what` IN ('config_beg','list_beg','list_beg_referal_urls')");
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `what`='beg'");
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what` IN ('beg','beg2')");
@@ -281,7 +281,7 @@ PRIMARY KEY (`id`)
                                break;
 
                        case '0.2.9': // SQL queries for v0.2.9
-                               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_beg_referals`');
+                               addDropTableSql('beg_referals');
                                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_beg_referals` (
 `id` BIGINT( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
 `userid` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL ,
index e820a08..610dfb2 100644 (file)
@@ -55,7 +55,7 @@ switch (getExtensionMode()) {
        case 'remove': // Do stuff when removing extension
                // SQL commands to run
                addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` DROP birthday_sent");
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_birthday`');
+               addDropTableSql('user_birthday');
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what`='config_birthday'");
                break;
 
@@ -78,7 +78,7 @@ switch (getExtensionMode()) {
 
                        case '0.2.0': // SQL queries for v0.2
                                addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `birthday_points` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
-                               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_birthday`');
+                               addDropTableSql('user_birthday');
                                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_user_birthday` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
index 2566759..3da3ec1 100644 (file)
@@ -54,7 +54,7 @@ switch (getExtensionMode()) {
                // SQL commands to run
                addAdminMenuSql('email','send_bonus','Bonusmail senden','Versenden Sie hier Bonus-Mails an alle Mitglieder oder nur an alle aus einer Kategorie. Es spielt keine Rolle, wie viele Mails bereits versendet worden, Sie k&ouml;nnen hier immer senden.', 5);
                addMemberMenuSql('main','bonus','Bonuspunkte','N','Y',7);
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_bonus`');
+               addDropTableSql('bonus`');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_bonus` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `cat_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -85,10 +85,10 @@ PRIMARY KEY  (`id`)
                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' LIMIT 1");
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `action`='bonus'");
-               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`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_bonus_turbo`');
+               addDropTableSql('bonus');
+               addDropTableSql('bonus_urls');
+               addDropTableSql('bonus_customer');
+               addDropTableSql('bonus_turbo');
 
                // Unregister filter
                unregisterFilter(__FUNCTION__, __LINE__, 'member_login_check', 'ADD_LOGIN_BONUS', true, isExtensionDryRun());
@@ -138,7 +138,7 @@ PRIMARY KEY  (`id`)
                                break;
 
                        case '0.2.2': // SQL queries for v0.2.2
-                               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_bonus_turbo`');
+                               addDropTableSql('bonus_turbo');
                                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_bonus_turbo` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -171,8 +171,8 @@ INDEX `userid` (`userid`)
                                break;
 
                        case '0.2.5': // SQL queries for v0.2.5
-                               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_bonus_urls`');
-                               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_bonus_customer`');
+                               addDropTableSql('bonus_urls');
+                               addDropTableSql('bonus_customer');
 
                                // Update notes (these will be set as task text!)
                                setExtensionUpdateNotes("Tabellen <u>{?_MYSQL_PREFIX?}_bonus_urls</u> und <u>{?_MYSQL_PREFIX?}_bonus_customer</u> entfernt, da dies bald von der Erweiterung <u>sponsor</u> erledigt wird.");
index 431b844..30183f9 100644 (file)
@@ -56,7 +56,7 @@ switch (getExtensionMode()) {
                addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `booking_purge` BIGINT(20) UNSIGNED NOT NULL DEFAULT ".(getOneDay() * 3)."");
 
                // Drop/create table for user bookings
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_book`');
+               addDropTableSql('user_book');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_user_book`(
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -82,7 +82,7 @@ PRIMARY KEY (`id`)
                break;
 
        case 'remove': // Do stuff when removing extension
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_book`');
+               addDropTableSql('user_book');
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what` IN ('config_booking','list_booking')");
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='booking'");
 
index b6227f1..5ed4b84 100644 (file)
@@ -52,7 +52,7 @@ setExtensionAlwaysActive('Y');
 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?}_countries`');
+               addDropTableSql('countries');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_countries` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `code` CHAR(2) NOT NULL DEFAULT 'DE',
@@ -73,7 +73,7 @@ PRIMARY KEY (`id`)
 
        case 'remove': // Do stuff when removing extension
                // SQL commands to run
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_countries`');
+               addDropTableSql('countries');
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='country'");
                break;
 
index a870a34..e12dde9 100644 (file)
@@ -55,7 +55,7 @@ enableExtensionProductive(false);
 switch (getExtensionMode()) {
        case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
                // Table for debug log entries
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_debug_log`');
+               addDropTableSql('debug_log');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_debug_log` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `sender_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -71,7 +71,7 @@ PRIMARY KEY (`id`)
 ) TYPE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Debug log data'");
 
                // Table against debug log abuse
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_debug_log_abuse`');
+               addDropTableSql('debug_log_abuse');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_debug_log_abuse` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `client_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -83,7 +83,7 @@ PRIMARY KEY (`id`)
 ) TYPE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Debug log abuse'");
 
                // Table on relay/server for client exchanges
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_debug_client`');
+               addDropTableSql('debug_client');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_debug_client` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `key` VARCHAR(255) NOT NULL DEFAULT 'SELF',
@@ -103,7 +103,7 @@ PRIMARY KEY (`id`)
                addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_debug_client` (`url`,`title`,`webmaster`,`status`) VALUES ('{?URL?}','{?MAIN_TITLE?}','{?WEBMASTER?}','ACTIVE')");
 
                // Table for debug log <-> client connection
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_debug_client_log`');
+               addDropTableSql('debug_client_log');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_debug_client_log` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `client_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 1,
@@ -140,10 +140,10 @@ PRIMARY KEY (`id`)
 
        case 'remove': // Do stuff when removing extension
                // SQL commands to run
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_debug_client_log`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_debug_client`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_debug_log`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_debug_log_abuse`');
+               addDropTableSql('debug_client_log');
+               addDropTableSql('debug_client');
+               addDropTableSql('debug_log');
+               addDropTableSql('debug_log_abuse');
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `action`='debug'");
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='debug'");
                break;
index 00d0676..0936e8a 100644 (file)
@@ -49,7 +49,7 @@ setExtensionVersionHistory(array('0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0
 switch (getExtensionMode()) {
        case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
                // Doubler table
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_doubler`');
+               addDropTableSql('doubler');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_doubler` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -116,7 +116,7 @@ PRIMARY KEY (`id`)
 
        case 'remove': // Do stuff when removing extension
                // SQL commands to run
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_doubler`');
+               addDropTableSql('doubler');
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='doubler'");
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `what`='doubler'");
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='doubler'");
index 8d4af26..53c89ce 100644 (file)
@@ -55,7 +55,7 @@ switch (getExtensionMode()) {
                addExtensionDependency('sponsor');
 
                // - Ads
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_forced_ads`');
+               addDropTableSql('forced_ads');
                addExtensionSql("CREATE TABLE IF NOT EXIST `{?_MYSQL_PREFIX?}_forced_ads` (
 `forced_ads_id` BIGINT( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
 `forced_ads_ad_url` VARCHAR( 255 ) NULL DEFAULT NULL ,
@@ -72,7 +72,7 @@ PRIMARY KEY ( `forced_ads_id` )
 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Forced Ads Data'");
 
                // - Campaigns
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_forced_campaigns`');
+               addDropTableSql('forced_campaigns');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_forced_campaigns` (
 `forced_campaign_id` BIGINT( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
 `forced_campaign_created` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,
@@ -89,7 +89,7 @@ PRIMARY KEY ( `forced_campaign_id` )
 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Forced Campaign Data'");
 
                // - Campaigns <-> Ads
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_forced_campaigns_ads`');
+               addDropTableSql('forced_campaigns_ads');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_forced_campaigns_ads` (
 `forced_campaign_ads_id` BIGINT( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
 `forced_campaign_id` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL ,
@@ -99,7 +99,7 @@ PRIMARY KEY ( `forced_campaign_ads_id` )
 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Forced Campaigns<->Ads'");
 
                // - Campaigns <-> User
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_forced_campaigns_user`');
+               addDropTableSql('forced_campaigns_user');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_forced_campaigns_user` (
 `forced_id` BIGINT( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
 `forced_campaign_id` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL ,
@@ -111,7 +111,7 @@ PRIMARY KEY ( `forced_id` )
 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Forced Campaigns<->User'");
 
                // - Campaign costs
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_forced_costs`');
+               addDropTableSql('forced_costs');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_forced_costs` (
 `forced_costs_id` BIGINT( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
 `forced_costs_price_click` FLOAT( 20, 5 ) UNSIGNED NULL DEFAULT NULL ,
@@ -121,7 +121,7 @@ PRIMARY KEY ( `forced_costs_id` )
 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Forced Campaign Costs'");
 
                // - Campaign Statistics
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_forced_stats`');
+               addDropTableSql('forced_stats');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_forced_stats` (
 `forced_stats_id` BIGINT( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
 `forced_stats_campaign_id` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL ,
@@ -141,12 +141,12 @@ PRIMARY KEY ( `forced_stats_id` )
 
        case 'remove': // Do stuff when removing extension
                // SQL commands to run
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_forced_ads`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_forced_campaigns`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_forced_campaigns_ads`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_forced_campaigns_user`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_forced_costs`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_forced_stats`');
+               addDropTableSql('forced_ads');
+               addDropTableSql('forced_campaigns');
+               addDropTableSql('forced_campaigns_ads');
+               addDropTableSql('forced_campaigns_user');
+               addDropTableSql('forced_costs');
+               addDropTableSql('forced_stats');
                break;
 
        case 'activate': // Do stuff when admin activates this extension
index 08ff2e4..19b08bf 100644 (file)
@@ -49,7 +49,7 @@ setExtensionVersionHistory(array('0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0
 switch (getExtensionMode()) {
        case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
                // Create database
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_holidays`');
+               addDropTableSql('user_holidays');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_user_holidays` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -78,7 +78,7 @@ PRIMARY KEY (`id`)
 
        case 'remove': // Do stuff when removing extension
                // SQL commands to run
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_holidays`');
+               addDropTableSql('user_holidays');
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='holiday' LIMIT 1");
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='holiday' LIMIT 4");
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_max_receive` WHERE `value`=0 LIMIT 1");
index 9b9c1b1..c630720 100644 (file)
@@ -65,7 +65,7 @@ switch (getExtensionMode()) {
                addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `imprint_image_script` VARCHAR(255) NOT NULL DEFAULT ''");
 
                // Create imprint data table
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_imprint_data`');
+               addDropTableSql('imprint_data');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_imprint_data` (
 `imprint_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `imprint_key` VARCHAR(255) NOT NULL DEFAULT '',
@@ -81,7 +81,7 @@ PRIMARY KEY (`imprint_id`)
 
        case 'remove': // Do stuff when removing extension
                // Imprint data
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_imprint_data`');
+               addDropTableSql('imprint_data');
 
                // Guest menu
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `what`='imprint' LIMIT 1");
index 58aaf2c..04aa118 100644 (file)
@@ -61,7 +61,7 @@ switch (getExtensionMode()) {
 
        case 'remove': // Do stuff when removing extension
                // SQL commands to run
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_mediadata`');
+               addDropTableSql('mediadata');
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what`='config_mediadata'");
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `what`='mediadata'");
 
@@ -99,7 +99,7 @@ switch (getExtensionMode()) {
 
                        case '0.0.4': // SQL queries for v0.0.4
                                // SQL commands to run
-                               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_mediadata`');
+                               addDropTableSql('mediadata');
                                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_mediadata` (
 `media_key` VARCHAR(255) NOT NULL DEFAULT '',
 `media_value` VARCHAR(255) NOT NULL DEFAULT '',
index 84b2bca..3493239 100644 (file)
@@ -73,7 +73,7 @@ enableExtensionProductive(false);
 switch (getExtensionMode()) {
        case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
                // Main table which hold
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_data`');
+               addDropTableSql('network_data');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_data` (
 `network_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `network_short_name` VARCHAR(50) NOT NULL DEFAULT '',
@@ -89,7 +89,7 @@ PRIMARY KEY (`network_id`)
 
                // Types the network provider is supporting (e.g. Forced-Banner and so on)
                // @TODO network_type_handle is an internal name and needs documentation
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_types`');
+               addDropTableSql('network_types');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_types` (
 `network_type_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `network_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -102,7 +102,7 @@ PRIMARY KEY (`network_type_id`)
 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Types provideable by networks'");
 
                // HTTP parameters (names) for URLs
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_request_params`');
+               addDropTableSql('network_request_params');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_request_params` (
 `network_param_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `network_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -116,7 +116,7 @@ PRIMARY KEY (`network_param_id`)
 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Request parameters for GET/POST request'");
 
                // Error status codes
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_error_codes`');
+               addDropTableSql('network_error_codes');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_error_codes` (
 `network_type_code_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `network_type_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -128,7 +128,7 @@ PRIMARY KEY (`network_type_code_id`)
 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Error codes for all types'");
 
                // Code types (internal table)
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_error_types`');
+               addDropTableSql('network_error_types');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_error_types` (
 `network_code_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `network_code` VARCHAR(100) NOT NULL DEFAULT 'INVALID_CODE',
@@ -137,7 +137,7 @@ PRIMARY KEY (`network_code_id`)
 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Error types, generic data, DO NOT ALTER!'");
 
                // Valid translation keys (we hate hard-coded arrays, you see?)
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_translations`');
+               addDropTableSql('network_translations');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_translations` (
 `network_translation_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `network_translation_name` VARCHAR(100) NOT NULL DEFAULT '',
@@ -146,7 +146,7 @@ PRIMARY KEY (`network_translation_id`)
 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Translations for array keys, generic data, DO NOT ALTER!'");
 
                // Array-Element translation tables per type/provider
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_api_translation`');
+               addDropTableSql('network_api_translation');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_api_translation` (
 `network_api_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `network_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -159,7 +159,7 @@ PRIMARY KEY (`network_api_id`)
 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Translation of API responses, generic data, DO NOT ALTER!'");
 
                // Data from the webmaster (you!)
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_config`');
+               addDropTableSql('network_config');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_config` (
 `network_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
 `network_affiliate_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -173,7 +173,7 @@ PRIMARY KEY (`network_id`)
 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Configuration data from the webmaster (you!)'");
 
                // Configuration data for e.g. reload-time
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_types_config`');
+               addDropTableSql('network_types_config');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_types_config` (
 `network_data_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `network_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -190,7 +190,7 @@ PRIMARY KEY (`network_data_id`)
                // Cache for queried APIs. Re-check depends on config
                // `network_cache_refresh` in seconds or if set to zero, full day
                // divided by query amount.
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_cache`');
+               addDropTableSql('network_cache');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_cache` (
 `network_cache_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `network_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -202,7 +202,7 @@ PRIMARY KEY (`network_cache_id`)
 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Cache for all queried APIs'");
 
                // Reload locks for several types
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_reloads`');
+               addDropTableSql('network_reloads');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_reloads` (
 `network_reload_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `network_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -4846,16 +4846,16 @@ PRIMARY KEY (`network_reload_id`)
 
        case 'remove': // Do stuff when removing extension
                // SQL commands to run
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_data`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_types`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_request_params`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_error_codes`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_error_types`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_api_translation`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_config`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_types_config`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_cache`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_reloads`');
+               addDropTableSql('network_data');
+               addDropTableSql('network_types');
+               addDropTableSql('network_request_params');
+               addDropTableSql('network_error_codes');
+               addDropTableSql('network_error_types');
+               addDropTableSql('network_api_translation');
+               addDropTableSql('network_config');
+               addDropTableSql('network_types_config');
+               addDropTableSql('network_cache');
+               addDropTableSql('network_reloads');
 
                // Admin menu
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='network'");
index f6d3d50..56fdfda 100644 (file)
@@ -59,9 +59,9 @@ switch (getExtensionMode()) {
                // SQL commands to run
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='newsletter'");
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='newsletter'");
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_newsletter_data`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_newsletter_topics`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_newsletter_orders`');
+               addDropTableSql('newsletter_data');
+               addDropTableSql('newsletter_topics');
+               addDropTableSql('newsletter_orders');
                break;
 
        case 'activate': // Do stuff when admin activates this extension
@@ -139,7 +139,7 @@ switch (getExtensionMode()) {
                        case '0.2.0': // SQL queries for v0.2.0
                                // Tables:
                                // - Main data table
-                               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_newsletter_data`');
+                               addDropTableSql('newsletter_data');
                                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_newsletter_data` (
 `nl_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `nl_subject` VARCHAR(255) NOT NULL DEFAULT '{OPEN_CONFIG}nl_default_subject{CLOSE_CONFIG}',
@@ -158,7 +158,7 @@ PRIMARY KEY (`nl_id`)
 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'General newsletter data'");
 
                                // - Topics data table
-                               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_newsletter_topics`');
+                               addDropTableSql('newsletter_topics');
                                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_newsletter_topics` (
 `nl_topic_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `nl_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -170,7 +170,7 @@ PRIMARY KEY (`nl_topic_id`)
 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Newsletter topics'");
 
                                // - Sponsor orders data table
-                               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_newsletter_orders`');
+                               addDropTableSql('newsletter_orders');
                                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_newsletter_orders` (
 `nl_order_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `nl_sponsor_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
index ced45a1..006f6c3 100644 (file)
@@ -58,7 +58,7 @@ switch (getExtensionMode()) {
                // 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('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_nickname_history`');
+               addDropTableSql('nickname_history');
                break;
 
        case 'activate': // Do stuff when admin activates this extension
@@ -174,7 +174,7 @@ switch (getExtensionMode()) {
 
                        case '0.1.9': // SQL queries for v0.1.9
                                addAdminMenuSql('user','list_nickname','Nickname-Historie','Listet alle verwendeten Nicknames der Mitglieder auf.', 12);
-                               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_nickname_history`');
+                               addDropTableSql('nickname_history');
                                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_nickname_history` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
index 0412fd3..210f331 100644 (file)
@@ -49,7 +49,7 @@ setExtensionVersionHistory(array('0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '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?}_online`');
+               addDropTableSql('online');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_online` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `sid` VARCHAR(32) NOT NULL DEFAULT '',
@@ -72,7 +72,7 @@ INDEX `admin_member` (`is_admin`, `is_member`)
 
        case 'remove': // Do stuff when removing extension
                // SQL commands to run
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_online`');
+               addDropTableSql('online');
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what`='usr_online'");
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `action`='online'");
 
index 16aedbe..0bdd839 100644 (file)
@@ -52,7 +52,7 @@ setExtensionAlwaysActive('Y');
 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?}_optimize_gain`');
+               addDropTableSql('optimize_gain');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_optimize_gain` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `gain` decimal(10,3) NOT NULL DEFAULT '0.000',
@@ -63,7 +63,7 @@ PRIMARY KEY (`id`)
 
        case 'remove': // Do stuff when removing extension
                // SQL commands to run
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_optimize_gain`');
+               addDropTableSql('optimize_gain');
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what`='optimize' LIMIT 1");
                break;
 
index a0b54f6..3d97ba6 100644 (file)
@@ -54,6 +54,7 @@ switch (getExtensionMode()) {
 
        case 'remove': // Do stuff when removing extension
                // SQL commands to run
+               addDropTableSql('url_blacklist');
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what`='config_order' LIMIT 1");
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `action`='order'");
                break;
@@ -298,7 +299,7 @@ nicht die vom Mitglied eingegebene. Resultat: Das Script beschwerte sich, der Us
                                break;
 
                        case '0.5.0': // SQL queries for v0.5.0
-                               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_url_blacklist`');
+                               addDropTableSql('url_blacklist');
                                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_url_blacklist` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `url` VARCHAR(255) NOT NULL DEFAULT '',
index a2d8d05..8a1b8fb 100644 (file)
@@ -49,7 +49,7 @@ setExtensionVersionHistory(array('0.0', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1
 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?}_user_payouts`');
+               addDropTableSql('user_payouts');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_user_payouts` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -63,7 +63,7 @@ INDEX (`userid`),
 INDEX (`payout_id`),
 PRIMARY KEY (`id`)
 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci");
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_payout_types`');
+               addDropTableSql('payout_types');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_payout_types` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `type` VARCHAR(255) NOT NULL DEFAULT '',
@@ -78,8 +78,8 @@ PRIMARY KEY (`id`)
 
        case 'remove': // Do stuff when removing extension
                // SQL commands to run
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_payouts`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_payout_types`');
+               addDropTableSql('user_payouts');
+               addDropTableSql('payout_types');
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='payouts'");
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='payout'");
                break;
index 8170b38..3ed6b07 100644 (file)
@@ -54,7 +54,7 @@ enableExtensionProductive(false);
 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?}_user_primera`');
+               addDropTableSql('user_primera');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_user_primera` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -89,7 +89,7 @@ PRIMARY KEY (`id`)
 
        case 'remove': // Do stuff when removing extension
                // SQL commands to run
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_primera`');
+               addDropTableSql('user_primera');
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='primera'");
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='primera'");
                break;
index 3215d9b..b594f4e 100644 (file)
@@ -49,7 +49,7 @@ setExtensionVersionHistory(array('0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '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?}_rallye_data`');
+               addDropTableSql('rallye_data');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_rallye_data` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `admin_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -65,7 +65,7 @@ switch (getExtensionMode()) {
 KEY (`admin_id`),
 PRIMARY KEY (`id`)
 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci");
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_rallye_prices`');
+               addDropTableSql('rallye_prices');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_rallye_prices` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `rallye_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -75,7 +75,7 @@ PRIMARY KEY (`id`)
 INDEX (`rallye_id`),
 PRIMARY KEY (`id`)
 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci");
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_rallye_users`');
+               addDropTableSql('rallye_users');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_rallye_users` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `rallye_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -102,9 +102,9 @@ PRIMARY KEY (`id`)
 
        case 'remove': // Do stuff when removing extension
                // Drop tables
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_rallye_data`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_rallye_prices`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_rallye_users`');
+               addDropTableSql('rallye_data');
+               addDropTableSql('rallye_prices');
+               addDropTableSql('rallye_users');
 
                // Remove menus
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='rallye'");
index cbdb0bc..aa555d7 100644 (file)
@@ -49,7 +49,7 @@ setExtensionVersionHistory(array('0.0','0.0.1'));
 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?}_user_refs`');
+               addDropTableSql('user_refs');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_user_refs` (
 `id` BIGINT(20) UNSIGNED NOT NULL auto_increment,
 `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -70,7 +70,7 @@ KEY (`refid`)
 
        case 'remove': // Do stuff when removing extension
                // SQL commands to run
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_refs`');
+               addDropTableSql('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("UPDATE `{?_MYSQL_PREFIX?}_refsystem` SET level=level-1");
index cc87523..e267db6 100644 (file)
@@ -55,7 +55,7 @@ switch (getExtensionMode()) {
        case 'remove': // Do stuff when removing extension
                // SQL commands to run
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what`='config_register'");
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_must_register`');
+               addDropTableSql('must_register');
 
                // Unregister a filter
                unregisterFilter(__FUNCTION__, __LINE__, 'register_must_fillout', 'REGISTER_MUST_FILLOUT', true, isExtensionDryRun());
@@ -74,7 +74,7 @@ switch (getExtensionMode()) {
        case 'update': // Update an extension
                switch (getCurrentExtensionVersion()) {
                        case '0.1.0': // SQL queries for v0.1
-                               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_must_register`');
+                               addDropTableSql('must_register');
                                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_must_register` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `field_name` VARCHAR(255) NOT NULL DEFAULT '',
index d31bbff..7fe7872 100644 (file)
@@ -60,7 +60,7 @@ switch (getExtensionMode()) {
                //
                // Sponsor data
                //
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_sponsor_data`');
+               addDropTableSql('sponsor_data');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_sponsor_data` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `company` VARCHAR(255) NOT NULL DEFAULT '',
@@ -102,7 +102,7 @@ PRIMARY KEY (`id`)
                //
                // Sponsor orders
                //
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_sponsor_orders`');
+               addDropTableSql('sponsor_orders');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_sponsor_orders` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `sponsor_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -122,7 +122,7 @@ PRIMARY KEY (`id`)
                //
                // Pay-types
                //
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_sponsor_paytypes`');
+               addDropTableSql('sponsor_paytypes');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_sponsor_paytypes` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `pay_name` VARCHAR(255) NOT NULL DEFAULT '',
@@ -134,7 +134,7 @@ PRIMARY KEY (`id`)
                //
                // Points-to-action converting
                //
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_sponsor_action_convert`');
+               addDropTableSql('sponsor_action_convert');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_sponsor_action_convert` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `ext_name` VARCHAR(255) NOT NULL DEFAULT 'sponsor',
@@ -146,7 +146,7 @@ PRIMARY KEY (`id`)
                //
                // Sponsor menu system (default)
                //
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_sponsor_menu`');
+               addDropTableSql('sponsor_menu');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_sponsor_menu` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `action` VARCHAR(255) NOT NULL DEFAULT '',
@@ -162,7 +162,7 @@ PRIMARY KEY (`id`)
                //
                // Registry for performable actions by your sponsors
                //
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_sponsor_registry`');
+               addDropTableSql('sponsor_registry');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_sponsor_registry` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `admin_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -176,7 +176,7 @@ PRIMARY KEY (`id`)
                //
                // URLs from the sponsors
                //
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_sponsor_urls`');
+               addDropTableSql('sponsor_urls');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_sponsor_urls` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `sponsor_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -190,7 +190,7 @@ PRIMARY KEY (`id`)
                //
                // Banners of any size from the sponsors
                //
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_sponsor_banner`');
+               addDropTableSql('sponsor_banner');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_sponsor_banner` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `sponsor_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -206,7 +206,7 @@ PRIMARY KEY (`id`)
                //
                // Campaigns
                //
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_sponsor_campaigns`');
+               addDropTableSql('sponsor_campaigns');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_sponsor_campaigns` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `sponsor_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -229,7 +229,7 @@ PRIMARY KEY (`id`)
                //
                // Campaigns + URLs + Banner
                //
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_sponsor_campaign_assigns`');
+               addDropTableSql('sponsor_campaign_assigns');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_sponsor_campaign_assigns` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `campaignid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -245,7 +245,7 @@ PRIMARY KEY (`id`)
                //
                // Allowed data to display (administrative)
                //
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_sponsor_admin_data`');
+               addDropTableSql('sponsor_admin_data');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_sponsor_admin_data` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `data_row` VARCHAR(255) NOT NULL DEFAULT '',
@@ -255,7 +255,7 @@ PRIMARY KEY (`id`)
                //
                // Allowed data to display (sponsor-side)
                //
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_sponsor_display_data`');
+               addDropTableSql('sponsor_display_data');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_sponsor_display_data` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `sponsor_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -387,18 +387,18 @@ PRIMARY KEY (`id`)
 
        case 'remove': // Do stuff when removing extension
                // SQL commands to run
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_sponsor_data`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_sponsor_orders`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_sponsor_action_convert`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_sponsor_paytypes`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_sponsor_menu`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_sponsor_registry`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_sponsor_urls`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_sponsor_banner`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_sponsor_campaigns`');
-               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`');
+               addDropTableSql('sponsor_data');
+               addDropTableSql('sponsor_orders');
+               addDropTableSql('sponsor_action_convert');
+               addDropTableSql('sponsor_paytypes');
+               addDropTableSql('sponsor_menu');
+               addDropTableSql('sponsor_registry');
+               addDropTableSql('sponsor_urls');
+               addDropTableSql('sponsor_banner');
+               addDropTableSql('sponsor_campaigns');
+               addDropTableSql('sponsor_campaign_assigns');
+               addDropTableSql('sponsor_admin_data');
+               addDropTableSql('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?}_guest_menu` WHERE `action`='sponsor'");
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what` IN('sponsor_list','sponsor_reg')");
index 9fa654d..87e1c8c 100644 (file)
@@ -57,11 +57,11 @@ switch (getExtensionMode()) {
 
        case 'remove': // Do stuff when removing extension
                // Drop tables
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_admin_menu_las`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_admin_menu_las_data`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_admin_menu_stats`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_filters`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_dns_cache`');
+               addDropTableSql('admin_menu_las');
+               addDropTableSql('admin_menu_las_data');
+               addDropTableSql('admin_menu_stats');
+               addDropTableSql('filters');
+               addDropTableSql('dns_cache');
 
                // Delete admin menu entries
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE
@@ -367,7 +367,7 @@ switch (getExtensionMode()) {
 
                        case '0.3.2': // SQL queries for v0.3.2
                                // Connection table between the menu system and the "logical area" system
-                               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_admin_menu_las`');
+                               addDropTableSql('admin_menu_las');
                                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_admin_menu_las` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `la_id` VARCHAR(255) NOT NULL DEFAULT '',
@@ -379,7 +379,7 @@ INDEX (`la_what`),
 PRIMARY KEY (`id`)
 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci");
                                // All "logical areas" together
-                               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_admin_menu_las_data`');
+                               addDropTableSql('admin_menu_las_data');
                                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_admin_menu_las_data` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `la_id` VARCHAR(255) NOT NULL DEFAULT '',
@@ -406,7 +406,7 @@ PRIMARY KEY (`id`)
                                addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `admin_menu_sorter` ENUM('Y','N') NOT NULL DEFAULT 'Y'");
 
                                // The statistics table
-                               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_admin_menu_stats`');
+                               addDropTableSql('admin_menu_stats');
                                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_admin_menu_stats` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `admin_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -614,7 +614,7 @@ PRIMARY KEY (`id`)
                                break;
 
                        case '0.5.9': // SQL queries for v0.5.9
-                               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_filters`');
+                               addDropTableSql('filters');
                                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_filters` (
 `filter_id` BIGINT(20) UNSIGNED AUTO_INCREMENT,
 `filter_name` VARCHAR(50) NOT NULL DEFAULT '',
@@ -713,7 +713,7 @@ PRIMARY KEY (`filter_id`)
 
                        case '0.7.0': // SQL queries for 0.7.0
                                // Table definition
-                               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_dns_cache`');
+                               addDropTableSql('dns_cache');
                                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_dns_cache` (
 `hostname` VARCHAR(255) NOT NULL,
 `ip` VARCHAR(15) NOT NULL,
index 2a1a4ec..8fe248f 100644 (file)
@@ -52,7 +52,7 @@ enableExtensionProductive(false);
 switch (getExtensionMode()) {
        case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
                // SQL commands to run (surfbar URLs)
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_surfbar_urls`');
+               addDropTableSql('surfbar_urls');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_surfbar_urls` (
 `url_id` BIGINT(20) UNSIGNED  NOT NULL AUTO_INCREMENT,
 `url_userid` BIGINT(20) UNSIGNED  NOT NULL DEFAULT 0,
@@ -73,7 +73,7 @@ INDEX `status_userid` (`url_status`,`url_userid`)
 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Surfbar URLs'");
 
                // Reload locks
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_surfbar_locks`');
+               addDropTableSql('surfbar_locks');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_surfbar_locks` (
 `locks_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `locks_userid` BIGINT(20) UNSIGNED  NOT NULL DEFAULT 0,
@@ -85,7 +85,7 @@ INDEX (`locks_url_id`)
 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Surfbar reload locks'");
 
                // Surfbar salts
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_surfbar_salts`');
+               addDropTableSql('surfbar_salts');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_surfbar_salts` (
 `salts_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `salts_userid` BIGINT(20) UNSIGNED  NOT NULL DEFAULT 0,
@@ -97,7 +97,7 @@ INDEX (`salts_url_id`)
 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Surfbar last used salts'");
 
                // Statistics
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_surfbar_stats`');
+               addDropTableSql('surfbar_stats');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_surfbar_stats` (
 `stats_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `stats_userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -110,7 +110,7 @@ INDEX (`stats_url_id`)
 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Surfbar Statistics'");
 
                // Member actions pending on status
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_surfbar_actions`');
+               addDropTableSql('surfbar_actions');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_surfbar_actions` (
 `actions_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `actions_status` ENUM('PENDING','ACTIVE','LOCKED','STOPPED','REJECTED','DELETED','MIGRATED','DEPLETED') NULL DEFAULT NULL,
@@ -199,11 +199,11 @@ UNIQUE KEY `status_action` (`actions_status`,`actions_action`)
 
        case 'remove': // Do stuff when removing extension
                // SQL commands to run
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_surfbar_actions`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_surfbar_locks`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_surfbar_salts`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_surfbar_stats`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_surfbar_urls`');
+               addDropTableSql('surfbar_actions');
+               addDropTableSql('surfbar_locks');
+               addDropTableSql('surfbar_salts');
+               addDropTableSql('surfbar_stats');
+               addDropTableSql('surfbar_urls');
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `action`='surfbar'");
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='surfbar'");
 
index bc8f161..6377696 100644 (file)
@@ -53,7 +53,7 @@ switch (getExtensionMode()) {
 
        case 'remove': // Do stuff when removing extension
                // Drop theme table
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_themes`');
+               addDropTableSql('themes');
 
                // Delete admin menu
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='theme'");
@@ -120,7 +120,7 @@ switch (getExtensionMode()) {
 
                        case '0.0.8': // SQL queries for v0.0.8
                                // Theme table
-                               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_themes`');
+                               addDropTableSql('themes');
                                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_themes` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `theme_path` VARCHAR(255) NOT NULL DEFAULT '',
index 1cba7f6..bfa708f 100644 (file)
@@ -48,11 +48,8 @@ setExtensionVersionHistory(array('0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0
 
 switch (getExtensionMode()) {
        case 'register': // Do stuff when installation is running
-               // SQL commands to run
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_transfers_in`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_transfers_out`');
-
                // Transfer from a member
+               addDropTableSql('user_transfers_in');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_user_transfers_in` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -67,6 +64,7 @@ PRIMARY KEY (`id`)
 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci");
 
                // Transfers to a member
+               addDropTableSql('user_transfers_out');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_user_transfers_out` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -102,8 +100,8 @@ PRIMARY KEY (`id`)
 
        case 'remove': // Do stuff when removing extension
                // SQL commands to run
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_transfers_in`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_transfers_out`');
+               addDropTableSql('user_transfers_in');
+               addDropTableSql('user_transfers_out');
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='transfer'");
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='transfer'");
                addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` DROP `opt_in`");
index 2d795d2..819fddc 100644 (file)
@@ -51,7 +51,7 @@ setExtensionAlwaysActive('Y');
 
 switch (getExtensionMode()) {
        case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_cats`');
+               addDropTableSql('user_cats');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_user_cats` (
   `id` BIGINT(22) NOT NULL AUTO_INCREMENT,
   `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -61,7 +61,7 @@ INDEX (`userid`),
 INDEX (`cat_id`)
 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci");
 
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_data`');
+               addDropTableSql('user_data');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_user_data` (
   `userid` BIGINT(22) NOT NULL AUTO_INCREMENT,
   `surname` VARCHAR(255) NOT NULL DEFAULT '',
@@ -102,7 +102,7 @@ INDEX (`refid`),
 INDEX `status_mails` (`status`,`max_mails`)
 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci");
 
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_points`');
+               addDropTableSql('user_points');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_user_points` (
   `id` BIGINT(22) NOT NULL AUTO_INCREMENT,
   `userid` BIGINT(22) NOT NULL DEFAULT 0,
@@ -113,7 +113,7 @@ PRIMARY KEY  (`id`),
 INDEX (`userid`)
 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci");
 
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_links`');
+               addDropTableSql('user_links');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_user_links` (
   `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
   `stats_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -124,7 +124,7 @@ INDEX (`userid`),
 INDEX (`stats_id`)
 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci");
 
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_stats`');
+               addDropTableSql('user_stats');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_user_stats` (
   `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
   `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -146,7 +146,7 @@ INDEX (`payment_id`),
 INDEX (`pool_id`)
 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci");
 
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_stats_data`');
+               addDropTableSql('user_stats_data');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_user_stats_data` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -173,13 +173,13 @@ INDEX (`stats_type`)
 
        case 'remove': // Do stuff when removing extension
                // SQL commands to run
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_del`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_cats`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_data`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_points`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_links`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_stats`');
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_stats_data`');
+               addDropTableSql('user_del');
+               addDropTableSql('user_cats');
+               addDropTableSql('user_data');
+               addDropTableSql('user_points');
+               addDropTableSql('user_links');
+               addDropTableSql('user_stats');
+               addDropTableSql('user_stats_data');
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what` IN('config_user','user_contct','list_user_del') OR `action`='user'");
                break;
 
@@ -347,7 +347,7 @@ INDEX (`stats_type`)
                                addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `lock_timestamp` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00'");
                                addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `user_delete_purge` BIGINT(20) UNSIGNED NOT NULL DEFAULT ".(getOneDay() * 30)."");
                                addAdminMenuSql('user', 'list_user_del', 'L&ouml;schungen auflisten', 'Listet die L&ouml;schungen von Usern auf.', 9);
-                               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_del`');
+                               addDropTableSql('user_del');
                                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_user_del` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
index 4829e11..4a901fd 100644 (file)
@@ -49,7 +49,7 @@ setExtensionVersionHistory(array('0.0', '0.0.1', '0.0.2', '0.0.3'));
 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?}_user_wernis`');
+               addDropTableSql('user_wernis');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_user_wernis` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -87,7 +87,7 @@ PRIMARY KEY (`id`)
 
        case 'remove': // Do stuff when removing extension
                // SQL commands to run
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_wernis`');
+               addDropTableSql('user_wernis');
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='wernis'");
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='wernis'");
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `what`='wernis_portal'");
index 10762ad..bfa56d6 100644 (file)
@@ -72,7 +72,7 @@ switch (getExtensionMode()) {
                addAdminMenuSql('email','list_yoomedia_tm','Yoo!Media Textmails','Listet Textmail-Buchungen &uuml;ber das Interface 2.0 von Yoo!Media nach Ihren eingestellten Kriterien auf. <strong>Vorsicht:</strong> Jede Aktualisierung dieser Liste kostet Ihnen eine Abfrage!',10);
 
                // Reload lock table
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_yoomedia_reload`');
+               addDropTableSql('yoomedia_reload');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_yoomedia_reload` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `type` VARCHAR(255) NOT NULL DEFAULT 'general',
@@ -87,7 +87,7 @@ UNIQUE `y_type` (`type`,`y_id`)
        case 'remove': // Do stuff when removing extension
                // SQL commands to run
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what` IN('config_yoomedia','list_yoomedia_tm')");
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_yoomedia_reload`');
+               addDropTableSql('yoomedia_reload');
                break;
 
        case 'activate': // Do stuff when admin activates this extension
index 86de21c..86fc276 100644 (file)
@@ -55,21 +55,104 @@ if ((isPostRequestParameterSet('id')) && (is_array(postRequestParameter('id')))
                adminEditEntriesConfirm(
                        postRequestParameter('id'),
                        'bank_packages',
-                       array('id', 'title', 'description', 'account_fee', 'free_transfers', 'transfer_fee', 'output_system_mode', 'package_active', 'free_months_no_fee', 'interest_plus', 'interest_minus', 'first_payment', 'free_account_income', 'free_account_stuff', 'tan_lock'),
-                       array('bigintval', '', '', 'translateComma', 'bigintval', 'translateComma', '', '', 'bigintval', 'translateComma', 'translateComma', 'translateComma', 'translateComma', '', 'bigintval'),
-                       array('', '', '', '', '', '', '', '', '', '', '', '', '', '', '')
+                       array(
+                               'id',
+                               'title',
+                               'description',
+                               'account_fee',
+                               'free_transfers',
+                               'transfer_fee',
+                               'output_system_mode',
+                               'package_active',
+                               'free_months_no_fee',
+                               'interest_plus',
+                               'interest_minus',
+                               'first_payment',
+                               'free_account_income',
+                               'free_account_stuff',
+                               'tan_lock'
+                       ),
+                       array(
+                               'bigintval',
+                               '',
+                               '',
+                               'translateComma',
+                               'bigintval',
+                               'translateComma',
+                               '',
+                               '',
+                               'bigintval',
+                               'translateComma',
+                               'translateComma',
+                               'translateComma',
+                               'translateComma',
+                               '',
+                               'bigintval'
+                       ),
+                       array(
+                               '',
+                               '',
+                               '',
+                               '',
+                               '',
+                               '',
+                               '',
+                               '',
+                               '',
+                               '',
+                               '',
+                               '',
+                               '',
+                               '',
+                               ''
+                       )
                );
                $show = false;
        } elseif (isPostRequestParameterSet('do_edit')) {
                // Delete entries (with confirmation)
-               adminEditEntriesConfirm(postRequestParameter('id'), 'bank_packages', array(), array(), array(), true);
+               adminEditEntriesConfirm(
+                       postRequestParameter('id'),
+                       'bank_packages',
+                       array(),
+                       array(),
+                       array(),
+                       true
+               );
        } elseif (isPostRequestParameterSet('delete')) {
                // Delete entries (with confirmation)
-               adminDeleteEntriesConfirm(postRequestParameter('id'), 'bank_packages', array('id', 'title', 'description', 'account_fee'), array('bigintval', '', '', 'translateComma'), array('', '', '', ''));
+               adminDeleteEntriesConfirm(
+                       postRequestParameter('id'),
+                       'bank_packages',
+                       array(
+                               'id',
+                               'title',
+                               'description',
+                               'account_fee'
+                       ),
+                       array(
+                               'bigintval',
+                               '',
+                               '',
+                               'translateComma'
+                       ),
+                       array(
+                               '',
+                               '',
+                               '',
+                               ''
+                       )
+               );
                $show = false;
        } elseif (isFormSent('remove')) {
                // Delete entries (with confirmation)
-               adminDeleteEntriesConfirm(postRequestParameter('id'), 'bank_packages', array(), array(), array(), true);
+               adminDeleteEntriesConfirm(
+                       postRequestParameter('id'),
+                       'bank_packages',
+                       array(),
+                       array(),
+                       array(),
+                       true
+               );
        }
 } // END - if
 
index 207f45b..5204455 100644 (file)
@@ -61,9 +61,26 @@ if (isFormSent('edit')) {
        adminEditEntriesConfirm(
                postRequestParameter('url_id'),
                'surfbar_urls',
-               array('url_id', 'url_userid', 'url'),
-               array('bigintval', 'addMemberSelectionBox', ''),
-               array('', array(false, true, true, 'url_userid[]'), ''),
+               array(
+                       'url_id',
+                       'url_userid',
+                       'url'
+               ),
+               array(
+                       'bigintval',
+                       'addMemberSelectionBox',
+                       ''
+               ),
+               array(
+                       '',
+                       array(
+                               false,
+                               true,
+                               true,
+                               'url_userid[]'
+                       ),
+                       ''
+               ),
                false,
                'url_id',
                'url_userid',
@@ -88,9 +105,24 @@ if (isFormSent('edit')) {
        adminDeleteEntriesConfirm(
        postRequestParameter('url_id'),
                'surfbar_urls',
-               array('url_id', 'url_userid', 'url', 'url_registered'),
-               array('bigintval', 'generateUserProfileLink', 'generateFrametesterUrl', ''),
-               array('', '', '', ''),
+               array(
+                       'url_id',
+                       'url_userid',
+                       'url',
+                       'url_registered'
+               ),
+               array(
+                       'bigintval',
+                       'generateUserProfileLink',
+                       'generateFrametesterUrl',
+                       ''
+               ),
+               array(
+                       '',
+                       '',
+                       '',
+                       ''
+               ),
                false,
                'url_id',
                'url_userid',
@@ -99,15 +131,41 @@ if (isFormSent('edit')) {
        $show = false;
 } elseif (isPostRequestParameterSet('do_delete')) {
        // Remove entries from database
-       adminDeleteEntriesConfirm(postRequestParameter('url_id'), 'surfbar_urls', array(), array(), array(), true, 'url_id');
+       adminDeleteEntriesConfirm(
+               postRequestParameter('url_id'),
+               'surfbar_urls',
+               array(),
+               array(),
+               array(),
+               true,
+               'url_id'
+       );
 } elseif (isFormSent('lock')) {
        // Un-/lock selected URLs. This does not work for pending URLs
        adminLockEntriesConfirm(
                postRequestParameter('url_id'),
                'surfbar_urls',
-               array('url_id', 'url_userid', 'url', 'url_registered', 'url_status'),
-               array('bigintval', 'generateUserProfileLink', 'generateFrametesterUrl', '', 'translateSurfbarUrlStatus'),
-               array('', '', '', '', ''),
+               array(
+                       'url_id',
+                       'url_userid',
+                       'url',
+                       'url_registered',
+                       'url_status'
+               ),
+               array(
+                       'bigintval',
+                       'generateUserProfileLink',
+                       'generateFrametesterUrl',
+                       '',
+                       'translateSurfbarUrlStatus'
+               ),
+               array(
+                       '',
+                       '',
+                       '',
+                       '',
+                       ''
+               ),
                false,
                'url_id',
                'url_userid',
@@ -122,7 +180,12 @@ if (isFormSent('edit')) {
                array(),
                array(),
                array(),
-               array('url_status' => array('ACTIVE' => 'LOCKED', 'LOCKED' => 'ACTIVE')),
+               array(
+                       'url_status' => array(
+                               'ACTIVE' => 'LOCKED',
+                               'LOCKED' => 'ACTIVE'
+                       )
+               ),
                true,
                'url_id',
                'url_userid',
@@ -133,9 +196,27 @@ if (isFormSent('edit')) {
        adminUndeleteEntriesConfirm(
                postRequestParameter('url_id'),
                'surfbar_urls',
-               array('url_id', 'url_userid', 'url', 'url_registered', 'url_status'),
-               array('bigintval', 'generateUserProfileLink', 'generateFrametesterUrl', '', 'translateSurfbarUrlStatus'),
-               array('', '', '', '', ''),
+               array(
+                       'url_id',
+                       'url_userid',
+                       'url',
+                       'url_registered',
+                       'url_status'
+               ),
+               array(
+                       'bigintval',
+                       'generateUserProfileLink',
+                       'generateFrametesterUrl',
+                       '',
+                       'translateSurfbarUrlStatus'
+               ),
+               array(
+                       '',
+                       '',
+                       '',
+                       '',
+                       ''
+               ),
                false,
                'url_id',
                'url_userid',
@@ -150,7 +231,11 @@ if (isFormSent('edit')) {
                array(),
                array(),
                array(),
-               array('url_status' => array('DELETED' => 'ACTIVE')),
+               array(
+                       'url_status' => array(
+                               'DELETED' => 'ACTIVE'
+                       )
+               ),
                true,
                'url_id',
                'url_userid',