Skip to content

Instantly share code, notes, and snippets.

@favoretti
Created January 4, 2012 22:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save favoretti/1562548 to your computer and use it in GitHub Desktop.
Save favoretti/1562548 to your computer and use it in GitHub Desktop.
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