Skip to content

Commit 1514286

Browse files
committed
Get rid of assets_dir, it's not needed anymore
1 parent 068c6ec commit 1514286

File tree

5 files changed

+9
-38
lines changed

5 files changed

+9
-38
lines changed

config/defaults.inc.php

-4
Original file line numberDiff line numberDiff line change
@@ -872,10 +872,6 @@
872872
// </FilesMatch>
873873
$config['assets_path'] = '';
874874

875-
// While assets_path is for the browser, assets_dir informs
876-
// PHP code about the location of asset files in filesystem
877-
$config['assets_dir'] = '';
878-
879875
// Options passed when creating Guzzle HTTP client, used to fetch remote content
880876
// For example:
881877
// [

program/include/rcmail.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -1541,8 +1541,7 @@ public function find_asset($path, $minified = true)
15411541
return null;
15421542
}
15431543

1544-
$assets_dir = $this->config->get('assets_dir');
1545-
$root_path = unslashify($assets_dir ?: INSTALL_PATH) . '/';
1544+
$root_path = unslashify(INSTALL_PATH) . '/';
15461545
$full_path = $root_path . trim($path, '/');
15471546

15481547
if (file_exists($full_path)) {
@@ -1942,7 +1941,7 @@ public static function get_uids($uids = null, $mbox = null, &$is_multifolder = f
19421941
}
19431942

19441943
/**
1945-
* Get resource file content (with assets_dir support)
1944+
* Get resource file content
19461945
*
19471946
* @param string $name File name
19481947
*

program/include/rcmail_action.php

+3-15
Original file line numberDiff line numberDiff line change
@@ -370,15 +370,14 @@ public static function html_editor($mode = '', $editorId = null)
370370

371371
$language = $_SESSION['language'] ?? 'en_US';
372372
$lang_codes = [$language];
373-
$assets_dir = $rcmail->config->get('assets_dir') ?: INSTALL_PATH;
374373
$skin_path = $rcmail->output->get_skin_path();
375374

376375
if ($pos = strpos($language, '_')) {
377376
$lang_codes[] = substr($language, 0, $pos);
378377
}
379378

380379
foreach ($lang_codes as $code) {
381-
if (file_exists("{$assets_dir}/program/js/tinymce/langs/{$code}.js")) {
380+
if (file_exists(INSTALL_PATH . "/program/js/tinymce/langs/{$code}.js")) {
382381
$lang = $code;
383382
break;
384383
}
@@ -833,7 +832,7 @@ public static function get_uids($uids = null, $mbox = null, &$is_multifolder = f
833832
}
834833

835834
/**
836-
* Get resource file content (with assets_dir support)
835+
* Get resource file content
837836
*
838837
* @param string $name File name
839838
*
@@ -845,18 +844,7 @@ public static function get_resource_content($name)
845844
$name = "program/resources/{$name}";
846845
}
847846

848-
$assets_dir = rcmail::get_instance()->config->get('assets_dir');
849-
850-
if ($assets_dir) {
851-
$path = slashify($assets_dir) . $name;
852-
if (@file_exists($path)) {
853-
$name = $path;
854-
}
855-
} else {
856-
$name = INSTALL_PATH . $name;
857-
}
858-
859-
return file_get_contents($name, false);
847+
return file_get_contents(INSTALL_PATH . $name, false);
860848
}
861849

862850
/**

program/include/rcmail_output_html.php

+3-13
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ protected function init($framed = false)
109109

110110
// load and setup the skin
111111
$this->set_skin($this->config->get('skin'));
112-
$this->set_assets_path($this->config->get('assets_path'), $this->config->get('assets_dir'));
112+
$this->set_assets_path($this->config->get('assets_path'));
113113

114114
if (!empty($_REQUEST['_extwin'])) {
115115
$this->set_env('extwin', 1);
@@ -186,10 +186,9 @@ public function set_env($name, $value, $addtojs = true)
186186
/**
187187
* Parse and set assets path
188188
*
189-
* @param string $path Assets path URL (relative or absolute)
190-
* @param string $fs_dir Assets path in filesystem
189+
* @param string $path Assets path URL (relative or absolute)
191190
*/
192-
public function set_assets_path($path, $fs_dir = null)
191+
public function set_assets_path($path)
193192
{
194193
// set absolute path for assets if /index.php/foo/bar url is used
195194
if (empty($path) && !empty($_SERVER['PATH_INFO'])) {
@@ -225,15 +224,6 @@ public function set_assets_path($path, $fs_dir = null)
225224
}
226225
}
227226

228-
// set filesystem path for assets
229-
if ($fs_dir) {
230-
if ($fs_dir[0] != '/') {
231-
$fs_dir = realpath(RCUBE_INSTALL_PATH . $fs_dir);
232-
}
233-
// ensure the path ends with a slash
234-
$this->assets_dir = rtrim($fs_dir, '/') . '/';
235-
}
236-
237227
$this->assets_path = $path;
238228
$this->set_env('assets_path', $path);
239229
}

program/lib/Roundcube/rcube_plugin_api.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -671,9 +671,7 @@ public function include_stylesheet($fn)
671671
if ($fn[0] != '/' && !preg_match('|^https?://|i', $fn)) {
672672
$rcube = rcube::get_instance();
673673
$devel_mode = $rcube->config->get('devel_mode');
674-
$assets_dir = $rcube->config->get('assets_dir');
675-
$path = unslashify($assets_dir ?: RCUBE_INSTALL_PATH);
676-
$dir = $path . (strpos($fn, 'plugins/') === false ? '/plugins' : '');
674+
$dir = unslashify(RCUBE_INSTALL_PATH) . (strpos($fn, 'plugins/') === false ? '/plugins' : '');
677675

678676
// Prefer .less files in devel_mode (assume less.js is loaded)
679677
if ($devel_mode) {

0 commit comments

Comments
 (0)