本文整理汇总了PHP中waAppSettingsModel::getByField方法的典型用法代码示例。如果您正苦于以下问题:PHP waAppSettingsModel::getByField方法的具体用法?PHP waAppSettingsModel::getByField怎么用?PHP waAppSettingsModel::getByField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类waAppSettingsModel
的用法示例。
在下文中一共展示了waAppSettingsModel::getByField方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkUpdates
public function checkUpdates()
{
try {
$app_settings_model = new waAppSettingsModel();
$time = $app_settings_model->get($this->application, 'update_time');
} catch (waDbException $e) {
// Can't connect to MySQL server
if ($e->getCode() == 2002) {
throw $e;
} elseif (!empty($app_settings_model)) {
$time = null;
$row = $app_settings_model->getByField(array('app_id' => $this->application, 'name' => 'update_time'));
if ($row) {
$time = $row['value'];
}
} elseif ($this->application != 'webasyst' && $this->environment == 'frontend') {
wa('webasyst');
}
} catch (waException $e) {
return;
}
if (empty($time)) {
try {
$this->install();
} catch (waException $e) {
waLog::log($e->__toString());
throw $e;
}
$ignore_all = true;
$time = null;
} else {
$ignore_all = false;
}
if (!self::isDebug()) {
$cache = new waVarExportCache('updates', 0, $this->application);
if ($cache->isCached() && $cache->get() <= $time) {
return;
}
}
$path = $this->getAppPath() . '/lib/updates';
$cache_database_dir = $this->getPath('cache') . '/db';
if (file_exists($path)) {
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::SELF_FIRST);
$files = array();
foreach ($iterator as $file) {
/**
* @var SplFileInfo $file
*/
if ($file->isFile() && preg_match('/^[0-9]+\\.php$/', $file->getFilename())) {
$t = substr($file->getFilename(), 0, -4);
if ($t > $time) {
$files[$t] = $file->getPathname();
}
}
}
ksort($files);
if (!self::isDebug()) {
// get last time
if ($files) {
$keys = array_keys($files);
$cache->set(end($keys));
} else {
$cache->set($time ? $time : 1);
}
}
foreach ($files as $t => $file) {
try {
if (!$ignore_all) {
$this->includeUpdate($file);
waFiles::delete($cache_database_dir);
$app_settings_model->set($this->application, 'update_time', $t);
}
} catch (Exception $e) {
if (waSystemConfig::isDebug()) {
echo $e;
}
// log errors
waLog::log($e->__toString());
break;
}
}
} else {
$t = 1;
}
if ($ignore_all) {
if (!isset($t) || !$t) {
$t = 1;
}
if (!isset($app_settings_model)) {
$app_settings_model = new waAppSettingsModel();
}
$app_settings_model->set($this->application, 'update_time', $t);
}
if (isset($this->info['edition']) && $this->info['edition']) {
if (!isset($app_settings_model)) {
$app_settings_model = new waAppSettingsModel();
}
if (!$app_settings_model->get($this->application, 'edition')) {
$app_settings_model->set($this->application, 'edition', $this->info['edition']);
}
//.........这里部分代码省略.........