Skip to content
Snippets Groups Projects
Commit 6e240ab6 authored by Till Brehm's avatar Till Brehm
Browse files

Merge branch 'feature/prevent-conflicting-aps-install-paths' into 'stable-3.1'

Prevent conflicting APS install paths

See merge request !943
parents 3ce6d765 20225e7b
No related branches found
No related tags found
No related merge requests found
......@@ -637,11 +637,27 @@ class ApsGUIController extends ApsBase
// The location might be empty but the DB return must not be false!
if($location_for_domain) $used_path .= $location_for_domain['value'];
// If user is trying to install into exactly the same path, give an error
if($new_path == $used_path)
{
$temp_errstr = $app->lng('error_used_location');
break;
}
// If the new path is _below_ an existing path, give an error because the
// installation will delete the files of the existing APS installation
if (mb_substr($used_path, 0, mb_strlen($new_path)) === $new_path) {
$temp_errstr = $app->lng('error_used_location');
break;
}
// If the new path is _within_ an existing path, give an error. Even if
// installation would proceed fine in theory, deleting the "lower" package
// in the future would also inadvertedly delete the "nested" package
if (mb_substr($new_path, 0, mb_strlen($used_path)) === $used_path) {
$temp_errstr = $app->lng('error_used_location');
break;
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment