Commit 45c45e7d authored by Leigh Stoller's avatar Leigh Stoller

Add ValidURN(). Be sure to unlink tmp file on failed create instance.

parent 979f4ad1
......@@ -238,6 +238,7 @@ class Instance
$retval = SUEXEC($uid, $pid,
"webcreate_instance $options -u $uuid $xmlname",
SUEXEC_ACTION_IGNORE);
unlink($xmlname);
if ($retval != 0) {
if ($retval < 0) {
......@@ -258,8 +259,6 @@ class Instance
}
return null;
}
unlink($xmlname);
$instance = Instance::Lookup($uuid);
if (!$instance) {
$errors["error"] = "Transient error(5); please try again later.";
......@@ -347,6 +346,13 @@ class Instance
}
return array();
}
function ValidURN($urn)
{
if (preg_match("/^[^+]*\+([^+]+)\+([^+]+)\+(.+)$/", $urn)) {
return true;
}
return false;
}
function SetExtensionReason($reason)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment