function __construct(&$props) { parent::__construct($props); if ($this->dbname) { if (!strcmp($this->dbname, VIRTUALReader::SOURCE_TREE_ID)) { $virtual = $this->req->GetProp('virtual', false); if ($virtual) { $prop = $virtual; } else { $prop = "srctree"; } $srctree = $this->req->GetProp($prop); } else { $srctree = $this->opts->Get("srctree", false); if ($this->srctree === false) { throw new ADEIException(translate("Invalid database (%s) is specified", $this->dbname)); } } if (strcmp($this->dbname, VIRTUALReader::SOURCE_TREE_ID)) { $flags = 0; } else { $flags = SOURCETree::IGNORE_UIDS | SOURCETree::IGNORE_BADITEMS | SOURCETree::EXPAND_SERVERS; } $this->srctree = new SOURCETree($srctree, false, $flags); //$this->srctree->CastProps(array($this, "CastProps")); } $this->cache_reader = false; }
function __construct(&$props) { parent::__construct($props); $this->db = new DATABASE($this->server); $this->req_cols = "ID AS gid, full_name AS name, writable, facility, NULL as axis"; $this->data_table = "att_@gid@"; $this->data_cond = false; $this->ro_cols = array("value"); $this->rw_cols = array("read_value", "write_value"); }
function __construct(&$props, CACHEDB $cache = NULL) { parent::__construct($props); if ($cache) { $this->cache = $cache; } else { if ($props instanceof SOURCERequest) { $this->cache = new CACHEDB($props); } else { $this->cache = NULL; } } $opts = $this->req->GetOptions(); if ($opts->Get('use_cache_reader')) { $this->reader_access = false; } else { $this->reader_access = true; } }
function __construct(&$props) { parent::__construct($props); $this->items = array(array("name" => _("Line"), "func" => '$y=0', "noise" => 0.1), array("name" => _("Sinus"), "func" => '$y=sin(deg2rad($x/$period))'), array("name" => _("Cosinus"), "func" => '$y=cos(deg2rad($x/$period))')); if ($this->dbname) { $list = $this->opts->ListConfiguredGroups(); if ($list) { $this->groups = array(); foreach ($list as $gid) { $this->groups[$gid] = array(); } } else { $this->groups = array('default' => array('name' => _("Default Group"))); } } /* if (sizeof($list) > 1) { array_push($this->groups, array( 'id' => "-1", 'name' => _("Combined Group"), 'complex' => true ); } */ }
function __construct(&$props) { $this->no_default_time_module = true; parent::__construct($props); $this->db = new DATABASE($this->server); $this->groups = $this->opts->Get('groups'); $this->group_class = "DBLogGroup"; $this->tables = $this->opts->Get('tables'); $this->columns = $this->opts->Get('columns'); $this->data_request = false; $this->data_columns = array(); $this->custom_columns = array(); $this->time_column = false; $this->slicer_column = array(); $this->axes = false; $this->item_info = false; $this->group_info = false; $this->use_db_slicer = false; // Setting default Time Module. We are currently can't handle multiple time modules for a single server if (!$this->time_module) { // Creating Time Module for Standard SQL DateTime $this->time_format = $this->db->GetTimeFormat(); $this->time_module = new READERTime($this, array('format' => $this->time_format, 'timezone' => $this->time_zone)); $this->use_db_slicer = true; } $time_sort = $this->opts->Get("timesort", 1); if ($time_sort) { if (is_string($time_sort)) { $this->time_sort = $time_sort; $this->inverse_sort = $this->opts->Get("inverse_timesort"); } else { if ($time_sort > 0) { $this->time_sort = $this->db->col_quote . $this->columns['time'] . $this->db->col_quote . " ASC"; $this->inverse_sort = $this->db->col_quote . $this->columns['time'] . $this->db->col_quote . " DESC"; } else { $this->time_sort = $this->db->col_quote . $this->columns['time'] . $this->db->col_quote . " DESC"; $this->inverse_sort = $this->db->col_quote . $this->columns['time'] . $this->db->col_quote . " ASC"; } } } else { $this->time_sort = false; $this->inverse_sort = false; } $this->private_axes = $this->opts->Get("private_axes"); /* per db only, no per group handling here */ $this->emit_delays = $this->opts->Get("emit_delays"); $this->monitor_timings = $this->opts->Get("monitor_timings"); }
/** * class constructor * */ function __construct(&$props) { parent::__construct($props); # server parameter $server = $this->req->srv; $database = $server['database'][0]; $http_method = $server['http_method']; $host = $server['host']; $port = $server['port']; $username = $server['user']; $password = $server['password']; # options parameter $options = $this->opts; # credentials $credential = ""; if ($username && $password) { $credential = implode(":", array($username, $password)); $credential = $credential . "@"; } # ports if ($port) { $port = ":" . $port; } # build URL for queries $this->base_view_url = implode("", array($http_method . "://", $credential, $host, $port . "/", $database . "/", "_design/", "%design_view%/", "_view/")); $this->base_url = implode("", array($http_method . "://", $credential, $host, $port . "/", $database . "/")); $this->resample = $options->props['resample']; }
function __construct(&$props) { parent::__construct($props); $this->db = new DATABASE($this->server); switch ($this->server["driver"]) { case "odbc": $this->char_mode = true; break; default: $this->char_mode = false; } }
function __construct(&$props) { parent::__construct($props); $opts = $this->req->GetOptions(); if ($this->dbname) { $munin = $opts->Get('munin', false); if ($munin) { $db = $this->server['database']; $this->rrd_folder = $opts->Get('rrd_folder', "{$munin}/{$db}"); $this->rrd_prefix = $opts->Get('rrd_prefix', "{$db}-"); $this->munin_datafile = $opts->Get('munin_datafile', "{$munin}/datafile"); $this->munin_lockfile = $opts->Get('munin_lockfile', false); $this->munin_filter = "/^{$db};/"; } else { $this->rrd_folder = $opts->Get('rrd_folder', false); $this->rrd_prefix = $opts->Get('rrd_prefix', ""); $this->munin_datafile = $opts->Get('munin_datafile', false); $this->munin_filter = false; if ($this->rrd_folder) { throw new ADEIException(translate("Folder with RRD files is not specified")); } } $this->items = $this::ReadRRDs(); //items holds all the RRD files if (empty($this->items)) { throw new ADEIException(translate("No files found in the specified folder %s", $this->folder)); } if ($this->munin_datafile) { $this->groups = $this::GetMuninGroups(); //read Munin file groups from the specified Munin datafile if (!$this->groups) { throw new ADEIException("Can't parse munin groups"); } $this->axes = $this::CreateAxes(); } else { $this->munin_datafile = false; if ($this->items) { $this->groups = array(); foreach ($this->items as $gid) { if ($names[$gid]) { $name = $names[$gid]; } else { $name = false; } $this->groups[$gid] = array('name' => $name); } } } } else { } }