From: Neil S. <sir...@us...> - 2003-06-19 06:04:49
|
CVSROOT : /cvsroot/publicdnsadmin Module : publicdnsadmin Commit time: 2003-06-19 06:04:48 UTC Modified files: dbbackup.php docs/CHANGELOG docs/INSTALL docs/TODO lib/config.php-dist lib/db.inc.php Log message: Author: SiRVu|caN Log message: improved dbbackup.php ---------------------- diff included ---------------------- Index: publicdnsadmin/dbbackup.php diff -u publicdnsadmin/dbbackup.php:1.2 publicdnsadmin/dbbackup.php:1.3 --- publicdnsadmin/dbbackup.php:1.2 Fri Jun 13 07:09:27 2003 +++ publicdnsadmin/dbbackup.php Wed Jun 18 23:04:38 2003 @@ -10,30 +10,19 @@ $Id: */ require("lib/prepend.php"); -include("lib/header.php"); -echo "<Br>"; if (userHasAccess($_SESSION["_UID"], "users")) { $date = date("mdy-hia"); -$filename = "/path/to/publicdnsadmin/data/lbdns-$date.sql"; -$dbhost = "127.0.0.1"; -$dbuser = "dbuser"; -$dbpass = "dbpass"; -$dbname = "dbname"; +$path = realpath("."); +$filename = "$path/data/lbdns-$date.sql"; -passthru("mysqldump --opt -h$dbhost -u$dbuser $dbname >$filename"); +passthru("mysqldump --opt -h$database_host -u$database_user $database_name >$filename"); $zipline = "gzip ".$filename.""; shell_exec($zipline); $filename2 = $filename.".gz"; $filesmall = "lbdns-$date.sql.gz"; +header("Location: $site_address/data/$filesmall"); -echo "<a href=\"data/".$filesmall."\">Download Backup ($date)</a>"; - -} else { - displayNoAccess(); -} -echo "<br><br>"; -include("lib/footer.php"); ?> Index: publicdnsadmin/docs/CHANGELOG diff -u publicdnsadmin/docs/CHANGELOG:1.9 publicdnsadmin/docs/CHANGELOG:1.10 --- publicdnsadmin/docs/CHANGELOG:1.9 Wed Jun 18 05:50:23 2003 +++ publicdnsadmin/docs/CHANGELOG Wed Jun 18 23:04:38 2003 @@ -16,3 +16,4 @@ SiRVu|caN <sir...@si...> - 18/6/2003 - Added in a graphical check for signup and/or login. SiRVu|caN <sir...@si...> - 18/6/2003 - Made the Contact email address changable in config.php. SiRVu|caN <sir...@si...> - 19/6/2003 - Added a small image to fill up some of the white space. +SiRVu|caN <sir...@si...> - 19/6/2003 - Improved dbbackup.php, now doesnt require seperate conf. Index: publicdnsadmin/docs/INSTALL diff -u publicdnsadmin/docs/INSTALL:1.3 publicdnsadmin/docs/INSTALL:1.4 --- publicdnsadmin/docs/INSTALL:1.3 Wed Jun 18 01:05:47 2003 +++ publicdnsadmin/docs/INSTALL Wed Jun 18 23:04:38 2003 @@ -17,14 +17,8 @@ properly. The required structure data can be found in mysql.sql and postgresql.sql in the same directory as this INSTALL-file. + Make sure the "data" dir is world writeable, so that backups of the database + can be written there. + If you are upgrading from a CVS version, make sure you run the *.update.sql scripts. - - Edit dbbackup.php in the Public DNS Administrator root dir, change thse values: - - $filename = "/path/to/publicdnsadmin/data/lbdns-$date.sql"; - $dbhost = "dbhost"; - $dbuser = "dbuser"; - $dbpass = "dbpass"; - $dbname = "dbname"; - Index: publicdnsadmin/docs/TODO diff -u publicdnsadmin/docs/TODO:1.4 publicdnsadmin/docs/TODO:1.5 --- publicdnsadmin/docs/TODO:1.4 Wed Jun 18 03:29:35 2003 +++ publicdnsadmin/docs/TODO Wed Jun 18 23:04:38 2003 @@ -1,4 +1,4 @@ - Some sort of maintenence news system (displayed on the main login page). - Graphical code check upon signup (and possibly login). -DONE -- Improve dbbackup.php. +- Improve dbbackup.php. -DONE - Improve nsstats.php. Index: publicdnsadmin/lib/config.php-dist diff -u publicdnsadmin/lib/config.php-dist:1.5 publicdnsadmin/lib/config.php-dist:1.6 --- publicdnsadmin/lib/config.php-dist:1.5 Wed Jun 18 21:31:58 2003 +++ publicdnsadmin/lib/config.php-dist Wed Jun 18 23:04:38 2003 @@ -7,7 +7,7 @@ Distributed under the GPL license, see LICENSE for more information - $Id: config.php-dist,v 1.5 2003/06/19 04:31:58 sirvulcan Exp $ + $Id: config.php-dist,v 1.6 2003/06/19 06:04:38 sirvulcan Exp $ */ /* @@ -15,7 +15,11 @@ Only supports "mysql" and "pgsql"-types at the moment Replace XXsql to either mysql or pgsql! */ -$connection_string = "XXsql://user:pass@database-address/database-name"; +$database_type = "XXsql"; +$database_user = "username"; +$database_pass = "password"; +$database_host = "database-address"; +$database_name = "database-name"; /* Master-value for the "domains"-table. See PowerDNS-docs for more info about this */ $default_master = ""; @@ -37,6 +41,9 @@ /* Contact email address */ $contact_addy = "dns...@do..."; + +/* Path to site (without a trailing fowardslash */ +$site_address = "http://www.site.com/publicdnsadmin"; /* NS Server Addresses / Access Data, You Need Webserver Enabled On PowerDNS */ $ns1addy = "ns1.server.com"; Index: publicdnsadmin/lib/db.inc.php diff -u publicdnsadmin/lib/db.inc.php:1.1.1.1 publicdnsadmin/lib/db.inc.php:1.2 --- publicdnsadmin/lib/db.inc.php:1.1.1.1 Wed Apr 16 00:19:07 2003 +++ publicdnsadmin/lib/db.inc.php Wed Jun 18 23:04:38 2003 @@ -7,12 +7,15 @@ Distributed under the GPL license, see LICENSE for more information - $Id: db.inc.php,v 1.1.1.1 2003/04/16 07:19:07 sirvulcan Exp $ + $Id: db.inc.php,v 1.2 2003/06/19 06:04:38 sirvulcan Exp $ */ function db_connect() { - global $connection_string; + global $database_type, $database_user, $database_pass, $database_host, $database_name; + + $connection_string = "$database_type://$database_user:$database_pass@$database_host/$database_name"; + $dbh =& DB::connect($connection_string); if (DB::isError($dbh)) { @@ -27,7 +30,9 @@ function db_type() { - global $connection_string; + global $database_type, $database_user, $database_pass, $database_host, $database_name; + + $connection_string = "$database_type://$database_user:$database_pass@$database_host/$database_name"; if (preg_match("/^mysql/", $connection_string)) { return "mysql"; ----------------------- End of diff ----------------------- |