]> git.mxchange.org Git - mailer.git/commitdiff
Wrapper function isVerboseSqlEnabled() introduced
authorRoland Häder <roland@mxchange.org>
Mon, 5 Jul 2010 06:12:49 +0000 (06:12 +0000)
committerRoland Häder <roland@mxchange.org>
Mon, 5 Jul 2010 06:12:49 +0000 (06:12 +0000)
inc/extensions-functions.php
inc/modules/admin/overview-inc.php
inc/modules/admin/what-config_extensions.php
inc/modules/admin/what-extensions.php
inc/wrapper-functions.php

index 2cd8a035afb13dd70bd3819fc8722b0af557c673..c4e88abaf0e2c30d28e159c23a72515348249f42 100644 (file)
@@ -741,7 +741,7 @@ function addExtensionVerboseSqlTable ($title = '', $dashed = '', $switch = false
        $OUT = '';
 
        // Do we have queries?
-       if ((isExtensionInstalledAndNewer('sql_patches', '0.0.7')) && (getConfig('verbose_sql') == 'Y')) {
+       if (isVerboseSqlEnabled()) {
                // Do we have entries?
                if (countExtensionSqls() > 0) {
                        // Init counter
@@ -1076,7 +1076,7 @@ function addExtensionNotes ($ext_ver) {
        $content = array();
 
        // Is do we have verbose output enabled?
-       if ((!isExtensionActive('sql_patches')) || (getConfig('verbose_sql') == 'Y')) {
+       if ((!isExtensionActive('sql_patches')) || (isVerboseSqlEnabled())) {
                // Update notes found?
                if (isExtensionUpdateNoteSet($ext_ver)) {
                        // Update notes found
index abeab6b2fefc66983718a5fde4e7c69f8cfc27ff..870c5b277eff6ef2760f305b5096b4dcf91014cc 100644 (file)
@@ -195,7 +195,7 @@ LIMIT 1",
                                $title = '{--TASK_NO_TITLE--}';
 
                                // Shall I list SQL commands assigned to an extension installation or update task?
-                               if ((getConfig('verbose_sql') == 'Y')) {
+                               if (isVerboseSqlEnabled()) {
                                        // Extract extension name from subject
                                        $ext_name = substr($taskData['subject'], 1, strpos($taskData['subject'], ':') - 1);
 
@@ -243,7 +243,7 @@ LIMIT 1",
                                        }
 
                                        // Add SQLs to a table
-                                       if ((!empty($ext_name)) && (isExtensionInstalled('sql_patches')) && (getConfig('verbose_sql') == 'Y')) {
+                                       if ((!empty($ext_name)) && (isVerboseSqlEnabled())) {
                                                // Add verbose SQL table
                                                $taskData['text'] .= addExtensionVerboseSqlTable($title, ' class="admin_table top left right"', true, '100%') . "<br />\n";
                                        } // END - if
@@ -258,7 +258,7 @@ LIMIT 1",
                                        $taskData['text'] .= getExtensionNotes();
                                } else {
                                        // This should not normally happen!
-                                       debug_report_bug(__FILE__, __LINE__, 'ext_name(' . $ext_name . ') or ext_ver(' . $ext_ver . ') is empty! sql_patches=' . getExtensionVersion('sql_patches') . '/verbose_sql=' . getConfig('verbose_sql'));
+                                       debug_report_bug(__FILE__, __LINE__, 'ext_name(' . $ext_name . ') or ext_ver(' . $ext_ver . ') is empty! isVerboseSqlEnabled=' . intval(isVerboseSqlEnabled()));
                                }
 
                                // Prepare array for the template
index 2f771ec7105baddcb404a3c47a9aa1cc0ebd6659..fd4d74d79aab634185bdf08a655513b5c252b6c0 100644 (file)
@@ -40,7 +40,7 @@
 // Some security stuff...
 if ((!defined('__SECURITY')) || (!isAdmin())) {
        die();
-}
+} // END - if
 
 // Add description as navigation point
 addMenuDescription('admin', __FILE__);
index 342fbf86b62ff03db47c2f291e637cfd721b1318..12aeec675fdb1dc68cd045f349227c59e7a59f63 100644 (file)
@@ -176,7 +176,7 @@ if (isGetRequestParameterSet('reg_ext')) {
                        // Get extension name
                        $ext_name = getExtensionName($taskId);
 
-                       if (getConfig('verbose_sql') == 'Y') {
+                       if (isVerboseSqlEnabled()) {
                                // Load SQL commands in remove mode
                                if (loadExtension($ext_name, 'remove', '', true)) {
                                        // Generate extra table with loaded SQL commands
index 770b3509585fdb111f792e0487125e39f5fba83d..6eb8cf1e401e233c5f6fe0a784dcd61cb2300216 100644 (file)
@@ -1706,5 +1706,17 @@ function ifPostContainsSelections ($element = 'sel') {
        return $GLOBALS['post_contains_selections'][$element];
 }
 
+// Checks wether verbose_sql is Y and returns true/false if so
+function isVerboseSqlEnabled () {
+       // Do we have cache?
+       if (!isset($GLOBALS['is_verbose_sql_enabled'])) {
+               // Determine it
+               $GLOBALS['is_verbose_sql_enabled'] = ((isExtensionInstalledAndNewer('sql_patches', '0.0.7')) && (getConfig('verbose_sql') == 'Y'));
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['is_verbose_sql_enabled'];
+}
+
 // [EOF]
 ?>