Changeset c455d7b for src/webapp/webservice/inc/GnuBoat/Config.php
- Timestamp:
- Aug 10, 2017, 6:05:33 PM (9 years ago)
- Branches:
- 0.5, app-cordova, debian/bullseye, debian/jessie, master
- Children:
- 6fec060
- Parents:
- 82b4b49
- File:
-
- 1 moved
-
src/webapp/webservice/inc/GnuBoat/Config.php (moved) (moved from src/webapp/webservice/inc/Config.php ) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/webapp/webservice/inc/GnuBoat/Config.php
r82b4b49 rc455d7b 17 17 */ 18 18 19 $configFile = __DIR__ ."/../config/config.php"; 20 if(file_exists($configFile)) 21 include($configFile); 22 else{ 23 error_log("No config file ". $configFile ." not found!"); 24 $config = array(); 25 } 19 namespace GNUBoat; 26 20 27 21 /** 28 22 * @brief Loads the configuration from webservice/config/config.php (if file exists) and provides the settings for usage 29 23 */ 30 class Config { 31 public function __construct(){ 32 global $config; 33 $this->_config = $config; 24 class Config 25 { 26 public function __construct() 27 { 28 $configFile = __DIR__ ."/../config/config.php"; 29 if(file_exists($configFile)){ 30 include($configFile); 31 $this->_config = $config; 32 } 33 else{ 34 $this->_config = array(); 35 } 34 36 } 35 37 36 public function databaseFile(){ 38 public function databaseFile() 39 { 37 40 return $this->dataDirectory() ."gnuboat.rrd"; 38 41 } 39 42 40 public function shutdownRequestFile(){ 43 public function shutdownRequestFile() 44 { 41 45 if(array_key_exists("shutdownfile", $this->_config)) 42 46 return $this->_config["shutdownfile"]; … … 44 48 } 45 49 46 public function dataDirectory(){ 50 public function dataDirectory() 51 { 47 52 if(array_key_exists("datadirectory", $this->_config)) 48 53 return addTrailingSlash($this->_config["datadirectory"]); … … 50 55 } 51 56 52 private static function addTrailingSlash($path){ 57 public function logDirectory() 58 { 59 if(array_key_exists("logdirectory", $this->_config)) 60 return addTrailingSlash($this->_config["logdirectory"]); 61 return "/var/log/gnuboat/"; 62 } 63 64 private static function addTrailingSlash($path) 65 { 53 66 $length = strlen($path); 54 67 if(substr($path, $length - 1, 1) != "/"){
Note:
See TracChangeset
for help on using the changeset viewer.
