summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEitan Mosenkis <eitan@mosenkis.net>2009-06-15 17:37:42 -0400
committerEitan Mosenkis <eitan@mosenkis.net>2009-06-15 17:37:42 -0400
commitd88c5c794636bc0ddef96d341e222abbe241b5b4 (patch)
treecd60a9d3fd75bf2be6d21dccc15bdfd13cb67b82
parentMore infrastructure, path constants SHARED, BACKEND, FRONTEND; function (diff)
downloadingenue-d88c5c794636bc0ddef96d341e222abbe241b5b4.tar.gz
ingenue-d88c5c794636bc0ddef96d341e222abbe241b5b4.tar.bz2
ingenue-d88c5c794636bc0ddef96d341e222abbe241b5b4.zip
Minor tweaks to tempdir
-rw-r--r--backend/functions/build.php1
-rw-r--r--backend/functions/tempdir.php4
2 files changed, 3 insertions, 2 deletions
diff --git a/backend/functions/build.php b/backend/functions/build.php
index 6cc6fc7..56beaef 100644
--- a/backend/functions/build.php
+++ b/backend/functions/build.php
@@ -1,6 +1,7 @@
<?php
// This is the main function that carries out a build from start to finish
function build() {
+ define('W', tempdir(WORK, 'build-'));
echo "BUILD!\n";
}
?>
diff --git a/backend/functions/tempdir.php b/backend/functions/tempdir.php
index 9c3018d..4ce3b90 100644
--- a/backend/functions/tempdir.php
+++ b/backend/functions/tempdir.php
@@ -2,9 +2,9 @@
// Adapted from code by Ron Korving (http://us3.php.net/manual/en/function.tempnam.php#61436)
function tempdir($dir, $prefix='', $mode=0700) {
if (substr($dir, -1) != '/') $dir .= '/';
- while (!mkdir($path, $mode)) {
+ do {
$path = $dir.$prefix.randstring(6);
- }
+ } while (!mkdir($path, $mode));
return $path;
}
?>