From d0c6dd29d19da4de9966cd9985d467fe1cfab556 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 26 Mar 2013 22:38:05 +0400 Subject: add experimental easy installer --- install/index.php | 352 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 352 insertions(+) create mode 100644 install/index.php (limited to 'install') diff --git a/install/index.php b/install/index.php new file mode 100644 index 000000000..21dd0d8c7 --- /dev/null +++ b/install/index.php @@ -0,0 +1,352 @@ + + + Tiny Tiny RSS - Installer + + + + + + + $msg"; + } + + function print_notice($msg) { + print "
+ $msg
"; + } + + function db_connect($host, $user, $pass, $db, $type) { + if ($type == "pgsql") { + + $string = "dbname=$db user=$user"; + + if ($pass) { + $string .= " password=$pass"; + } + + if ($host) { + $string .= " host=$host"; + } + + if (defined('DB_PORT')) { + $string = "$string port=" . DB_PORT; + } + + $link = pg_connect($string); + + return $link; + + } else if ($type == "mysql") { + $link = mysql_connect($host, $user, $pass); + if ($link) { + $result = mysql_select_db($db, $link); + return $link; + } + } + } + + function db_query($link, $query, $type, $die_on_error = true) { + if ($type == "pgsql") { + $result = pg_query($link, $query); + if (!$result) { + $query = htmlspecialchars($query); // just in case + if ($die_on_error) { + die("Query $query failed [$result]: " . ($link ? pg_last_error($link) : "No connection")); + } + } + return $result; + } else if ($type == "mysql") { + $result = mysql_query($query, $link); + if (!$result) { + $query = htmlspecialchars($query); + if ($die_on_error) { + die("Query $query failed: " . ($link ? mysql_error($link) : "No connection")); + } + } + return $result; + } + } + +?> + + + +

Tiny Tiny RSS Installer

+ + + +

Database settings

+ +
+ + + + +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +

+ +
+ + + +

Checking configuration

+ + 0) { + print "

Some configuration tests failed. Please correct them before continuing.

"; + + print ""; + + exit; + } + + ?> + +

Checking database

+ + + +

Initialize database

+ +

Before you can start using tt-rss, database needs to be initialized. Click on the button below to do that now.

+ + + +
+
+ + + + + + + + + + +

+ +

+ +
+ +
+
+ + + + + + + + +

+
+ +
+ + Initializing database..."; + + $lines = explode(";", preg_replace("/[\r\n]/", "", file_get_contents("../schema/ttrss_schema_".basename($DB_TYPE).".sql"))); + + foreach ($lines as $line) { + if (strpos($line, "--") !== 0 && $line) { + db_query($link, $line, $DB_TYPE); + } + } + + print_notice("Database initialization completed."); + + } else { + print_notice("Database initialization skipped."); + } + + print "

Generated configuration file

"; + + print "

Copy following text and save as config.php in tt-rss main directory. It is suggested to read through the file to the end in case you need any options changed fom default values.

"; + + print ""; + + print "

You can generate the file again by changing the form above.

"; + } + ?> + + + + -- cgit v1.2.3