Subversion Repositories PHPX

Compare Revisions

Last modification

Ignore whitespace Rev 72 → Rev 73

/trunk/Db/MySQLDB.php
121,4 → 121,47
. (!is_null($this->_charset) ? ";charset={$this->_charset}" : ''),
$username, $password, null, $force);
}
 
/**
* Returns the date of last modification of this database or
* one of its tables.
*
* @param string $table (optional)
* Table name. If not provided, all tables of this database
* are considered.
* @return int|null
* Timestamp of last modification, or <code>null</code> if
* unavailable.
*/
public function getLastModified ($table = null)
{
$filter = array('TABLE_SCHEMA' => $this->_dbname);
 
if ($table !== null)
{
$filter['TABLE_NAME'] = $table;
}
 
$times = $this->select(
'`information_schema`.`tables`',
array('CREATE_TIME', 'UPDATE_TIME'),
$filter,
array('UPDATE_TIME DESC', 'CREATE_TIME DESC'),
1
);
 
$modi = ($times ? $times[0] : null);
 
if ($modi)
{
$modi = $modi['UPDATE_TIME'] ?: $modi['CREATE_TIME'];
 
if ($modi)
{
$modi = strtotime($modi . ' GMT');
}
}
 
return $modi;
}
}