Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function __construct()
{
global $dataSourceName; //configuration variable, has all the information to connect to database
global $dbOpts; // configuration variable, has db operation options see config and PEAR DB module for details
global $logHandler;
global $logName;
global $logIdent;
global $logConf;
global $logLevel; //these are log configuration things. Make sure you've made your homework ;)
// mne nuzhny takie veschi
// molotok
self::$logger = &Log::singleton($logHandler, $logName, $logIdent.":Backend",$logConf, Log::MAX($logLevel));
self::$logger->setMask(Log::MAX($logLevel));
if (self::$logger === null ){
$str = "Warning: can not instantiate logger for some reason. Constructor returned null in CObject::__construct.";
$str.= " Logging will be disabled.\n";
echo $str;
}
// tiski
self::$db = &MDB2::connect($dataSourceName, $dbOpts);
if (PEAR::isError (self::$db)){
$err_mesg=self::$db->getMessage();
$this->logit("Can not construct CObject, reason $err_mesg",PEAR_LOG_EMERG);
throw new Exception($err_mesg);
}else{
$this->lastStatus=true;
}
// i kleschi
// kleschi poka ne podvezli, obojdemsja poka bez nih
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.