<commit_before><?php

/*
 * This file is part of the symfony package.
 * (c) 2004-2006 <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

require_once(dirname(__FILE__).'/sfPropelBaseTask.class.php');

/**
 * Generates Propel model, SQL, initializes database, and load data.
 *
 * @package    symfony
 * @subpackage propel
 * @author     <NAME> <<EMAIL>>
 * @version    SVN: $Id$
 */
class sfPropelBuildAllLoadTask extends sfPropelBaseTask
{
  /**
   * @see sfTask
   */
  protected function configure()
  {
    $this->addOptions(array(
      new sfCommandOption('application', null, sfCommandOption::PARAMETER_OPTIONAL, 'The application name', null),
      new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'),
      new sfCommandOption('connection', null, sfCommandOption::PARAMETER_REQUIRED, 'The connection name', 'propel'),
      new sfCommandOption('no-confirmation', null, sfCommandOption::PARAMETER_NONE, 'Do not ask for confirmation'),
      new sfCommandOption('skip-forms', 'F', sfCommandOption::PARAMETER_NONE, 'Skip generating forms'),
      new sfCommandOption('phing-arg', null, sfCommandOption::PARAMETER_REQUIRED | sfCommandOption::IS_ARRAY, 'Arbitrary phing argument'),
    ));

    $this->aliases = array('propel-build-all-load');
    $this->namespace = 'propel';
    $this->name = 'build-all-load';
    $this->briefDescription = 'Generates Propel model, SQL, initializes database, and load data';

    $this->detailedDescription = <<<EOF
The [propel:build-all-load|INFO] task is a shortcut for four other tasks:

  [./symfony propel:build-all-load|INFO]

The task is equivalent to:

  [./symfony propel:build-all|INFO]
  [./symfony propel:data-load|INFO]

The task takes an application argument because of the [propel:data-load|COMMENT]
task. See [propel:data-load|COMMENT] help page for more information.

To bypass the confirmation, you can pass the [no-confirmation|COMMENT]
option:

  [./symfony propel:buil-all-load --no-confirmation|INFO]
EOF;
  }

