Skip to content

Commit

Permalink
non Windows server path fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Syxton committed Aug 30, 2023
1 parent 281302c commit e9f4467
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions classes/processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ protected function archivecourse($obj, $delete = true) {

$archivefile = date("Y-m-d") . "{$suffix}-{$safeshort}.mbz";

$rootpath = trim(get_config('tool_coursearchiver', 'coursearchiverrootpath'), "/\\");
$rootpath = rtrim(get_config('tool_coursearchiver', 'coursearchiverrootpath'), "/\\");
$archivepath = trim(str_replace(str_split(':*?"<>|'),
'',
get_config('tool_coursearchiver', 'coursearchiverpath')),
Expand Down Expand Up @@ -1542,7 +1542,7 @@ public static function get_archivelist($search, $recover = false) {
$isadmin = is_siteadmin();
$config = get_config('tool_coursearchiver');

$rootpath = trim($config->coursearchiverrootpath, "/\\");
$rootpath = rtrim($config->coursearchiverrootpath, "/\\");
$archivepath = trim(str_replace(str_split(':*?"<>|'),
'',
$config->coursearchiverpath),
Expand Down Expand Up @@ -1631,7 +1631,7 @@ public static function delete_archives($selected) {
global $CFG, $DB;

$config = get_config('tool_coursearchiver');
$rootpath = trim($config->coursearchiverrootpath, "/\\");
$rootpath = rtrim($config->coursearchiverrootpath, "/\\");
$archivepath = trim(str_replace(str_split(':*?"<>|'),
'',
$config->coursearchiverpath),
Expand Down Expand Up @@ -1667,7 +1667,7 @@ public static function delete_archives($selected) {
public static function recover_archives($selected) {
global $CFG, $DB;

$rootpath = trim(get_config('tool_coursearchiver', 'coursearchiverrootpath'), "/\\");
$rootpath = rtrim(get_config('tool_coursearchiver', 'coursearchiverrootpath'), "/\\");
$archivepath = trim(str_replace(str_split(':*?"<>|'),
'',
get_config('tool_coursearchiver', 'coursearchiverpath')),
Expand Down
2 changes: 1 addition & 1 deletion classes/task/cron_task.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function get_name() {
public function execute() {
global $CFG, $DB;

$rootpath = trim(get_config('tool_coursearchiver', 'coursearchiverrootpath'), "/\\");
$rootpath = rtrim(get_config('tool_coursearchiver', 'coursearchiverrootpath'), "/\\");
$archivepath = trim(str_replace(str_split(':*?"<>|'),
'',
get_config('tool_coursearchiver', 'coursearchiverpath')),
Expand Down
2 changes: 1 addition & 1 deletion db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ function xmldb_tool_coursearchiver_upgrade($oldversion) {
}

// Fill up the database with previously archived files.
$rootpath = trim(get_config('tool_coursearchiver', 'coursearchiverrootpath'), "/\\");
$rootpath = rtrim(get_config('tool_coursearchiver', 'coursearchiverrootpath'), "/\\");
$archivepath = trim(str_replace(str_split(':*?"<>|'),
'',
get_config('tool_coursearchiver', 'coursearchiverpath')),
Expand Down
2 changes: 1 addition & 1 deletion restorefile.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

global $CFG, $DB;

$rootpath = trim(get_config('tool_coursearchiver', 'coursearchiverrootpath'), "/\\");
$rootpath = rtrim(get_config('tool_coursearchiver', 'coursearchiverrootpath'), "/\\");
$archivepath = trim(str_replace(str_split(':*?"<>|'),
'',
get_config('tool_coursearchiver', 'coursearchiverpath')),
Expand Down

0 comments on commit e9f4467

Please sign in to comment.