Skip to content
Snippets Groups Projects
Commit 20225e7b authored by Webslice's avatar Webslice
Browse files

Prevent conflicting APS install paths

parent db6af21d
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