MTrack/SCM/WorkingCopy.php
[web.mtrack] / MTrack / SCM / WorkingCopy.php
index dfce40d..df9f596 100644 (file)
@@ -33,13 +33,33 @@ abstract class MTrack_SCM_WorkingCopy {
     {
         if (strlen($this->dir) > 1) {
             require_once 'System.php';
-            //echo "rmdir {$this->dir}";
             
-            System::rm('-r', $this->dir);
+            //System::rm('-r', $this->dir);
         }
     }
+    
+    function rmdir($dir) {
+        require_once 'System.php';
+        $rm = System::which('rm');
+        $cmd = "$rm -rf " . escapeshellarg($dir);
+        `$cmd`;
+        
+        
+    }
+    
     function generateTempDir()
     {
+        
+        $tn =  '/var/lib/php5/mtrackworkingdirlEwD96a';
+        if (file_exists($tn)) {
+            $this->rmdir($tn);
+        }
+        clearstatcache();
+        if (file_exists($tn)) {
+            die("OOPS");
+        }
+        return $tn;
+
         $tn = tempnam(ini_get('session.save_path'),'mtrackworkingdir');
         unlink($tn);
         return $tn;