From: Roland Häder Date: Thu, 27 Jan 2011 00:50:40 +0000 (+0000) Subject: New wrapper functions introduced, some one-line parameter monsters killed: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=16b311c338bb4f8436e2ed9e76cb1cd5f3741640;p=mailer.git New wrapper functions introduced, some one-line parameter monsters killed: - 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 --- diff --git a/DOCS/TODOs.txt b/DOCS/TODOs.txt index 0aa233a537..17ef26b3f3 100644 --- a/DOCS/TODOs.txt +++ b/DOCS/TODOs.txt @@ -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? diff --git a/inc/db/lib-mysql3.php b/inc/db/lib-mysql3.php index 701506b8a1..80e3a1d509 100644 --- a/inc/db/lib-mysql3.php +++ b/inc/db/lib-mysql3.php @@ -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=
' . print_r($content, true) . '
'); - 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=
' . print_r($content, true) . '
'); + 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] ?> diff --git a/inc/extensions-functions.php b/inc/extensions-functions.php index 3581bf0227..7e5895c8d4 100644 --- a/inc/extensions-functions.php +++ b/inc/extensions-functions.php @@ -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 diff --git a/inc/extensions/ext-admins.php b/inc/extensions/ext-admins.php index ae5943eb12..8fb79f24ae 100644 --- a/inc/extensions/ext-admins.php +++ b/inc/extensions/ext-admins.php @@ -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, diff --git a/inc/extensions/ext-bank.php b/inc/extensions/ext-bank.php index a6f05bb95c..be9151be46 100644 --- a/inc/extensions/ext-bank.php +++ b/inc/extensions/ext-bank.php @@ -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; diff --git a/inc/extensions/ext-beg.php b/inc/extensions/ext-beg.php index c9f38be2ae..86cf1b2f8d 100644 --- a/inc/extensions/ext-beg.php +++ b/inc/extensions/ext-beg.php @@ -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 , diff --git a/inc/extensions/ext-birthday.php b/inc/extensions/ext-birthday.php index e820a089fd..610dfb29d6 100644 --- a/inc/extensions/ext-birthday.php +++ b/inc/extensions/ext-birthday.php @@ -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, diff --git a/inc/extensions/ext-bonus.php b/inc/extensions/ext-bonus.php index 256675914b..3da3ec1cfe 100644 --- a/inc/extensions/ext-bonus.php +++ b/inc/extensions/ext-bonus.php @@ -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ö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 {?_MYSQL_PREFIX?}_bonus_urls und {?_MYSQL_PREFIX?}_bonus_customer entfernt, da dies bald von der Erweiterung sponsor erledigt wird."); diff --git a/inc/extensions/ext-booking.php b/inc/extensions/ext-booking.php index 431b844cd1..30183f9999 100644 --- a/inc/extensions/ext-booking.php +++ b/inc/extensions/ext-booking.php @@ -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'"); diff --git a/inc/extensions/ext-country.php b/inc/extensions/ext-country.php index b6227f148d..5ed4b84c99 100644 --- a/inc/extensions/ext-country.php +++ b/inc/extensions/ext-country.php @@ -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; diff --git a/inc/extensions/ext-debug.php b/inc/extensions/ext-debug.php index a870a34125..e12dde9fcf 100644 --- a/inc/extensions/ext-debug.php +++ b/inc/extensions/ext-debug.php @@ -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; diff --git a/inc/extensions/ext-doubler.php b/inc/extensions/ext-doubler.php index 00d0676731..0936e8a12d 100644 --- a/inc/extensions/ext-doubler.php +++ b/inc/extensions/ext-doubler.php @@ -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'"); diff --git a/inc/extensions/ext-forced.php b/inc/extensions/ext-forced.php index 8d4af26ab7..53c89cea1a 100644 --- a/inc/extensions/ext-forced.php +++ b/inc/extensions/ext-forced.php @@ -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 diff --git a/inc/extensions/ext-holiday.php b/inc/extensions/ext-holiday.php index 08ff2e44a6..19b08bf7bd 100644 --- a/inc/extensions/ext-holiday.php +++ b/inc/extensions/ext-holiday.php @@ -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"); diff --git a/inc/extensions/ext-imprint.php b/inc/extensions/ext-imprint.php index 9b9c1b1780..c630720e05 100644 --- a/inc/extensions/ext-imprint.php +++ b/inc/extensions/ext-imprint.php @@ -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"); diff --git a/inc/extensions/ext-mediadata.php b/inc/extensions/ext-mediadata.php index 58aaf2c7a8..04aa118939 100644 --- a/inc/extensions/ext-mediadata.php +++ b/inc/extensions/ext-mediadata.php @@ -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 '', diff --git a/inc/extensions/ext-network.php b/inc/extensions/ext-network.php index 84b2bcace2..3493239ca6 100644 --- a/inc/extensions/ext-network.php +++ b/inc/extensions/ext-network.php @@ -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'"); diff --git a/inc/extensions/ext-newsletter.php b/inc/extensions/ext-newsletter.php index f6d3d50513..56fdfda8f9 100644 --- a/inc/extensions/ext-newsletter.php +++ b/inc/extensions/ext-newsletter.php @@ -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, diff --git a/inc/extensions/ext-nickname.php b/inc/extensions/ext-nickname.php index ced45a11fd..006f6c36ed 100644 --- a/inc/extensions/ext-nickname.php +++ b/inc/extensions/ext-nickname.php @@ -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, diff --git a/inc/extensions/ext-online.php b/inc/extensions/ext-online.php index 0412fd3e85..210f331aa5 100644 --- a/inc/extensions/ext-online.php +++ b/inc/extensions/ext-online.php @@ -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'"); diff --git a/inc/extensions/ext-optimize.php b/inc/extensions/ext-optimize.php index 16aedbed5c..0bdd839066 100644 --- a/inc/extensions/ext-optimize.php +++ b/inc/extensions/ext-optimize.php @@ -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; diff --git a/inc/extensions/ext-order.php b/inc/extensions/ext-order.php index a0b54f6dcd..3d97ba65b5 100644 --- a/inc/extensions/ext-order.php +++ b/inc/extensions/ext-order.php @@ -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 '', diff --git a/inc/extensions/ext-payout.php b/inc/extensions/ext-payout.php index a2d8d054e5..8a1b8fb869 100644 --- a/inc/extensions/ext-payout.php +++ b/inc/extensions/ext-payout.php @@ -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; diff --git a/inc/extensions/ext-primera.php b/inc/extensions/ext-primera.php index 8170b38a32..3ed6b0750c 100644 --- a/inc/extensions/ext-primera.php +++ b/inc/extensions/ext-primera.php @@ -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; diff --git a/inc/extensions/ext-rallye.php b/inc/extensions/ext-rallye.php index 3215d9b4ea..b594f4e054 100644 --- a/inc/extensions/ext-rallye.php +++ b/inc/extensions/ext-rallye.php @@ -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'"); diff --git a/inc/extensions/ext-refback.php b/inc/extensions/ext-refback.php index cbdb0bc400..aa555d790f 100644 --- a/inc/extensions/ext-refback.php +++ b/inc/extensions/ext-refback.php @@ -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"); diff --git a/inc/extensions/ext-register.php b/inc/extensions/ext-register.php index cc8752391e..e267db6437 100644 --- a/inc/extensions/ext-register.php +++ b/inc/extensions/ext-register.php @@ -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 '', diff --git a/inc/extensions/ext-sponsor.php b/inc/extensions/ext-sponsor.php index d31bbffea4..7fe78722ac 100644 --- a/inc/extensions/ext-sponsor.php +++ b/inc/extensions/ext-sponsor.php @@ -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')"); diff --git a/inc/extensions/ext-sql_patches.php b/inc/extensions/ext-sql_patches.php index 9fa654dfe3..87e1c8c3ba 100644 --- a/inc/extensions/ext-sql_patches.php +++ b/inc/extensions/ext-sql_patches.php @@ -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, diff --git a/inc/extensions/ext-surfbar.php b/inc/extensions/ext-surfbar.php index 2a1a4ec972..8fe248f89f 100644 --- a/inc/extensions/ext-surfbar.php +++ b/inc/extensions/ext-surfbar.php @@ -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'"); diff --git a/inc/extensions/ext-theme.php b/inc/extensions/ext-theme.php index bc8f161755..6377696579 100644 --- a/inc/extensions/ext-theme.php +++ b/inc/extensions/ext-theme.php @@ -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 '', diff --git a/inc/extensions/ext-transfer.php b/inc/extensions/ext-transfer.php index 1cba7f6b89..bfa708f1cc 100644 --- a/inc/extensions/ext-transfer.php +++ b/inc/extensions/ext-transfer.php @@ -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`"); diff --git a/inc/extensions/ext-user.php b/inc/extensions/ext-user.php index 2d795d2c0e..819fddcbee 100644 --- a/inc/extensions/ext-user.php +++ b/inc/extensions/ext-user.php @@ -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öschungen auflisten', 'Listet die Lö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, diff --git a/inc/extensions/ext-wernis.php b/inc/extensions/ext-wernis.php index 4829e1119a..4a901fde25 100644 --- a/inc/extensions/ext-wernis.php +++ b/inc/extensions/ext-wernis.php @@ -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'"); diff --git a/inc/extensions/ext-yoomedia.php b/inc/extensions/ext-yoomedia.php index 10762ad145..bfa56d6eed 100644 --- a/inc/extensions/ext-yoomedia.php +++ b/inc/extensions/ext-yoomedia.php @@ -72,7 +72,7 @@ switch (getExtensionMode()) { addAdminMenuSql('email','list_yoomedia_tm','Yoo!Media Textmails','Listet Textmail-Buchungen über das Interface 2.0 von Yoo!Media nach Ihren eingestellten Kriterien auf. Vorsicht: 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 diff --git a/inc/modules/admin/what-list_bank_package.php b/inc/modules/admin/what-list_bank_package.php index 86de21ccc2..86fc276b8b 100644 --- a/inc/modules/admin/what-list_bank_package.php +++ b/inc/modules/admin/what-list_bank_package.php @@ -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 diff --git a/inc/modules/admin/what-list_surfbar_urls.php b/inc/modules/admin/what-list_surfbar_urls.php index 207f45b603..5204455333 100644 --- a/inc/modules/admin/what-list_surfbar_urls.php +++ b/inc/modules/admin/what-list_surfbar_urls.php @@ -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',