Skip to content

Commit 0ab6e87

Browse files
committed
Handle old config settings better
Signed-off-by: Andrew Welch <andrew@nystudio107.com>
1 parent b8575c8 commit 0ab6e87

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

src/models/Settings.php

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,15 @@ public function __construct(array $config = [])
3333
{
3434
// Unset any deprecated properties
3535
if (!empty($config)) {
36-
unset($config['transcoderPath'], $config['transcoderUrl']);
36+
// If the old properties are set, remap them to the default
37+
if (isset($config['transcoderPath'])) {
38+
$config['transcoderPaths']['default'] = $config['transcoderPath'];
39+
unset($config['transcoderPath']);
40+
}
41+
if (isset($config['transcoderUrl'])) {
42+
$config['$transcoderUrls']['default'] = $config['transcoderUrl'];
43+
unset($config['transcoderUrl']);
44+
}
3745
}
3846
parent::__construct($config);
3947
}
@@ -70,10 +78,10 @@ public function __construct(array $config = [])
7078
*/
7179
public $transcoderPaths = [
7280
'default' => '@webroot/transcoder/',
73-
'video' => '@webroot/transcoder/video/',
74-
'audio' => '@webroot/transcoder/audio/',
75-
'thumbnail' => '@webroot/transcoder/thumbnail/',
76-
'gif' => '@webroot/transcoder/gif/',
81+
'video' => '@webroot/transcoder/',
82+
'audio' => '@webroot/transcoder/',
83+
'thumbnail' => '@webroot/transcoder/',
84+
'gif' => '@webroot/transcoder/',
7785
];
7886

7987
/**
@@ -84,10 +92,10 @@ public function __construct(array $config = [])
8492
*/
8593
public $transcoderUrls = [
8694
'default' => '@web/transcoder/',
87-
'video' => '@web/transcoder/video/',
88-
'audio' => '@web/transcoder/audio/',
89-
'thumbnail' => '@web/transcoder/thumbnail/',
90-
'gif' => '@web/transcoder/gif/',
95+
'video' => '@web/transcoder/',
96+
'audio' => '@web/transcoder/',
97+
'thumbnail' => '@web/transcoder/',
98+
'gif' => '@web/transcoder/',
9199
];
92100

93101
/**
@@ -226,10 +234,7 @@ public function __construct(array $config = [])
226234
*/
227235
public function init()
228236
{
229-
$tokens = [
230-
'{DOCUMENT_ROOT}' => $_SERVER['DOCUMENT_ROOT'],
231-
];
232-
$this->transcoderPath = str_replace(array_keys($tokens), array_values($tokens), $this->transcoderPath);
237+
parent::init();
233238
}
234239

235240
/**

0 commit comments

Comments
 (0)