+// Add configuration entry if not found for actual extension
+function addConfigAddSql ($columnName, $columnSql) {
+ // Is the column there?
+ if (!isSqlTableColumnFound('{?_MYSQL_PREFIX?}_config', $columnName)) {
+ // Not found, so add it
+ addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `' . $columnName . '` ' . $columnSql);
+ } elseif (isDebugModeEnabled()) {
+ // Add debug line
+ logDebugMessage(__FUNCTION__, __LINE__, 'Configuration entry ' . $columnName . ' already created. columnSql=' . $columnSql);
+ }
+}
+
+// Drop configuration entry if found for actual extension
+function addConfigDropSql ($columnName) {
+ // Is the column there?
+ if (isSqlTableColumnFound('{?_MYSQL_PREFIX?}_config', $columnName)) {
+ // Found, so add it
+ addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_config` DROP `' . $columnName . '`');
+ } elseif (isDebugModeEnabled()) {
+ // Add debug line, debug_report_bug() would cause some extenion updates fail
+ logDebugMessage(__FUNCTION__, __LINE__, 'Configuration entry ' . $columnName . ' not found.');
+ }
+}
+
+// Change configuration entry for actual extension
+function addConfigChangeSql ($oldColumnName, $newColumnName, $columnSql) {
+ // Add the SQL statement
+ addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_config` CHANGE `' . $oldColumnName . '` `' . $newColumnName . '` ' . $columnSql);
+}
+
+// Enables/disables productive mode for current extension (used only while
+// registration).
+// @TODO This should be rewrittten to allow, more development states, e.g. 'planing','alpha','beta','beta2','stable'
+function enableExtensionProductive ($isProductive = true) {
+ // Log debug message
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("ext_name=%s,isProductive=%d", getCurrentExtensionName(), intval($isProductive)));
+
+ // Set it
+ $GLOBALS['ext_productive'][getCurrentExtensionName()] = (bool) $isProductive;
+}
+
+// Checks wether the extension is in productive phase. If not set, development
+// phase (=false) is assumed.
+function isExtensionProductive ($ext_name = '') {
+ // Is the extension name empty? Then use current
+ if (empty($ext_name)) {
+ // Get current extension name
+ $ext_name = getCurrentExtensionName();
+ } // END - if
+
+ // Do we have cache?
+ if (!isset($GLOBALS[__FUNCTION__][$ext_name])) {
+ // Load extension only if not yet loaded
+ if (!isset($GLOBALS['ext_productive'][$ext_name])) {
+ // Load extension in test mode
+ loadExtension($ext_name, 'test');
+ } // END - if
+
+ // Determine it
+ $GLOBALS[__FUNCTION__][$ext_name] = ((isset($GLOBALS['ext_productive'][$ext_name])) && ($GLOBALS['ext_productive'][$ext_name] === true));
+ } // END - if
+
+ // Log debug message
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("ext_name=%s,isProductive=%s", $ext_name, intval($GLOBALS[__FUNCTION__][$ext_name])));
+
+ // Return result
+ return $GLOBALS[__FUNCTION__][$ext_name];
+}
+
+// Mark extension file as loaded
+function markExtensionAsLoaded ($ext_name) {
+ // Is it already loaded?
+ if (isExtensionLoaded($ext_name)) {
+ // Then abort here
+ debug_report_bug(__FUNCTION__, __LINE__, 'Extension ' . $ext_name . ' is already marked as loaded!');
+ } // END - if
+
+ // Mark it
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("ext_name=%s,ext_loaded=true", $ext_name));
+ $GLOBALS['ext_loaded']['ext_name'][$ext_name] = true;
+}
+
+// Determine wether the given extension is already loaded
+function isExtensionLoaded ($ext_name) {
+ // Is it there?
+ return ((isset($GLOBALS['ext_loaded']['ext_name'][$ext_name])) && ($GLOBALS['ext_loaded']['ext_name'][$ext_name] === true));
+}
+
+// Mark extension's library file as loaded
+function markExtensionLibraryAsLoaded ($ext_name) {
+ // Is it already loaded?
+ if (isExtensionLibraryLoaded($ext_name)) {
+ // Then abort here
+ debug_report_bug(__FUNCTION__, __LINE__, 'Extension library ' . $ext_name . ' is already marked as loaded!');
+ } // END - if
+
+ // Mark it
+ $GLOBALS['ext_loaded']['library'][$ext_name] = true;
+}
+
+// Determine wether the given extension's library is already loaded
+function isExtensionLibraryLoaded ($ext_name) {
+ // Is it there?
+ return ((isset($GLOBALS['ext_loaded']['library'][$ext_name])) && ($GLOBALS['ext_loaded']['library'][$ext_name] === true));
+}
+