diff -r 1ede5203910d -r edd0c3ee3e1d install/index.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/install/index.php Mon Apr 28 18:18:06 2008 +0000 @@ -0,0 +1,157 @@ +\n"; +echo "\n"; +echo "
\n"; +echo "This installer expects you to have a PowerDNS database accessable from this server. This installer also expects you to have never ran Poweradmin before, or that you want to overwrite the Poweradmin part of the database. If you have had Poweradmin running before, any data in the following tables will be destroyed:
\n"; + echo "This installer will, of course, not touch the data in the PowerDNS tables of the database. However, it is, of course, recommended you create a backup of your database before proceeding.
"; + echo "Finaly, if you see any errors during the installation process, a problem report would be. You can report problems (and ask for help) on the poweradmin-users mailinglist or you can create a ticket in the ticketsystem.
"; + echo "Do you want to proceed now?
\n"; + echo ""; + break; + + case 2: + $step++; + echo "To prepare the database for using Poweradmin, the installer needs to modify the PowerDNS database. It'll add a number of tables and it'll fill these tables with some data. If the tables are already present, the installer will drop them first.
"; + echo "To do all of this, the installer needs to access the database with an account which has sufficient rights. If you trust the installer, you may give it the username and password of the database user root. Otherwise, make sure the user has enough rights, before actually proceeding.
"; + echo ""; + break; + + case 3: + $step++; + echo "Updating database... "; + include_once("../inc/config-me.inc.php"); + include_once("database-structure.inc.php"); + $db_user = $_POST['user']; + $db_pass = $_POST['pass']; + $db_host = $_POST['host']; + $db_name = $_POST['name']; + $db_type = "mysql"; + require_once("../inc/database.inc.php"); + $db = dbConnect(); + $db->loadModule('Manager'); + $db->loadModule('Extended'); + + $current_tables = $db->listTables(); + + foreach ($def_tables as $table) { + if (in_array($table['table_name'], $current_tables)) $db->dropTable($table['table_name']); + $db->createTable($table['table_name'], $table['fields']); + } + + $fill_perm_items = $db->prepare('INSERT INTO perm_items VALUES (?, ?, ?)'); + $db->extended->executeMultiple($fill_perm_items, $def_permissions); + $fill_perm_items->free(); + + foreach ($def_remaining_queries as $query) { + $db->query($query); + } + + echo "done!
"; + + echo "We have now updated the PowerDNS database to work with Poweradmin. You now want to give limited rights to Poweraadmin so it can update the data in the tables. To do this, you should create a new user and give it rights to select, delete, insert and update records in the PowerDNS database. In MySQL should now perform the following command:
"; + echo "GRANT SELECT, INSERT, UPDATE, DELETE
ON powerdns-database.*
TO 'poweradmin-user'@'localhost'
IDENTIFIED BY 'poweradmin-password';
On PgSQL you would use:
"; + echo "$ createuser poweradmin-user
Shall the new role be a superuser? (y/n) n
Shall the new user be allowed to create databases? (y/n) n
Shall the new user be allowed to create more new users? (y/n) n
CREATE USER
$ psql powerdns-database
psql> GRANT SELECT, INSERT, DELETE, UPDATE
ON powerdns-database
TO poweradmin-user;
After you have added the new user, proceed with this installation procedure.
\n"; + echo ""; + break; + + case 4: + $step++; + $db_host = $_POST['host']; + $db_name = $_POST['name']; + $db_type = $_POST['type']; + echo "Now we will put together the configuration. To do so, I need some details:
"; + echo ""; + break; + + case 5: + $step++; + echo "The configuration is printed here. You should now create the file " . $local_config_file . " in the Poweradmin root directory yourself. It should contain the following few lines:
"; + + echo ""; + echo "\$db_host\t\t= \"" . $_POST['db_host'] . "\";\n" . + "\$db_user\t\t= \"" . $_POST['db_user'] . "\";\n" . + "\$db_pass\t\t= \"" . $_POST['db_pass'] . "\";\n" . + "\$db_name\t\t= \"" . $_POST['db_name'] . "\";\n" . + "\$db_type\t\t= \"" . $_POST['db_type'] . "\";\n" . + "\n" . + "\$dns_hostmaster\t\t= \"" . $_POST['dns_hostmaster'] . "\";\n" . + "\$dns_ns1\t\t= \"" . $_POST['dns_ns1'] . "\";\n" . + "\$dns_ns2\t\t= \"" . $_POST['dns_ns2'] . "\";\n" . + "\n"; + echo ""; + echo ""; + break; + + case 6: + $step++; + echo "
Now we have finished the configuration, you should remove the directory \"install/\" from the Poweradmin root directory. You will not be able to use the file if it exists. Do it now.
"; + echo "After you have removed the file, you can login to Poweradmin with username \"admin\" and password \"admin\". You are highly encouraged to change these as soon as you are logged in.
"; + break; + + default: + break; +} + +echo " "; + +?> + + +