Development

Changeset 7397

You must first sign up to be able to contribute.

Changeset 7397

Show
Ignore:
Timestamp:
02/08/08 07:48:35 (4 years ago)
Author:
fabien
Message:

added sfTask::log() and sfTask::logSection() shortcuts

Files:

Legend:

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

    r7394 r7397  
    6464      $dbSchema->loadXML($schema); 
    6565 
    66       $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('schema', sprintf('converting "%s" to YML', $schema))))); 
     66      $this->log('schema', sprintf('converting "%s" to YML', $schema)); 
    6767 
    6868      $localprefix = $prefix; 
     
    7878 
    7979      $file = str_replace(basename($schema), $prefix.$yml_file_name,  $schema); 
    80       $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('schema', 'putting '.$file)))); 
     80      $this->log('schema', sprintf('putting %s', $file)); 
    8181      file_put_contents($file, $dbSchema->asYAML()); 
    8282    } 
     
    114114      foreach ($customSchemas as $customSchema) 
    115115      { 
    116         $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('schema', sprintf('found custom schema %s', $customSchema))))); 
     116        $this->log('schema', sprintf('found custom schema %s', $customSchema)); 
    117117         
    118118        $customSchemaArray = sfYaml::load($customSchema); 
     
    127127      $dbSchema->loadArray($schemaArray); 
    128128 
    129       $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('schema', sprintf('converting "%s" to XML', $schema))))); 
     129      $this->log('schema', sprintf('converting "%s" to XML', $schema)); 
    130130 
    131131      $localprefix = $prefix; 
     
    141141 
    142142      $file = str_replace(basename($schema), $localprefix.$xml_file_name,  $schema); 
    143       $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('schema', 'putting '.$file)))); 
     143      $this->log('schema', sprintf('putting %s', $file)); 
    144144      file_put_contents($file, $dbSchema->asXML()); 
    145145    } 
  • branches/1.1/lib/plugins/sfPropelPlugin/lib/task/sfPropelBuildFormsTask.class.php

    r7247 r7397  
    5959  protected function execute($arguments = array(), $options = array()) 
    6060  { 
    61     $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('propel', 'generating form classes')))); 
     61    $this->log('propel', 'generating form classes'); 
    6262 
    6363    $generatorManager = new sfGeneratorManager(); 
  • branches/1.1/lib/plugins/sfPropelPlugin/lib/task/sfPropelBuildModelTask.class.php

    r7247 r7397  
    5959    $this->cleanup(); 
    6060 
    61     $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('autoload', 'reloading autoloading')))); 
     61    $this->log('autoload', 'reloading autoloading'); 
    6262 
    6363    sfSimpleAutoload::getInstance()->reload(); 
  • branches/1.1/lib/plugins/sfPropelPlugin/lib/task/sfPropelDataDumpTask.class.php

    r7247 r7397  
    7979    } 
    8080 
    81     $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('propel', sprintf('dumping data to "%s"', $filename))))); 
     81    $this->log('propel', sprintf('dumping data to "%s"', $filename)); 
    8282 
    8383    $data = new sfPropelData(); 
  • branches/1.1/lib/plugins/sfPropelPlugin/lib/task/sfPropelDataLoadTask.class.php

    r7333 r7397  
    101101      } 
    102102 
    103       $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('propel', sprintf('load data from "%s"', $fixturesDir))))); 
     103      $this->log('propel', sprintf('load data from "%s"', $fixturesDir)); 
    104104      $data->loadData($fixturesDir, $options['connection']); 
    105105    } 
  • branches/1.1/lib/task/help/sfHelpTask.class.php

    r6931 r7397  
    100100    } 
    101101 
    102     $this->dispatcher->notify(new sfEvent($this, 'command.log', $messages)); 
     102    $this->log($messages); 
    103103  } 
    104104} 
  • branches/1.1/lib/task/help/sfListTask.class.php

    r6931 r7397  
    101101    } 
    102102 
    103     $this->dispatcher->notify(new sfEvent($this, 'command.log', $messages)); 
     103    $this->log($messages); 
    104104  } 
    105105} 
  • branches/1.1/lib/task/i18n/sfI18nExtractTask.class.php

    r6931 r7397  
    8484    $this->bootstrapSymfony($arguments['application'], 'dev', true); 
    8585 
    86     $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('i18n', sprintf('extracting i18n strings for the "%s" application', $arguments['application']))))); 
     86    $this->logSection('i18n', sprintf('extracting i18n strings for the "%s" application', $arguments['application'])); 
    8787 
    8888    $extract = new sfI18nApplicationExtract(); 
     
    9090    $extract->extract(); 
    9191 
    92     $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('i18n', sprintf('found "%d" new i18n strings', count($extract->getNewMessages())))))); 
    93     $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('i18n', sprintf('found "%d" old i18n strings', count($extract->getOldMessages())))))); 
     92    $this->logSection('i18n', sprintf('found "%d" new i18n strings', count($extract->getNewMessages()))); 
     93    $this->logSection('i18n', sprintf('found "%d" old i18n strings', count($extract->getOldMessages()))); 
    9494 
    9595    if ($options['display-new']) 
    9696    { 
    97       $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('i18n', sprintf('display new i18n strings', count($extract->getOldMessages())))))); 
     97      $this->logSection('i18n', sprintf('display new i18n strings', count($extract->getOldMessages()))); 
    9898      foreach ($extract->getNewMessages() as $message) 
    9999      { 
    100         $this->dispatcher->notify(new sfEvent($this, 'command.log', array('               '.$message."\n"))); 
     100        $this->log('               '.$message."\n"); 
    101101      } 
    102102    } 
     
    104104    if ($options['auto-save']) 
    105105    { 
    106       $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('i18n', 'saving new i18n strings')))); 
     106      $this->logSection('i18n', 'saving new i18n strings'); 
    107107 
    108108      $extract->saveNewMessages(); 
     
    111111    if ($options['display-old']) 
    112112    { 
    113       $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('i18n', sprintf('display old i18n strings', count($extract->getOldMessages())))))); 
     113      $this->logSection('i18n', sprintf('display old i18n strings', count($extract->getOldMessages()))); 
    114114      foreach ($extract->getOldMessages() as $message) 
    115115      { 
    116         $this->dispatcher->notify(new sfEvent($this, 'command.log', array('               '.$message."\n"))); 
     116        $this->log('               '.$message."\n"); 
    117117      } 
    118118    } 
     
    120120    if ($options['auto-delete']) 
    121121    { 
    122       $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('i18n', 'deleting old i18n strings')))); 
     122      $this->logSection('i18n', 'deleting old i18n strings'); 
    123123 
    124124      $extract->deleteOldMessages(); 
  • branches/1.1/lib/task/i18n/sfI18nFindTask.class.php

    r6931 r7397  
    4545  public function execute($arguments = array(), $options = array()) 
    4646  { 
    47     $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('i18n', sprintf('find non "i18n ready" strings in the "%s" application', $arguments['application']))))); 
     47    $this->logSection('i18n', sprintf('find non "i18n ready" strings in the "%s" application', $arguments['application'])); 
    4848 
    4949    sfCore::initDirectoryLayout(sfConfig::get('sf_root_dir'), $arguments['application'], $options['env']); 
     
    9898      foreach ($templateStrings as $template => $messages) 
    9999      { 
    100         $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('i18n', sprintf('strings in "%s:%s"', $moduleName, $template))))); 
     100        $this->logSection('i18n', sprintf('strings in "%s:%s"', $moduleName, $template)); 
    101101        foreach ($messages as $message) 
    102102        { 
    103           $this->dispatcher->notify(new sfEvent($this, 'command.log', array("  $message\n"))); 
     103          $this->log("  $message\n"); 
    104104        } 
    105105      } 
  • branches/1.1/lib/task/plugin/sfPluginAddChannelTask.class.php

    r7247 r7397  
    4747  protected function execute($arguments = array(), $options = array()) 
    4848  { 
    49     $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('plugin', sprintf('add channel "%s"', $arguments['name']))))); 
     49    $this->logSection('plugin', sprintf('add channel "%s"', $arguments['name'])); 
    5050 
    5151    $this->getPluginManager()->registerChannel($arguments['name']); 
  • branches/1.1/lib/task/plugin/sfPluginInstallTask.class.php

    r7247 r7397  
    9393  protected function execute($arguments = array(), $options = array()) 
    9494  { 
    95     $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('plugin', sprintf('installing plugin "%s"', $arguments['name']))))); 
     95    $this->logSection('plugin', sprintf('installing plugin "%s"', $arguments['name'])); 
    9696 
    9797    $this->getPluginManager()->installPlugin($arguments['name'], $options); 
  • branches/1.1/lib/task/plugin/sfPluginListTask.class.php

    r7247 r7397  
    4646  protected function execute($arguments = array(), $options = array()) 
    4747  { 
    48     $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->format('Installed plugins:', 'COMMENT')))); 
     48    $this->log($this->formatter->format('Installed plugins:', 'COMMENT')); 
    4949 
    5050    foreach ($this->getPluginManager()->getInstalledPlugins() as $package) 
    5151    { 
    5252      $alias = $this->getPluginManager()->getRegistry()->getChannel($package->getChannel())->getAlias(); 
    53       $this->dispatcher->notify(new sfEvent($this, 'command.log', array(sprintf(' %-40s %10s-%-6s %s', $this->formatter->format($package->getPackage(), 'INFO'), $package->getVersion(), $package->getState() ? $package->getState() : null, $this->formatter->format(sprintf('# %s (%s)', $package->getChannel(), $alias), 'COMMENT'))))); 
     53      $this->log(sprintf(' %-40s %10s-%-6s %s', $this->formatter->format($package->getPackage(), 'INFO'), $package->getVersion(), $package->getState() ? $package->getState() : null, $this->formatter->format(sprintf('# %s (%s)', $package->getChannel(), $alias), 'COMMENT'))); 
    5454    } 
    5555  } 
  • branches/1.1/lib/task/plugin/sfPluginUninstallTask.class.php

    r7247 r7397  
    6868  protected function execute($arguments = array(), $options = array()) 
    6969  { 
    70     $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('plugin', sprintf('uninstalling plugin "%s"', $arguments['name']))))); 
     70    $this->logSection('plugin', sprintf('uninstalling plugin "%s"', $arguments['name'])); 
    7171 
    7272    $this->getPluginManager()->uninstallPlugin($arguments['name'], $options); 
  • branches/1.1/lib/task/plugin/sfPluginUpgradeTask.class.php

    r7247 r7397  
    6161  protected function execute($arguments = array(), $options = array()) 
    6262  { 
    63     $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('plugin', sprintf('upgrading plugin "%s"', $arguments['name']))))); 
     63    $this->logSection('plugin', sprintf('upgrading plugin "%s"', $arguments['name'])); 
    6464 
    6565    $this->getPluginManager()->installPlugin($arguments['name'], $options); 
  • branches/1.1/lib/task/project/sfProjectDeployTask.class.php

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

    r7335 r7397  
    5050 
    5151    $lockFile = $app.'_'.$env.'.lck'; 
    52     if (!file_exists(sfConfig::get('sf_cache_dir').'/'.$lockFile)) 
     52    if (file_exists(sfConfig::get('sf_cache_dir').'/'.$lockFile)) 
    5353    { 
    54       $this->filesystem->touch($lockFile); 
     54      $this->logSection('enable', sprintf('%s [%s] is currently DISABLED', $app, $env)); 
     55    } 
    5556 
    56       $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('enable', "$app [$env] has been DISABLED")))); 
    57     } 
    58     else 
    59     { 
    60       $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('enable', "$app [$env] is currently DISABLED")))); 
    61     } 
     57    $this->filesystem->touch($lockFile); 
     58 
     59    $this->logSection('enable', sprintf('%s [%s] has been DISABLED', $app, $env)); 
    6260  } 
    6361} 
  • branches/1.1/lib/task/project/sfProjectEnableTask.class.php

    r7335 r7397  
    5050 
    5151    $lockFile = $app.'_'.$env.'.lck'; 
    52     if (file_exists(sfConfig::get('sf_cache_dir').'/'.$lockFile)) 
     52    if (!file_exists(sfConfig::get('sf_cache_dir').'/'.$lockFile)) 
    5353    { 
    54       $this->filesystem->remove($lockFile); 
     54      $this->logSection('enable', sprintf('%s [%s] is currently ENABLED', $app, $env)); 
     55    } 
    5556 
    56       $clearCache = new sfCacheClearTask($this->dispatcher, $this->formatter); 
    57       $clearCache->run(); 
     57    $this->filesystem->remove($lockFile); 
    5858 
    59       $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('enable', "$app [$env] has been ENABLED")))); 
    60     } 
    61     else 
    62     { 
    63       $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('enable', "$app [$env] is currently ENABLED")))); 
    64     } 
     59    $clearCache = new sfCacheClearTask($this->dispatcher, $this->formatter); 
     60    $clearCache->run(); 
     61 
     62    $this->logSection('enable', sprintf('%s [%s] has been ENABLED', $app, $env)); 
    6563  } 
    6664} 
  • branches/1.1/lib/task/project/sfProjectFreezeTask.class.php

    r7332 r7397  
    7373    $symfony_data_dir = $arguments['symfony_data_dir']; 
    7474 
    75     $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('freeze', 'freezing lib found in "'.$symfony_lib_dir.'"')))); 
    76     $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('freeze', 'freezing data found in "'.$symfony_data_dir.'"')))); 
     75    $this->logSection('freeze', sprintf('freezing lib found in "%s', $symfony_lib_dir)); 
     76    $this->logSection('freeze', sprintf('freezing data found in "%s"', $symfony_data_dir)); 
    7777 
    7878    $this->filesystem->mkdirs('lib'.DIRECTORY_SEPARATOR.'symfony'); 
  • branches/1.1/lib/task/project/upgrade1.1/sfAutoloadingUpgrade.class.php

    r7333 r7397  
    3131          $content = str_replace("'sfAutoload'", 'sfAutoload::getInstance()', $content); 
    3232 
    33           $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('config.php', sprintf('Migrating %s', $file))))); 
     33          $this->logSection('config.php', sprintf('Migrating %s', $file)); 
    3434          file_put_contents($file, $content); 
    3535        } 
     
    4747EOF; 
    4848 
    49       $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('config.php', sprintf('Migrating %s', $file))))); 
     49      $this->logSection('config.php', sprintf('Migrating %s', $file)); 
    5050      file_put_contents($file, $content); 
    5151    } 
  • branches/1.1/lib/task/project/upgrade1.1/sfComponentUpgrade.class.php

    r7333 r7397  
    3333      if ($count) 
    3434      { 
    35         $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('component', sprintf('Migrating %s', $file))))); 
     35        $this->logSection('component', sprintf('Migrating %s', $file)); 
    3636        file_put_contents($file, $content); 
    3737      } 
  • branches/1.1/lib/task/project/upgrade1.1/sfConfigUpgrade.class.php

    r7322 r7397  
    2828      if ($count) 
    2929      { 
    30         $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('config', sprintf('Migrating %s', $file))))); 
     30        $this->logSection('config', sprintf('Migrating %s', $file)); 
    3131        file_put_contents($file, $content); 
    3232      } 
  • branches/1.1/lib/task/project/upgrade1.1/sfEnvironmentUpgrade.class.php

    r6931 r7397  
    3939      if ($count) 
    4040      { 
    41         $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('environment', sprintf('Migrating %s', $file))))); 
     41        $this->logSection('environment', sprintf('Migrating %s', $file)); 
    4242        file_put_contents($file, $content); 
    4343      } 
  • branches/1.1/lib/task/project/upgrade1.1/sfFactoriesUpgrade.class.php

    r6931 r7397  
    3232        $content = preg_replace('/^((.+)automatic_cleaning_factor:(\s+)(.+?))$/m', "$1\n$2prefix:$3                   %SF_APP_DIR%", $content); 
    3333 
    34         $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('factories.yml', sprintf('Migrating %s', $file))))); 
     34        $this->logSection('factories.yml', sprintf('Migrating %s', $file)); 
    3535        file_put_contents($file, $content); 
    3636      } 
  • branches/1.1/lib/task/project/upgrade1.1/sfFlashUpgrade.class.php

    r6931 r7397  
    3939      if ($count) 
    4040      { 
    41         $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('flash', sprintf('Migrating %s', $file))))); 
     41        $this->logSection('flash', sprintf('Migrating %s', $file)); 
    4242        file_put_contents($file, $content); 
    4343      } 
     
    5858      if ($count) 
    5959      { 
    60         $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('flash', sprintf('Migrating %s', $file))))); 
     60        $this->logSection('flash', sprintf('Migrating %s', $file)); 
    6161        file_put_contents($file, $content); 
    6262      } 
     
    7373      if ($count) 
    7474      { 
    75         $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('flash', sprintf('Migrating %s', $file))))); 
     75        $this->logSection('flash', sprintf('Migrating %s', $file)); 
    7676        file_put_contents($file, $content); 
    7777      } 
  • branches/1.1/lib/task/project/upgrade1.1/sfLoggerUpgrade.class.php

    r6931 r7397  
    2929      if ($count) 
    3030      { 
    31         $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('logger', sprintf('Migrating %s', $file))))); 
     31        $this->logSection('logger', sprintf('Migrating %s', $file)); 
    3232        file_put_contents($file, $content); 
    3333      } 
  • branches/1.1/lib/task/project/upgrade1.1/sfPropelUpgrade.class.php

    r6931 r7397  
    2828    if ($count) 
    2929    { 
    30       $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('propel', sprintf('Migrating %s', $file))))); 
     30      $this->logSection('propel', sprintf('Migrating %s', $file)); 
    3131      file_put_contents($file, $content); 
    3232    } 
     
    4343 
    4444EOF; 
    45       $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('propel', sprintf('Migrating %s', $file))))); 
     45      $this->logSection('propel', sprintf('Migrating %s', $file)); 
    4646      file_put_contents($file, $content); 
    4747    } 
  • branches/1.1/lib/task/project/upgrade1.1/sfSingletonUpgrade.class.php

    r6931 r7397  
    4040      if ($count) 
    4141      { 
    42         $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('singleton', sprintf('Migrating %s', $file))))); 
     42        $this->logSection('singleton', sprintf('Migrating %s', $file)); 
    4343        file_put_contents($file, $content); 
    4444      } 
     
    6969      .$content; 
    7070 
    71       $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('factories.yml', sprintf('Migrating %s', $file))))); 
     71      $this->logSection('factories.yml', sprintf('Migrating %s', $file)); 
    7272      file_put_contents($file, $content); 
    7373    } 
     
    8787      $content = preg_replace('/(prod\:\s+\.settings\:)/s', "$1\n    logging_enabled: off", $content); 
    8888 
    89       $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('settings.yml', sprintf('Migrating %s', $file))))); 
     89      $this->logSection('settings.yml', sprintf('Migrating %s', $file)); 
    9090      file_put_contents($file, $content); 
    9191    } 
  • branches/1.1/lib/task/project/upgrade1.1/sfWebDebugUpgrade.class.php

    r6931 r7397  
    2828      if ($count) 
    2929      { 
    30         $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('web_debug', sprintf('Migrating %s', $file))))); 
     30        $this->logSection('web_debug', sprintf('Migrating %s', $file)); 
    3131        file_put_contents($file, $content); 
    3232      } 
  • branches/1.1/lib/task/sfFilesystem.class.php

    r5250 r7397  
    7171    if ($options['override'] || !file_exists($targetFile) || $mostRecent) 
    7272    { 
    73       $this->log('file+', $targetFile); 
     73      $this->logSection('file+', $targetFile); 
    7474      copy($originFile, $targetFile); 
    7575    } 
     
    9191    } 
    9292 
    93     $this->log('dir+', $path); 
     93    $this->logSection('dir+', $path); 
    9494 
    9595    return @mkdir($path, $mode, true); 
     
    110110    foreach ($files as $file) 
    111111    { 
    112       $this->log('file+', $file); 
     112      $this->logSection('file+', $file); 
    113113 
    114114      touch($file); 
     
    133133      if (is_dir($file) && !is_link($file)) 
    134134      { 
    135         $this->log('dir-', $file); 
     135        $this->logSection('dir-', $file); 
    136136 
    137137        rmdir($file); 
     
    139139      else 
    140140      { 
    141         $this->log(is_link($file) ? 'link-' : 'file-', $file); 
     141        $this->logSection(is_link($file) ? 'link-' : 'file-', $file); 
    142142 
    143143        unlink($file); 
     
    165165    foreach ($files as $file) 
    166166    { 
    167       $this->log(sprintf('chmod %o', $mode), $file); 
     167      $this->logSection(sprintf('chmod %o', $mode), $file); 
    168168      chmod($file, $mode); 
    169169    } 
     
    186186    } 
    187187 
    188     $this->log('rename', $origin.' > '.$target); 
     188    $this->logSection('rename', $origin.' > '.$target); 
    189189    rename($origin, $target); 
    190190  } 
     
    221221    if (!$ok) 
    222222    { 
    223       $this->log('link+', $targetDir); 
     223      $this->logSection('link+', $targetDir); 
    224224      symlink($originDir, $targetDir); 
    225225    } 
     
    264264  public function sh($cmd) 
    265265  { 
    266     $this->log('exec ', $cmd); 
     266    $this->logSection('exec ', $cmd); 
    267267 
    268268    ob_start(); 
     
    302302      } 
    303303 
    304       $this->log('tokens', $file); 
     304      $this->logSection('tokens', $file); 
    305305 
    306306      file_put_contents($file, $content); 
     
    309309 
    310310  /** 
    311    * Logs a message
     311   * Logs a message in a section
    312312   * 
    313313   * @param string  The section name 
     
    315315   * @param integer The maximum size of a line 
    316316   */ 
    317   protected function log($section, $text, $size = null) 
     317  protected function logSection($section, $message, $size = null) 
    318318  { 
    319319    if (!$this->dispatcher) 
     
    322322    } 
    323323 
    324     $message = $this->formatter ? $this->formatter->formatSection($section, $text, $size) : $section.' '.$text."\n"; 
     324    $message = $this->formatter ? $this->formatter->formatSection($section, $message, $size) : $section.' '.$message."\n"; 
    325325 
    326326    $this->dispatcher->notify(new sfEvent($this, 'command.log', array($message))); 
  • branches/1.1/lib/task/sfTask.class.php

    r6931 r7397  
    276276 
    277277  /** 
     278   * Logs a message. 
     279   * 
     280   * @param mixed The message as an array of lines of a single string 
     281   */ 
     282  protected function log($messages) 
     283  { 
     284    if (!is_array($messages)) 
     285    { 
     286      $messages = array($messages); 
     287    } 
     288 
     289    $this->dispatcher->notify(new sfEvent($this, 'command.log', $messages)); 
     290  } 
     291 
     292  /** 
     293   * Logs a message in a section. 
     294   * 
     295   * @param string  The section name 
     296   * @param string  The message 
     297   * @param integer The maximum size of a line 
     298   */ 
     299  protected function logSection($section, $message, $size = null) 
     300  { 
     301    $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection($section, $message, $size)))); 
     302  } 
     303 
     304  /** 
    278305   * Executes the current task. 
    279306   *