From a30da9ca393c9f03a7e2808f444d9a17357917fd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 1 Nov 2009 22:02:06 +0000 Subject: [PATCH] All non-productive extensions marked as 'non-productive', a warning will be issued if you try to register such extension --- DOCS/TODOs.txt | 18 +++++++++--------- inc/extensions-functions.php | 15 +++++++++++++++ inc/extensions/ext-autoreg.php | 3 +++ inc/extensions/ext-bank.php | 3 +++ inc/extensions/ext-booking.php | 5 ++++- inc/extensions/ext-events.php | 3 +++ inc/extensions/ext-jackpot.php | 3 +++ inc/extensions/ext-network.php | 15 +++++++++------ inc/extensions/ext-primera.php | 5 ++++- inc/extensions/ext-refsell.php | 3 +++ inc/extensions/ext-safe.php | 5 ++++- inc/extensions/ext-seo.php | 5 ++++- inc/extensions/ext-sponsor.php | 5 ++++- inc/extensions/ext-surfbar.php | 3 +++ inc/extensions/ext-update.php | 3 +++ inc/language/de.php | 1 + inc/modules/admin/overview-inc.php | 8 +++++++- 17 files changed, 82 insertions(+), 21 deletions(-) diff --git a/DOCS/TODOs.txt b/DOCS/TODOs.txt index 222388c896..f783ca2899 100644 --- a/DOCS/TODOs.txt +++ b/DOCS/TODOs.txt @@ -7,15 +7,15 @@ ./inc/config-functions.php:143: // @TODO Make this all better... :-/ ./inc/config-functions.php:318: // @TODO Find a way for updating configuration here ./inc/extensions/ext-html_mail.php:140: // @TODO Move these arrays into config -./inc/extensions/ext-network.php:68: // @TODO network_type_name is an internal name and needs documentation +./inc/extensions/ext-network.php:71: // @TODO network_type_name is an internal name and needs documentation ./inc/extensions/ext-newsletter.php:215: // @TODO Move these into configuration ./inc/extensions/ext-rallye.php:329: // @TODO Move this code into rallye_functions.php ./inc/extensions/ext-sql_patches.php:741: // @TODO Rewrite this to a filter ./inc/extensions/ext-sql_patches.php:94: /* @TODO SQL_ALTER_TABLE() should work now properly ./inc/extensions/ext-yoomedia.php:122: // @TODO Can this be moved into a database table? ./inc/extensions/ext-yoomedia.php:55:// @TODO Only deprecated when 'network' is ready! setExtensionDeprecated('Y'); -./inc/extensions-functions.php:370:// @TODO Change from ext_id to ext_name (not just even the variable! ;-) ) -./inc/extensions-functions.php:481: // @TODO Extension is loaded, what next? +./inc/extensions-functions.php:373:// @TODO Change from ext_id to ext_name (not just even the variable! ;-) ) +./inc/extensions-functions.php:484: // @TODO Extension is loaded, what next? ./inc/functions.php:1350: // @TODO Remove this if() block if all is working fine ./inc/functions.php:222: // @TODO Remove this sanity-check if all is fine ./inc/functions.php:225: // @TODO Try to rewrite all $DATA to $content @@ -33,8 +33,8 @@ ./inc/functions.php:580: // @TODO Extension 'msg' does not exist ./inc/functions.php:657:// @TODO Rewrite this to an extension 'smtp' ./inc/install-functions.php:62: // @TODO DEACTIVATED: changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'OUTPUT-MODE', "setConfigEntry('OUTPUT_MODE', '", "');", postRequestElement('omode'), 0); -./inc/language/de.php:1139:// @TODO Rewrite these two constants -./inc/language/de.php:1155:// @TODO Rewrite these five constants +./inc/language/de.php:1140:// @TODO Rewrite these two constants +./inc/language/de.php:1156:// @TODO Rewrite these five constants ./inc/language/de.php:735:// @TODO The template 'admin_extensions_installed' is using this. But the template is no longer used. ./inc/language/de.php:843:// @TODO Are these constants longer used? ./inc/language-functions.php:45:// @TODO Rewrite all language constants to this function. @@ -69,10 +69,10 @@ ./inc/modules/admin/admin-inc.php:527: // @TODO Try to rewrite this to $content = SQL_FETCHARRAY(). Please look some lines above for the dynamic query ./inc/modules/admin/overview-inc.php:160: // @TODO Rewrite this to a filter ./inc/modules/admin/overview-inc.php:170: // @TODO Can this SQL be encapsulated in a function, so all similar queries can be rewritten? -./inc/modules/admin/overview-inc.php:275: // @TODO Rewrite this to something with include files -./inc/modules/admin/overview-inc.php:313: // @TODO This may also be rewritten to include files -./inc/modules/admin/overview-inc.php:315: default: // @TODO Unknown support mode -./inc/modules/admin/overview-inc.php:434: // @TODO Try to move this in includes +./inc/modules/admin/overview-inc.php:281: // @TODO Rewrite this to something with include files +./inc/modules/admin/overview-inc.php:319: // @TODO This may also be rewritten to include files +./inc/modules/admin/overview-inc.php:321: default: // @TODO Unknown support mode +./inc/modules/admin/overview-inc.php:440: // @TODO Try to move this in includes ./inc/modules/admin/overview-inc.php:44:// @TODO This function does also check for uncompleted tasks ./inc/modules/admin.php:94: // @TODO Why is this set to 'done'? ./inc/modules/admin/what-add_guestnl_cat.php:48: // @TODO Check if category does already exist diff --git a/inc/extensions-functions.php b/inc/extensions-functions.php index 990c04ce79..710d154398 100644 --- a/inc/extensions-functions.php +++ b/inc/extensions-functions.php @@ -150,6 +150,9 @@ function registerExtension ($ext_name, $task_id, $dry_run = false, $logout = tru // Enable dry-run enableExtensionDryRun($dry_run); + // By default all extensions are in productive phase + enableExtensionProductive(); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "currName=".getCurrentExtensionName()." - ENTERED!"); // This shall never do a non-admin user or if the extension is active (already installed) if ((!isAdmin()) || (isExtensionInstalled($ext_name))) { @@ -1708,5 +1711,17 @@ function addSponsorMenuSql ($action, $what, $title, $active, $sort) { } } +// Enables/disables productive mode for current extension (used only while +// registration). +function enableExtensionProductive ($isProductive = true) { + $GLOBALS['ext_productive'][getCurrentExtensionName()] = (bool) $isProductive; +} + +// Checks wether the extension is in productive phase. If not set, development +// phase (=false) is assumed. +function isExtensionProductive () { + return ((isset($GLOBALS['ext_productive'][getCurrentExtensionName()])) && ($GLOBALS['ext_productive'][getCurrentExtensionName()] === true)); +} + // [EOF] ?> diff --git a/inc/extensions/ext-autoreg.php b/inc/extensions/ext-autoreg.php index fac6f8aac4..aaa92891f5 100644 --- a/inc/extensions/ext-autoreg.php +++ b/inc/extensions/ext-autoreg.php @@ -47,6 +47,9 @@ setThisExtensionVersion('0.0'); // Version history array (add more with , '0.1.0' and so on) setExtensionVersionHistory(array('0.0')); +// This extension is in development (non-productive) +enableExtensionProductive(false); + switch (getExtensionMode()) { case 'register': // Do stuff when installation is running (modules.php?module=admin is called) // SQL commands to run diff --git a/inc/extensions/ext-bank.php b/inc/extensions/ext-bank.php index bf16f243b7..f0339643e0 100644 --- a/inc/extensions/ext-bank.php +++ b/inc/extensions/ext-bank.php @@ -47,6 +47,9 @@ setThisExtensionVersion('0.0'); // Version history array (add more with , '0.1.0' and so on) setExtensionVersionHistory(array('0.0')); +// This extension is in development (non-productive) +enableExtensionProductive(false); + switch (getExtensionMode()) { case 'register': // Do stuff when installation is running (modules.php?module=admin is called) // SQL commands to run diff --git a/inc/extensions/ext-booking.php b/inc/extensions/ext-booking.php index 077b1f94dc..7c636d2128 100644 --- a/inc/extensions/ext-booking.php +++ b/inc/extensions/ext-booking.php @@ -39,7 +39,7 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); -} +} // END - if // Version number setThisExtensionVersion('0.0'); @@ -47,6 +47,9 @@ setThisExtensionVersion('0.0'); // Version history array (add more with , '0.1.0' and so on) setExtensionVersionHistory(array('0.0')); +// This extension is in development (non-productive) +enableExtensionProductive(false); + switch (getExtensionMode()) { case 'register': // Do stuff when installation is running (modules.php?module=admin is called) // Configuration entries diff --git a/inc/extensions/ext-events.php b/inc/extensions/ext-events.php index 33e279e196..684fe3fbb0 100644 --- a/inc/extensions/ext-events.php +++ b/inc/extensions/ext-events.php @@ -48,6 +48,9 @@ setThisExtensionVersion('0.0'); // Version history array (add more with , '0.1.0' and so on) setExtensionVersionHistory(array('0.0')); +// This extension is in development (non-productive) +enableExtensionProductive(false); + switch (getExtensionMode()) { case 'register': // Do stuff when installation is running (modules.php?module=admin is called) // SQL commands to run diff --git a/inc/extensions/ext-jackpot.php b/inc/extensions/ext-jackpot.php index 420bcc8812..bf7c1c161d 100644 --- a/inc/extensions/ext-jackpot.php +++ b/inc/extensions/ext-jackpot.php @@ -47,6 +47,9 @@ setThisExtensionVersion('0.0'); // Version history array (add more with , '0.1.0' and so on) setExtensionVersionHistory(array('0.0')); +// This extension is in development (non-productive) +enableExtensionProductive(false); + switch (getExtensionMode()) { case 'register': // Do stuff when installation is running (modules.php?module=admin is called) // SQL commands to run diff --git a/inc/extensions/ext-network.php b/inc/extensions/ext-network.php index 805a78cf4d..721765cba9 100644 --- a/inc/extensions/ext-network.php +++ b/inc/extensions/ext-network.php @@ -47,6 +47,9 @@ setThisExtensionVersion('0.0'); // Version history array (add more with , '0.1.0' and so on) setExtensionVersionHistory(array('0.0')); +// This extension is in development (non-productive) +enableExtensionProductive(false); + switch (getExtensionMode()) { case 'register': // Do stuff when installation is running (modules.php?module=admin is called) // Main table which hold @@ -113,8 +116,8 @@ PRIMARY KEY (`network_code_id`) ) TYPE={?_TABLE_TYPE?} COMMENT='Error types, generic data, DO NOT ALTER!'"); // Data from the webmaster (you!) - addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_config_data`"); - addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_config_data` ( + addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_config`"); + addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_config` ( `network_id` BIGINT(20) NOT NULL DEFAULT 0, `network_affiliate_id` BIGINT(20) NOT NULL DEFAULT 0, `network_api_password` VARCHAR(255) NOT NULL DEFAULT '', @@ -125,8 +128,8 @@ PRIMARY KEY (`network_id`) ) TYPE={?_TABLE_TYPE?} COMMENT='Configuration data from the webmaster (you!)'"); // Configuration data for e.g. reload-time - addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_types_data`"); - addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_types_data` ( + addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_types_config`"); + addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_types_config` ( `network_data_id` BIGINT(20) NOT NULL AUTO_INCREMENT, `network_id` BIGINT(20) NOT NULL DEFAULT 0, `network_type_id` BIGINT(20) NOT NULL DEFAULT 0, @@ -176,8 +179,8 @@ PRIMARY KEY (`network_data_id`) 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_type_errors`"); - addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_config_data`"); - addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_types_data`"); + addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_config`"); + addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_types_config`"); // Admin menu addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='network'"); diff --git a/inc/extensions/ext-primera.php b/inc/extensions/ext-primera.php index 2a2d7adac7..892732c707 100644 --- a/inc/extensions/ext-primera.php +++ b/inc/extensions/ext-primera.php @@ -41,7 +41,7 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); -} +} // END - if // Version of this extension setThisExtensionVersion('0.0'); @@ -49,6 +49,9 @@ setThisExtensionVersion('0.0'); // Version history array (add more with , '0.1.0' and so on) setExtensionVersionHistory(array('0.0')); +// This extension is in development (non-productive) +enableExtensionProductive(false); + switch (getExtensionMode()) { case 'register': // Do stuff when installation is running (modules.php?module=admin is called) // SQL commands to run diff --git a/inc/extensions/ext-refsell.php b/inc/extensions/ext-refsell.php index 208120ab33..be449598f4 100644 --- a/inc/extensions/ext-refsell.php +++ b/inc/extensions/ext-refsell.php @@ -47,6 +47,9 @@ setThisExtensionVersion('0.0'); // Version history array (add more with , '0.1.0' and so on) setExtensionVersionHistory(array('0.0')); +// This extension is in development (non-productive) +enableExtensionProductive(false); + switch (getExtensionMode()) { case 'register': // Do stuff when installation is running (modules.php?module=admin is called) // SQL commands to run diff --git a/inc/extensions/ext-safe.php b/inc/extensions/ext-safe.php index 93006e7cc3..6af71b7445 100644 --- a/inc/extensions/ext-safe.php +++ b/inc/extensions/ext-safe.php @@ -40,7 +40,7 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); -} +} // END - if // Version number setThisExtensionVersion('0.0'); @@ -48,6 +48,9 @@ setThisExtensionVersion('0.0'); // Version history array (add more with , '0.1.0' and so on) setExtensionVersionHistory(array('0.0')); +// This extension is in development (non-productive) +enableExtensionProductive(false); + switch (getExtensionMode()) { case 'register': // Do stuff when installation is running (modules.php?module=admin is called) // SQL commands to run diff --git a/inc/extensions/ext-seo.php b/inc/extensions/ext-seo.php index f4ae90b684..f31c2cd441 100644 --- a/inc/extensions/ext-seo.php +++ b/inc/extensions/ext-seo.php @@ -39,7 +39,7 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); -} +} // END - if // Version number setThisExtensionVersion('0.0'); @@ -47,6 +47,9 @@ setThisExtensionVersion('0.0'); // Version history array (add more with , '0.1.0' and so on) setExtensionVersionHistory(array('0.0')); +// This extension is in development (non-productive) +enableExtensionProductive(false); + switch (getExtensionMode()) { case 'register': // Do stuff when installation is running (modules.php?module=admin is called) // SQL commands to run diff --git a/inc/extensions/ext-sponsor.php b/inc/extensions/ext-sponsor.php index a5d137761a..130a53bda7 100644 --- a/inc/extensions/ext-sponsor.php +++ b/inc/extensions/ext-sponsor.php @@ -39,7 +39,7 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); -} +} // END - if // Version number setThisExtensionVersion('0.0'); @@ -47,6 +47,9 @@ setThisExtensionVersion('0.0'); // Version history array (add more with , '0.1.0' and so on) setExtensionVersionHistory(array('0.0')); +// This extension is in development (non-productive) +enableExtensionProductive(false); + switch (getExtensionMode()) { case 'register': // Do stuff when installation is running (modules.php?module=admin is called) // diff --git a/inc/extensions/ext-surfbar.php b/inc/extensions/ext-surfbar.php index e437d892b4..488e829e70 100644 --- a/inc/extensions/ext-surfbar.php +++ b/inc/extensions/ext-surfbar.php @@ -47,6 +47,9 @@ setThisExtensionVersion('0.0'); // Version history array (add more with , '0.1.0' and so on) setExtensionVersionHistory(array('0.0')); +// This extension is in development (non-productive) +enableExtensionProductive(false); + switch (getExtensionMode()) { case 'register': // Do stuff when installation is running (modules.php?module=admin is called) // SQL commands to run (surfbar URLs) diff --git a/inc/extensions/ext-update.php b/inc/extensions/ext-update.php index 72c76ec324..2d8378d87b 100644 --- a/inc/extensions/ext-update.php +++ b/inc/extensions/ext-update.php @@ -47,6 +47,9 @@ setThisExtensionVersion('0.0'); // Version history array (add more with , '0.1.0' and so on) setExtensionVersionHistory(array('0.0')); +// This extension is in development (non-productive) +enableExtensionProductive(false); + switch (getExtensionMode()) { case 'register': // Do stuff when installation is running (modules.php?module=admin is called) // SQL commands to run diff --git a/inc/language/de.php b/inc/language/de.php index d23589f553..d844634220 100644 --- a/inc/language/de.php +++ b/inc/language/de.php @@ -1132,6 +1132,7 @@ addMessages(array( 'GUEST_STATS_NO_CLICKS' => "Keine Klicks in Ihrem {?mt_word?} verzeichnet.", 'ADMIN_EXTENSIONS_REMOVED' => "Es wurden %s Erweiterungen aus Ihrem {?mt_word?} entfernt.", 'ADMIN_WARNING_SQL_PATCHES_MISSING' => "Eine essentielle Erweiterung sql_patches ist noch nicht installiert. Bitte erledigen Sie dies bald, da Ihr {?mt_word?} sonst nicht funktioniert.", + 'ADMIN_EXTENSION_IS_NON_PRODUCTIVE' => "Die von Ihnen ausgewählte Erweiterung %s ist noch nicht für den produktiven Betrieb freigegeben und befindet sich somit noch in der Entwicklung. Bitte nur verwenden, wenn Sie wissen, was Sie tun.", 'MEMBER_MAIL_BONUS_CONFIRMED_ON' => "Sie haben diese Bonusmail %s bestätigt.", 'MEMBER_MAIL_NORMAL_CONFIRMED_ON' => "Sie haben diese Klickmail %s bestätigt.", diff --git a/inc/modules/admin/overview-inc.php b/inc/modules/admin/overview-inc.php index ebd9c8377b..637e12009c 100644 --- a/inc/modules/admin/overview-inc.php +++ b/inc/modules/admin/overview-inc.php @@ -204,9 +204,15 @@ LIMIT 1", // Update task or extension task? if (($type == 'EXTENSION') && (!isExtensionInstalled($ext_name))) { - // Load SQL commands for registering + // Load SQL commands for registering in dry-run registerExtension($ext_name, $id, true); + // Is this non-productive? + if (isExtensionProductive() === false) { + // Issue warning + $text .= loadTemplate('admin_settings_saved', true, sprintf(getMessage('ADMIN_EXTENSION_IS_NON_PRODUCTIVE'), $ext_name)); + } // END - if + // Set current extension name setCurrentExtensionName($ext_name); -- 2.30.2