Skip to content

Commit 2ad4820

Browse files
committed
Fix context aware mode getting disabled when upgrading remotely.
1 parent 03156c2 commit 2ad4820

5 files changed

Lines changed: 20 additions & 5 deletions

File tree

_build/build.transport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function getSnippetContent($filename = '') {
2323
/* define version */
2424
define('PKG_NAME','ClientConfig');
2525
define('PKG_NAME_LOWER',strtolower(PKG_NAME));
26-
define('PKG_VERSION','2.3.2');
26+
define('PKG_VERSION','2.3.3');
2727
define('PKG_RELEASE','pl');
2828

2929
/* load modx */

_build/resolvers/setupoptions.resolver.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
<?php
2-
2+
/**
3+
* @var array $options
4+
*/
35
// Convenience
46
if (!isset($modx) && isset($object) && isset($object->xpdo)) {
57
$modx = $object->xpdo;
68
}
79

10+
// Check if the setup options form was submitted
11+
$isSetupOptions = array_key_exists('clientconfig_setup_options', $options);
812
$contextAware = array_key_exists('clientconfig_context_aware', $options) ? (bool)$options['clientconfig_context_aware'] : false;
913

10-
$setting = $modx->getObject('modSystemSetting', ['key' => 'clientconfig.context_aware']);
11-
if ($setting instanceof modSystemSetting) {
14+
$setting = $modx->getObject(modSystemSetting::class, ['key' => 'clientconfig.context_aware']);
15+
// Only update context aware value if set via setup options. Remote upgrades should keep the setting as is.
16+
if ($setting instanceof modSystemSetting && $isSetupOptions) {
1217
$setting->set('value', $contextAware);
1318
$setting->save();
1419
}

_build/setup.options.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<?php
2-
2+
/**
3+
* @var modX $modx
4+
* @var array $options
5+
*/
36
switch ($options[xPDOTransport::PACKAGE_ACTION]) {
47
case xPDOTransport::ACTION_INSTALL:
58
case xPDOTransport::ACTION_UPGRADE:
@@ -9,6 +12,7 @@
912
$contextChecked = $isContextAware ? 'checked="checked"' : '';
1013

1114
return <<<HTML
15+
<input type="hidden" name="clientconfig_setup_options" value="1">
1216
<p>ClientConfig 2.0 comes in two different flavours: global, and multi context mode. </p>
1317
<br>
1418
<ul style="list-style: disc; padding-left: 2em; padding-bottom: 1em;">
119 KB
Binary file not shown.

core/components/clientconfig/docs/changelog.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
ClientConfig 2.3.3-pl
2+
---------------------
3+
Released on 2022-09-
4+
5+
- Fix context aware mode being disabled when upgrading remotely. [#177]
6+
17
ClientConfig 2.3.2-pl
28
---------------------
39
Released on 2022-07-15

0 commit comments

Comments
 (0)