Code snippets for symfony 1.x

Navigation

Refine Tags

Snippets tagged "fixperms"

Extending fix-perms

Sometimes we need more or different folders to be fix-permed. Mine is an easy hack, but having symfony freezed its not that ugly. The file is: /data/symfony/tasks/sfPakeMisc.php (line 41++)

function run_fix_perms($task, $args)
{
  $sf_root_dir = sfConfig::get('sf_root_dir');
 
  // just added this line for a folder
  pake_chmod("batch/any/folder", $sf_root_dir, 0777);
 
  pake_chmod(sfConfig::get('sf_cache_dir_name'), $sf_root_dir, 0777);
  pake_chmod(sfConfig::get('sf_log_dir_name'), $sf_root_dir, 0777);
  pake_chmod(sfConfig::get('sf_web_dir_name').DIRECTORY_SEPARATOR.sfConfig::get('sf_upload_dir_name'), $sf_root_dir, 0777);
  pake_chmod('symfony', $sf_root_dir, 0777);
 
  $dirs = array(
    // and this for chmoding files inside:  
    sfConfig::get('sf_root_dir') . "/batch/any/folder",  
 
    sfConfig::get('sf_cache_dir_name'),
    sfConfig::get('sf_web_dir_name').DIRECTORY_SEPARATOR.sfConfig::get('sf_upload_dir_name'), 
    sfConfig::get('sf_log_dir_name'));
  $dir_finder = pakeFinder::type('dir')->ignore_version_control();
  $file_finder = pakeFinder::type('file')->ignore_version_control();
  foreach ($dirs as $dir)
  {
    pake_chmod($dir_finder, $dir, 0777);
    pake_chmod($file_finder, $dir, 0666);
  }
}

Perhaps somebody uses a more elegant way ... ;)

Accessing just via:

> symfony fix-perms
by Axel Bernhardt on 2007-08-02, tagged fixperms  pake  task