Author: Jonathan.Wage
Date: 2010-02-01 20:40:42 +0100 (Mon, 01 Feb 2010)
New Revision: 27395

Modified:
   plugins/sfSympalPlugin/trunk/lib/task/sfSympalBaseTask.class.php
   plugins/sfSympalPlugin/trunk/lib/task/sfSympalFixPermsTask.class.php
Log:
[1.4][sfSympalPlugin][1.0] Changing fix perms to use chmod from system when in 
unix to improve speed when running on unix


Modified: plugins/sfSympalPlugin/trunk/lib/task/sfSympalBaseTask.class.php
===================================================================
--- plugins/sfSympalPlugin/trunk/lib/task/sfSympalBaseTask.class.php    
2010-02-01 19:33:42 UTC (rev 27394)
+++ plugins/sfSympalPlugin/trunk/lib/task/sfSympalBaseTask.class.php    
2010-02-01 19:40:42 UTC (rev 27395)
@@ -2,6 +2,16 @@
 
 abstract class sfSympalBaseTask extends sfTaskExtraBaseTask
 {
+  public function isUnix()
+  {
+    return DIRECTORY_SEPARATOR == '/';
+  }
+
+  public function isWindows()
+  {
+    return !$this->isUnix();
+  }
+
   public function getSympalContext()
   {
     return sfSympalContext::getInstance();

Modified: plugins/sfSympalPlugin/trunk/lib/task/sfSympalFixPermsTask.class.php
===================================================================
--- plugins/sfSympalPlugin/trunk/lib/task/sfSympalFixPermsTask.class.php        
2010-02-01 19:33:42 UTC (rev 27394)
+++ plugins/sfSympalPlugin/trunk/lib/task/sfSympalFixPermsTask.class.php        
2010-02-01 19:40:42 UTC (rev 27395)
@@ -46,13 +46,23 @@
     $fileFinder = sfFinder::type('file');
     foreach ($items as $item)
     {
-      @$this->getFilesystem()->chmod($item, 0777);
-      if (is_file($item))
+      if ($this->isUnix())
       {
-        continue;
+        if (is_dir($item))
+        {
+          $this->getFilesystem()->execute('chmod -R 0777 '.$item);
+        } else {
+          $this->getFilesystem()->execute('chmod 0777 '.$item);          
+        }
+      } else {
+        @$this->getFilesystem()->chmod($item, 0777);
+        if (is_file($item))
+        {
+          continue;
+        }
+        @$this->getFilesystem()->chmod($dirFinder->in($items), 0777);
+        @$this->getFilesystem()->chmod($fileFinder->in($items), 0666);
       }
-      @$this->getFilesystem()->chmod($dirFinder->in($items), 0777);
-      @$this->getFilesystem()->chmod($fileFinder->in($items), 0666);
     }
   }
 }
\ No newline at end of file

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to