Ejemplo n.º 1
0
 function __construct($options, $make_dsn)
 {
     // unpack dsn, connect to database, load current settings
     if ($make_dsn && ($this->dsn = Dbl::make_dsn($options))) {
         list($this->dblink, $options["dbName"]) = Dbl::connect_dsn($this->dsn);
     }
     if (!isset($options["confid"])) {
         $options["confid"] = get($options, "dbName");
     }
     $this->opt = $options;
     $this->dbname = $options["dbName"];
     if ($this->dblink && !Dbl::$default_dblink) {
         Dbl::set_default_dblink($this->dblink);
         Dbl::set_error_handler(array($this, "query_error_handler"));
     }
     if ($this->dblink) {
         Dbl::$landmark_sanitizer = "/^(?:Dbl::|Conf::q|call_user_func)/";
         $this->load_settings();
     } else {
         $this->crosscheck_options();
     }
 }
Ejemplo n.º 2
0
    }
}
set_memory_limit();
// Create the conference
// XXX more modern method
if (isset($Opt["dbName"])) {
    if (!isset($Opt["sessionName"])) {
        $Opt["sessionName"] = $Opt["dbName"];
    }
    if (!isset($Opt["downloadPrefix"])) {
        $Opt["downloadPrefix"] = $Opt["dbName"] . "-";
    }
}
global $Conf;
if (!@$Conf) {
    $Conf = new Conference(Dbl::make_dsn($Opt));
}
if (!$Conf->dblink) {
    Multiconference::fail_bad_database();
}
// Set server timezone
if (function_exists("date_default_timezone_set")) {
    if (isset($Opt["timezone"])) {
        date_default_timezone_set($Opt["timezone"]);
    } else {
        if (!ini_get("date.timezone") && !getenv("TZ")) {
            date_default_timezone_set("America/New_York");
        }
    }
}
// Extract problem set information
Ejemplo n.º 3
0
    }
}
if (!get($Opt, "loaded") || get($Opt, "missing")) {
    Multiconference::fail_bad_options();
}
if (get($Opt, "dbLogQueries")) {
    Dbl::log_queries($Opt["dbLogQueries"]);
}
// Allow lots of memory
function set_memory_limit()
{
    global $Opt;
    if (!get($Opt, "memoryLimit")) {
        $suf = array("" => 1, "k" => 1 << 10, "m" => 1 << 20, "g" => 1 << 30);
        if (preg_match(',\\A(\\d+)\\s*([kmg]?)\\z,', strtolower(ini_get("memory_limit")), $m) && $m[1] * $suf[$m[2]] < 128 << 20) {
            $Opt["memoryLimit"] = "128M";
        }
    }
    if (get($Opt, "memoryLimit")) {
        ini_set("memory_limit", $Opt["memoryLimit"]);
    }
}
set_memory_limit();
// Create the conference
global $Conf;
if (!$Conf) {
    $Conf = Conf::$g = new Conf(Dbl::make_dsn($Opt));
}
if (!$Conf->dblink) {
    Multiconference::fail_bad_database();
}