Development

Changeset 7401

You must first sign up to be able to contribute.

Changeset 7401

Show
Ignore:
Timestamp:
02/08/08 09:01:18 (10 months ago)
Author:
fabien
Message:

replace sfTask->filesystem by sfTask->getFilesystem()

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.1/lib/plugins/sfPropelPlugin/lib/task/sfPropelBaseTask.class.php

    r7398 r7401  
    170170      } 
    171171 
    172       $this->filesystem->copy($schema, 'config'.DIRECTORY_SEPARATOR.$localprefix.basename($schema)); 
     172      $this->getFilesystem()->copy($schema, 'config'.DIRECTORY_SEPARATOR.$localprefix.basename($schema)); 
    173173      if ('' === $localprefix) 
    174174      { 
    175         $this->filesystem->remove($schema); 
     175        $this->getFilesystem()->remove($schema); 
    176176      } 
    177177    } 
     
    181181  { 
    182182    $finder = sfFinder::type('file')->name('generated-*schema.xml'); 
    183     $this->filesystem->remove($finder->in(array('config', 'plugins'))); 
     183    $this->getFilesystem()->remove($finder->in(array('config', 'plugins'))); 
    184184  } 
    185185 
  • branches/1.1/lib/plugins/sfPropelPlugin/lib/task/sfPropelDataDumpTask.class.php

    r7399 r7401  
    8181    { 
    8282      $dir = sfConfig::get('sf_data_dir').DIRECTORY_SEPARATOR.'fixtures'; 
    83       $this->filesystem->mkdirs($dir); 
     83      $this->getFilesystem()->mkdirs($dir); 
    8484      $filename = $dir.DIRECTORY_SEPARATOR.$filename; 
    8585 
  • branches/1.1/lib/plugins/sfPropelPlugin/lib/task/sfPropelGenerateCrudTask.class.php

    r7333 r7401  
    113113 
    114114    // copy our generated module 
    115     $this->filesystem->mirror($tmpDir.'/auto'.ucfirst($arguments['module']), $moduleDir, sfFinder::type('any')); 
     115    $this->getFilesystem()->mirror($tmpDir.'/auto'.ucfirst($arguments['module']), $moduleDir, sfFinder::type('any')); 
    116116 
    117117    if (!$options['with-show']) 
    118118    { 
    119       $this->filesystem->remove($moduleDir.'/templates/showSuccess.php'); 
     119      $this->getFilesystem()->remove($moduleDir.'/templates/showSuccess.php'); 
    120120    } 
    121121 
    122122    // change module name 
    123     $this->filesystem->replaceTokens($moduleDir.'/actions/actions.class.php', '', '', array('auto'.ucfirst($arguments['module']) => $arguments['module'])); 
     123    $this->getFilesystem()->replaceTokens($moduleDir.'/actions/actions.class.php', '', '', array('auto'.ucfirst($arguments['module']) => $arguments['module'])); 
    124124 
    125125    // customize php and yml files 
    126126    $finder = sfFinder::type('file')->name('*.php', '*.yml'); 
    127     $this->filesystem->replaceTokens($finder->in($moduleDir), '##', '##', $this->constants); 
     127    $this->getFilesystem()->replaceTokens($finder->in($moduleDir), '##', '##', $this->constants); 
    128128 
    129129    // create basic test 
    130     $this->filesystem->copy(sfConfig::get('sf_symfony_lib_dir').'/task/generator/skeleton/module/test/actionsTest.php', sfConfig::get('sf_test_dir').'/functional/'.$arguments['application'].'/'.$arguments['module'].'ActionsTest.php'); 
     130    $this->getFilesystem()->copy(sfConfig::get('sf_symfony_lib_dir').'/task/generator/skeleton/module/test/actionsTest.php', sfConfig::get('sf_test_dir').'/functional/'.$arguments['application'].'/'.$arguments['module'].'ActionsTest.php'); 
    131131 
    132132    // customize test file 
    133     $this->filesystem->replaceTokens(sfConfig::get('sf_test_dir').'/functional/'.$arguments['application'].DIRECTORY_SEPARATOR.$arguments['module'].'ActionsTest.php', '##', '##', $this->constants); 
     133    $this->getFilesystem()->replaceTokens(sfConfig::get('sf_test_dir').'/functional/'.$arguments['application'].DIRECTORY_SEPARATOR.$arguments['module'].'ActionsTest.php', '##', '##', $this->constants); 
    134134 
    135135    // delete temp files 
    136     $this->filesystem->remove(sfFinder::type('any')->in($tmpDir)); 
     136    $this->getFilesystem()->remove(sfFinder::type('any')->in($tmpDir)); 
    137137  } 
    138138 
     
    148148      if (is_dir($dir)) 
    149149      { 
    150         $this->filesystem->mirror($dir, $moduleDir, $finder); 
     150        $this->getFilesystem()->mirror($dir, $moduleDir, $finder); 
    151151        break; 
    152152      } 
     
    154154 
    155155    // create basic test 
    156     $this->filesystem->copy(sfConfig::get('sf_symfony_lib_dir').'/task/generator/skeleton/module/test/actionsTest.php', sfConfig::get('sf_test_dir').'/functional/'.$arguments['application'].'/'.$arguments['module'].'ActionsTest.php'); 
     156    $this->getFilesystem()->copy(sfConfig::get('sf_symfony_lib_dir').'/task/generator/skeleton/module/test/actionsTest.php', sfConfig::get('sf_test_dir').'/functional/'.$arguments['application'].'/'.$arguments['module'].'ActionsTest.php'); 
    157157 
    158158    // customize test file 
    159     $this->filesystem->replaceTokens(sfConfig::get('sf_test_dir').'/functional/'.$arguments['application'].DIRECTORY_SEPARATOR.$arguments['module'].'ActionsTest.php', '##', '##', $this->constants); 
     159    $this->getFilesystem()->replaceTokens(sfConfig::get('sf_test_dir').'/functional/'.$arguments['application'].DIRECTORY_SEPARATOR.$arguments['module'].'ActionsTest.php', '##', '##', $this->constants); 
    160160 
    161161    // customize php and yml files 
     
    166166      $options['with-show'] ? 'true' : 'false' 
    167167    ); 
    168     $this->filesystem->replaceTokens($finder->in($moduleDir), '##', '##', $this->constants); 
     168    $this->getFilesystem()->replaceTokens($finder->in($moduleDir), '##', '##', $this->constants); 
    169169  } 
    170170} 
  • branches/1.1/lib/plugins/sfPropelPlugin/lib/task/sfPropelInitAdminTask.class.php

    r7333 r7401  
    8383      if (is_dir($dir)) 
    8484      { 
    85         $this->filesystem->mirror($dir, $moduleDir, $finder); 
     85        $this->getFilesystem()->mirror($dir, $moduleDir, $finder); 
    8686        break; 
    8787      } 
     
    9090    // customize php and yml files 
    9191    $finder = sfFinder::type('file')->name('*.php', '*.yml'); 
    92     $this->filesystem->replaceTokens($finder->in($moduleDir), '##', '##', $constants); 
     92    $this->getFilesystem()->replaceTokens($finder->in($moduleDir), '##', '##', $constants); 
    9393  } 
    9494} 
  • branches/1.1/lib/task/cache/sfCacheClearTask.class.php

    r7335 r7401  
    9595    if (!$mainApp) 
    9696    { 
    97       $this->filesystem->remove($finder->in(sfConfig::get('sf_cache_dir'))); 
     97      $this->getFilesystem()->remove($finder->in(sfConfig::get('sf_cache_dir'))); 
    9898    } 
    9999 
     
    146146          else 
    147147          { 
    148             $this->filesystem->remove($finder->in(sfConfig::get('sf_root_dir').'/'.$subDir)); 
     148            $this->getFilesystem()->remove($finder->in(sfConfig::get('sf_root_dir').'/'.$subDir)); 
    149149          } 
    150150        } 
     
    163163  { 
    164164    // create a lock file 
    165     $this->filesystem->touch(sfConfig::get('sf_cache_dir').'/'.$lockName.'.lck'); 
     165    $this->getFilesystem()->touch(sfConfig::get('sf_cache_dir').'/'.$lockName.'.lck'); 
    166166 
    167167    // change mode so the web user can remove it if we die 
    168     $this->filesystem->chmod(sfConfig::get('sf_cache_dir').'/'.$lockName.'.lck', 0777); 
     168    $this->getFilesystem()->chmod(sfConfig::get('sf_cache_dir').'/'.$lockName.'.lck', 0777); 
    169169 
    170170    // remove cache files 
    171     $this->filesystem->remove($finder->in(sfConfig::get('sf_root_dir').'/'.$subDir)); 
     171    $this->getFilesystem()->remove($finder->in(sfConfig::get('sf_root_dir').'/'.$subDir)); 
    172172 
    173173    // release lock 
    174     $this->filesystem->remove(sfConfig::get('sf_cache_dir').'/'.$lockName.'.lck'); 
     174    $this->getFilesystem()->remove(sfConfig::get('sf_cache_dir').'/'.$lockName.'.lck'); 
    175175  } 
    176176} 
  • branches/1.1/lib/task/generator/sfGenerateAppTask.class.php

    r7400 r7401  
    8484    // Create basic application structure 
    8585    $finder = sfFinder::type('any')->ignore_version_control()->discard('.sf'); 
    86     $this->filesystem->mirror(dirname(__FILE__).'/skeleton/app/app', $appDir, $finder); 
     86    $this->getFilesystem()->mirror(dirname(__FILE__).'/skeleton/app/app', $appDir, $finder); 
    8787 
    8888    // Create $app.php or index.php if it is our first app 
     
    9696    // Set no_script_name value in settings.yml for production environment 
    9797    $finder = sfFinder::type('file')->name('settings.yml'); 
    98     $this->filesystem->replaceTokens($finder->in($appDir.'/'.sfConfig::get('sf_app_config_dir_name')), '##', '##', array('NO_SCRIPT_NAME' => ($firstApp ? 'on' : 'off'))); 
     98    $this->getFilesystem()->replaceTokens($finder->in($appDir.'/'.sfConfig::get('sf_app_config_dir_name')), '##', '##', array('NO_SCRIPT_NAME' => ($firstApp ? 'on' : 'off'))); 
    9999 
    100     $this->filesystem->copy(dirname(__FILE__).'/skeleton/app/web/index.php', sfConfig::get('sf_web_dir').'/'.$indexName.'.php'); 
    101     $this->filesystem->copy(dirname(__FILE__).'/skeleton/app/web/index_dev.php', sfConfig::get('sf_web_dir').'/'.$app.'_dev.php'); 
     100    $this->getFilesystem()->copy(dirname(__FILE__).'/skeleton/app/web/index.php', sfConfig::get('sf_web_dir').'/'.$indexName.'.php'); 
     101    $this->getFilesystem()->copy(dirname(__FILE__).'/skeleton/app/web/index_dev.php', sfConfig::get('sf_web_dir').'/'.$app.'_dev.php'); 
    102102 
    103103    $finder = sfFinder::type('file')->name($indexName.'.php', $app.'_dev.php'); 
    104     $this->filesystem->replaceTokens($finder->in(sfConfig::get('sf_web_dir')), '##', '##', array('APP_NAME' => $app)); 
     104    $this->getFilesystem()->replaceTokens($finder->in(sfConfig::get('sf_web_dir')), '##', '##', array('APP_NAME' => $app)); 
    105105 
    106106    $fixPerms = new sfProjectPermissionsTask($this->dispatcher, $this->formatter); 
     
    109109 
    110110    // Create test dir 
    111     $this->filesystem->mkdirs(sfConfig::get('sf_test_dir').'/functional/'.$app); 
     111    $this->getFilesystem()->mkdirs(sfConfig::get('sf_test_dir').'/functional/'.$app); 
    112112  } 
    113113} 
  • branches/1.1/lib/task/generator/sfGenerateControllerTask.class.php

    r7296 r7401  
    7979    ); 
    8080 
    81     $this->filesystem->copy(dirname(__FILE__).'/skeleton/controller/controller.php', sfConfig::get('sf_web_dir').'/'.$controller.'.php'); 
    82     $this->filesystem->replaceTokens(sfConfig::get('sf_web_dir').DIRECTORY_SEPARATOR.$controller.'.php', '##', '##', $constants); 
     81    $this->getFilesystem()->copy(dirname(__FILE__).'/skeleton/controller/controller.php', sfConfig::get('sf_web_dir').'/'.$controller.'.php'); 
     82    $this->getFilesystem()->replaceTokens(sfConfig::get('sf_web_dir').DIRECTORY_SEPARATOR.$controller.'.php', '##', '##', $constants); 
    8383  } 
    8484} 
  • branches/1.1/lib/task/generator/sfGenerateModuleTask.class.php

    r7333 r7401  
    9797    // create basic application structure 
    9898    $finder = sfFinder::type('any')->ignore_version_control()->discard('.sf'); 
    99     $this->filesystem->mirror($skeletonDir.'/module', $moduleDir, $finder); 
     99    $this->getFilesystem()->mirror($skeletonDir.'/module', $moduleDir, $finder); 
    100100 
    101101    // create basic test 
    102     $this->filesystem->copy($skeletonDir.'/test/actionsTest.php', sfConfig::get('sf_test_dir').'/functional/'.$app.'/'.$module.'ActionsTest.php'); 
     102    $this->getFilesystem()->copy($skeletonDir.'/test/actionsTest.php', sfConfig::get('sf_test_dir').'/functional/'.$app.'/'.$module.'ActionsTest.php'); 
    103103 
    104104    // customize test file 
    105     $this->filesystem->replaceTokens(sfConfig::get('sf_test_dir').'/functional/'.$app.DIRECTORY_SEPARATOR.$module.'ActionsTest.php', '##', '##', $constants); 
     105    $this->getFilesystem()->replaceTokens(sfConfig::get('sf_test_dir').'/functional/'.$app.DIRECTORY_SEPARATOR.$module.'ActionsTest.php', '##', '##', $constants); 
    106106 
    107107    // customize php and yml files 
    108108    $finder = sfFinder::type('file')->name('*.php', '*.yml'); 
    109     $this->filesystem->replaceTokens($finder->in($moduleDir), '##', '##', $constants); 
     109    $this->getFilesystem()->replaceTokens($finder->in($moduleDir), '##', '##', $constants); 
    110110  } 
    111111} 
  • branches/1.1/lib/task/generator/sfGenerateProjectTask.class.php

    r7400 r7401  
    6969    // Create basic project structure 
    7070    $finder = sfFinder::type('any')->ignore_version_control()->discard('.sf'); 
    71     $this->filesystem->mirror(dirname(__FILE__).'/skeleton/project', sfConfig::get('sf_root_dir'), $finder); 
     71    $this->getFilesystem()->mirror(dirname(__FILE__).'/skeleton/project', sfConfig::get('sf_root_dir'), $finder); 
    7272 
    7373    // Update project name and directory 
    7474    $finder = sfFinder::type('file')->name('properties.ini', 'apache.conf', 'propel.ini'); 
    75     $this->filesystem->replaceTokens($finder->in(sfConfig::get('sf_config_dir')), '##', '##', array('PROJECT_NAME' => $arguments['name'], 
     75    $this->getFilesystem()->replaceTokens($finder->in(sfConfig::get('sf_config_dir')), '##', '##', array('PROJECT_NAME' => $arguments['name'], 
    7676                                                                                                    'PROJECT_DIR' => sfConfig::get('sf_root_dir'))); 
    7777 
    7878    // Update config/config.php 
    79     $this->filesystem->replaceTokens(sfConfig::get('sf_config_dir').'/config.php', '##', '##', array( 
     79    $this->getFilesystem()->replaceTokens(sfConfig::get('sf_config_dir').'/config.php', '##', '##', array( 
    8080      'SYMFONY_LIB_DIR'  => sfConfig::get('sf_symfony_lib_dir'), 
    8181    )); 
  • branches/1.1/lib/task/log/sfLogClearTask.class.php

    r6931 r7401  
    4242  { 
    4343    $logs = sfFinder::type('file')->ignore_version_control()->in(sfConfig::get('sf_log_dir')); 
    44     $this->filesystem->remove($logs); 
     44    $this->getFilesystem()->remove($logs); 
    4545  } 
    4646} 
  • branches/1.1/lib/task/project/sfProjectClearControllersTask.class.php

    r6931 r7401  
    7272      if (isset($foundApp[1]) && isset($env[1]) && $env[1] != 'prod') 
    7373      { 
    74         $this->filesystem->remove($controller); 
     74        $this->getFilesystem()->remove($controller); 
    7575      } 
    7676    } 
  • branches/1.1/lib/task/project/sfProjectDeployTask.class.php

    r7397 r7401  
    146146    $dryRun = $options['go'] ? '' : '--dry-run'; 
    147147 
    148     $this->log($this->filesystem->sh("rsync --progress $dryRun $parameters -e $ssh ./ $user$host:$dir")); 
     148    $this->log($this->getFilesystem()->sh("rsync --progress $dryRun $parameters -e $ssh ./ $user$host:$dir")); 
    149149  } 
    150150} 
  • branches/1.1/lib/task/project/sfProjectDisableTask.class.php

    r7397 r7401  
    5555    } 
    5656 
    57     $this->filesystem->touch($lockFile); 
     57    $this->getFilesystem()->touch($lockFile); 
    5858 
    5959    $this->logSection('enable', sprintf('%s [%s] has been DISABLED', $app, $env)); 
  • branches/1.1/lib/task/project/sfProjectEnableTask.class.php

    r7400 r7401  
    5555    } 
    5656 
    57     $this->filesystem->remove($lockFile); 
     57    $this->getFilesystem()->remove($lockFile); 
    5858 
    5959    $clearCache = new sfCacheClearTask($this->dispatcher, $this->formatter); 
  • branches/1.1/lib/task/project/sfProjectFreezeTask.class.php

    r7397 r7401  
    6767    if (is_link(sfConfig::get('sf_web_dir').'/sf')) 
    6868    { 
    69       $this->filesystem->remove(sfConfig::get('sf_web_dir').'/sf'); 
     69      $this->getFilesystem()->remove(sfConfig::get('sf_web_dir').'/sf'); 
    7070    } 
    7171 
     
    7676    $this->logSection('freeze', sprintf('freezing data found in "%s"', $symfony_data_dir)); 
    7777 
    78     $this->filesystem->mkdirs('lib'.DIRECTORY_SEPARATOR.'symfony'); 
    79     $this->filesystem->mkdirs('data'.DIRECTORY_SEPARATOR.'symfony'); 
     78    $this->getFilesystem()->mkdirs('lib'.DIRECTORY_SEPARATOR.'symfony'); 
     79    $this->getFilesystem()->mkdirs('data'.DIRECTORY_SEPARATOR.'symfony'); 
    8080 
    8181    $finder = sfFinder::type('any')->ignore_version_control(); 
    82     $this->filesystem->mirror($symfony_lib_dir, sfConfig::get('sf_lib_dir').'/symfony', $finder); 
    83     $this->filesystem->mirror($symfony_data_dir, sfConfig::get('sf_data_dir').'/symfony', $finder); 
     82    $this->getFilesystem()->mirror($symfony_lib_dir, sfConfig::get('sf_lib_dir').'/symfony', $finder); 
     83    $this->getFilesystem()->mirror($symfony_data_dir, sfConfig::get('sf_data_dir').'/symfony', $finder); 
    8484 
    85     $this->filesystem->rename(sfConfig::get('sf_data_dir').'/symfony/web/sf', sfConfig::get('sf_web_dir').'/sf'); 
     85    $this->getFilesystem()->rename(sfConfig::get('sf_data_dir').'/symfony/web/sf', sfConfig::get('sf_web_dir').'/sf'); 
    8686 
    8787    // change symfony paths in config/config.php 
  • branches/1.1/lib/task/project/sfProjectPermissionsTask.class.php

    r7336 r7401  
    4141  protected function execute($arguments = array(), $options = array()) 
    4242  { 
    43     $this->filesystem->chmod(sfConfig::get('sf_cache_dir'), 0777); 
    44     $this->filesystem->chmod(sfConfig::get('sf_log_dir'), 0777); 
    45     $this->filesystem->chmod(sfConfig::get('sf_upload_dir'), 0777); 
    46     $this->filesystem->chmod(sfConfig::get('sf_root_dir').DIRECTORY_SEPARATOR.'symfony', 0777); 
     43    $this->getFilesystem()->chmod(sfConfig::get('sf_cache_dir'), 0777); 
     44    $this->getFilesystem()->chmod(sfConfig::get('sf_log_dir'), 0777); 
     45    $this->getFilesystem()->chmod(sfConfig::get('sf_upload_dir'), 0777); 
     46    $this->getFilesystem()->chmod(sfConfig::get('sf_root_dir').DIRECTORY_SEPARATOR.'symfony', 0777); 
    4747 
    4848    $dirs = array(sfConfig::get('sf_cache_dir'), sfConfig::get('sf_upload_dir'), sfConfig::get('sf_log_dir')); 
     
    5151    foreach ($dirs as $dir) 
    5252    { 
    53       $this->filesystem->chmod($dirFinder->in($dir), 0777); 
    54       $this->filesystem->chmod($fileFinder->in($dir), 0666); 
     53      $this->getFilesystem()->chmod($dirFinder->in($dir), 0777); 
     54      $this->getFilesystem()->chmod($fileFinder->in($dir), 0666); 
    5555    } 
    5656  } 
  • branches/1.1/lib/task/project/sfProjectUnfreezeTask.class.php

    r7332 r7401  
    5454 
    5555    $finder = sfFinder::type('any'); 
    56     $this->filesystem->remove($finder->in(sfConfig::get('sf_lib_dir').'/symfony')); 
    57     $this->filesystem->remove(sfConfig::get('sf_lib_dir').'/symfony'); 
    58     $this->filesystem->remove($finder->in(sfConfig::get('sf_data_dir').'/symfony')); 
    59     $this->filesystem->remove(sfConfig::get('sf_data_dir').'/symfony'); 
    60     $this->filesystem->remove($finder->in(sfConfig::get('sf_web_dir').'/sf')); 
    61     $this->filesystem->remove(sfConfig::get('sf_web_dir').'/sf'); 
     56    $this->getFilesystem()->remove($finder->in(sfConfig::get('sf_lib_dir').'/symfony')); 
     57    $this->getFilesystem()->remove(sfConfig::get('sf_lib_dir').'/symfony'); 
     58    $this->getFilesystem()->remove($finder->in(sfConfig::get('sf_data_dir').'/symfony')); 
     59    $this->getFilesystem()->remove(sfConfig::get('sf_data_dir').'/symfony'); 
     60    $this->getFilesystem()->remove($finder->in(sfConfig::get('sf_web_dir').'/sf')); 
     61    $this->getFilesystem()->remove(sfConfig::get('sf_web_dir').'/sf'); 
    6262   } 
    6363 
  • branches/1.1/lib/task/sfBaseTask.class.php

    r7400 r7401  
    4242  } 
    4343 
    44   public function __get($key) 
     44  /** 
     45   * Returns the filesystem instance. 
     46   * 
     47   * @return sfFilesystem A sfFilesystem instance 
     48   */ 
     49  public function getFilesystem() 
    4550  { 
    46     switch ($key
     51    if (!isset($this->filesystem)
    4752    { 
    48       case 'filesystem': 
    49         if (!isset($this->filesystem)) 
    50         { 
    51           if (is_null($this->commandApplication) || $this->commandApplication->isVerbose()) 
    52           { 
    53             $this->filesystem = new sfFilesystem($this->dispatcher, $this->formatter); 
    54           } 
    55           else 
    56           { 
    57             $this->filesystem = new sfFilesystem(); 
    58           } 
    59         } 
     53      if (is_null($this->commandApplication) || $this->commandApplication->isVerbose()) 
     54      { 
     55        $this->filesystem = new sfFilesystem($this->dispatcher, $this->formatter); 
     56      } 
     57      else 
     58      { 
     59        $this->filesystem = new sfFilesystem(); 
     60      } 
     61    } 
    6062 
    61         return $this->filesystem; 
    62       default: 
    63         trigger_error(sprintf('Undefined property: %s::$%s', get_class($this), $key), E_USER_NOTICE); 
    64     } 
     63    return $this->filesystem; 
    6564  } 
    6665