From: Roland Häder Date: Mon, 5 Jul 2010 18:47:02 +0000 (+0000) Subject: One more wrapper function introduced, fixed for installation phase X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5c8a9ba30d1aaa13a6f18c51548a4d3f2c25326e;p=mailer.git One more wrapper function introduced, fixed for installation phase --- diff --git a/inc/extensions/ext-sql_patches.php b/inc/extensions/ext-sql_patches.php index 4d73669ae9..64883e68b3 100644 --- a/inc/extensions/ext-sql_patches.php +++ b/inc/extensions/ext-sql_patches.php @@ -756,17 +756,8 @@ INDEX (`ip`) // Read key from secret file if ((isExtensionInstalledAndNewer('sql_patches', '0.3.6')) && ((getFileHash() == '') || (getMasterSalt() == '') || (getPassScramble() == ''))) { - // Cache instance // Maybe need setup of secret key! loadIncludeOnce('inc/gen_sql_patches.php'); - - // @TODO Rewrite this to a filter - if ((isExtensionInstalledAndNewer('cache', '0.1.2')) && (isCacheInstanceValid())) { - // Destroy some cache files - if ($GLOBALS['cache_instance']->loadCacheFile('config')) $GLOBALS['cache_instance']->removeCacheFile(); - if ($GLOBALS['cache_instance']->loadCacheFile('extension')) $GLOBALS['cache_instance']->removeCacheFile(); - if ($GLOBALS['cache_instance']->loadCacheFile('modules')) $GLOBALS['cache_instance']->removeCacheFile(); - } // END - if } // END - if // Test again diff --git a/inc/gen_sql_patches.php b/inc/gen_sql_patches.php index 184eb28e30..3d2a48dfe5 100644 --- a/inc/gen_sql_patches.php +++ b/inc/gen_sql_patches.php @@ -85,6 +85,7 @@ if (getFileHash() == '') { if (isFileReadable($FQFN)) { // Also update configuration setConfigEntry('secret_key', $secretKey); + updateConfiguration('file_hash', $fileHash); // Remove variables unset($secretKey); @@ -92,5 +93,13 @@ if (getFileHash() == '') { } // END - if } // END - if +// @TODO Rewrite this to a filter +if ((isExtensionInstalledAndNewer('cache', '0.1.2')) && (isCacheInstanceValid())) { + // Destroy some cache files + if ($GLOBALS['cache_instance']->loadCacheFile('config')) $GLOBALS['cache_instance']->removeCacheFile(); + if ($GLOBALS['cache_instance']->loadCacheFile('extension')) $GLOBALS['cache_instance']->removeCacheFile(); + if ($GLOBALS['cache_instance']->loadCacheFile('modules')) $GLOBALS['cache_instance']->removeCacheFile(); +} // END - if + // [EOF] ?> diff --git a/inc/modules/admin/overview-inc.php b/inc/modules/admin/overview-inc.php index 870c5b277e..73077463a7 100644 --- a/inc/modules/admin/overview-inc.php +++ b/inc/modules/admin/overview-inc.php @@ -133,7 +133,7 @@ function outputSeletectedTasks ($postData, $result_tasks) { if ((isset($postData['assign'])) && (count($postData['sel']) > 0)) { // Assign / do tasks $OUT = ''; - foreach ($postData['sel'] as $id => $sel) { + foreach ($postData['sel'] as $taskId => $sel) { $result_task = SQL_QUERY_ESC("SELECT `id`, `userid`, `task_type`, `subject`, `text`, `task_created`, `status`, `assigned_admin` FROM @@ -142,7 +142,7 @@ WHERE `id`=%s AND (`assigned_admin`=%s OR (`assigned_admin`=0 AND `status`='NEW')) LIMIT 1", array( - bigintval($id), + bigintval($taskId), getCurrentAdminId() ), __FILE__, __LINE__); @@ -195,14 +195,14 @@ LIMIT 1", $title = '{--TASK_NO_TITLE--}'; // Shall I list SQL commands assigned to an extension installation or update task? - if (isVerboseSqlEnabled()) { + if ((isVerboseSqlEnabled()) || (!isExtensionInstalled('sql_patches'))) { // Extract extension name from subject $ext_name = substr($taskData['subject'], 1, strpos($taskData['subject'], ':') - 1); // Update task or extension task? if (($taskData['task_type'] == 'EXTENSION') && (!isExtensionInstalled($ext_name))) { // Load SQL commands for registering in dry-run - registerExtension($ext_name, $id, true); + registerExtension($ext_name, $taskId, true); // Is this non-productive? if (isExtensionProductive() === false) { @@ -285,7 +285,7 @@ LIMIT 1", if ($lines == '0') { // New extension found $OUT .= loadTemplate('admin_extension_reg_form', true, array( - 'id' => bigintval($id), + 'id' => bigintval($taskId), 'ext_name' => $ext_name )); } else { @@ -378,12 +378,12 @@ LIMIT 1", break; case 'MEMBER_ORDER': // Member mail orders - $OUT .= loadTemplate('admin_task_order', true, $id); + $OUT .= loadTemplate('admin_task_order', true, $taskId); break; default: // Unknown task type logDebugMessage(__FILE__, __LINE__, sprintf("Unknown task type %s detected.", $taskData['task_type'])); - $OUT .= '
' . sprintf(getMessage('ADMIN_UNKNOWN_TASK_TYPE'), $taskData['task_type'], $id) . '
'; + $OUT .= '
' . sprintf(getMessage('ADMIN_UNKNOWN_TASK_TYPE'), $taskData['task_type'], $taskId) . '
'; break; } $OUT .= ' @@ -402,15 +402,15 @@ LIMIT 1", // Only unassign / delete tasks when there are selected tasks posted if (!empty($postData['unassign'])) { // Unassign from tasks - foreach ($postData['sel'] as $id => $sel) { + foreach ($postData['sel'] as $taskId => $sel) { SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_task_system` SET `assigned_admin`=0 WHERE `id`=%s AND `assigned_admin`=%s LIMIT 1", - array(bigintval($id), getCurrentAdminId()), __FILE__, __LINE__); + array(bigintval($taskId), getCurrentAdminId()), __FILE__, __LINE__); } } elseif (isset($postData['del'])) { // Delete tasks - foreach ($postData['sel'] as $id => $sel) { + foreach ($postData['sel'] as $taskId => $sel) { SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_task_system` WHERE `id`=%s AND `assigned_admin` IN (%s,0) LIMIT 1", - array(bigintval($id), getCurrentAdminId()), __FILE__, __LINE__); + array(bigintval($taskId), getCurrentAdminId()), __FILE__, __LINE__); } } else { // Unknown action diff --git a/inc/modules/admin/what-config_secure.php b/inc/modules/admin/what-config_secure.php index 3cd889890c..db890563e9 100644 --- a/inc/modules/admin/what-config_secure.php +++ b/inc/modules/admin/what-config_secure.php @@ -52,7 +52,7 @@ if (isFormSent()) { loadInclude('inc/gen_sql_patches.php'); // Forget the wrong number! - unsetPostRequestParameter(('salt_length')); + unsetPostRequestParameter('salt_length'); // Redirect to logout link redirectToUrl('modules.php?module=admin&logout=1'); diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index 58674e0649..bc89dfc63f 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -1418,6 +1418,18 @@ function getMysqlPrefix () { return $GLOBALS['mysql_prefix']; } +// "Getter" for table_type +function getTableType () { + // Do we have cache? + if (!isset($GLOBALS['table_type'])) { + // Determine it + $GLOBALS['table_type'] = getConfig('_TABLE_TYPE'); + } // END - if + + // Return cache + return $GLOBALS['table_type']; +} + // "Getter" for salt_length function getSaltLength () { // Do we have cache?