Development

/branches/1.2/lib/task/project/sfProjectPermissionsTask.class.php

You must first sign up to be able to contribute.

root/branches/1.2/lib/task/project/sfProjectPermissionsTask.class.php

Revision 13423, 1.7 kB (checked in by pookey, 5 years ago)

checking that upload directory exists before chmoding - removing error

  • Property svn:mime-type set to text/x-php
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1 <?php
2
3 /*
4  * This file is part of the symfony package.
5  * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
6  *
7  * For the full copyright and license information, please view the LICENSE
8  * file that was distributed with this source code.
9  */
10
11 /**
12  * Fixes symfony directory permissions.
13  *
14  * @package    symfony
15  * @subpackage task
16  * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
17  * @version    SVN: $Id$
18  */
19 class sfProjectPermissionsTask extends sfBaseTask
20 {
21   /**
22    * @see sfTask
23    */
24   protected function configure()
25   {
26     $this->aliases = array('permissions', 'fix-perms');
27     $this->namespace = 'project';
28     $this->name = 'permissions';
29     $this->briefDescription = 'Fixes symfony directory permissions';
30
31     $this->detailedDescription = <<<EOF
32 The [project:permissions|INFO] task fixes directory permissions:
33
34   [./symfony project:permissions|INFO]
35 EOF;
36   }
37
38   /**
39    * @see sfTask
40    */
41   protected function execute($arguments = array(), $options = array())
42   {
43     if (file_exists(sfConfig::get('sf_upload_dir')))
44     {
45       $this->getFilesystem()->chmod(sfConfig::get('sf_upload_dir'), 0777);
46     }
47     $this->getFilesystem()->chmod(sfConfig::get('sf_cache_dir'), 0777);
48     $this->getFilesystem()->chmod(sfConfig::get('sf_log_dir'), 0777);
49     $this->getFilesystem()->chmod(sfConfig::get('sf_root_dir').DIRECTORY_SEPARATOR.'symfony', 0777);
50
51     $dirs = array(sfConfig::get('sf_cache_dir'), sfConfig::get('sf_upload_dir'), sfConfig::get('sf_log_dir'));
52     $dirFinder = sfFinder::type('dir');
53     $fileFinder = sfFinder::type('file');
54     foreach ($dirs as $dir)
55     {
56       $this->getFilesystem()->chmod($dirFinder->in($dir), 0777);
57       $this->getFilesystem()->chmod($fileFinder->in($dir), 0666);
58     }
59   }
60 }
61
Note: See TracBrowser for help on using the browser.