From f96e38f36b5177f836f8b69075fddb460263e7b3 Mon Sep 17 00:00:00 2001 From: Justin Otherguy Date: Wed, 29 Dec 2010 23:22:09 +0100 Subject: [PATCH] more path updated...and some clean-ups --- misc/sql/README | 4 +- misc/sql/demo/README | 7 ---- misc/tools/generate_docs.php | 6 +-- misc/tools/import_flo.php | 74 ---------------------------------- misc/tools/import_justin.php | 59 --------------------------- misc/tools/install.php | 78 ------------------------------------ misc/tools/install.sh | 3 +- 7 files changed, 6 insertions(+), 225 deletions(-) delete mode 100644 misc/tools/import_flo.php delete mode 100644 misc/tools/import_justin.php delete mode 100644 misc/tools/install.php diff --git a/misc/sql/README b/misc/sql/README index 2025cd0..8ee7a19 100644 --- a/misc/sql/README +++ b/misc/sql/README @@ -2,9 +2,9 @@ volkszaehler.org uses doctrine [1] as database abstraction and object relation m To setup your database follow these steps: -1. Make sure you have a proper configuration file (backend/volkszaehler.conf.php) +1. Make sure you have a proper configuration file (etc/volkszaehler.conf.php) 2. Adjust the configuration to your database setup -3. Call backend/bin/doctrine orm:schema-tool:create --dump-sql > share/sql/mysql.sql +3. Call misc/tools/doctrine orm:schema-tool:create --dump-sql > misc/sql/mysql.sql 4. import the resulting file using your favorite sql tool Alternatively you can directly import a existing mysql.sql file or diff --git a/misc/sql/demo/README b/misc/sql/demo/README index cc81d88..8108076 100644 --- a/misc/sql/demo/README +++ b/misc/sql/demo/README @@ -1,8 +1 @@ Dieses Verzeichnis enhällt Datenbankdumps mit Daten, die für Demonstrationszwecke genutzt werden könne. - -HOWTO Import pulses.dummy.copy.gz: - -gunzip pulses.dummy.copy.gz -psql -d smartmeter -c "COPY pulses FROM '/var/lib/postgresql/pulses.dummy.copy';" - -or use share/tools/import.php for mysql databases. diff --git a/misc/tools/generate_docs.php b/misc/tools/generate_docs.php index a9fff33..01a4533 100644 --- a/misc/tools/generate_docs.php +++ b/misc/tools/generate_docs.php @@ -41,7 +41,7 @@ . - */ - -$sql = ''; -$pulses = array(); - -// initialize db connection -mysql_connect('localhost', 'vz', 'demo'); -mysql_select_db('volkszaehler_doctrine'); - -// dump => db channel id mapping -$mapping[4] = 22; -$mapping[5] = 23; -$mapping[9] = 24; -$mapping[10] = 25; - -$fd = fopen('/home/steffen/Desktop/testdaten_nicht_veroeffentlichen.sql', 'r'); -if ($fd) { - while (!feof($fd)) { - $line = fgets($fd); - - // $matches index 1 2 3 4 5 6 7 8 - if (preg_match('/^\((\d), \'(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})\', (\d)/', $line, $matches)) { - - $ts = mktime($matches[5], $matches[6], $matches[7], $matches[3], $matches[4], $matches[2]) * 1000; - $value = $matches[8]; - $channel = $mapping[$matches[1]]; - - if ($ts > 0) { - $pulses[] = '(' . $channel . ', ' . $ts . ', ' . $value . ')'; - } - - if (count($pulses) % 1000 == 0) { - $sql = 'INSERT INTO data (channel_id, timestamp, value) VALUES ' . implode(', ', $pulses); - if (!mysql_query($sql)){ - echo mysql_error(); - } - - echo 'Rows inserted: ' . mysql_affected_rows() . '
'; - - flush(); - $pulses = array(); - } - } - }; - - fclose($fd); -} - -?> \ No newline at end of file diff --git a/misc/tools/import_justin.php b/misc/tools/import_justin.php deleted file mode 100644 index 02fc889..0000000 --- a/misc/tools/import_justin.php +++ /dev/null @@ -1,59 +0,0 @@ -. - */ - -$sql = ''; - -$fd = fopen('../docs/developer/pulses.dummy.copy', 'r'); -if ($fd) { - while (!feof($fd)) { - $buffer = explode("\t", fgets($fd)); - - $ts = parsePgSqlTimestamp($buffer[0]); - - if ($ts > 0) - $pulses[] = '(' . (int) ($buffer[2] + 1) . ', ' . $ts . ', 1)'; - }; - - fclose($fd); - - $sql = 'INSERT INTO data (channel_id, timestamp, value) VALUES ' . implode(', ', $pulses); - $dbh->execute($sql); - - echo 'Imported rows: ' . $dbh->affectedRows(); -} -else { - throw new Exception('cant open dump'); -} - -function parsePgSqlTimestamp($timestamp) { - $unix = strtotime($timestamp); - $ms = substr($timestamp, strrpos($timestamp, '.') + 1); - - return $unix + $ms/pow(10, strlen($ms)); -} - -?> \ No newline at end of file diff --git a/misc/tools/install.php b/misc/tools/install.php deleted file mode 100644 index dda5d40..0000000 --- a/misc/tools/install.php +++ /dev/null @@ -1,78 +0,0 @@ -. - */ -?> - - - - - - volkszaehler.org - setup - - -

volkszaehler.org - setup

- -Invalid step during installation: ' . $_GET['step'] . ' -

back

'; - } -} -else { - echo <<Welcome to the installation of your volkszaehler.org!
-This installer will: - -Only fundamental administration knowledge is required :) -

-

-So, ready? Take a cup of coffee and lets take a look on your system:

-

Start with step 1: analyze your system

-EOT; -} - -?> - - - \ No newline at end of file diff --git a/misc/tools/install.sh b/misc/tools/install.sh index aab6de0..b6ad86f 100755 --- a/misc/tools/install.sh +++ b/misc/tools/install.sh @@ -87,8 +87,7 @@ fi echo echo volkszaehler setup... -#/var/www/volkszaehler.org -ask "volkszaehler path?" /var/www/vz +ask "volkszaehler path?" /var/www/volkszaehler.org vzdir=$REPLY REPLY=y