* @version $Id: install.php,v 1.49 2013/03/21 16:27:57 andig2 Exp $ */ error_reporting(E_ALL ^ E_NOTICE); require_once './core/compatibility.php'; require_once './core/install.core.php'; require_once './core/constants.php'; // required files $install_sql = './install/install.sql'; $upgrade_sql = './install/upgrade.sql'; // button definitions $button_next = '   Next   >>'; $button_prev = '<<   Previous   '; $button_upgrade = 'Upgrade'; // extract request parameters and disable warnings extract($_REQUEST, EXTR_OVERWRITE); // create default config file if not existing if (!file_exists(CONFIG_FILE)) { @copy('./config.sample.php', CONFIG_FILE); } // set default $upgrading = false; // stepping back? if (isset($formPrevious)) { $step -= 2; } // upgrading? elseif (isset($action) && stristr($action, 'upgrade')) { $upgrading = true; // load configuration @include_once(CONFIG_FILE); // begin of upgrade? if (empty($step)) { // set initial step for upgrading $step = 2; // set default db configuration if (empty($db_server)) { extract($config, EXTR_OVERWRITE, 'db_'); } // remove files from previous version foreach(array( 'imdb.php', 'amazon.php', 'engines.php', 'functions.php', 'setupfunctions.php', 'compatibility.php', 'template.php', 'queryparser.php', 'genres.php', 'output.php', 'session.php', './core/setupfunctions.php', './core/installfunctions.php', './core/xml_functions.php', './doc/createtables.sql', './doc/updatedb.sql') as $file) { if (file_exists($file)) @rename($file, $file.'.old'); } // remove old xajax library delete_files('lib/xajax/lib'); // remove old smarty cache delete_files('cache/smarty'); // recursively delete old smarty folder (now lib/smarty) delete_files('smarty', true); // obsolete templates delete_files('templates/advanced', true); delete_files('templates/downlord', true); delete_files('templates/jeckyll', true); } } // or first installation step? elseif (empty($step)) { $step = 1; } ?> videoDB - Installation
Installer for
0) { error("DB has already tables with this prefix!"); break; } // add root user warning if ($db_user == 'root') { warn("You've used 'root' as database username. Root is often the master administration account. For security reasons it is recommended that you choose a different username after the installation."); } // continue with table installation $step++; case 4: /* * continue installation by upgrading or installing tables and (re)moving files (upgrade only) */ if ($upgrading) { // re-connect if not continued from step 3 if (!isset($dbh)) { $dbh = @mysqli_connect($db_server, $db_user, $db_password); if (mysqli_connect_error()) trigger_error("Can't connect: ".mysqli_connect_error(), E_USER_ERROR); mysqli_select_db($dbh, $db_database) or trigger_error("Can't select database: ".mysqli_error($dbh), E_USER_ERROR); } // get version $sql = "SELECT value FROM {$db_prefix}config WHERE opt = 'dbversion'"; $rs = mysqli_query($dbh, $sql); if ($rs) list($version) = mysqli_fetch_row($rs); // successfully retrieved installed version? if (!($rs && $version)) { error("Error getting DB version, try full install instead of upgrade: ".mysqli_error($dbh)); error("

$sql
"); $step--; break; } // already correct db version? this might happen if just the username/ password were wrong if ($version >= DB_REQUIRED) { info("Database upgrade not required."); break; } // perform actual upgrade $upgrades = parse_upgrades($upgrade_sql); if ($version >= max(array_keys($upgrades))) { info("Database upgrade not required."); $step--; break; } else { // upgrade info("
Upgrading tables..."); info("Old database version: $version"); $sql_array = array(); // select the relevant upgrades (> current version) foreach ($upgrades as $ver => $value) { if ($ver > $version) $sql_array["$ver"] = $value; } // upgrades successful? $version = db_upgrade($sql_array); if (is_numeric($version)) { info("New database version: $version"); // dev-time sanity check if ($version > DB_REQUIRED) warn("Upgraded database version $version is higher than required database version ".DB_REQUIRED); } else { // error $step--; } } } else { // install info("
Installing tables..."); // re-connect if not continued from step 3 if (!$dbh) { $dbh = @mysqli_connect($db_server, $db_user, $db_password); if (mysqli_connect_error()) trigger_error("Can't connect: ".mysqli_connect_error(), E_USER_ERROR); mysqli_select_db($dbh, $db_database) or trigger_error("Can't select database: ".mysqli_error($dbh), E_USER_ERROR); } // open SQL script from doc directory $sql = file_get_contents($install_sql); if (!$sql) trigger_error('Couldn\'t open SQL file: '.$install_sql, E_USER_ERROR); if (runSQL($sql, $dbh) === false) { error('Error creating tables: '.mysqli_error($dbh)); error('

'.$sql.'
'); $step--; } else { $write_config_file = true; /* // create config file info("
Writing config file..."); $config = parse_config(array( 'db_server' => $db_server, 'db_user' => $db_user, 'db_password' => $db_password, 'db_database' => $db_database, 'db_prefix' => $db_prefix), true); if (!file_put_contents(CONFIG_FILE, $config)) { error('
Could not write config file '.CONFIG_FILE.'!
Please make sure your config file contains the following lines:

'. highlight_string($config, 1)); } */ } } break; } // determine next installation step switch ($step) { case 4: // start videoDB $action_target = 'index.php'; break; default: // continue installation $action_target = 'install.php'; } ?>
"; } switch ($step) { case 4: // start VideoDB $installed = ($upgrading) ? 'upgraded' : 'installed'; ?>
Installation successful!

VideoDB database and tables have been successfully .

Writing config file..."); $config_file = parse_config(array( 'db_server' => $db_server, 'db_user' => $db_user, 'db_password' => $db_password, 'db_database' => $db_database, 'db_prefix' => $db_prefix), true); if (!@file_put_contents(CONFIG_FILE, $config_file)) { error('
Could not write config file '.CONFIG_FILE.'!
Please make sure your config file contains the following lines:

'. highlight_string($config_file, 1), true); } /* warn('Your username/ password chosen for this upgrade do not match your config file. Please make sure to update the config file.', true); */ } warn('For security reasons this file (install.php) should be deleted after the installation. You can later adjust the database settings by modifying the '.CONFIG_FILE.' file.', true); ?> Click Start to begin using videoDB...


database and tables.



database and tables.

You have selected a non-empty database. Installing into a non-empty database might lead to data loss and is only recommended for experienced users.

Choose Upgrade to upgrade the existing installation (recommended). Before upgrading, please make sure to backup your database!



Click Next to install the tables into the existing non-empty database...


Database Upgrade

Your database does not match the current version of VideoDB and needs to be upgraded.

Select database and user.


Select database and user.

Note: unless you're installing into an existing database, the database login must have 'Create Database' rights.

Server:
User:
Password:
Database:
Table prefix: (only required for new installations)

Click Next to database and tables...


This is the installer for videoDB. You will require:
  1. PHP >= 5.5.0 with GD library and session support configured.


  2. A MySQL database, login (username and password) with create/drop table rights.


  3. If you want this installer to create the config file for you, it needs permission to write to web server's the videoDB root directory.


The installer will create a database in your MySQL installation, create and populate the required tables, and generate the videoDB configuration file.

Click Next to setup the database connection...


Step: