/** * Display the database configuration form. */ public function config_db() { // We need to know if the db is already configured. If so, just redirect back, otherwise it could be maliciously overwritten. $messages = array(); config_test::check_db($messages, true); if (count($messages) == 0) { url::redirect('setup_check'); } else { // Db does indeed need to be configured. $this->template->title = 'Database Configuration'; $this->template->content = new View('fixers/config_db'); $this->template->content->error = $this->error; // init and default values of view vars $this->view_var = array(); $description = str_replace(array('*code*', '*code_user*', '*code_perm*'), array('<span class="code">CREATE DATABASE indicia TEMPLATE=template_postgis;</span>', '<span class="code">CREATE USER indicia_user WITH PASSWORD \'indicia\';<br/>' . 'GRANT ALL PRIVILEGES ON DATABASE indicia TO indicia_user;</span>', '<span class="code">GRANT ALL PRIVILEGES ON TABLE geometry_columns TO indicia_user;<br/>' . 'GRANT ALL PRIVILEGES ON TABLE spatial_ref_sys TO indicia_user;<br/>' . 'GRANT EXECUTE ON FUNCTION st_astext(geometry) TO indicia_user;<br/>' . 'GRANT EXECUTE ON FUNCTION st_geomfromtext(text, integer) TO indicia_user;<br/>' . 'GRANT EXECUTE ON FUNCTION st_transform(geometry, integer) TO indicia_user;</span>'), Kohana::lang('setup.description')); $this->template->content->description = $description; // Assign default settings if the user has not yet updated the db config $db_config = kohana::config('database'); if ($db_config['default']['connection']['type'] == 'mysql') { $this->template->content->host = 'localhost'; $this->template->content->port = '5432'; $this->template->content->user = ''; $this->template->content->password = ''; $this->template->content->reportuser = ''; $this->template->content->reportpassword = ''; $this->template->content->schema = ''; $this->template->content->database = ''; } else { $this->template->content->host = $db_config['default']['connection']['host']; $this->template->content->port = $db_config['default']['connection']['port']; $this->template->content->user = $db_config['default']['connection']['user']; $this->template->content->password = $db_config['default']['connection']['pass']; $this->template->content->reportuser = $db_config['report']['connection']['user']; $this->template->content->reportpassword = $db_config['report']['connection']['pass']; $this->template->content->schema = $db_config['default']['schema']; $this->template->content->database = $db_config['default']['connection']['database']; } } }
if ($db_version < $app_version) { ?> <div class="ui-state-error ui-corner-all page-notice">Your database needs to be upgraded as the application version is <?php echo $app_version; ?> but the database version is <?php echo $db_version; ?> . <a class="ui-state-default ui-corner-all button" href="<?php echo url::base(); ?> index.php/home/upgrade">Run Upgrade</a></div> <?php } $problems = config_test::check_config(true, true); if (count($problems) > 0) { ?> <div class="ui-state-error ui-corner-all page-notice"> <p>There are configuration issues on this server. <span id="issues_toggle" class="ui-state-default ui-corner-all button" style="margin-left: 1em;">Show/Hide Details</span> </p> <div id='issues'> <?php foreach ($problems as $problem) { echo '<div class="page-notice ui-widget-content ui-corner-all"><div>' . $problem['title'] . '</div><div>' . $problem['description'] . '</div></div>'; } ?> </div> </div> <?php