Internal: Scripts: Fix Config Access in Script - refs BT#21099

pull/5133/head
christianbeeznst 2 years ago
parent 70178f39b2
commit 763837ec9c
  1. 13
      public/main/inc/global.inc.php
  2. 6
      tests/scripts/disable_user_conditions.php

@ -58,6 +58,18 @@ if (!empty($flashBag->keys())) {
$response = $kernel->handle($request, HttpKernelInterface::MAIN_REQUEST, false);
$context = Container::getRouter()->getContext();
$isCli = 'cli' === php_sapi_name();
$baseUrl = null;
if ($isCli) {
$cliOptions = getopt('', ['url:']);
if (!empty($cliOptions['url'])) {
$baseUrl = $cliOptions['url'];
}
}
if ($isCli && $baseUrl) {
$context->setBaseUrl($baseUrl);
} else {
$pos = strpos($currentBaseUrl, 'main');
$posPlugin = strpos($currentBaseUrl, 'plugin');
$posCertificate = strpos($currentBaseUrl, 'certificate');
@ -76,6 +88,7 @@ if (false !== $pos) {
}
$context->setBaseUrl($newBaseUrl);
}
try {
// Load legacy configuration.php

@ -18,7 +18,7 @@
require_once __DIR__.'/../../public/main/inc/global.inc.php';
$senderId = api_get_setting('disable_user_conditions_sender_id');
$senderId = api_get_setting('platform.disable_user_conditions_sender_id');
if (empty($senderId)) {
exit;
@ -56,7 +56,7 @@ $sql = "SELECT u.id
LEFT JOIN extra_field_values ev
ON u.id = ev.item_id AND field_id = $fieldId
WHERE
(ev.value IS NULL OR ev.value = '') AND
(ev.field_value IS NULL OR ev.field_value = '') AND
u.active = 1
$statusCondition
";
@ -170,7 +170,7 @@ $sql = "SELECT u.id
INNER JOIN extra_field_values ev
ON u.id = ev.item_id AND field_id = $fieldId
WHERE
ev.value = 1 AND
ev.field_value = 1 AND
u.active = 1
$statusCondition
";

Loading…
Cancel
Save