X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fextensions-functions.php;h=e1ccca57d11507a857823d0397eb97f0cadd86bb;hb=c9eeea4ffb9f186fb8d5207542a0bb0da7028f83;hp=f531cb40e88894a34561b725c8e9c6c695c09cdf;hpb=16de7d9e8b98108627db01688bc095240b5ba8d2;p=mailer.git diff --git a/inc/extensions-functions.php b/inc/extensions-functions.php index f531cb40e8..e1ccca57d1 100644 --- a/inc/extensions-functions.php +++ b/inc/extensions-functions.php @@ -1,7 +1,7 @@ %s has empty version!", $ext_name)); } // END - if @@ -765,17 +765,18 @@ function getExtensionName ($ext_id) { } // Get extension id from name -function getExtensionId ($ext_name, $forceDb = false) { +function getExtensionId ($ext_name) { // Init id number - $ret = 0; + $ret = '0'; + // Do we have cache? if (isset($GLOBALS['cache_array']['extension']['ext_id'][$ext_name])) { // Load from cache $ret = $GLOBALS['cache_array']['extension']['ext_id'][$ext_name]; // Count cache hits incrementStatsEntry('cache_hits'); - } elseif (($forceDb === true) || (!isExtensionActive('cache'))) { + } else { // Load from database $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_extensions` WHERE `ext_name`='%s' LIMIT 1", array($ext_name), __FUNCTION__, __LINE__); @@ -791,10 +792,7 @@ function getExtensionId ($ext_name, $forceDb = false) { // Cache it $GLOBALS['cache_array']['extension']['ext_id'][$ext_name] = $ret; - } else { - // Caching enabled but no cache found is bad - debug_report_bug(__FUNCTION__ . ': Cache not found but ext-cache is active. ext_name=' . $ext_name); - } // END - if + } // Return value return $ret; @@ -893,7 +891,7 @@ function createExtensionUpdateTask ($adminId, $ext_name, $ext_ver, $notes) { // Is the extension there? if (isExtensionInstalled($ext_name)) { // Check if task is not there - if (determineTaskIdBySubject($subject) == 0) { + if (determineTaskIdBySubject($subject) == '0') { // Create extension update-task createNewTask($subject, $notes, 'EXTENSION_UPDATE', 0, $adminId); } // END - if @@ -906,7 +904,7 @@ function createExtensionUpdateTask ($adminId, $ext_name, $ext_ver, $notes) { // Creates a new task for newly installed extension function createNewExtensionTask ($adminId, $subject, $ext) { // Not installed and do we have created a task for the admin? - if ((determineTaskIdBySubject($subject) == 0) && (!isExtensionInstalled($ext))) { + if ((determineTaskIdBySubject($subject) == '0') && (!isExtensionInstalled($ext))) { // Set default message if ext-foo is missing $message = sprintf(getMessage('ADMIN_EXT_TEXT_FILE_MISSING'), $ext); @@ -937,7 +935,7 @@ function createExtensionDeactivationTask ($ext) { $subject = sprintf("[%s:] %s", $ext, getMessage('TASK_SUBJ_EXTENSION_DEACTIVATED')); // Not installed and do we have created a task for the admin? - if ((determineTaskIdBySubject($subject) == 0) && (getExtensionVersion($ext) != '')) { + if ((determineTaskIdBySubject($subject) == '0') && (getExtensionVersion($ext) != '')) { // Task not created so add it createNewTask($subject, SQL_ESCAPE(loadTemplate('task_ext_deactivated', true, $ext)), 'EXTENSION_DEACTIVATION'); } // END - if @@ -995,7 +993,7 @@ function ifModuleHasMenu ($mod, $forceDb = false) { // Determines the task id for given extension function determineExtensionTaskId ($ext_name) { // Default is not found - $task_id = 0; + $task_id = '0'; // Search for extension task's id $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_task_system` WHERE `task_type`='EXTENSION' AND `subject`='[%s:]' LIMIT 1", @@ -1017,7 +1015,7 @@ function determineExtensionTaskId ($ext_name) { // Determines the task id for given subject function determineTaskIdBySubject ($subject) { // Default is not found - $task_id = 0; + $task_id = '0'; // Search for task id $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_task_system` WHERE `subject` LIKE '%s%%' LIMIT 1", @@ -1143,7 +1141,7 @@ function addExtensionUpdateDependency ($updateDepends) { // Is the update depency empty? (NEED TO BE FIXED!) if (empty($updateDepends)) { // Please report this bug! - debug_report_bug("updateDepends is left empty!"); + debug_report_bug('updateDepends is left empty!'); } // END - if // Is it not yet added? @@ -1236,7 +1234,7 @@ function removeExtensionUpdateDependency ($ext_name) { // Init iterator for update depencies function initExtensionUpdateIterator () { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "currName=".getCurrentExtensionName()); - $GLOBALS['ext_depend_iterator'][getCurrentExtensionName()] = 0; + $GLOBALS['ext_depend_iterator'][getCurrentExtensionName()] = '0'; } // Getter for depency iterator @@ -1453,7 +1451,7 @@ function removeExtensionFromArray () { $ext_name = getCurrentExtensionName(); // Now loop through the whole cache - foreach ($GLOBALS['cache_array']['extension'] as $cacheName=>$cacheArray) { + foreach ($GLOBALS['cache_array']['extension'] as $cacheName => $cacheArray) { // Is it an element? if (isset($cacheArray[$ext_name])) { // Array element