mam mały problem nad którym juz siedzę 3 dzień i czuję że sobie nie poradze z nim szybko.
Mianowicie mam skrypt w którym mam plik odpowiedzialny za instalacje wstepną.
Ten plik ma za zadanie utworzenie bazy danych ale z poziomu Root do którego nie mam dostępu, wgranie tabeli , oraz zapisanie ustawień w plikach.
Wszystko to zrobiłem recznie dodałem baze, tabele , skonfigurowałem pliki ini
a to diabelstwo poniżej nie chce mnie przepuścić do kolejnego kroku
"create admin"
Nie chodzi mi o zmianę całości lecz tylko o przejscie do natępnego kroku INSTALACJI pomimo napotkanych błedów
w którym miejscu pliku mam dopisać jakąś funkcje typu
"jeżeli bład to idz do $this->_redirect('install/create-admin'); "
dziekuję za pomoc
<?php class Install_IndexController extends Zend_Controller_Action { /* @access Public * @var object */ /* @access Public * @var object */ /* @access Public * @var object */ /** * @access Public * @return void */ public function init() { self::$installForm = new Model_Install_Form; $config = Zend_Registry::get('configuration'); if($config->installed) { $this->_redirect('index'); } } /** * @access Public * @return void */ public function indexAction() { $error = false; $this->view->databaseConfig = true; $this->view->config = true; $this->view->media = true; $this->view->cache = true; // pre validation Database.ini $error = true; $this->view->databaseConfig = false; } // pre validation Config.ini $error = true; $this->view->config = false; } // pre validation media directory $error = true; $this->view->media = false; } // prevalidation cache $error = true; $this->view->cache = false; } $form = self::$installForm->dbForm(); // if we have post if ($this->getRequest()->isPost()) { // If form is not valid if (!$form->isValid($_POST)) { $this->view->form = $form; } else { $values = $form->getValues(); // write config $config = new Zend_Config_Ini(Zend_Registry::get('siteRootDir').'/application/Configs/Database.ini', null, 'allowModifications' => true)); $config->default->params->host = $values['host']; $config->default->params->dbname = $values['dbname']; $config->default->params->username = $values['username']; $config->default->params->password = $values['password']; 'filename' => Zend_Registry::get('siteRootDir').'/application/Configs/Database.ini')); $writer->write(); // create database use native mysql to do this if (!$link) { $this->view->createDbError = true; $this->view->dbError = $this->view->translate('Error_Database_Connect_Fail'); $this->view->form = $form; } else { $sql = "CREATE DATABASE `" . $values['dbname'] . "`"; $this->view->createDbError = true; $this->view->form = $form; } else { if (!$db_selected) { $this->view->createDbError = true; $this->view->form = $form; } else { // import tables $filename = Zend_Registry::get('siteRootDir').'/data/voodoo.sql'; foreach ($queries as $query){ $this->view->createDbError = true; // drop the Db there was an error //mysql_query("DROP DATABASE `" . $values['dbname'] . "`"); break; } } } if (!$this->view->dbError) { // set install to 1 $config = new Zend_Config_Ini(Zend_Registry::get('siteRootDir').'/application/Configs/Config.ini', null, 'allowModifications' => true)); $config->default->installed = 1; 'filename' => Zend_Registry::get('siteRootDir').'/application/Configs/Config.ini')); $writer->write(); // redirect to install step 2 $this->_redirect('install/create-admin'); } else { $this->view->form = $form; } } } } } } else { $this->view->error = $error; if ( !$error){ $this->view->form = $form; } else { $this->form = ''; } } } }