Exemplo n.º 1
0
 /**
  * Load settings from the config file.
  */
 private static function load()
 {
     // Read correct config file based on environment
     $env = '';
     if (isset($_SERVER['BINARYPOOL_CONFIG'])) {
         $env = $_SERVER['BINARYPOOL_CONFIG'];
     }
     $filename = API_PROJECT_DIR . "/conf/binarypool.php";
     if ($env != '' && file_exists($filename)) {
         $filename = API_PROJECT_DIR . '/conf/binarypool-' . $env . '.php';
     }
     include $filename;
     // Get values
     self::$buckets = $BUCKETS;
     self::$root = $ROOT;
     if (!file_exists(self::$root)) {
         mkdir(self::$root);
         if (!file_exists(self::$root)) {
             throw new binarypool_exception(107, 500, "Binary Pool path is not available.");
         }
     }
     self::$root = realpath(self::$root);
     if (self::$root[strlen(self::$root) - 1] !== '/') {
         self::$root .= '/';
     }
     self::$paths = $PATHS;
     self::$badUrlExpiry = $BADURLEXPIRY;
     self::$cacheRevalidate = $CACHEREVALIDATE;
     self::$useragent = $USERAGENT;
 }