public function indexAction() { $t = Doctrine::getTable('User_Model_User'); try { $t->count(); $this->_helper->redirector->gotoSimple('createuser', 'install', 'install'); } catch (Doctrine_Exception $e) { $this->view->form = new FansubCMS_Form_Confirmation(); if ($this->request->isPost()) { $submit = $this->request->getParam('yes'); if (!empty($submit)) { Install_Api_DoctrineTool::getInstance()->createTablesFromArray(); Install_Api_Migration::getInstance()->setCurrentVersion(Install_Api_Migration::getInstance()->getLatestVersion()); // we are on the top atm $this->_helper->redirector->gotoSimple('createuser', 'install', 'install'); } else { $this->_helper->redirector->gotoSimple('index', 'index', 'install'); } } } }
/** * * Get an instance of the API * @return Install_Api_DoctrineTool */ public static function getInstance() { if (empty(self::$_instance)) { self::$_instance = new self(); } return self::$_instance; }
public function setmigrationversionAction() { $this->view->title = "Set the migration version of the databse"; $version = $this->getRequest()->getParam('version', null); $api = Install_Api_DoctrineTool::getInstance(); if (is_null($version)) { $this->view->partialData = new stdClass(); $this->view->message = 'Please provide parameter "version". If you provide "current" it means latest version.'; $this->_forward('index'); return; } elseif ($version == 'current') { $api->setMigrationVersionToCurrent(); $this->view->message = 'Migration version was set to latest version available.'; } else { $api->setMigrationVersion($version); $this->view->message = "Migration version was set to {$version}."; } $this->view->partialData = new stdClass(); $this->_forward('index'); }