本文整理汇总了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"));
}
示例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;
}
示例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'];
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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);
}