/**
  * Log the given message to a file
  *
  * @param string $txt Log message
  * @return void
  */
 protected function log($txt)
 {
     file_put_contents(sfConfig::get('sf_log_dir') . '/daemon-' . get_class($this) . '.txt', $txt . "\n", FILE_APPEND);
     if ($this->task instanceof sfTask) {
         $this->task->logSection('worker', $txt);
     }
 }
 protected function process(sfCommandManager $commandManager, $options)
 {
     parent::process($commandManager, $options);
     // capture phing-arg options
     if ($commandManager->getOptionSet()->hasOption('phing-arg')) {
         $this->additionalPhingArgs = $commandManager->getOptionValue('phing-arg');
     }
 }
Beispiel #3
0
 public function __construct(sfEventDispatcher $dispatcher, sfFormatter $formatter, $basePath, $configuration)
 {
     parent::__construct($dispatcher, $formatter);
     if (!is_dir($basePath) || !is_readable($basePath)) {
         throw new RuntimeException('The specified basepath for the opUpgrader must be directory and readable.');
     }
     $this->basePath = $basePath;
     $this->configuration = $configuration;
 }
 /**
  * Set up information about this task.
  *
  * @see lib/task/Task#configure()
  *
  * @return void
  */
 protected function configure()
 {
     $this->addOptions(array(new sfCommandOption('application', null, sfCommandOption::PARAMETER_REQUIRED, 'The application name', 'frontend'), new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'), new sfCommandOption('connection', null, sfCommandOption::PARAMETER_REQUIRED, 'The connection name', 'propel')));
     parent::configure();
     $this->namespace = 'notifications';
     $this->name = 'install-notifier';
     $this->briefDescription = 'Install a new Notifier';
     $this->detailedDescription = 'This task installs a new Notifier by adding a NotificationType and its NotificationTypeAttributes.';
     $this->addArgument('notifier', sfCommandArgument::REQUIRED, 'The name of the notifier being installed.');
 }
 public function initialize(sfEventDispatcher $dispatcher, sfFormatter $formatter)
 {
     parent::initialize($dispatcher, $formatter);
     if (!self::$done) {
         $libDir = dirname(__FILE__) . '/..';
         $autoloader = sfSimpleAutoload::getInstance();
         $autoloader->addDirectory($libDir);
         $autoloader->register();
         self::$done = true;
     }
 }
 protected function createConfiguration($application, $env)
 {
     $configuration = parent::createConfiguration($application, $env);
     $autoloader = sfSimpleAutoload::getInstance();
     $config = new sfAutoloadConfigHandler();
     $mapping = $config->evaluate($configuration->getConfigPaths('config/autoload.yml'));
     foreach ($mapping as $class => $file) {
         $autoloader->setClassPath($class, $file);
     }
     $autoloader->register();
     return $configuration;
 }
  protected function configure()
  {
    
    date_default_timezone_set('Europe/Zurich');

    parent::configure();
    
    $this->addOptions(array(
      new sfCommandOption('go', null, sfCommandOption::PARAMETER_NONE, 'Do the processing.'),
      new sfCommandOption('application', null, sfCommandOption::PARAMETER_REQUIRED, 'The application', 'backend'),
      new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environement', 'prod'),
    ));
      //new sfCommandOption('go', null, sfCommandOption::PARAMETER_NONE, 'Do the sync'),
      //new sfCommandOption('force', null, sfCommandOption::PARAMETER_NONE, 'Ignore sync and force upload for all files'),
      //new sfCommandOption('application', null, sfCommandOption::PARAMETER_REQUIRED, 'The application', 'frontend'),
      //new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environement', 'dev'),
 
    $this->namespace = 'lucene';
    $this->name = 'rebuild';
    $this->briefDescription = '....';
    
    $this->detailedDescription = <<<EOF
The [dropbox:sync|INFO] command pushes all new or modified files to you dropbox:
 
   [./symfony dropbox:sync|INFO]
 
The Dropbox-account must be configured in [app.yml|COMMENT]:

  [dropbox:
    consumer_key: dgz37k324ogxtge
    consumer_secret: dgz37k324ogxtge
    token: dgz37k324ogxtge
    token_secret: dgz37k324ogxtge
    root: Website/Reports/|INFO]

By default, the task is in dry-mode. To do a real sync, you
must pass the [--go|COMMENT] option:

  [./symfony dropbox:sync --go|INFO]

You can ignore the sync-status an force pushing all files
to dropbox with the [--force|COMMENT] option:

  [./symfony dropbox:sync --go --force|INFO]
  
EOF;
  }
 /**
  * @see sfTask
  */
 public function initialize(sfEventDispatcher $dispatcher, sfFormatter $formatter)
 {
     parent::initialize($dispatcher, $formatter);
     $globConfigs = sfYaml::load(dirname(__FILE__) . '/../../config/audit.yml');
     $this->patternConfigs = array();
     foreach ($globConfigs as $glob => $globConfig) {
         // Globs like //foo/... must be matched against paths with a leading
         // slash, while globs like foo/... must be matched against paths without
         // a leading slash.  Consequently, prefix all globs with slash, if
         // necessary, and always match against paths with a leading slash.
         if (strncmp($glob, '/', 1) != 0) {
             $glob = '/' . $glob;
         }
         $pattern = self::globToPattern($glob);
         $this->patternConfigs[$pattern] = $globConfig;
     }
 }
 public function initialize(sfEventDispatcher $dispatcher, sfFormatter $formatter)
 {
     parent::initialize($dispatcher, $formatter);
     if (!self::$done) {
         set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/../vendor');
         $libDir = dirname(__FILE__) . '/..';
         $autoloader = sfSimpleAutoload::getInstance();
         $autoloader->addDirectory($libDir . '/vendor/creole');
         $autoloader->addDirectory($libDir . '/vendor/propel');
         $autoloader->addDirectory($libDir . '/creole');
         $autoloader->addDirectory($libDir . '/propel');
         $autoloader->setClassPath('Propel', $libDir . '/propel/sfPropelAutoload.php');
         $autoloader->addDirectory(sfConfig::get('sf_lib_dir') . '/model');
         $autoloader->addDirectory(sfConfig::get('sf_lib_dir') . '/form');
         $autoloader->register();
         self::$done = true;
     }
 }
 /**
  * Dynamically adds options to this task based on the current route.
  *
  * @param sfCommandManager $commandManager
  * @param array            $options        Options as read from commandline
  *
  * @return void
  * @see sfTask
  */
 protected function process(sfCommandManager $commandManager, $options)
 {
     $commandManager->process($options);
     if (array_key_exists('application', $commandManager->getArgumentValues()) && array_key_exists('sf_route', $commandManager->getArgumentValues())) {
         $application = $commandManager->getArgumentValue('application');
         $routeName = $commandManager->getArgumentValue('sf_route');
         $configuration = $this->createConfiguration($application, 'prod');
         $this->route = sfImageTransformExtraPluginConfiguration::getRoute($routeName, $configuration);
         $routeVariables = array_keys($this->route->getVariables());
         $this->options = array();
         $optionSet = new sfCommandOptionSet();
         foreach ($commandManager->getErrors() as $error) {
             if (preg_match('/"--([\\w-_]+)"/', $error, $matches) && in_array($matches[1], $routeVariables)) {
                 $option = new sfCommandOption($matches[1], null, sfCommandOption::PARAMETER_OPTIONAL, '', null);
                 $this->options[] = $option;
                 $optionSet->addOption($option);
             }
         }
         $commandManager->setOptionSet($optionSet);
     }
     parent::process($commandManager, $options);
 }
 public function log($v, $force = false)
 {
     if ($force || $this->verbose) {
         parent::log($v);
     }
 }
Beispiel #12
0
 public function getMailer()
 {
     return parent::getMailer();
 }
 protected function process(sfCommandManager $commandManager, $options)
 {
     parent::process($commandManager, $options);
     $this->commandManager = $commandManager;
 }
Beispiel #14
0
 public function initializeAutoload(sfProjectConfiguration $configuration, $reload = false)
 {
     parent::initializeAutoload($configuration, $reload);
 }
Beispiel #15
0
 /**
  * @see sfTask
  */
 public function logSection($section, $message, $size = null, $style = 'INFO')
 {
     parent::logSection($this->pid . ' : ' . $section, $message, $size, $style);
 }
 /**
  * Default configuration.
  */
 protected function configure()
 {
     parent::configure();
     $this->addOptions(array(new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'), new sfCommandOption('application', null, sfCommandOption::PARAMETER_REQUIRED, 'Application used', 'frontend')));
     $this->addOptions(array(new sfCommandOption('config', false, sfCommandOption::PARAMETER_REQUIRED, 'The yaml config used by the plugin', 'default'), new sfCommandOption('check-running', false, sfCommandOption::PARAMETER_OPTIONAL, 'Check that the same task is not currently running'), new sfCommandOption('only-processed', false, sfCommandOption::PARAMETER_OPTIONAL, 'Record into database only if there were things processed by the task.'), new sfCommandOption('once-by-day', false, sfCommandOption::PARAMETER_OPTIONAL, 'Check that the task was not already executed once today.')));
 }
Beispiel #17
0
 public function initialize(sfEventDispatcher $dispatcher, sfFormatter $formatter)
 {
     parent::initialize($dispatcher, $formatter);
 }
 /**
  * Set up the shutdown interrupt, before running the task.
  *
  * @see BaseTask::doRun
  *
  * @return int
  */
 public function runFromCLI(sfCommandManager $commandManager, $options = null)
 {
     declare (ticks=1);
     pcntl_signal(self::INTERRUPT, array(&$this, 'shutdown'));
     return parent::runFromCLI($commandManager, $options);
 }