mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-06 11:43:50 +00:00
Upgrade: Using Advanced > Upgrade > Source Code now automatically updates switch /scripts/ folder contents (on by default), keeping switch scripts up to date with each system upgrade. Option to opt out of auto script updates is available via a Default Setting (switch > scripts_update > boolean > false).
This commit is contained in:
@@ -69,7 +69,29 @@ if (sizeof($_POST) > 0) {
|
||||
$response_message = $text['message-upgrade_svn_failed'];
|
||||
}
|
||||
else {
|
||||
$response_message = $text['message-upgrade_svn'];
|
||||
//update scripts folder, if allowed (default)
|
||||
if ($_SESSION['switch']['scripts_update']['boolean'] != 'false' && $_SESSION['switch']['scripts']['dir'] != '') {
|
||||
$scripts_dir_target = $_SESSION['switch']['scripts']['dir'];
|
||||
$scripts_dir_source = realpath($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/scripts');
|
||||
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($scripts_dir_source)) as $file_path_source) {
|
||||
if (
|
||||
substr_count($file_path_source, '/..') == 0 &&
|
||||
substr_count($file_path_source, '/.') == 0 &&
|
||||
substr_count($file_path_source, '/.svn') == 0
|
||||
) {
|
||||
$file_path_target = str_replace($scripts_dir_source, $scripts_dir_target, $file_path_source);
|
||||
if ($file_path_target != $scripts_dir_target.'/resources/config.lua') {
|
||||
//echo $file_path_source.' ---> '.$file_path_target.'<br>';
|
||||
copy($file_path_source, $file_path_target);
|
||||
chmod($file_path_target, 0755);
|
||||
}
|
||||
}
|
||||
}
|
||||
$response_message = $text['message-upgrade_svn_scripts'];
|
||||
}
|
||||
else {
|
||||
$response_message = $text['message-upgrade_svn'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user