Ignore:
Timestamp:
Apr 23, 2017, 5:41:30 PM (10 years ago)
Author:
Joachim Langenbach <joachim.langenbach@…>
Branches:
debian/bullseye, debian/jessie
Children:
12afe34
Parents:
e9ed726 (diff), 19ac332 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Joachim Langenbach <joachim.langenbach@…> (04/23/17 17:40:44)
git-committer:
Joachim Langenbach <joachim.langenbach@…> (04/23/17 17:41:30)
Message:

Merge branch 'master' into debian/jessie

Location:
src/webapp/webservice
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/webapp/webservice/inc/Config.php

    re9ed726 r7b68139  
    3535
    3636        public function databaseFile(){
    37                 return $this->dataDirectory() ."log-webservice.rrd";
     37                return $this->dataDirectory() ."gnuboat.rrd";
    3838        }
    39        
     39
    4040        public function shutdownRequestFile(){
    4141                if(array_key_exists("shutdownfile", $this->_config))
    … …  
    4343                return "/var/spool/gnuboat/shutdown.request";
    4444        }
    45        
     45
    4646        public function dataDirectory(){
    4747                if(array_key_exists("datadirectory", $this->_config))
    … …  
    4949                return __DIR__ ."/../data/";
    5050        }
    51        
     51
    5252        private static function addTrailingSlash($path){
    5353                $length = strlen($path);
    … …  
    5757                return $path;
    5858        }
    59        
     59
    6060        private $_config;
    6161}
  • src/webapp/webservice/index.php

    re9ed726 r7b68139  
    1616    along with this program.  If not, see <http://www.gnu.org/licenses/>.
    1717*/
     18
     19xdebug_start_trace();
    1820
    1921require_once(__DIR__ ."/inc/Config.php");
    … …  
    6365        $lastTime = -1;
    6466        $keys = array_keys($data);
    65         if(count($keys) < 0 ){
     67        $keyTimeframes = $keys[0];
     68        $itemCount = count($keys);
     69        if($itemCount < 0 ){
    6670                error_log("No keys in fetched rrd data from ". $dbFile);
    6771                echo json_encode("");
    6872                exit;
    6973        }
     74        $timeframesCount = count($data[$keyTimeframes]);
    7075        if($debug > 0){
    71                 echo "<p>Variables: ". count($keys) ."; Timeframes: ". count($data[$keys[0]]) ."</p>\n";
     76                echo "<p>Variables: ". $itemCount ."; Timeframes: ". $timeframesCount ."</p>\n";
    7277        }
    73         for($i = 0; $i < count($data[$keys[0]]); $i++){
    74                 $time = array_keys($data[$keys[0]])[$i];
     78        $keysTimeframes = array_keys($data[$keyTimeframes]);
     79        for($i = 0; $i < $timeframesCount; $i++){
     80                $time = $keysTimeframes[$i];
    7581                $allValid = true;
    7682                $tmp = array();
    … …  
    175181}
    176182
     183xdebug_stop_trace();
     184
    177185?>
  • src/webapp/webservice/tileserver.php

    re9ed726 r7b68139  
    294294      $this->db = new PDO('sqlite:' . $tileset, '', '', array(PDO::ATTR_PERSISTENT => true));
    295295    } catch (Exception $exc) {
    296       echo $exc->getTraceAsString();
     296      error_log($exc->getTraceAsString());
    297297      die;
    298298    }
    … …  
    300300    if (!isset($this->db)) {
    301301      header('Content-type: text/plain');
    302       echo 'Incorrect tileset name: ' . $tileset;
     302      error_log('Incorrect tileset name: ' . $tileset);
    303303      die;
    304304    }
    … …  
    401401    } else {
    402402      header('HTTP/1.1 404 Not Found');
    403       echo 'Server: Unknown or not specified dataset "' . $tileset . '"';
     403      error_log('Server: Unknown or not specified dataset "' . $tileset . '"');
    404404      die;
    405405    }
Note: See TracChangeset for help on using the changeset viewer.