public function execute(InputInterface $input, OutputInterface $output) { App::bind('io', new IO($this, $input, $output))->title('Purge'); $pdo = (require App::get('in')->getArgument('pdo')); jp::CleanMsSQLdb($pdo); App::get('io')->success("Purged"); }
public function execute(InputInterface $input, OutputInterface $output) { App::bind('io', new IO($this, $input, $output))->title('Create'); $database = App::get('Name')->database(); $username = App::get('Name')->user(); if (App::get('Query')->execute($this->sql($database, $username))) { App::get('io')->success("Created database: {$database}"); } }
public function __construct(Command $cmd, InputInterface $in, OutputInterface $out) { $this->cmd = $cmd; $this->in = $in; $this->out = $out; App::bind('in', $in); App::bind('out', $out); $this->style = new SymfonyStyle($in, $out); }
public function __construct(string $name = null) { // get database name if (empty($name)) { $name = App::get('in')->getArgument('name'); } try { $name = $this->validate($name); } catch (RuntimeException $e) { $q = 'Please enter a name for the database (max 7 characters)'; $name = App::get('io')->ask($q, null, function ($name) { return $this->validate($name); }); } $this->name = $name; // generate ID App::bind('id', App::get('Random')->id()); $name = $this->database(); App::get('io')->write("<comment>name:</> <info>{$name}</>"); }
public function execute(InputInterface $input, OutputInterface $output) { App::bind('io', new IO($this, $input, $output))->title('Execute'); $file = App::get('in')->getArgument('sql'); $pathinfo = pathinfo($file); if ($pathinfo['extension'] === 'sql') { $files[] = $file; } else { $files = file($file, FILE_IGNORE_NEW_LINES); // eager load in case of PDOFile path before chdir App::get('Query'); chdir($pathinfo['dirname']); } foreach ($files as $file) { $sql = file_get_contents($file); $result = App::get('Query')->execute($sql); if ($result !== false) { App::get('io')->success("Executed {$file}"); } } }