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


PHP Config::getFlag方法代码示例

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


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

示例1: runBackgroundCron

 /**
  * running background cron for updating tree changes into solr
  */
 public static function runBackgroundCron()
 {
     $coreName = \CB\Config::get('core_name');
     if (\CB\Config::getFlag('disableTriggers') || \CB\Config::getFlag('disableSolrIndexing')) {
         return;
     }
     $cmd = 'php -f "' . \CB\CRONS_DIR . 'run_cron.php" -- -n solr_update_tree -c ' . $coreName . ' > ' . \CB\LOGS_DIR . 'bg_solr_update_tree.log &';
     if (\CB\IS_WINDOWS) {
         $cmd = 'start /D "' . \CB\CRONS_DIR . '" php -f "run_cron.php" -- -n solr_update_tree -c ' . $coreName . ' > ' . \CB\LOGS_DIR . 'bg_solr_update_tree.log';
     }
     pclose(popen($cmd, "r"));
 }
开发者ID:austinvernsonger,项目名称:casebox,代码行数:15,代码来源:Client.php

示例2: create

 /**
  * create method
  * @return void
  */
 public function create($p = false)
 {
     //disable default log from parent Object class
     //we'll set comments add as comment action for parent
     $disableLogFlag = \CB\Config::getFlag('disableActivityLog');
     \CB\Config::setFlag('disableActivityLog', true);
     $rez = parent::create($p);
     \CB\Config::setFlag('disableActivityLog', $disableLogFlag);
     $p =& $this->data;
     $this->parentObj = Objects::getCachedObject($p['pid']);
     $this->updateParentFollowers();
     $this->logAction('file_upload', array('file' => array('id' => $p['id'], 'name' => $p['name'])));
     return $rez;
 }
开发者ID:sebbie42,项目名称:casebox,代码行数:18,代码来源:File.php

示例3: add

 /**
  * add an action to log
  * @param array $p action params
  *     array(
  *       @varchar "type" - action type
  *       ,object "old" - old object
  *       ,object "new" - new object
  *     )
  * @return int logged action id
  */
 public static function add(&$p)
 {
     $userId = User::getId();
     //check if log not disabled
     if (Config::getFlag('disableActivityLog') || empty($userId)) {
         return;
     }
     $data = empty($p['new']) ? empty($p['old']) ? $p['data'] : $p['old']->getData() : $p['new']->getData();
     fireEvent('beforelogadd', $p);
     $p['logData'] = static::getLogData($p);
     $p['activityData'] = static::getActivityData($data);
     $params = array('object_id' => $data['id'], 'object_pid' => @$data['pid'], 'user_id' => $userId, 'action_type' => $p['type'], 'data' => Util\jsonEncode($p['logData']), 'activity_data_db' => Util\jsonEncode($p['activityData']));
     $p['action_id'] = DM\Log::create($params);
     $params['id'] = $p['action_id'];
     static::addSolrRecord($p);
     static::addNotificationRecords($params);
     fireEvent('logadd', $p);
     return $p['action_id'];
 }
开发者ID:ameliefranco,项目名称:casebox,代码行数:29,代码来源:Log.php

示例4: setUp

 public function setUp()
 {
     $this->oldValues = array('user_id' => $_SESSION['user']['id'], 'userVerified' => empty($_SESSION['verified']), 'solrIndexing' => \CB\Config::getFlag('disableSolrIndexing'));
     $_SESSION['verified'] = true;
     \CB\Config::setFlag('disableSolrIndexing', true);
     /* create users */
     $usersData = Data\Providers::createUsersData();
     $this->userIds = array();
     foreach ($usersData[0] as $data) {
         $this->userIds[] = $this->createUser($data);
     }
     /* create objects for test notifications on them */
     $objectsData = Data\Providers::createTasksData();
     $userIds = $this->userIds;
     $id = array_shift($userIds);
     array_push($userIds, $id);
     foreach ($objectsData[0] as $data) {
         $data['data']['assigned'] = array_shift($userIds);
         $this->objectIds[] = $this->createObject($data);
     }
 }
开发者ID:austinvernsonger,项目名称:casebox,代码行数:21,代码来源:NotificationsTest.php

示例5: setUp

 public function setUp()
 {
     $this->oldValues = array('user_id' => $_SESSION['user']['id'], 'userVerified' => empty($_SESSION['verified']), 'solrIndexing' => Config::getFlag('disableSolrIndexing'));
     $_SESSION['verified'] = true;
     Config::setFlag('disableSolrIndexing', true);
 }
开发者ID:sebbie42,项目名称:casebox,代码行数:6,代码来源:SearchTest.php

示例6: logAction

 /**
  * add action to log
  * @param  varchar $type
  * @param  array   $params
  * @return void
  */
 protected function logAction($type, $params = array())
 {
     if (!Cache::get('disable_logs', false) && !Config::getFlag('disableActivityLog')) {
         $params['type'] = $type;
         $obj =& $this;
         if (empty($params['new'])) {
             $params['new'] =& $this;
         } else {
             $obj =& $params['new'];
         }
         $logActionId = Log::add($params);
         $uid = User::getId();
         //add action to object sys_data
         $data = $obj->getData();
         $lastAction = $obj->getLastActionData();
         if ($lastAction['type'] != $type) {
             $lastAction = array('type' => $type, 'time' => Util\dateMysqlToISO('now'), 'users' => array());
         }
         /*$sysData = empty($data['sys_data'])
                         ? $this->getSysData()
                         : $data['sys_data'];
         
                     $lastAction = array(
                         'type' => $type
                         ,'time' => Util\dateMysqlToISO('now')
                         ,'users' => array()
                     );
         
                     if (!empty($sysData['lastAction']) &&
                         ($sysData['lastAction']['type'] == $type)
                     ) {
                         $lastAction['users'] = $sysData['lastAction']['users'];
                     } /**/
         unset($lastAction['users'][$uid]);
         $lastAction['users'][$uid] = $logActionId;
         $obj->setSysDataProperty('lastAction', $lastAction);
     }
 }
开发者ID:ameliefranco,项目名称:casebox,代码行数:44,代码来源:Object.php

示例7: save

 /**
  * save or create an object
  * @param  array $p object properties
  * @return json  responce
  */
 public function save($p)
 {
     $d = Util\toJSONArray($p['data']);
     // check if need to create object instead of update
     if (empty($d['id']) || !is_numeric($d['id'])) {
         return $this->create($d);
     }
     // SECURITY: check if current user has write access to this action
     if (!Security::canWrite($d['id'])) {
         throw new \Exception(L\get('Access_denied'));
     }
     /* prepare params */
     if (empty($d['date']) && !empty($d['date_start'])) {
         $d['date'] = $d['date_start'];
     }
     /* end of prepare params */
     // update object
     $object = $this->getCachedObject($d['id']);
     //set sys_data from object, it can contain custom data
     //that shouldn't be overwritten
     $d['sys_data'] = $object->getSysData();
     $object->update($d);
     Objects::updateCaseUpdateInfo($d['id']);
     /* updating saved document into solr directly (before runing background cron)
        so that it'll be displayed with new name without delay */
     if (!\CB\Config::getFlag('disableSolrIndexing')) {
         $solrClient = new Solr\Client();
         $solrClient->updateTree(array('id' => $d['id']));
         //running background cron to index other nodes
         $solrClient->runBackgroundCron();
     }
     return $this->load($d);
 }
开发者ID:ameliefranco,项目名称:casebox,代码行数:38,代码来源:Objects.php


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