aboutsummaryrefslogtreecommitdiff
path: root/lib/task/isisInfoTask.class.php
blob: c9de8682678be661b0a2e2bb8d92f13ae4c7fd2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php

class isisInfoTask extends mySfTask
{
  protected function configure()
  {
    $this->addArgument('database', sfCommandArgument::OPTIONAL, 'Optional database name');
    $this->addOptions(array(
      new sfCommandOption('application', null, sfCommandOption::PARAMETER_REQUIRED, 'The application name'),
      new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'),
      new sfCommandOption('connection', null, sfCommandOption::PARAMETER_REQUIRED, 'The connection name', 'doctrine'),
      new sfCommandOption('loglevel', 'l', sfCommandOption::PARAMETER_REQUIRED, 'Log level', 'info'),
    ));

    $this->namespace           = 'isis';
    $this->name                = 'info';
    $this->briefDescription    = 'List information of ISIS databases';
    $this->detailedDescription = <<<EOF
The [isis:info|INFO] task lists information of ISIS databases.
Call it with:

  [php symfony isis:info|INFO]
EOF;
  }

  protected function execute($arguments = array(), $options = array())
  {
    // Initialize an IsisConnector.
    $class = (class_exists('IsisImporterManager')) ? 'IsisImporterManager' : 'sfIsisImporterManager';
    $isis  = new $class($options['loglevel']);

    // Error handling.
    if ($isis == FALSE)
    {
      $this->logSection('isis', 'Error opening ISIS database.');
      return FALSE;
    }

    // Database information.
    $isis->info($this, 'task', $arguments['database']);
  }
}