databasemanager.class.php (fogproject-1.5.5) | : | databasemanager.class.php (fogproject-1.5.6) | ||
---|---|---|---|---|
skipping to change at line 34 | skipping to change at line 34 | |||
class DatabaseManager extends FOGCore | class DatabaseManager extends FOGCore | |||
{ | { | |||
/** | /** | |||
* Initiate the connection to the database. | * Initiate the connection to the database. | |||
* | * | |||
* @return object | * @return object | |||
*/ | */ | |||
public static function establish() | public static function establish() | |||
{ | { | |||
/** | /** | |||
* Certain scripts don't use the database at all | ||||
* so we skip connecting to the DB entirely for those. | ||||
*/ | ||||
$noDBpattern = array( | ||||
'status\/bandwidth\.php$', | ||||
'status\/freespace\.php$', | ||||
'status\/getfiles\.php$', | ||||
'status\/gethash\.php$', | ||||
'status\/getservertime\.php$', | ||||
'status\/getsize\.php$', | ||||
'status\/hw\.php$', | ||||
'status\/newtoken\.php$' | ||||
); | ||||
$noDBpattern = '#'.implode($noDBpattern, "|").'#'; | ||||
if (preg_match($noDBpattern, self::$scriptname)) { | ||||
return; | ||||
} | ||||
/** | ||||
* If the db is already connected, | * If the db is already connected, | |||
* return immediately. | * return immediately. | |||
*/ | */ | |||
if (self::$DB) { | if (self::$DB) { | |||
return new self; | return new self; | |||
} | } | |||
/** | /** | |||
* Establish connection. | * Establish connection. | |||
*/ | */ | |||
self::$DB = new PDODB(); | self::$DB = new PDODB(); | |||
skipping to change at line 67 | skipping to change at line 85 | |||
/** | /** | |||
* If it is, and we don't have a link and the | * If it is, and we don't have a link and the | |||
* script is not using dbrunning, inform the | * script is not using dbrunning, inform the | |||
* calling script that the db is unavailable. | * calling script that the db is unavailable. | |||
*/ | */ | |||
if (($testscript | if (($testscript | |||
&& !self::getLink() | && !self::getLink() | |||
&& false === strpos(self::$scriptname, 'dbrunning')) | && false === strpos(self::$scriptname, 'dbrunning')) | |||
) { | ) { | |||
echo json_encode(_('A valid database connection could not be made')) ; | echo json_encode(_('A valid database connection could not be made')) ; | |||
if (self::$json | exit(10); | |||
|| self::$ajax | ||||
) { | ||||
exit(10); | ||||
} | ||||
} | } | |||
/** | /** | |||
* Get the version | * Get the version | |||
*/ | */ | |||
self::_getVersion(); | self::_getVersion(); | |||
/** | /** | |||
* If the installed schema is greater than or equal to the | * If the installed schema is greater than or equal to the | |||
* installed version, return immediately. | * installed version, return immediately. | |||
*/ | */ | |||
if (self::$mySchema >= FOG_SCHEMA) { | if (self::$mySchema >= FOG_SCHEMA) { | |||
End of changes. 2 change blocks. | ||||
5 lines changed or deleted | 19 lines changed or added |