Encapsulated adding configuration entries with new wrapper function addConfigAddSql()
[mailer.git] / inc / extensions-functions.php
index cc85912150d86ddd6d81200c2ec60fef9aee95f4..cd3f0d068a935afb9ce71d30a737ef2f94fe3557 100644 (file)
@@ -1883,6 +1883,18 @@ function addSponsorMenuSql ($action, $what, $title, $active, $sort) {
        }
 }
 
+// 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 `' . $columName . '` ' . $columnSql);
+       } else {
+               // Add debug line
+               logDebugMessage(__FUNCTION__, __LINE__, 'Configuration entry ' . $columnName . ' already created. columnSql=' . $columnSql);
+       }
+}
+
 // Enables/disables productive mode for current extension (used only while
 // registration).
 function enableExtensionProductive ($isProductive = true) {
@@ -1956,5 +1968,6 @@ function isExtensionLibraryLoaded ($ext_name) {
        // Is it there?
        return ((isset($GLOBALS['ext_loaded']['library'][$ext_name])) && ($GLOBALS['ext_loaded']['library'][$ext_name] === true));
 }
+
 // [EOF]
 ?>