Author: weaverryan
Date: 2010-02-06 18:20:53 +0100 (Sat, 06 Feb 2010)
New Revision: 27618
Modified:
plugins/sfSympalPlugin/trunk/lib/task/sfSympalFixPermsTask.class.php
Log:
[1.4][sfSympalPlugin][1.0] Improved handling of errors in unix for the
fix-permissions task. Instead of erroring out immediately upon hitting a
problem (insufficient permissions to set permissions), it will now continue
through everything and then report the failures at the end (like
sfProjectPermissionsTask). A further fix may need to be made for the non-unix
situation.
Modified: plugins/sfSympalPlugin/trunk/lib/task/sfSympalFixPermsTask.class.php
===================================================================
--- plugins/sfSympalPlugin/trunk/lib/task/sfSympalFixPermsTask.class.php
2010-02-06 17:00:26 UTC (rev 27617)
+++ plugins/sfSympalPlugin/trunk/lib/task/sfSympalFixPermsTask.class.php
2010-02-06 17:20:53 UTC (rev 27618)
@@ -2,6 +2,9 @@
class sfSympalFixPermsTask extends sfSympalBaseTask
{
+ protected
+ $failed = array();
+
protected function configure()
{
$this->aliases = array();
@@ -48,12 +51,19 @@
{
if ($this->isUnix())
{
- if (is_dir($item))
+ try
{
- $this->getFilesystem()->execute('chmod -R 0777 '.$item);
- } else {
- $this->getFilesystem()->execute('chmod 0777 '.$item);
+ if (is_dir($item))
+ {
+ $this->getFilesystem()->execute('chmod -R 0777 '.$item);
+ } else {
+ $this->getFilesystem()->execute('chmod 0777 '.$item);
+ }
}
+ catch (RuntimeException $e)
+ {
+ $this->failed[] = $item;
+ }
} else {
@$this->getFilesystem()->chmod($item, 0777);
if (is_file($item))
@@ -64,5 +74,14 @@
@$this->getFilesystem()->chmod($fileFinder->in($items), 0666);
}
}
+
+ // note those files that failed
+ if (count($this->failed))
+ {
+ $this->logBlock(array_merge(
+ array('Permissions on the following file(s) or dir(s) could not be
fixed:', ''),
+ array_map(create_function('$f', 'return \' -
\'.sfDebug::shortenFilePath($f);'), $this->failed)
+ ), 'ERROR_LARGE');
+ }
}
}
\ 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.