/lib/task/sfAtosPayementTask.class.php

https://github.com/cedriclombardot/sfAtosPaymentPlugin · PHP · 63 lines · 38 code · 16 blank · 9 comment · 0 complexity · a3f1908e849e3b9b8ea2c6283232076e MD5 · raw file

  1. <?php
  2. /**
  3. * @author Cédric Lombardot <cedric.lombardot@spyrit.net>
  4. * @see http://symfony.spyrit.net
  5. * @package sfAtosPaymentPlugin
  6. * @subpackage sfAtosPaymentTask
  7. * @version sf1.2 - 0.1
  8. *
  9. * Task pour réécrire le pathfile
  10. */
  11. require_once sfConfig::get('sf_plugins_dir').'/sfAtosPaymentPlugin/lib/sfAtosPaymentConfig.class.php';
  12. class sfAtosPaymentTask extends sfPluginBaseTask{
  13. protected function configure(){
  14. $this->addArguments(array(
  15. new sfCommandArgument('application', sfCommandArgument::REQUIRED, 'The application name'),
  16. ));
  17. $this->addOptions(array(
  18. new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'),
  19. ));
  20. $this->namespace = 'atos';
  21. $this->name = 'pathfile';
  22. $this->briefDescription = 'create the pathfile from config';
  23. $this->detailedDescription = <<<EOF
  24. This plugin will generate your path file from the app.yml
  25. EOF;
  26. }
  27. protected function execute($arguments = array(), $options = array())
  28. {
  29. $configuration = ProjectConfiguration::getApplicationConfiguration($arguments['application'], $options['env'], true);
  30. $dir=sfAtosPaymentConfig::get('pathfile',sfConfig::get('sf_plugins_dir').DIRECTORY_SEPARATOR.'sfAtosPaymentPlugin'.DIRECTORY_SEPARATOR.'atos');
  31. $fp=fopen($dir.DIRECTORY_SEPARATOR.'pathfile','w');
  32. $debug=sfAtosPaymentConfig::get('debug',false);
  33. fputs($fp,'DEBUG!'.(($debug)?'YES':'NO').'!
  34. ');
  35. fputs($fp,'D_LOGO!'.sfAtosPaymentConfig::get('d_logo','/sfAtosPaymentPlugin/logos/').'!
  36. ');
  37. fputs($fp,'F_CERTIFICATE!'.sfAtosPaymentConfig::get('f_certificate',$dir.'/certif').'!
  38. ');
  39. fputs($fp,'F_PARAM!'.sfAtosPaymentConfig::get('f_param',$dir.'/parcom').'!
  40. ');
  41. fputs($fp,'F_DEFAULT!'.sfAtosPaymentConfig::get('f_param',$dir.'/'.sfAtosPaymentConfig::get('f_default_name')).'!
  42. ');
  43. fclose($fp);
  44. echo 'Fichier '.$dir.DIRECTORY_SEPARATOR.'pathfile ecrit';
  45. }
  46. }
  47. ?>