Skip to content

Commit ea33dbd

Browse files
committed
Merge branch '3.2.x' into 3.3.x
2 parents 87140bf + a62b31a commit ea33dbd

File tree

4 files changed

+38
-19
lines changed

4 files changed

+38
-19
lines changed

config/config.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ class config extends \phpbb\titania\entity\base
2020
/** @var \phpbb\config\config */
2121
protected $config;
2222

23+
/** @var \phpbb\config\db_text */
24+
protected $config_text;
25+
2326
/** @var string */
2427
protected $ext_root_path;
2528

@@ -29,13 +32,15 @@ class config extends \phpbb\titania\entity\base
2932
/**
3033
* Constructor.
3134
*
32-
* @param \phpbb\config\config $config
33-
* @param string $ext_root_path
34-
* @param string $php_ext
35+
* @param \phpbb\config\config $config
36+
* @param \phpbb\config\db_text $config_text
37+
* @param string $ext_root_path
38+
* @param string $php_ext
3539
*/
36-
public function __construct(\phpbb\config\config $config, $ext_root_path, $php_ext)
40+
public function __construct(\phpbb\config\config $config, \phpbb\config\db_text $config_text, $ext_root_path, $php_ext)
3741
{
3842
$this->config = $config;
43+
$this->config_text = $config_text;
3944
$this->ext_root_path = $ext_root_path;
4045
$this->php_ext = $php_ext;
4146

@@ -289,7 +294,12 @@ protected function set_from_phpbb_config()
289294

290295
foreach ($this->get_configurables() as $config => $type)
291296
{
292-
if ($this->config->offsetExists(ext::TITANIA_CONFIG_PREFIX . $config))
297+
if (strpos($type, 'array') === 0 && $config_text = $this->config_text->get(ext::TITANIA_CONFIG_PREFIX . $config))
298+
{
299+
$configs[$config] = json_decode($config_text, true);
300+
}
301+
302+
else if ($this->config->offsetExists(ext::TITANIA_CONFIG_PREFIX . $config))
293303
{
294304
$configs[$config] = json_decode($this->config->offsetGet(ext::TITANIA_CONFIG_PREFIX . $config), true);
295305
}

config/controllers.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@ services:
388388
arguments:
389389
- '@auth'
390390
- '@config'
391+
- '@config_text'
391392
- '@dbal.conn'
392393
- '@template'
393394
- '@user'

config/services.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ services:
132132
class: phpbb\titania\config\config
133133
arguments:
134134
- '@config'
135+
- '@config_text'
135136
- '%phpbb.titania.root_path%'
136137
- '%core.php_ext%'
137138

controller/manage/config_settings.php

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919

2020
class config_settings extends base
2121
{
22+
/** @var \phpbb\config\db_text */
23+
protected $config_text;
24+
2225
/** @var \phpbb\group\helper $group_helper */
2326
protected $group_helper;
2427

@@ -28,26 +31,28 @@ class config_settings extends base
2831
/**
2932
* Constructor
3033
*
31-
* @param \phpbb\auth\auth $auth
32-
* @param \phpbb\config\config $config
34+
* @param \phpbb\auth\auth $auth
35+
* @param \phpbb\config\config $config
36+
* @param \phpbb\config\db_text $config_text
3337
* @param \phpbb\db\driver\driver_interface $db
34-
* @param \phpbb\template\template $template
35-
* @param \phpbb\user $user
36-
* @param \phpbb\titania\cache\service $cache
37-
* @param \phpbb\titania\controller\helper $helper
38-
* @param type_collection $types
39-
* @param \phpbb\request\request $request
40-
* @param \phpbb\titania\config\config $ext_config
41-
* @param \phpbb\titania\display $display
42-
* @param \phpbb\titania\message\message $message
43-
* @param \phpbb\group\helper $group_helper
38+
* @param \phpbb\template\template $template
39+
* @param \phpbb\user $user
40+
* @param \phpbb\titania\cache\service $cache
41+
* @param \phpbb\titania\controller\helper $helper
42+
* @param type_collection $types
43+
* @param \phpbb\request\request $request
44+
* @param \phpbb\titania\config\config $ext_config
45+
* @param \phpbb\titania\display $display
46+
* @param \phpbb\titania\message\message $message
47+
* @param \phpbb\group\helper $group_helper
4448
*/
45-
public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\template\template $template, \phpbb\user $user, \phpbb\titania\cache\service $cache, \phpbb\titania\controller\helper $helper, type_collection $types, \phpbb\request\request $request, \phpbb\titania\config\config $ext_config, \phpbb\titania\display $display, \phpbb\titania\message\message $message, \phpbb\group\helper $group_helper)
49+
public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\config\db_text $config_text, \phpbb\db\driver\driver_interface $db, \phpbb\template\template $template, \phpbb\user $user, \phpbb\titania\cache\service $cache, \phpbb\titania\controller\helper $helper, type_collection $types, \phpbb\request\request $request, \phpbb\titania\config\config $ext_config, \phpbb\titania\display $display, \phpbb\titania\message\message $message, \phpbb\group\helper $group_helper)
4650
{
4751
parent::__construct($auth, $config, $db, $template, $user, $cache, $helper, $types, $request, $ext_config, $display);
4852

4953
$this->message = $message;
5054
$this->group_helper = $group_helper;
55+
$this->config_text = $config_text;
5156
}
5257

5358
/**
@@ -116,13 +121,15 @@ public function save()
116121
{
117122
$value[$key] = $this->request->variable($config . '_' . $key, $this->get_default($type[1]));
118123
}
124+
$this->config_text->set(ext::TITANIA_CONFIG_PREFIX . $config, json_encode($value));
125+
$this->config->delete(ext::TITANIA_CONFIG_PREFIX . $config); // delete it from config if its still there for any reason
119126
}
120127
else
121128
{
122129
$value = $this->request->variable($config, $this->get_default($type));
130+
$this->config->set(ext::TITANIA_CONFIG_PREFIX . $config, json_encode($value));
123131
}
124132

125-
$this->config->set(ext::TITANIA_CONFIG_PREFIX . $config, json_encode($value));
126133
$this->ext_config->__set($config, $value);
127134
}
128135
}

0 commit comments

Comments
 (0)