本文整理汇总了PHP中CSCacheAPC::getMem方法的典型用法代码示例。如果您正苦于以下问题:PHP CSCacheAPC::getMem方法的具体用法?PHP CSCacheAPC::getMem怎么用?PHP CSCacheAPC::getMem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSCacheAPC
的用法示例。
在下文中一共展示了CSCacheAPC::getMem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: expireCache
public function expireCache()
{
if (isset($_SESSION['lhc_chat_config'])) {
unset($_SESSION['lhc_chat_config']);
}
if ($this->expiredInRuntime == false) {
$this->expiredInRuntime = true;
foreach ($this->expireOptions as $option) {
$this->setSetting('cachetimestamps', $option, 0);
}
foreach ($this->sessionExpireOptions as $option) {
if (isset($_SESSION[$option])) {
unset($_SESSION[$option]);
}
}
$compiledModules = ezcBaseFile::findRecursive('cache/cacheconfig', array('@\\.cache\\.php@'));
foreach ($compiledModules as $compiledClass) {
unlink($compiledClass);
}
$compiledTemplates = ezcBaseFile::findRecursive('cache/compiledtemplates', array('@(\\.php|\\.js|\\.css)@'));
foreach ($compiledTemplates as $compiledTemplate) {
unlink($compiledTemplate);
}
$instance = CSCacheAPC::getMem();
$instance->increaseImageManipulationCache();
$this->save();
}
}
示例2: getTranslatedURL
public static function getTranslatedURL($url, $suburl = '')
{
$cache = CSCacheAPC::getMem();
$cacheKey = md5('site_version_' . $cache->getCacheVersion('site_version') . '_alias_' . $url . '_' . $suburl);
if (($returnAlias = $cache->restore($cacheKey)) === false) {
$url = erLhcoreClassCharTransform::TransformToURL($url);
$returnAlias = false;
if ($returnAlias !== false) {
$cache->store($cacheKey, $returnAlias);
}
}
return $returnAlias;
}
示例3: fetchCache
public static function fetchCache($identifier)
{
if (self::$disableCache == false && isset($GLOBALS['lhc_erLhcoreClassModelChatConfig' . $identifier])) {
return $GLOBALS['lhc_erLhcoreClassModelChatConfig' . $identifier];
}
$cache = CSCacheAPC::getMem();
$configArray = $cache->getArray('lhc_chat_config');
if (isset($configArray[$identifier])) {
return $configArray[$identifier];
} else {
$_SESSION['lhc_chat_config'][$identifier] = self::fetch($identifier);
return $_SESSION['lhc_chat_config'][$identifier];
}
}
示例4: changeStatus
public static function changeStatus($params)
{
$changeStatus = $params['status'];
$chat = $params['chat'];
$userData = $params['user'];
$allowCloseRemote = $params['allow_close_remote'];
if ($changeStatus == erLhcoreClassModelChat::STATUS_ACTIVE_CHAT) {
if ($chat->status != erLhcoreClassModelChat::STATUS_ACTIVE_CHAT) {
$chat->status = erLhcoreClassModelChat::STATUS_ACTIVE_CHAT;
$chat->wait_time = time() - $chat->time;
}
if ($chat->user_id == 0) {
$chat->user_id = $userData->id;
}
$chat->updateThis();
} elseif ($changeStatus == erLhcoreClassModelChat::STATUS_PENDING_CHAT) {
$chat->status = erLhcoreClassModelChat::STATUS_PENDING_CHAT;
$chat->support_informed = 0;
$chat->has_unread_messages = 1;
$chat->updateThis();
} elseif ($changeStatus == erLhcoreClassModelChat::STATUS_CLOSED_CHAT && $chat->user_id == $userData->id || $allowCloseRemote == true) {
if ($chat->status != erLhcoreClassModelChat::STATUS_CLOSED_CHAT) {
$chat->status = erLhcoreClassModelChat::STATUS_CLOSED_CHAT;
$chat->chat_duration = erLhcoreClassChat::getChatDurationToUpdateChatID($chat->id);
$msg = new erLhcoreClassModelmsg();
$msg->msg = (string) $userData . ' ' . erTranslationClassLhTranslation::getInstance()->getTranslation('chat/closechatadmin', 'has closed the chat!');
$msg->chat_id = $chat->id;
$msg->user_id = -1;
$chat->last_user_msg_time = $msg->time = time();
erLhcoreClassChat::getSession()->save($msg);
$chat->updateThis();
CSCacheAPC::getMem()->removeFromArray('lhc_open_chats', $chat->id);
// Execute callback for close chat
erLhcoreClassChat::closeChatCallback($chat, $userData);
}
} elseif ($changeStatus == erLhcoreClassModelChat::STATUS_CHATBOX_CHAT) {
$chat->status = erLhcoreClassModelChat::STATUS_CHATBOX_CHAT;
erLhcoreClassChat::getSession()->update($chat);
} elseif ($changeStatus == erLhcoreClassModelChat::STATUS_OPERATORS_CHAT) {
$chat->status = erLhcoreClassModelChat::STATUS_OPERATORS_CHAT;
erLhcoreClassChat::getSession()->update($chat);
}
erLhcoreClassChat::updateActiveChats($chat->user_id);
if ($chat->department !== false) {
erLhcoreClassChat::updateDepartmentStats($chat->department);
}
}
示例5: getList
public static function getList($paramsSearch = array())
{
$paramsDefault = array('limit' => 500, 'offset' => 0);
$params = array_merge($paramsDefault, $paramsSearch);
if (isset($params['enable_sql_cache']) && $params['enable_sql_cache'] == true) {
$sql = self::multi_implode(',', $params);
$cache = CSCacheAPC::getMem();
$cacheKey = isset($params['cache_key']) ? md5($sql . $params['cache_key']) : md5('objects_list_' . strtolower(__CLASS__) . '_v_' . $cache->getCacheVersion('site_attributes_version_' . strtolower(__CLASS__)) . $sql);
if (($result = $cache->restore($cacheKey)) !== false) {
return $result;
}
}
$session = self::getSession();
$q = $session->createFindQuery(__CLASS__);
$conditions = self::getConditions($params, $q);
if (count($conditions) > 0) {
$q->where($conditions);
}
if ($params['limit'] !== false) {
$q->limit($params['limit'], $params['offset']);
}
if (!isset($params['sort']) || $params['sort'] !== false) {
if (isset(self::$dbDefaultSort)) {
$q->orderBy(isset($params['sort']) ? $params['sort'] : self::$dbDefaultSort);
} else {
$q->orderBy(isset($params['sort']) ? $params['sort'] : self::$dbTable . "." . self::$dbTableId . " " . self::$dbSortOrder);
}
}
$objects = $session->find($q);
if (isset($params['prefill_attributes'])) {
foreach ($params['prefill_attributes'] as $attr => $prefillOptions) {
$teamsId = array();
foreach ($objects as $object) {
$teamsId[] = $object->{$prefillOptions}['attr_id'];
}
if (!empty($teamsId)) {
$teams = call_user_func($object->{$prefillOptions}['function'], array('limit' => false, 'sort' => false, 'filterin' => array('id' => $teamsId)));
foreach ($objects as &$object) {
if (isset($teams[$object->{$prefillOptions}['attr_id']])) {
$object->{$prefillOptions}['attr_name'] = $teams[$object->{$prefillOptions}['attr_id']];
}
}
}
}
}
if (isset($params['enable_sql_cache']) && $params['enable_sql_cache'] == true) {
if (isset($params['sql_cache_timeout'])) {
$cache->store($cacheKey, $objects, $params['sql_cache_timeout']);
} else {
$cache->store($cacheKey, $objects);
}
}
return $objects;
}
示例6: canReopenDirectly
public static function canReopenDirectly($params = array())
{
if (($chatPart = CSCacheAPC::getMem()->getSession('chat_hash_widget_resume', true)) !== false) {
try {
$parts = explode('_', $chatPart);
$chat = erLhcoreClassModelChat::fetch($parts[0]);
if (($chat->last_user_msg_time > time() - 600 || $chat->last_user_msg_time == 0) && (!isset($params['reopen_closed']) || $params['reopen_closed'] == 1 || $params['reopen_closed'] == 0 && $chat->status != erLhcoreClassModelChat::STATUS_CLOSED_CHAT)) {
return array('id' => $parts[0], 'hash' => $parts[1]);
} else {
return false;
}
} catch (Exception $e) {
return false;
}
}
return false;
}
示例7: array
}
}
?>
</div></div></div><script>$( document ).ready(function() {lhinst.attachTabNavigator();$('#right-column-page').removeAttr('id');$('#tabs a:first').tab('show')});<?php
$chatsOpen = CSCacheAPC::getMem()->getArray('lhc_open_chats');
if (!empty($chatsOpen)) {
$chats = erLhcoreClassChat::getList(array('filterin' => array('id' => $chatsOpen)));
$deleteKeys = array_diff($chatsOpen, array_keys($chats));
foreach ($deleteKeys as $chat_id) {
CSCacheAPC::getMem()->removeFromArray('lhc_open_chats', $chat_id);
}
foreach ($chats as $chat) {
if (erLhcoreClassChat::hasAccessToRead($chat)) {
echo "lhinst.startChat('{$chat->id}',\$('#tabs'),'" . erLhcoreClassDesign::shrt($chat->nick, 10, '...', 30, ENT_QUOTES) . "');";
} else {
CSCacheAPC::getMem()->removeFromArray('lhc_open_chats', $chat->id);
}
}
}
?>
</script><?php
} else {
?>
<h1>System configuration</h1><?php
$currentUser = erLhcoreClassUser::instance();
?>
<div role="tabpanel"><ul class="nav nav-tabs" role="tablist"><li role="presentation" class="active"><a href="#system" aria-controls="system" role="tab" data-toggle="tab">System</a></li><?php
$system_configuration_tabs_generate_js_enabled = true;
if ($system_configuration_tabs_generate_js_enabled == true && $currentUser->hasAccessTo('lhsystem', 'generate_js_tab')) {
?>
<li role="presentation"><a href="#embed" aria-controls="embed" role="tab" data-toggle="tab">Embed code</a></li><?php
开发者ID:niravpatel2008,项目名称:north-american-nemesis-new,代码行数:31,代码来源:5d0370c4f43d45420ba48ede3ad4b44f.php
示例8: time
// Set last message ID
if ($Chat->last_msg_id < $msg->id) {
$Chat->last_msg_id = $msg->id;
}
// Delete legacy messages, propability 1 of 100
if (1 == mt_rand(1, 100)) {
erLhcoreClassChatbox::cleanupChatbox($Chat);
}
$Chat->last_user_msg_time = $msg->time = time();
$Chat->has_unread_messages = 1;
$Chat->updateThis();
if ($Params['user_parameters_unordered']['render'] == 'true') {
$tpl = erLhcoreClassTemplate::getInstance('lhchatbox/render.tpl.php');
$tpl->set('msg', $msg);
$tpl->set('chat', $Chat);
$content = $tpl->fetch();
$parts = explode('{{SPLITTER}}', $content);
$partsReturn['or'] = $parts[0];
$partsReturn['ur'] = $parts[1];
}
// Just increase cache version upon message ad
CSCacheAPC::getMem()->increaseCacheVersion('chatbox_' . erLhcoreClassChatbox::getIdentifierByChatId($Chat->id));
echo json_encode(array('error' => $error, 'id' => $msg->id, 'or' => $partsReturn['or'], 'ur' => $partsReturn['ur'], 'sender' => $sender));
exit;
}
} else {
$error = 't';
$partsReturn['or'] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Please enter a message, max characters') . ' - ' . (int) erLhcoreClassModelChatConfig::fetch('max_message_length')->current_value;
echo json_encode(array('error' => $error, 'or' => $partsReturn['or']));
exit;
}
示例9: storeCache
function storeCache()
{
if (is_null($this->cacheWriter)) {
$this->cacheWriter = new erLhcoreClassCacheStorage('cache/cacheconfig/');
}
try {
$this->cacheWriter->store('templateCache', $this->cacheTemplates);
} catch (Exception $e) {
// Do nothing, this happens on a lot of requests
}
$cacheObj = CSCacheAPC::getMem();
$cacheObj->store('templateCacheArray_version_' . $cacheObj->getCacheVersion('site_version'), $this->cacheTemplates);
}
示例10: die
<?php
if (!$currentUser->validateCSFRToken($Params['user_parameters_unordered']['csfr'])) {
die('Invalid CSFR Token');
exit;
}
$ObjectData = erLhcoreClassAbstract::getSession()->load('erLhAbstractModel' . $Params['user_parameters']['identifier'], (int) $Params['user_parameters']['object_id']);
$object_trans = $ObjectData->getModuleTranslations();
if (isset($object_trans['permission']) && !$currentUser->hasAccessTo($object_trans['permission']['module'], $object_trans['permission']['function'])) {
erLhcoreClassModule::redirect();
exit;
}
if (method_exists($ObjectData, 'checkPermission')) {
if ($ObjectData->checkPermission() === false) {
erLhcoreClassModule::redirect();
exit;
}
}
$ObjectData->removeThis();
$cache = CSCacheAPC::getMem();
$cache->increaseCacheVersion('site_attributes_version');
erLhcoreClassModule::redirect('abstract/list', '/' . $Params['user_parameters']['identifier']);
exit;
示例11: __get
public function __get($var)
{
switch ($var) {
case 'is_active':
$this->is_active = $this->request > 0 && ($this->expires == 0 || $this->expires > time()) && $this->suspended == 0 && $this->reseller_suspended == 0;
return $this->is_active;
break;
case 'sms_used_percentenge':
return round($this->sms_left / $this->sms_plan * 100, 2);
break;
case 'soft_limit_in_effect':
$soft_limit_in_effect = false;
if ($this->soft_limit_type == 0 && $this->sms_left / $this->sms_plan * 100 < $this->soft_limit) {
$soft_limit_in_effect = true;
} elseif ($this->soft_limit_type == 1 && $this->sms_left < $this->soft_limit) {
$soft_limit_in_effect = true;
}
return $soft_limit_in_effect;
break;
case 'hard_limit_in_effect':
$hard_limit_in_effect = false;
if ($this->hard_limit_type == 0 && $this->sms_left / $this->sms_plan * 100 < $this->hard_limit) {
$hard_limit_in_effect = true;
} elseif ($this->hard_limit_type == 1 && $this->sms_left < $this->hard_limit) {
$hard_limit_in_effect = true;
}
return $hard_limit_in_effect;
break;
case 'can_send_sms':
$this->can_send_sms = $this->sms_supported == true && $this->hard_limit_in_effect == false;
return $this->can_send_sms;
break;
case 'phone_response':
$this->phone_response = $this->phone_response_data;
return $this->phone_response;
break;
case 'phone_response_timeout':
$this->phone_response_timeout = $this->phone_response_timeout_data;
return $this->phone_response_timeout;
break;
case 'phone_number_departments':
$this->phone_number_departments = array();
foreach ($this->phone_number as $phoneData) {
if ($phoneData['phone'] != '') {
$this->phone_number_departments[$phoneData['phone']] = $phoneData['department'];
}
}
return $this->phone_number_departments;
break;
case 'phone_number_first':
$this->phone_number_first = '';
foreach ($this->phone_number as $phone) {
if ($phone['phone'] != '') {
$this->phone_number_first = $phone['phone'];
return $this->phone_number_first;
}
}
return $this->phone_number_first;
break;
case 'phone_number':
$phoneNumber = json_decode($this->phone_number_data, true);
if ($phoneNumber !== false) {
$this->phone_number = $phoneNumber;
} else {
$this->phone_number = array(array('phone' => $this->phone_number_data, 'department' => 0));
}
for ($i = count($this->phone_number); $i < 15; $i++) {
$this->phone_number = array(array('phone' => '', 'department' => 0));
}
return $this->phone_number;
break;
case 'translation_config':
if (($this->translation_config = CSCacheAPC::getMem()->getSession('automatic_translations')) == false) {
$db = ezcDbInstance::get();
$cfg = erConfigClassLhConfig::getInstance();
$db->query('USE ' . $cfg->getSetting('db', 'database'));
// Fetches from manager
$this->translation_config = erLhcoreClassModelChatConfig::fetch('translation_data')->data;
$db->query('USE ' . $cfg->getSetting('db', 'database_user_prefix') . erLhcoreClassInstance::$instanceChat->id);
CSCacheAPC::getMem()->setSession('automatic_translations', $this->translation_config);
}
return $this->translation_config;
break;
case 'reseller_instances_count':
$db = ezcDbInstance::get();
$cfg = erConfigClassLhConfig::getInstance();
$db->query('USE ' . $cfg->getSetting('db', 'database'));
$this->reseller_instances_count = self::getCount(array('filter' => array('reseller_id' => $this->id)));
$db->query('USE ' . $cfg->getSetting('db', 'database_user_prefix') . erLhcoreClassInstance::$instanceChat->id);
return $this->reseller_instances_count;
break;
case 'client_attributes_array':
$this->client_attributes_array = json_decode($this->client_attributes, true);
if (!is_array($this->client_attributes_array)) {
$this->client_attributes_array = array();
}
return $this->client_attributes_array;
break;
default:
break;
//.........这里部分代码省略.........
示例12: prefillObjects
public static function prefillObjects(&$objects, $attrs = array(), $params = array())
{
$cache = CSCacheAPC::getMem();
foreach ($attrs as $attr) {
$ids = array();
foreach ($objects as $object) {
if (is_array($attr[0])) {
if (is_object($object->{$attr[0][0]}) && $object->{$attr[0][0]}->{$attr[0][1]} > 0) {
$ids[] = $object->{$attr[0][0]}->{$attr[0][1]};
}
} else {
if ($object->{$attr[0]} > 0) {
$ids[] = $object->{$attr[0]};
}
}
}
$ids = array_unique($ids);
if (!empty($ids)) {
// First try to fetch from memory
if (isset($params['use_cache'])) {
list($class) = explode('::', $attr[2]);
$class = strtolower($class);
$cacheKeyPrefix = $cache->cacheGlobalKey . 'object_' . $class . '_';
$cacheKeyPrefixStore = 'object_' . $class . '_';
$cacheKeys = array();
foreach ($ids as $id) {
$cacheKeys[] = $cacheKeyPrefix . $id;
}
$cachedObjects = $cache->restoreMulti($cacheKeys);
if (!empty($cachedObjects)) {
foreach ($objects as &$item) {
if (is_array($attr[0])) {
if (isset($cachedObjects[$cacheKeyPrefix . $item->{$attr[0][0]}->{$attr[0][1]}]) && $cachedObjects[$cacheKeyPrefix . $item->{$attr[0][0]}->{$attr[0][1]}] !== false) {
$item->{$attr[1][0]}->{$attr[1][1]} = $cachedObjects[$cacheKeyPrefix . $item->{$attr[0][0]}->{$attr[0][1]}];
$key = array_search($item->{$attr[0][0]}->{$attr[0][1]}, $ids);
if ($key !== false) {
unset($ids[$key]);
}
}
} else {
if (isset($cachedObjects[$cacheKeyPrefix . $item->{$attr[0]}]) && $cachedObjects[$cacheKeyPrefix . $item->{$attr[0]}] !== false) {
$item->{$attr[1]} = $cachedObjects[$cacheKeyPrefix . $item->{$attr[0]}];
$key = array_search($item->{$attr[0]}, $ids);
if ($key !== false) {
unset($ids[$key]);
}
}
}
}
}
}
// Check again that ID's were not filled
if (!empty($ids)) {
$filter_attr = 'id';
if (isset($attr[3]) && $attr[3]) {
$filter_attr = $attr[3];
}
$objectsPrefill = call_user_func($attr[2], array('limit' => false, 'filterin' => array($filter_attr => $ids)));
if ($filter_attr != 'id') {
$objectsPrefillNew = array();
foreach ($objectsPrefill as $key => $value) {
$objectsPrefillNew[$value->{$filter_attr}] = $value;
}
$objectsPrefill = $objectsPrefillNew;
}
foreach ($objects as &$item) {
if (is_array($attr[0])) {
if (is_object($item->{$attr[0][0]}) && isset($objectsPrefill[$item->{$attr[0][0]}->{$attr[0][1]}])) {
$item->{$attr[1][0]}->{$attr[1][1]} = $objectsPrefill[$item->{$attr[0][0]}->{$attr[0][1]}];
if (isset($params['use_cache']) && $params['use_cache'] == true) {
$cache->store($cacheKeyPrefixStore . $item->{$attr[0][0]}->{$attr[0][1]}, $objectsPrefill[$item->{$attr[0][0]}->{$attr[0][1]}]);
}
}
} else {
if (isset($objectsPrefill[$item->{$attr[0]}])) {
$item->{$attr[1]} = $objectsPrefill[$item->{$attr[0]}];
if (isset($params['fill_cache']) && $params['fill_cache'] == true) {
$GLOBALS[get_class($objectsPrefill[$item->{$attr[0]}]) . '_' . $item->{$attr[0]}] = $item->{$attr[1]};
}
if (isset($params['use_cache']) && $params['use_cache'] == true) {
$cache->store($cacheKeyPrefixStore . $item->{$attr[0]}, $objectsPrefill[$item->{$attr[0]}]);
}
}
}
}
}
}
}
}
示例13: moduleInit
public static function moduleInit()
{
$url = erLhcoreClassURL::getInstance();
$cfg = erConfigClassLhConfig::getInstance();
self::$currentModuleName = preg_replace('/[^a-zA-Z0-9\\-_]/', '', $url->getParam('module'));
self::$currentView = preg_replace('/[^a-zA-Z0-9\\-_]/', '', $url->getParam('function'));
self::$cacheInstance = CSCacheAPC::getMem();
self::$cacheVersionSite = self::$cacheInstance->getCacheVersion('site_version');
self::$defaultTimeZone = $cfg->getSetting('site', 'time_zone', false);
self::$dateFormat = $cfg->getSetting('site', 'date_format', false);
self::$dateHourFormat = $cfg->getSetting('site', 'date_hour_format', false);
self::$dateDateHourFormat = $cfg->getSetting('site', 'date_date_hour_format', false);
if (self::$currentModuleName == '' || (self::$currentModule = self::getModule(self::$currentModuleName)) === false) {
$params = $cfg->getOverrideValue('site', 'default_url');
if (self::$currentModuleName != '') {
header("HTTP/1.1 301 Moved Permanently");
self::redirect();
exit;
}
self::$currentView = $params['view'];
self::$currentModuleName = $params['module'];
self::$currentModule = self::getModule(self::$currentModuleName);
}
return self::runModule();
}
示例14: getSetting
public static function getSetting($identifier, $default_value, $user_id = false, $noSession = false)
{
if ($user_id == false) {
$currentUser = erLhcoreClassUser::instance();
if ($currentUser->isLogged()) {
$user_id = $currentUser->getUserID();
}
}
if ($user_id !== false) {
$value = CSCacheAPC::getMem()->getSession('settings_user_id_' . $user_id . '_' . $identifier, true);
if ($value === false && ($value = CSCacheAPC::getMem()->restore('settings_user_id_' . $user_id . '_' . $identifier)) === false) {
$value = $default_value;
$list = self::getList(array('filter' => array('user_id' => $user_id, 'identifier' => $identifier)));
if (count($list) > 0) {
$item = array_shift($list);
$value = $item->value;
} else {
$item = new erLhcoreClassModelUserSetting();
$item->value = $default_value;
$item->user_id = $user_id;
$item->identifier = $identifier;
$item->saveThis();
}
CSCacheAPC::getMem()->store('settings_user_id_' . $user_id . '_' . $identifier, $value);
CSCacheAPC::getMem()->setSession('settings_user_id_' . $user_id . '_' . $identifier, $value, true);
}
} else {
$value = $default_value;
if ($noSession === false && ($value = CSCacheAPC::getMem()->getSession('anonymous_' . $identifier)) === false) {
$value = $default_value;
CSCacheAPC::getMem()->setSession('anonymous_' . $identifier, $value);
}
}
return $value;
}
示例15: time
<?php
$tpl = erLhcoreClassTemplate::getInstance('lhchat/adminchat.tpl.php');
$chat = erLhcoreClassChat::getSession()->load('erLhcoreClassModelChat', $Params['user_parameters']['chat_id']);
$tpl->set('chat', $chat);
if (erLhcoreClassChat::hasAccessToRead($chat)) {
$userData = $currentUser->getUserData();
if ($Params['user_parameters_unordered']['remember'] == 'true') {
CSCacheAPC::getMem()->appendToArray('lhc_open_chats', $chat->id);
}
if ($userData->invisible_mode == 0) {
$operatorAccepted = false;
$chatDataChanged = false;
if ($chat->user_id == 0) {
$currentUser = erLhcoreClassUser::instance();
$chat->user_id = $currentUser->getUserID();
$chatDataChanged = true;
}
// If status is pending change status to active
if ($chat->status == erLhcoreClassModelChat::STATUS_PENDING_CHAT) {
$chat->status = erLhcoreClassModelChat::STATUS_ACTIVE_CHAT;
if ($chat->wait_time == 0) {
$chat->wait_time = time() - $chat->time;
}
$chat->user_id = $currentUser->getUserID();
$operatorAccepted = true;
$chatDataChanged = true;
}
if ($chat->support_informed == 0 || $chat->has_unread_messages == 1 || $chat->unread_messages_informed == 1) {
$chatDataChanged = true;
}