Development

Changeset 27211

You must first sign up to be able to contribute.

Changeset 27211

Show
Ignore:
Timestamp:
01/26/10 21:23:26 (2 years ago)
Author:
FabianLange
Message:

[1.3, 1.4] added check and logging for non executable remote installer files in sfGenerateProjectTask (closes #7921)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.3/lib/task/generator/sfGenerateProjectTask.class.php

    r23322 r27211  
    136136    if ($options['installer'] && $this->commandApplication) 
    137137    { 
    138       $this->reloadTasks(); 
    139  
    140       include $options['installer']; 
     138      if ($this->canRunInstaller($options['installer'])) 
     139      { 
     140        $this->reloadTasks(); 
     141        include $options['installer']; 
     142      } 
    141143    } 
    142144 
     
    149151    $this->replaceTokens(); 
    150152  } 
     153 
     154  protected function canRunInstaller($installer) 
     155  { 
     156    if (preg_match('#^(https?|ftps?)://#', $installer)) 
     157    { 
     158      if (ini_get('allow_url_fopen') === false) 
     159      { 
     160        $this->logSection('generate', sprintf('Cannot run remote installer "%s" because "allow_url_fopen" is off', $installer)); 
     161      } 
     162      if (ini_get('allow_url_include') === false) 
     163      { 
     164        $this->logSection('generate', sprintf('Cannot run remote installer "%s" because "allow_url_include" is off', $installer)); 
     165      } 
     166      return ini_get('allow_url_fopen') && ini_get('allow_url_include'); 
     167    } 
     168    return true; 
     169  } 
    151170} 
  • branches/1.4/lib/task/generator/sfGenerateProjectTask.class.php

    r23922 r27211  
    135135    if ($options['installer'] && $this->commandApplication) 
    136136    { 
    137       $this->reloadTasks(); 
    138  
    139       include $options['installer']; 
     137      if ($this->canRunInstaller($options['installer'])) 
     138      { 
     139        $this->reloadTasks(); 
     140        include $options['installer']; 
     141      } 
    140142    } 
    141143 
     
    148150    $this->replaceTokens(); 
    149151  } 
     152 
     153  protected function canRunInstaller($installer) 
     154  { 
     155    if (preg_match('#^(https?|ftps?)://#', $installer)) 
     156    { 
     157      if (ini_get('allow_url_fopen') === false) 
     158      { 
     159        $this->logSection('generate', sprintf('Cannot run remote installer "%s" because "allow_url_fopen" is off', $installer)); 
     160      } 
     161      if (ini_get('allow_url_include') === false) 
     162      { 
     163        $this->logSection('generate', sprintf('Cannot run remote installer "%s" because "allow_url_include" is off', $installer)); 
     164      } 
     165      return ini_get('allow_url_fopen') && ini_get('allow_url_include'); 
     166    } 
     167    return true; 
     168  } 
    150169}