Created
January 4, 2012 22:29
-
-
Save favoretti/1562548 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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