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
`id`=%s AND (`assigned_admin`=%s OR (`assigned_admin`=0 AND `status`='NEW'))
LIMIT 1",
array(
- bigintval($id),
+ bigintval($taskId),
getCurrentAdminId()
), __FILE__, __LINE__);
$title = '{--TASK_NO_TITLE--}';
// Shall I list SQL commands assigned to an extension installation or update task?
- if ((getConfig('verbose_sql') == 'Y')) {
+ 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) {
}
// 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
$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
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 {
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 .= '<div class="admin_failed medium">' . sprintf(getMessage('ADMIN_UNKNOWN_TASK_TYPE'), $taskData['task_type'], $id) . '</div>';
+ $OUT .= '<div class="admin_failed medium">' . sprintf(getMessage('ADMIN_UNKNOWN_TASK_TYPE'), $taskData['task_type'], $taskId) . '</div>';
break;
}
$OUT .= '
// 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