  /**
   * @see sfTask
   */
  protected function execute($arguments = array(), $options = array())
  {
    // load Propel configuration before Phing
    $databaseManager = new sfDatabaseManager($this->configuration);

    require_once dirname(__FILE__) . '/../addon/sfPropelAutoload.php';

    $buildAll = new sfPropelBuildAllTask($this->dispatcher, $this->formatter);
    $buildAll->setCommandApplication($this->commandApplication);

    $buildAllOptions = array('--env='.$options['env'], '--connection='.$options['connection']);
    foreach ($options['phing-arg'] as $arg)
    {
      $buildAllOptions[] = '--phing-arg='.escapeshellarg($arg);
    }
    if ($options['application'])
    {
      $buildAllOptions[] = '--application='.$options['application'];
    }
    if ($options['skip-forms'])
    {
      $buildAllOptions[] = '--skip-forms';
    }
    if ($options['no-confirmation'])
    {
      $buildAllOptions[] = '--no-confirmation';
    }
    $ret = $buildAll->run(array(), $buildAllOptions);

    if (0 == $ret)
    {
      $loadData = new sfPropelLoadDataTask($this->dispatcher, $this->formatter);
      $loadData->setCommandApplication($this->commandApplication);

      $insertSqlOptions = array('--env='.$options['env'], '--connection='.$options['connection']);
      if ($options['application'])
      {
        $insertSqlOptions[] = '--application='.$options['application'];
      }

      $loadData->run(array(), $insertSqlOptions);
    }
<commit_msg>[1.2] added propel:data-load options to propel:build-all-load<commit_after><?php

/*
 * This file is part of the symfony package.
 * (c) 2004-2006 <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

require_once(dirname(__FILE__).'/sfPropelBaseTask.class.php');

/**
 * Generates Propel model, SQL, initializes database, and load data.
 *
 * @package    symfony
 * @subpackage propel
 * @author     <NAME> <<EMAIL>>
 * @version    SVN: $Id$
 */
class sfPropelBuildAllLoadTask extends sfPropelBaseTask
{
  /**
   * @see sfTask
   */
  protected function configure()
  {
    $this->addOptions(array(
      new sfCommandOption('application', null, sfCommandOption::PARAMETER_OPTIONAL, 'The application name', null),
      new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'),
      new sfCommandOption('connection', null, sfCommandOption::PARAMETER_REQUIRED, 'The connection name', 'propel'),
      new sfCommandOption('no-confirmation', null, sfCommandOption::PARAMETER_NONE, 'Do not ask for confirmation'),
      new sfCommandOption('skip-forms', 'F', sfCommandOption::PARAMETER_NONE, 'Skip generating forms'),
      new sfCommandOption('phing-arg', null, sfCommandOption::PARAMETER_REQUIRED | sfCommandOption::IS_ARRAY, 'Arbitrary phing argument'),
      new sfCommandOption('append', null, sfCommandOption::PARAMETER_NONE, 'Don\'t delete current data in the database'),
      new sfCommandOption('dir', null, sfCommandOption::PARAMETER_REQUIRED | sfCommandOption::IS_ARRAY, 'The directories to look for fixtures'),
    ));

    $this->aliases = array('propel-build-all-load');
    $this->namespace = 'propel';
    $this->name = 'build-all-load';
    $this->briefDescription = 'Generates Propel model, SQL, initializes database, and load data';

    $this->detailedDescription = <<<EOF
The [propel:build-all-load|INFO] task is a shortcut for four other tasks:

  [./symfony propel:build-all-load|INFO]

The task is equivalent to:

  [./symfony propel:build-all|INFO]
  [./symfony propel:data-load|INFO]

The task takes an application argument because of the [propel:data-load|COMMENT]
task. See [propel:data-load|COMMENT] help page for more information.

To bypass the confirmation, you can pass the [no-confirmation|COMMENT]
option:

  [./symfony propel:buil-all-load --no-confirmation|INFO]
EOF;
  }

  /**
   * @see sfTask
   */
  protected function execute($arguments = array(), $options = array())
  {
    // load Propel configuration before Phing
    $databaseManager = new sfDatabaseManager($this->configuration);

    require_once dirname(__FILE__) . '/../addon/sfPropelAutoload.php';

    $buildAll = new sfPropelBuildAllTask($this->dispatcher, $this->formatter);
    $buildAll->setCommandApplication($this->commandApplication);

    $buildAllOptions = array('--env='.$options['env'], '--connection='.$options['connection']);
    foreach ($options['phing-arg'] as $arg)
    {
      $buildAllOptions[] = '--phing-arg='.escapeshellarg($arg);
    }
    if ($options['application'])
    {
      $buildAllOptions[] = '--application='.$options['application'];
    }
    if ($options['skip-forms'])
    {
      $buildAllOptions[] = '--skip-forms';
    }
    if ($options['no-confirmation'])
    {
      $buildAllOptions[] = '--no-confirmation';
    }
    $ret = $buildAll->run(array(), $buildAllOptions);

    if (0 == $ret)
    {
      $loadData = new sfPropelLoadDataTask($this->dispatcher, $this->formatter);
      $loadData->setCommandApplication($this->commandApplication);

      $dataLoadOptions = array('--env='.$options['env'], '--connection='.$options['connection']);
      if ($options['application'])
      {
        $dataLoadOptions[] = '--application='.$options['application'];
      }
      if ($options['dir'])
      {
        foreach ($options['dir'] as $dir)
        {
          $dataLoadOptions[] = '--dir='.$dir;
        }
      }
      if ($options['append'])
      {
        $dataLoadOptions[] = '--append';
      }

      $loadData->run(array(), $dataLoadOptions);
    }

{'fraction_non_alphanumeric': 0.15631469979296067, 'fraction_numerical': 0.002587991718426501, 'mean_word_length': 3.919796308084023, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2262684', 'n_tokens_mistral': 2341, 'n_tokens_neox': 2326, 'n_words': 529}