本文整理汇总了PHP中Dataface_Table::getTableModificationTimes方法的典型用法代码示例。如果您正苦于以下问题:PHP Dataface_Table::getTableModificationTimes方法的具体用法?PHP Dataface_Table::getTableModificationTimes怎么用?PHP Dataface_Table::getTableModificationTimes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dataface_Table
的用法示例。
在下文中一共展示了Dataface_Table::getTableModificationTimes方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
function handle(&$params)
{
session_write_close();
set_time_limit(0);
import('Dataface/Index.php');
$index = new Dataface_Index();
if (@$_POST['--build-index']) {
if (is_array($_POST['--tables'])) {
$tables = $_POST['--tables'];
} else {
if (!empty($_POST['--tables'])) {
$tables = array($_POST['--tables']);
} else {
$tables = null;
}
}
if (@$_POST['--clear']) {
$clear = true;
} else {
$clear = false;
}
$index->buildIndex($tables, '*', $clear);
$app =& Dataface_Application::getInstance();
header('Location: ' . $app->url('') . '&--msg=' . urlencode('Successfully indexed database'));
exit;
}
$tables = array_keys(Dataface_Table::getTableModificationTimes());
$count = 0;
$indexable = array();
foreach ($tables as $key => $table) {
if (preg_match('/^dataface__/', $table)) {
continue;
}
if (preg_match('/^_/', $table)) {
continue;
}
if ($index->isTableIndexable($table)) {
$indexable[] = $table;
//unset($tables[$key]);
}
}
$tables = $indexable;
df_display(array('tables' => $tables), 'manage_build_index.html');
}
示例2: update
/**
* Checks to see if any of the dependent tables have been modified since this table
* was last modified. If so, it will drop the table and regenerate it.
*/
public function update()
{
$mod_times = \Dataface_Table::getTableModificationTimes();
if (!isset($mod_times[$this->tableName])) {
$me = 0;
} else {
$me = $mod_times[$this->tableName];
}
$outOfDate = false;
foreach ($this->dependencies as $dep) {
if (@$mod_times[$dep] > $me) {
$outOfDate = true;
break;
}
}
if ($outOfDate) {
\df_q("DROP TABLE IF EXISTS `" . str_replace('`', '', $this->tableName) . "`");
\df_q($this->sql);
import('Dataface/IO.php');
\Dataface_IO::touchTable($this->tableName);
}
}
示例3: memcache_get
function memcache_get($sql, $lang = null)
{
$app =& Dataface_Application::getInstance();
$memcache =& $app->memcache;
if (!@$app->_conf['cache_queries']) {
return null;
}
$key = $this->memcache_get_key($sql, $lang);
$tables = $this->getTableDependencies($sql, $lang);
if (PEAR::isError($tables)) {
return null;
}
// This is a list of the tables that would cause the cache to be invalidated.
$modification_times = Dataface_Table::getTableModificationTimes();
$mtime = 0;
foreach ($tables as $table) {
if (isset($modification_times[$table])) {
$mtime = max($mtime, $modification_times[$table]);
} else {
$t =& Dataface_Table::loadTable($table);
if (@$t->_atts['__source_tables__']) {
$ts = explode(',', $t->_atts['__source_tables__']);
foreach ($ts as $tst) {
if (isset($modification_times[trim($tst)])) {
$mtime = max($mtime, $modification_times[trim($tst)]);
} else {
$mtime = time();
break;
}
}
} else {
//echo "$table no modified date";
$mtime = time();
break;
}
unset($t);
}
}
// Now we will get the cached value if it is newer than $mtime
$cache_mtime = 0;
if ($memcache) {
$cache_mtime = $this->memcache_mtime($key);
} else {
$cache_mtime = $this->fcache_mtime($key);
}
//echo "Cache time for ".$this->fcache_path($key)." is $cache_mtime";
//echo "[$sql : $cache_mtime : $mtime]";
if ($cache_mtime > $mtime) {
if ($memcache) {
if ($result = $memcache->get($key)) {
return unserialize($result);
}
} else {
if (($result = $this->fcache_get($key)) !== null) {
return unserialize($result);
}
}
}
return null;
}
示例4:
/**
* Returns an associative array of table names and their associated
* update times as unix timestamps.
* eg: [Tablename] -> [Unix Timestamp]
*/
function &getTableModificationTimes()
{
$mod_times =& Dataface_Table::getTableModificationTimes();
$this->tableModificationTimes =& $mod_times;
return $mod_times;
}