<commit_before><?php

class phastDatabaseTask extends sfBaseTask
{
    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', 'prod'),
            new sfCommandOption('connection', null, sfCommandOption::PARAMETER_REQUIRED, 'The connection name', 'propel'),
        ));

        $this->namespace = 'phast';
        $this->name = 'database';
        $this->briefDescription = '';
        $this->detailedDescription = <<<EOF
The [mailing:schedule|INFO] task does things.
Call it with:

  [php symfony mailing:schedule|INFO]
EOF;
    }

    protected function execute($arguments = array(), $options = array())
    {

        $this->log('Configure database');

        $validator = new sfValidatorString();

        $adapter = $this->ask('adapter (= mysql):', 'QUESTION', 'mysql');
        $this->log('');
        $host = $this->ask('host (= localhost):', 'QUESTION', 'localhost');
        $this->log('');
        $dbname = $this->askAndValidate('db name:', $validator);
        $this->log('');
        $username = $this->askAndValidate('username:', $validator);
        $this->log('');
        $password = $this->askAndValidate('password:', $validator);

        $this->log('');

        file_put_contents(sfConfig::get('sf_config_dir') . '/databases.yml',
<<<"EOT"
dev:
  propel:
    param:
      classname:  DebugPDO
      debug:
        realmemoryusage: true
        details:
          time:       { enabled: true }
          slow:       { enabled: true, threshold: 0.1 }
          mem:        { enabled: true }
          mempeak:    { enabled: true }
          memdelta:   { enabled: true }

test:
  propel:
    param:
      classname:  DebugPDO

all:
  propel:
    class:        sfPropelDatabase
    param:
      classname:  PropelPDO
      dsn:        mysql:dbname=$dbname;host=$host<commit_msg>phast database task<commit_after><?php

class phastDatabaseTask extends sfBaseTask
{
    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', 'prod'),
            new sfCommandOption('connection', null, sfCommandOption::PARAMETER_REQUIRED, 'The connection name', 'propel'),
        ));

        $this->namespace = 'phast';
        $this->name = 'database';
        $this->briefDescription = '';
        $this->detailedDescription = <<<EOF
The [mailing:schedule|INFO] task does things.
Call it with:

  [php symfony mailing:schedule|INFO]
EOF;
    }

    protected function execute($arguments = array(), $options = array())
    {

        $this->log('Configure database');

        $validator = new sfValidatorString();

        $adapter = $this->ask('adapter (= mysql):', 'QUESTION', 'mysql');
        $this->log('');
        $host = $this->ask('host (= localhost):', 'QUESTION', 'localhost');
        $this->log('');
        $dbname = $this->askAndValidate('db name:', $validator);
        $this->log('');
        $username = $this->askAndValidate('username:', $validator);
        $this->log('');
        $password = $this->ask('password:', 'QUESTION', '');

        $this->log('');

        file_put_contents(sfConfig::get('sf_config_dir') . '/databases.yml',
<<<"EOT"
dev:
  propel:
    param:
      classname:  DebugPDO
      debug:
        realmemoryusage: true
        details:
          time:       { enabled: true }
          slow:       { enabled: true, threshold: 0.1 }
          mem:        { enabled: true }
          mempeak:    { enabled: true }
          memdelta:   { enabled: true }

test:
  propel:
    param:
      classname:  DebugPDO

all:
  propel:
    class:        sfPropelDatabase
    param:
      classname:  PropelPDO
      dsn:        mysql:dbname=$dbname;host=$host
{'fraction_non_alphanumeric': 0.1529037000735114, 'fraction_numerical': 0.00098015192354815, 'mean_word_length': 2.625222024866785, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 35, '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': '2347735', 'n_tokens_mistral': 1210, 'n_tokens_neox': 1206, 'n_words': 261}