Index: infusionBuilder-secure/php/postProcessor.php =================================================================== --- infusionBuilder-secure/php/postProcessor.php (revision 9348) +++ infusionBuilder-secure/php/postProcessor.php (working copy) @@ -144,6 +144,27 @@ return $is_cached; } +/** + * Gets a mysql UUID from an already established mysql connection + * + * @return string UUID + */ +function getUUID() { + + //get UUID to use as temp directory name + $uuid_query = "SELECT uuid()"; + $uuid_result = mysql_query($uuid_query); + if (!$uuid_result) { + returnError("Cannot get UUID"); + exit (1); + } + if (mysql_num_rows($uuid_result) == 1) { + $uuid_row = mysql_fetch_assoc($uuid_result); + mysql_free_result($uuid_result); + } + return $uuid_row["uuid()"]; +} + //START OF EXECUTION //process posted values @@ -174,27 +195,10 @@ exit (1); } -//get UUID to use as temp directory name -$uuid_query = "SELECT uuid()"; -$uuid_result = mysql_query($uuid_query); -if (!$uuid_result) { - returnError("Cannot complete cache retrieval query"); - exit (1); -} -if (mysql_num_rows($uuid_result) == 1) { - $uuid_row = mysql_fetch_assoc($uuid_result); - mysql_free_result($uuid_result); -} -$uuid = $uuid_row["uuid()"]; - //initialize some variables -$tmppath = OUTPUT_FILE_PATH_PRODUCTS.$uuid; //path for temporary files $cachepath = CACHE_FILE_PATH.$cacheKey; //path to cached files - $minfilename = "infusion-".$ver.".zip"; //filename of minified zip $srcfilename = "infusion-".$ver."-src.zip"; //filename of source zip - -$tmpfilename = $tmppath."/".$minfilename; //path and filename of temporary zip file $filename = $min ? $minfilename : $srcfilename; //filename desired (either source or zip) $filepath = $cachepath."/".$filename; //path and filename of cached file @@ -206,6 +210,10 @@ //file is not cached - go through build process if (!$is_cached) { + $uuid = getUUID(); + $tmppath = OUTPUT_FILE_PATH_PRODUCTS.$uuid; //path for temporary files + $tmpfilename = $tmppath."/".$minfilename; //path and filename of temporary zip file + //create cache directory if (!file_exists($cachepath)) { if (!@mkdir($cachepath, 0755, true)) {