diff --git a/backend/bin/doctrine.php b/backend/bin/doctrine.php index ef48e55..5c89ba0 100644 --- a/backend/bin/doctrine.php +++ b/backend/bin/doctrine.php @@ -1,7 +1,7 @@ * @package doctrine * @copyright Copyright (c) 2010, The volkszaehler.org project @@ -58,7 +58,7 @@ $cli->addCommands(array( // DBAL Commands new \Doctrine\DBAL\Tools\Console\Command\RunSqlCommand(), new \Doctrine\DBAL\Tools\Console\Command\ImportCommand(), - + // ORM Commands new \Doctrine\ORM\Tools\Console\Command\ClearCache\MetadataCommand(), new \Doctrine\ORM\Tools\Console\Command\ClearCache\ResultCommand(), @@ -76,3 +76,5 @@ $cli->addCommands(array( new \Doctrine\ORM\Tools\Console\Command\ValidateSchemaCommand(), )); $cli->run(); + +?> diff --git a/backend/index.php b/backend/index.php index b537210..556c1c9 100644 --- a/backend/index.php +++ b/backend/index.php @@ -1,9 +1,10 @@ * @copyright Copyright (c) 2010, The volkszaehler.org project + * @package default * @license http://opensource.org/licenses/gpl-license.php GNU Public License * * This file is part of volkzaehler.org diff --git a/backend/lib/Controller/Data.php b/backend/lib/Controller/Data.php index a97a4ee..54fb4e6 100644 --- a/backend/lib/Controller/Data.php +++ b/backend/lib/Controller/Data.php @@ -26,70 +26,72 @@ use Volkszaehler\Util; /** * data controller - * + * * @author Steffen Vogel * @todo call via redirect from Controller\Channel */ class Data extends Controller { - + /** * @todo authentification/indentification */ public function get() { // TODO use uuids for groups or channels $ids = explode(',', trim($this->view->request->getParameter('ids'))); - + $q = $this->em->createQuery('SELECT c FROM Volkszaehler\Model\Channel c WHERE c.id IN (' . implode(', ', $ids) . ')'); $channels = $q->execute(); - + $from = ($this->view->request->getParameter('from')) ? (int) $this->view->request->getParameter('from') : NULL; $to = ($this->view->request->getParameter('to')) ? (int) $this->view->request->getParameter('to') : NULL; $groupBy = ($this->view->request->getParameter('groupBy')) ? $this->view->request->getParameter('groupBy') : NULL; // get all readings by default - + foreach ($channels as $channel) { $interpreter = $channel->getInterpreter($this->em); $this->view->add($channel, $interpreter->getValues($from, $to, $groupBy)); } } - + /** - * + * */ public function add() { $ucid = $this->view->request->getParameter('ucid'); $channel = $this->em->getRepository('Volkszaehler\Model\Channel\Channel')->findOneBy(array('uuid' => $ucid)); - + $value = (float) $this->view->request->getParameter('value'); $ts = (int) $this->view->request->getParameter('timestamp'); if ($ts == 0) { $ts = microtime(TRUE) * 1000; } - + $data = new \Volkszaehler\Model\Data($channel, $value, $ts); - + $channel->addData($data); - + $this->em->persist($data); $this->em->flush(); } - + /** * prune data from database - * + * * @todo authentification/indentification */ public function delete() { $dql = 'DELETE FROM \Volkszaehler\Model\Data WHERE channel_id = ' . $this->id; - + if ($this->view->request->getParameter('from')) { $dql .= ' && timestamp > ' . (int) $this->view->request->getParameter('from'); } - + if ($this->view->request->getParameter('to')) { $dql .= ' && timestamp < ' . $this->view->request->getParameter('to'); } - + $q = $em->createQuery($dql); $q->execute(); } -} \ No newline at end of file +} + +?> diff --git a/backend/lib/Dispatcher.php b/backend/lib/Dispatcher.php index 776318f..bebdbae 100644 --- a/backend/lib/Dispatcher.php +++ b/backend/lib/Dispatcher.php @@ -1,6 +1,7 @@ */ class Dispatcher { diff --git a/backend/lib/Interpreter/Interpreter.php b/backend/lib/Interpreter/Interpreter.php index 47d82ad..7bcb2d4 100644 --- a/backend/lib/Interpreter/Interpreter.php +++ b/backend/lib/Interpreter/Interpreter.php @@ -1,6 +1,7 @@ * */ @@ -35,16 +37,16 @@ interface InterpreterInterface { /** * interpreter superclass for all interpreters - * + * * @author Steffen Vogel * */ abstract class Interpreter implements InterpreterInterface { protected $channel; protected $em; - + /** - * + * * @param $channel * @param $em */ @@ -52,9 +54,9 @@ abstract class Interpreter implements InterpreterInterface { $this->channel = $channel; $this->em = $em; } - + /** - * + * * @param integer $from timestamp in ms since 1970 * @param integer $to timestamp in ms since 1970 * @param mixed $groupBy @@ -86,7 +88,7 @@ abstract class Interpreter implements InterpreterInterface { case 'minute': $sqlGroupBy = 'YEAR(' . $ts . '), DAYOFYEAR(' . $ts . '), HOUR(' . $ts . '), MINUTE(' . $ts . ')'; break; - + case 'second': $sqlGroupBy = 'YEAR(' . $ts . '), DAYOFYEAR(' . $ts . '), HOUR(' . $ts . '), MINUTE(' . $ts . '), SECOND(' . $ts . ')'; break; @@ -104,11 +106,11 @@ abstract class Interpreter implements InterpreterInterface { $sql = 'SELECT'; $sql .= ($sqlGroupBy === FALSE) ? ' timestamp, value' : ' MAX(timestamp) AS timestamp, SUM(value) AS value, COUNT(timestamp) AS count'; $sql .= ' FROM data WHERE channel_id = ' . (int) $this->channel->getId(); - + if (isset($from)) { $sql .= ' && timestamp > ' . $from; } - + if (isset($to)) { $sql .= ' && timestamp < ' . $to; } @@ -116,21 +118,21 @@ abstract class Interpreter implements InterpreterInterface { if ($sqlGroupBy !== FALSE) { $sql .= ' GROUP BY ' . $sqlGroupBy; } - + $sql .= ' ORDER BY timestamp DESC'; - + $rsm = new \Doctrine\ORM\Query\ResultsetMapping; $rsm->addScalarResult('timestamp', 'timestamp'); $rsm->addScalarResult('value', 'value'); - + if ($sqlGroupBy) { $rsm->addScalarResult('count', 'count'); } - + $query = $this->em->createNativeQuery($sql, $rsm); $result = $query->getResult(); $totalCount = count($result); - + if (is_int($groupBy) && $groupBy < $totalCount) { // return $groupBy values $packageSize = floor($totalCount / $groupBy); $packageCount = $groupBy; diff --git a/backend/lib/Interpreter/Meter.php b/backend/lib/Interpreter/Meter.php index 6e06a3f..7803d96 100644 --- a/backend/lib/Interpreter/Meter.php +++ b/backend/lib/Interpreter/Meter.php @@ -1,7 +1,7 @@ resolution / 1000; // returns Wh } - + /** - * + * * @param integer $from timestamp in ms since 1970 * @param integer $to timestamp in ms since 1970 */ public function getMin($from = NULL, $to = NULL) { $data = $this->getData($from, $to); - + $min = current($data); foreach ($data as $reading) { if ($reading['value '] < $min['value']) { @@ -65,15 +66,15 @@ class Meter extends Interpreter { } return $min; } - + /** - * + * * @param integer $from timestamp in ms since 1970 * @param integer $to timestamp in ms since 1970 */ public function getMax($from = NULL, $to = NULL) { $data = $this->getData($from, $to); - + $min = current($data); foreach ($data as $reading) { if ($reading['value '] > $min['value']) { @@ -82,44 +83,44 @@ class Meter extends Interpreter { } return $min; } - + /** - * + * * @param integer $from timestamp in ms since 1970 * @param integer $to timestamp in ms since 1970 * @todo calculate timeinterval if no params were given */ - public function getAverage($from = NULL, $to = NULL) { + public function getAverage($from = NULL, $to = NULL) { return $this->getConsumption($from, $to) / ($to - $from) / 1000; // return W } - + /** * just a passthru of raw data - * + * * @param integer $from timestamp in ms since 1970 * @param integer $to timestamp in ms since 1970 */ public function getPulses($from = NULL, $to = NULL, $groupBy = NULL) { return parent::getData($from, $to, $groupBy); } - + /** * raw pulses to power conversion - * + * * @param integer $from timestamp in ms since 1970 * @param integer $to timestamp in ms since 1970 */ public function getValues($from = NULL, $to = NULL, $groupBy = NULL) { $pulses = parent::getData($from, $to, $groupBy); $pulseCount = count($pulses); - + for ($i = 1; $i < $pulseCount; $i++) { $delta = $pulses[$i]['timestamp'] - $pulses[$i-1]['timestamp']; - + $pulses[$i]['timestamp'] -= $delta/2; $pulses[$i]['value'] *= 3600000/(($this->channel->getResolution() / 1000) * $delta); // TODO untested } - + return $pulses; // returns W } } diff --git a/backend/lib/Interpreter/Sensor.php b/backend/lib/Interpreter/Sensor.php index 5fd5bf3..98f74be 100644 --- a/backend/lib/Interpreter/Sensor.php +++ b/backend/lib/Interpreter/Sensor.php @@ -1,7 +1,7 @@ */ class Sensor extends Interpreter { - + /** - * + * * @param integer $from timestamp in ms since 1970 * @param integer $to timestamp in ms since 1970 */ public function getValues($from = NULL, $to = NULL, $groupBy = NULL) { $data = parent::getData($from, $to, $groupBy); - + array_walk($data, function(&$reading) { $reading['value'] /= $reading['count']; // calculate average (ungroup the sql sum() function) }); - + return $data; } /** - * + * * @param integer $from timestamp in ms since 1970 * @param integer $to timestamp in ms since 1970 - * + * * @todo untested */ public function getMin($from = NULL, $to = NULL) { return $this->dbh->query('SELECT value, timestamp FROM data WHERE channel_id = ' . (int) $this->id . self::buildFilterTime($from, $to) . ' ORDER BY value ASC', 1)->current(); } - + /** - * + * * @param integer $from timestamp in ms since 1970 * @param integer $to timestamp in ms since 1970 - * + * * @todo untested */ public function getMax($from = NULL, $to = NULL) { // TODO untested return $this->dbh->query('SELECT value, timestamp FROM data WHERE channel_id = ' . (int) $this->id . self::buildFilterTime($from, $to) . ' ORDER BY value DESC', 1)->current(); } - + /** - * + * * @param integer $from timestamp in ms since 1970 * @param integer $to timestamp in ms since 1970 - * + * * @todo untested */ public function getAverage($from = NULL, $to = NULL) { // TODO untested diff --git a/backend/lib/Logger/Flukso.php b/backend/lib/Logger/Flukso.php index 6afdd98..6594fd7 100644 --- a/backend/lib/Logger/Flukso.php +++ b/backend/lib/Logger/Flukso.php @@ -1,7 +1,7 @@ * @todo to be implemented */ class Flukso implements Logger { - + } ?> \ No newline at end of file diff --git a/backend/lib/Logger/Logger.php b/backend/lib/Logger/Logger.php index 8fdee3b..f1fd469 100644 --- a/backend/lib/Logger/Logger.php +++ b/backend/lib/Logger/Logger.php @@ -1,7 +1,7 @@ + * @package data * @todo to be implemented */ interface Logger { diff --git a/backend/lib/Model/Channel.php b/backend/lib/Model/Channel.php index 5aa93ca..9401d2c 100644 --- a/backend/lib/Model/Channel.php +++ b/backend/lib/Model/Channel.php @@ -28,7 +28,8 @@ use Doctrine\Common\Collections\ArrayCollection; * Channel entity * * @author Steffen Vogel - * + * @package channel + * * @Entity * @Table(name="channels") */ @@ -38,7 +39,7 @@ class Channel extends Entity { /** @Column(type="string") */ protected $description; - + /** @Column(type="string") */ protected $indicator; @@ -46,13 +47,13 @@ class Channel extends Entity { * @OneToMany(targetEntity="Data", mappedBy="channel"), cascade={"remove"} */ protected $data = NULL; - + /** @Column(type="integer") */ protected $resolution; /** @Column(type="decimal", precision="5", scale="2") */ protected $cost; - + /** * indicator => interpreter, unit mapping */ @@ -64,21 +65,21 @@ class Channel extends Entity { 'pressure' => array('sensor', 'hPa'), 'humidity' => array('sensor', '%') ); - + /** * constructor */ public function __construct($indicator) { parent::__construct(); - + if (!in_array($indicator, self::$indicators)) { throw new \InvalidArgumentException($indicator . ' is no known indicator'); } - + $this->indicator = $indicator; $this->data = new ArrayCollection(); } - + /** * add a new data to the database * @todo move to Logger\Logger? @@ -86,7 +87,7 @@ class Channel extends Entity { public function addData(\Volkszaehler\Model\Data $data) { $this->data->add($data); } - + /** * obtain channels data interpreter to calculate statistical information */ @@ -97,7 +98,7 @@ class Channel extends Entity { } return new $interpreterClassName($this, $em); } - + /** * getter & setter */ @@ -111,4 +112,6 @@ class Channel extends Entity { public function setResolution($resolution) { $this->resolution = $resolution; } public function getCost() { return $this->cost; } public function setCost($cost) { $this->cost = $cost; } -} \ No newline at end of file +} + +?> diff --git a/backend/lib/Model/Data.php b/backend/lib/Model/Data.php index e2b87d3..f991b84 100644 --- a/backend/lib/Model/Data.php +++ b/backend/lib/Model/Data.php @@ -26,16 +26,17 @@ use Doctrine\Common\Collections\ArrayCollection; /** * Data entity - * + * * @author Steffen Vogel - * + * @package data + * * @Entity * @Table(name="data") */ class Data { /** * ending timestamp of period in ms since 1970 - * + * * @Id * @Column(type="bigint") */ @@ -53,13 +54,13 @@ class Data { * @JoinColumn(name="channel_id", referencedColumnName="id") */ protected $channel; - + public function __construct(Channel\Channel $channel, $value, $timestamp) { $this->channel = $channel; $this->value = $value; $this->timestamp = $timestamp; } - + /** * setter & getter */ diff --git a/backend/lib/Model/Entity.php b/backend/lib/Model/Entity.php index a223609..5880ace 100644 --- a/backend/lib/Model/Entity.php +++ b/backend/lib/Model/Entity.php @@ -1,6 +1,7 @@ - * + * @package default + * * @MappedSuperclass */ abstract class Entity { @@ -37,17 +39,19 @@ abstract class Entity { * @GeneratedValue(strategy="AUTO") */ protected $id; - + /** @Column(type="string", length=36) */ protected $uuid; - + public function __construct() { $this->uuid = Util\Uuid::mint(); } - + /** * getter & setter */ public function getId() { return $this->id; } // read only public function getUuid() { return $this->uuid; } // read only -} \ No newline at end of file +} + +?> diff --git a/backend/lib/Model/Group.php b/backend/lib/Model/Group.php index d0b9796..ec08475 100644 --- a/backend/lib/Model/Group.php +++ b/backend/lib/Model/Group.php @@ -26,19 +26,20 @@ use Doctrine\Common\Collections\ArrayCollection; /** * Group entity - * + * * @author Steffen Vogel - * + * @package group + * * @Entity * @Table(name="groups") */ class Group extends Entity { /** @Column(type="string") */ protected $name; - + /** @Column(type="string") */ protected $description; - + /** * @ManyToMany(targetEntity="Channel") * @JoinTable(name="groups_channel", @@ -47,7 +48,7 @@ class Group extends Entity { * ) */ protected $channels = NULL; - + /** * @ManyToMany(targetEntity="Group") * @JoinTable(name="groups_groups", @@ -62,11 +63,11 @@ class Group extends Entity { */ public function __construct() { parent::__construct(); - + $this->channels = new ArrayCollection(); $this->children = new ArrayCollection(); } - + /** * getter & setter */ diff --git a/backend/lib/Util/ClassLoader.php b/backend/lib/Util/ClassLoader.php index 71eafb3..8d20b89 100644 --- a/backend/lib/Util/ClassLoader.php +++ b/backend/lib/Util/ClassLoader.php @@ -28,6 +28,7 @@ namespace Volkszaehler\Util; * * namespace is mapped to the filesystem structure * + * @package util * @author Roman Borschel * @license http://www.opensource.org/licenses/lgpl-license.php Lesser GNU Public License */ @@ -209,4 +210,5 @@ class ClassLoader { return NULL; } -} \ No newline at end of file +} +?> diff --git a/backend/lib/Util/Configuration.php b/backend/lib/Util/Configuration.php index 0aecce3..a61fdc7 100644 --- a/backend/lib/Util/Configuration.php +++ b/backend/lib/Util/Configuration.php @@ -25,6 +25,7 @@ namespace Volkszaehler\Util; /** * static configuration class for loading and storing the configuration to the disk * + * @package util * @author Steffen Vogel */ class Configuration { diff --git a/backend/lib/Util/Debug.php b/backend/lib/Util/Debug.php index 87137fb..417051d 100644 --- a/backend/lib/Util/Debug.php +++ b/backend/lib/Util/Debug.php @@ -27,6 +27,7 @@ use Doctrine\DBAL\Logging; /** * static debugging class * + * @package util * @author Steffen Vogel */ class Debug implements Logging\SQLLogger { @@ -152,4 +153,4 @@ class Debug implements Logging\SQLLogger { public function getMessages() { return $this->messages; } } -?> \ No newline at end of file +?> diff --git a/backend/lib/Util/UUID.php b/backend/lib/Util/UUID.php index 3ceb4fd..95838d8 100644 --- a/backend/lib/Util/UUID.php +++ b/backend/lib/Util/UUID.php @@ -1,6 +1,7 @@ GetRandom($bytes,0)); // straight binary mysteriously doesn't work, hence the base64 } } + +?> + diff --git a/backend/lib/View/CSV/CSV.php b/backend/lib/View/CSV/CSV.php index 42e1975..851581b 100644 --- a/backend/lib/View/CSV/CSV.php +++ b/backend/lib/View/CSV/CSV.php @@ -1,6 +1,7 @@ + * @package default */ abstract class CSV extends View\View { protected $csv = array(); diff --git a/backend/lib/View/CSV/Data.php b/backend/lib/View/CSV/Data.php index 2571738..b7fa976 100644 --- a/backend/lib/View/CSV/Data.php +++ b/backend/lib/View/CSV/Data.php @@ -24,10 +24,14 @@ namespace Volkszaehler\View\CSV; /** * CSV data view + * * @author Steffen Vogel + * @package data */ class Data extends CSV { public function add($obj, $data) { $this->csv = array_merge($this->csv, $data); } -} \ No newline at end of file +} + +?> diff --git a/backend/lib/View/HTTP/Request.php b/backend/lib/View/HTTP/Request.php index 695489e..ac4eb07 100644 --- a/backend/lib/View/HTTP/Request.php +++ b/backend/lib/View/HTTP/Request.php @@ -28,6 +28,7 @@ namespace Volkszaehler\View\HTTP; * also used for data * * @author Steffen Vogel + * @package http */ class Request { protected $headers; @@ -67,3 +68,5 @@ class Request { return (isset($this->parameters[$method][$name])) ? $this->parameters[$method][$name] : NULL; } } + +?> diff --git a/backend/lib/View/HTTP/Response.php b/backend/lib/View/HTTP/Response.php index 398386b..3464bd7 100644 --- a/backend/lib/View/HTTP/Response.php +++ b/backend/lib/View/HTTP/Response.php @@ -1,12 +1,7 @@ * @license http://www.opensource.org/licenses/gpl-license.php GNU Public License * * This file is part of volkzaehler.org @@ -28,7 +23,12 @@ namespace Volkszaehler\View\HTTP; /** + * HTTP request + * * simple class to control the output buffering + * + * @author Steffen Vogel + * @package http */ class Response { protected $headers = array(); @@ -113,3 +113,4 @@ class Response { } } +?> diff --git a/backend/lib/View/JSON/Channel.php b/backend/lib/View/JSON/Channel.php index 6708ec0..c762c0c 100644 --- a/backend/lib/View/JSON/Channel.php +++ b/backend/lib/View/JSON/Channel.php @@ -28,6 +28,7 @@ namespace Volkszaehler\View\JSON; * also used for data * * @author Steffen Vogel + * @package channel */ class Channel extends JSON { diff --git a/backend/lib/View/JSON/Group.php b/backend/lib/View/JSON/Group.php index 1756123..8d30abe 100644 --- a/backend/lib/View/JSON/Group.php +++ b/backend/lib/View/JSON/Group.php @@ -26,6 +26,7 @@ namespace Volkszaehler\View\JSON; * JSON group view * * @author Steffen Vogel + * @package group */ class Group extends JSON { @@ -45,3 +46,6 @@ class Group extends JSON { $this->json['groups'][] = $group; } } + +?> + diff --git a/backend/lib/View/JSON/JSON.php b/backend/lib/View/JSON/JSON.php index 40a8991..17790aa 100644 --- a/backend/lib/View/JSON/JSON.php +++ b/backend/lib/View/JSON/JSON.php @@ -1,11 +1,7 @@ + * @package default * @license http://www.opensource.org/licenses/gpl-license.php GNU Public License * * This file is part of volkzaehler.org @@ -31,6 +27,14 @@ use Volkszaehler\View\HTTP; use Volkszaehler\View; use Volkszaehler\Util; +/** + * JSON view + * + * also used for data + * + * @package default + * @author Steffen Vogel + */ abstract class JSON extends View\View { protected $json = array(); diff --git a/backend/lib/View/JpGraph.php b/backend/lib/View/JpGraph.php index a3303da..f9bbd88 100644 --- a/backend/lib/View/JpGraph.php +++ b/backend/lib/View/JpGraph.php @@ -1,6 +1,7 @@ * @link http://jpgraph.net/ * @todo add caching diff --git a/backend/lib/View/View.php b/backend/lib/View/View.php index 95886ba..3e982dc 100644 --- a/backend/lib/View/View.php +++ b/backend/lib/View/View.php @@ -1,6 +1,7 @@ * */ @@ -73,4 +75,6 @@ abstract class View { public function addDebug(Util\Debug $debug) { } -} \ No newline at end of file +} + +?> diff --git a/backend/lib/View/XML/Channel.php b/backend/lib/View/XML/Channel.php index 60d15cb..b5aa641 100644 --- a/backend/lib/View/XML/Channel.php +++ b/backend/lib/View/XML/Channel.php @@ -30,6 +30,7 @@ use Volkszaehler\View\HTTP; * also used for data * * @author Steffen Vogel + * @package channel */ class Channel extends XML { @@ -74,4 +75,6 @@ class Channel extends XML { parent::render(); } -} \ No newline at end of file +} + +?> diff --git a/backend/lib/View/XML/Group.php b/backend/lib/View/XML/Group.php index 123f32a..47da824 100644 --- a/backend/lib/View/XML/Group.php +++ b/backend/lib/View/XML/Group.php @@ -28,6 +28,7 @@ use Volkszaehler\View\HTTP; * XML group view * * @author Steffen Vogel + * @package group */ class Group extends XML { protected $xml; @@ -54,4 +55,6 @@ class Group extends XML { parent::render(); } -} \ No newline at end of file +} + +?> diff --git a/backend/lib/View/XML/XML.php b/backend/lib/View/XML/XML.php index d062f94..3a12b1b 100644 --- a/backend/lib/View/XML/XML.php +++ b/backend/lib/View/XML/XML.php @@ -1,9 +1,7 @@ + * @package default * @license http://www.opensource.org/licenses/gpl-license.php GNU Public License * * This file is part of volkzaehler.org @@ -28,6 +26,12 @@ use Volkszaehler\View\HTTP; use Volkszaehler\View; use Volkszaehler\Util; +/** + * XML view + * + * @author Steffen Vogel + * @package default + */ abstract class XML extends View\View { protected $xmlDoc; @@ -107,4 +111,4 @@ abstract class XML extends View\View { } } -?> \ No newline at end of file +?> diff --git a/backend/volkszaehler.conf.default.php b/backend/volkszaehler.conf.default.php index 9ef8ec8..c04aeea 100644 --- a/backend/volkszaehler.conf.default.php +++ b/backend/volkszaehler.conf.default.php @@ -1,12 +1,13 @@ + * @package default * @license http://www.opensource.org/licenses/gpl-license.php GNU Public License * * This file is part of volkzaehler.org diff --git a/share/tests/configuration.php b/share/tests/configuration.php index d1b82ba..e47f1ba 100644 --- a/share/tests/configuration.php +++ b/share/tests/configuration.php @@ -1,22 +1,25 @@ +/** + * a simple test for Volkszaehler\Util\Configuration * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License (either version 2 or - * version 3) as published by the Free Software Foundation. + * @copyright Copyright (c) 2010, The volkszaehler.org project + * @package tests + * @license http://www.opensource.org/licenses/gpl-license.php GNU Public License * - * This program is distributed in the hope that it will be useful, + * This file is part of volkzaehler.org + * + * volkzaehler.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * volkzaehler.org is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * For more information on the GPL, please go to: - * http://www.gnu.org/copyleft/gpl.html + * along with volkszaehler.org. If not, see . */ use Volkszaehler\Util; diff --git a/share/tests/test.php b/share/tests/test.php index f88fc80..b568b9f 100644 --- a/share/tests/test.php +++ b/share/tests/test.php @@ -1,6 +1,6 @@ +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License (either version 2 or +# version 3) as published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# For more information on the GPL, please go to: +# http://www.gnu.org/copyleft/gpl.html +# +# This is simple bash script to update the project documentation +# based on PHPDocumentor. It's used to be invoked by post-commit hooks +# of GitHub or the release script. +# + +# change directory +cd /var/www/vz/github/ + +# update git +git pull + +cd /var/www/vz/ + +# update dokumentation +phpdoc/phpdoc --directory github --target docs \ +--title "volkszaehler.org Documentation" \ +--output HTML:frames:phpedit \ +--ignoresymlinks \ +--ignore backend/lib/vendor/,backend/lib/Model/Proxies/ \ No newline at end of file diff --git a/share/tools/import_flo.php b/share/tools/import_flo.php index dba7683..07d48c4 100644 --- a/share/tools/import_flo.php +++ b/share/tools/import_flo.php @@ -1,26 +1,25 @@ -* -* This program is free software; you can redistribute it and/or modify it -* under the terms of the GNU General Public License (either version 2 or -* version 3) as published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -* -* For more information on the GPL, please go to: -* http://www.gnu.org/copyleft/gpl.html -*/ - -/* +/** * simple script to import demo pulses + * + * @copyright Copyright (c) 2010, The volkszaehler.org project + * @package tools + * @license http://www.opensource.org/licenses/gpl-license.php GNU Public License + * + * This file is part of volkzaehler.org + * + * volkzaehler.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * volkzaehler.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with volkszaehler.org. If not, see . */ $sql = ''; @@ -40,32 +39,32 @@ $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); } diff --git a/share/tools/import_justin.php b/share/tools/import_justin.php index 5ca5a09..5df17ec 100644 --- a/share/tools/import_justin.php +++ b/share/tools/import_justin.php @@ -1,48 +1,46 @@ -* -* This program is free software; you can redistribute it and/or modify it -* under the terms of the GNU General Public License (either version 2 or -* version 3) as published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -* -* For more information on the GPL, please go to: -* http://www.gnu.org/copyleft/gpl.html -*/ - -/* +/** * simple script to import demo pulses + * + * @copyright Copyright (c) 2010, The volkszaehler.org project + * @package tools + * @license http://www.opensource.org/licenses/gpl-license.php GNU Public License + * @todo adapt to doctrine dal or use native mysql + * + * This file is part of volkzaehler.org + * + * volkzaehler.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * volkzaehler.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with volkszaehler.org. If not, see . */ -// TODO adapt to doctrine dal or use native mysql - $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 { @@ -52,7 +50,7 @@ else { function parsePgSqlTimestamp($timestamp) { $unix = strtotime($timestamp); $ms = substr($timestamp, strrpos($timestamp, '.') + 1); - + return $unix + $ms/pow(10, strlen($ms)); } diff --git a/share/tools/install.php b/share/tools/install.php index b1b547d..c03d8c6 100644 --- a/share/tools/install.php +++ b/share/tools/install.php @@ -1,22 +1,27 @@ +/** + * install script * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License (either version 2 or - * version 3) as published by the Free Software Foundation. + * for creating/updating of the configuration/database * - * This program is distributed in the hope that it will be useful, + * @copyright Copyright (c) 2010, The volkszaehler.org project + * @package tools + * @license http://www.opensource.org/licenses/gpl-license.php GNU Public License + * + * This file is part of volkzaehler.org + * + * volkzaehler.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * volkzaehler.org is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * For more information on the GPL, please go to: - * http://www.gnu.org/copyleft/gpl.html + * along with volkszaehler.org. If not, see . */ ?> @@ -37,7 +42,7 @@ switch (@$_GET['step']) { case '1': echo 'bla'; break; - + default: echo '

welcome to the installation of your volkszaehler backend!

lets proceed with the next step

'; diff --git a/share/tools/log1wire.sh b/share/tools/log_onewire.sh similarity index 100% rename from share/tools/log1wire.sh rename to share/tools/log_onewire.sh