]> git.mxchange.org Git - mailer.git/blobdiff - inc/extensions-functions.php
Workarounds for empty referal id
[mailer.git] / inc / extensions-functions.php
index 59e2e95ded0f601a09d53dabb77eed19b259741c..710d154398739c4a7650de14256415e063ae11fd 100644 (file)
@@ -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))) {
@@ -676,9 +679,9 @@ function addExtensionVerboseSqlTable ($title = '', $dashed = '', $switch = false
                $SW = 2;
 
                // Get all SQLs
-               foreach (getExtensionSqls() as $idx => $sqls) {
+               foreach (getExtensionSqls() as $sqls) {
                        // New array format is recursive
-                       foreach ($sqls as $sql) {
+                       foreach ($sqls as $idx => $sql) {
                                // Trim out spaces
                                $sql = trim($sql);
 
@@ -1036,7 +1039,7 @@ function addExtensionNotes ($ver) {
        $out = ''; $content = array();
 
        // Is do we have verbose output enabled?
-       if ((getConfig('verbose_sql') == 'Y') || (!isExtensionActive('sql_patches'))) {
+       if ((!isExtensionActive('sql_patches')) || (getConfig('verbose_sql') == 'Y')) {
                // Update notes found?
                if (getExtensionUpdateNotes($ver) != '') {
                        // Update notes found
@@ -1391,9 +1394,9 @@ function FILTER_INIT_EXTENSIONS () {
        // Do we have some entries?
        //* DEBUG */ print __FUNCTION__.': ENTRY!<br />';
        if (isset($GLOBALS['cache_array']['extension']['ext_name'])) {
-               //* DEBUG */ print __FUNCTION__.': CACHE - START!<br />';
                // Load all found extensions if found
-               foreach ($GLOBALS['cache_array']['extension']['ext_name'] as $key=>$ext_name) {
+               //* DEBUG */ print __FUNCTION__.': CACHE - START!<br />';
+               foreach ($GLOBALS['cache_array']['extension']['ext_name'] as $key => $ext_name) {
                        // Load it
                        //* DEBUG */ print __FUNCTION__.': '.$ext_name.' - START<br />';
                        loadExtension($ext_name, 'init');
@@ -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]
 ?>