"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "packages/web/lib/db/pdodb.class.php" between
fogproject-1.5.5.tar.gz and fogproject-1.5.6.tar.gz

About: FOG is a Linux-based network computer cloning solution for Windows, Mac OSX and various Linux distributions that ties together a few open-source tools with a PHP-based web interface. FOG doesn’t use any boot disks, or CDs; everything is done via TFTP and PXE.

pdodb.class.php  (fogproject-1.5.5):pdodb.class.php  (fogproject-1.5.6)
skipping to change at line 142 skipping to change at line 142
} }
/** /**
* Connects the database as needed. * Connects the database as needed.
* *
* @param bool $dbexists does db exist * @param bool $dbexists does db exist
* @param bool $always always test connection. * @param bool $always always test connection.
* *
* @throws PDOException * @throws PDOException
* @return object * @return object
*/ */
private function _connect($dbexists = true, $always = false) private function _connect($dbexists = true)
{ {
try { try {
if (self::$_link && !$always) { if (self::$_link) {
return $this; return $this;
} }
$type = DATABASE_TYPE; $type = DATABASE_TYPE;
$host = preg_replace('#p:#i', '', DATABASE_HOST); $host = preg_replace('#p:#i', '', DATABASE_HOST);
$user = DATABASE_USERNAME; $user = DATABASE_USERNAME;
$pass = DATABASE_PASSWORD; $pass = DATABASE_PASSWORD;
$dsn = sprintf( $dsn = sprintf(
'%s:host=%s;dbname=%s;charset=utf8', '%s:host=%s;dbname=%s;charset=utf8',
$type, $type,
$host, $host,
skipping to change at line 546 skipping to change at line 546
{ {
return self::$_dbName; return self::$_dbName;
} }
/** /**
* Returns the primary link * Returns the primary link
* *
* @return object * @return object
*/ */
public function link() public function link()
{ {
$this->_connect(true, true); if ($this->ping()) {
return self::$_link;
}
$this->_connect(true);
return self::$_link; return self::$_link;
} }
/** /**
* Returns the DB Link object
*
* @return boolean
*/
public function ping()
{
try {
if (self::$_link) {
if (self::$_link->query('SELECT 1')) {
return true;
}
}
} catch (PDOException $e) {
}
return (self::$_link = false);
}
/**
* Returns the item whatever this is * Returns the item whatever this is
* Could be database manager or pdodb. * Could be database manager or pdodb.
* *
* @return object * @return object
*/ */
public function returnThis() public function returnThis()
{ {
return $this; return $this;
} }
/** /**
 End of changes. 4 change blocks. 
3 lines changed or deleted 23 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)