public function removeAction($name = null) { if (!$name) { return $this->dispatchError('not-found'); } $db = $this->src->getDatabase($name); $dbName = $db->getName(); $removed = false; if ($db->exists()) { $db->remove(); $removed = true; } return $this->view(['title' => "Remove Database {$dbName}", 'name' => $dbName, 'removed' => $removed, 'indexUrl' => $this->getUrl('data/database.{{format}}'), 'getUrl' => $this->getUrl("data/database/get/{$dbName}.{{format}}")]); }
public function initDb() { $this->src = $this->getDataSource('common'); $this->addForm('database', ['database' => 'text']); $form = $this->getFilledForm('database', Method::GET); $this->dbName = $form->database->getValue(); if (!$this->dbName) { return $this->dispatchError('not-found'); } $this->db = $this->src->getDatabase($this->dbName); if (!$this->db->exists()) { return $this->dispatchError('not-found'); } }