Ejemplo n.º 1
0
 public function init(OutputInterface $output = null, $dbPath = null)
 {
     $this->setDefaultCommand('run');
     if ($output === null) {
         $output = new ConsoleOutput();
     }
     $this->output = new ConsoleStyle(new ArgvInput(), $output);
     $this->folder = dirname(dirname(__FILE__));
     chdir($this->folder);
     if ($dbPath === null) {
         $dbPath = $this->folder . '/db.sqlite';
     }
     DBA::connect('sqlite:' . $dbPath, '', '');
     $this->settings = new Settings($this);
     $migration = new Migration($this);
     $migration->run();
     // Prevent the previous command from being executed in case anything fails later on
     $this->batchPath = $this->folder . DIRECTORY_SEPARATOR . 'cli-launch.temp.bat';
     file_put_contents($this->batchPath, '');
 }
Ejemplo n.º 2
0
 /**
  * Returns false when there are no tables at all
  *
  * @return bool
  */
 private function hasTables()
 {
     $sql = 'SELECT COUNT(*) FROM sqlite_master';
     $count = (int) DBA::execute($sql)->fetchColumn();
     return $count !== 0;
 }