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


PHP HSetting::model方法代码示例

本文整理汇总了PHP中HSetting::model方法的典型用法代码示例。如果您正苦于以下问题:PHP HSetting::model方法的具体用法?PHP HSetting::model怎么用?PHP HSetting::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HSetting的用法示例。


在下文中一共展示了HSetting::model方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: disable

 /**
  * Disables a module
  *
  * Which means delete all (user-) data created by the module.
  *
  */
 public function disable()
 {
     if (!$this->isEnabled() || $this->isCoreModule) {
         return false;
     }
     // Check this module is a SpaceModule
     if ($this->isSpaceModule()) {
         foreach ($this->getSpaceModuleSpaces() as $space) {
             $space->disableModule($this->getId());
         }
     }
     // Check this module is a UserModule
     if ($this->isUserModule()) {
         foreach ($this->getUserModuleUsers() as $user) {
             $user->disableModule($this->getId());
         }
     }
     // Disable module in database
     $moduleEnabled = ModuleEnabled::model()->findByPk($this->getId());
     if ($moduleEnabled != null) {
         $moduleEnabled->delete();
     }
     HSetting::model()->deleteAllByAttributes(array('module_id' => $this->getId()));
     SpaceSetting::model()->deleteAllByAttributes(array('module_id' => $this->getId()));
     UserSetting::model()->deleteAllByAttributes(array('module_id' => $this->getId()));
     // Delete also records with disabled state from SpaceApplicationModule Table
     foreach (SpaceApplicationModule::model()->findAllByAttributes(array('module_id' => $this->getId())) as $sam) {
         $sam->delete();
     }
     // Delete also records with disabled state from UserApplicationModule Table
     foreach (UserApplicationModule::model()->findAllByAttributes(array('module_id' => $this->getId())) as $uam) {
         $uam->delete();
     }
     ModuleManager::flushCache();
     return true;
 }
开发者ID:ahdail,项目名称:humhub,代码行数:42,代码来源:HWebModule.php

示例2: GetRecord

 /**
  * Returns a registry record by Name and Module Id
  * The result is cached.
  *
  * @param type $name
  * @param type $moduleId
  * @return \HSetting
  */
 private static function GetRecord($name, $moduleId = "")
 {
     $cacheId = 'HSetting_' . $name . '_' . $moduleId;
     // Check if stored in Runtime Cache
     if (RuntimeCache::Get($cacheId) !== false) {
         return RuntimeCache::Get($cacheId);
     }
     // Check if stored in Cache
     $cacheValue = Yii::app()->cache->get($cacheId);
     if ($cacheValue !== false) {
         return $cacheValue;
     }
     $condition = "";
     $params = array('name' => $name);
     if ($moduleId != "") {
         $params['module_id'] = $moduleId;
     } else {
         $condition = "module_id IS NULL or module_id = ''";
     }
     $record = HSetting::model()->findByAttributes($params, $condition);
     if ($record == null) {
         $record = new HSetting();
         $record->name = $name;
         $record->module_id = $moduleId;
     }
     $expireTime = 3600;
     if ($record->name != 'expireTime' && $record->module_id != "cache") {
         $expireTime = HSetting::Get('expireTime', 'cache');
     }
     Yii::app()->cache->set($cacheId, $record, $expireTime);
     RuntimeCache::Set($cacheId, $record);
     return $record;
 }
开发者ID:crankyolditguy,项目名称:humhub,代码行数:41,代码来源:HSetting.php


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