Example #1
0
 /**
  * Private constructor to respect the singleton pattern
  */
 private function __construct()
 {
     self::$configVariables = array();
     $query = "SELECT * FROM `codev_config_table`";
     $result = SqlWrapper::getInstance()->sql_query($query);
     if (!$result) {
         echo "<span style='color:red'>ERROR: Query FAILED</span>";
         exit;
     }
     while ($row = SqlWrapper::getInstance()->sql_fetch_object($result)) {
         if (self::$logger->isDebugEnabled()) {
             self::$logger->debug("id={$row->config_id}, val={$row->value}, type={$row->type}");
         }
         $key = $row->config_id . "_" . $row->user_id . $row->project_id . $row->team_id . $row->servicecontract_id . $row->commandset_id . $row->command_id;
         self::$configVariables[$key] = new ConfigItem($row->config_id, $row->value, $row->type);
     }
     if (self::$logger->isEnabledFor(LoggerLevel::getLevelTrace())) {
         self::$logger->trace("Config ready");
     }
 }