当前位置: 首页>>代码示例>>PHP>>正文


PHP waAppSettingsModel::getByField方法代码示例

本文整理汇总了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']);
         }
//.........这里部分代码省略.........
开发者ID:cjmaximal,项目名称:webasyst-framework,代码行数:101,代码来源:waAppConfig.class.php


注:本文中的waAppSettingsModel::getByField方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。