本文整理汇总了PHP中IPSLib::isUsingRemoteArchiveDB方法的典型用法代码示例。如果您正苦于以下问题:PHP IPSLib::isUsingRemoteArchiveDB方法的具体用法?PHP IPSLib::isUsingRemoteArchiveDB怎么用?PHP IPSLib::isUsingRemoteArchiveDB使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPSLib
的用法示例。
在下文中一共展示了IPSLib::isUsingRemoteArchiveDB方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getData
/**
* Write single entry to DB
* @param array INTS
*/
public function getData($data = array())
{
if (!$this->remoteDB) {
return;
}
/* Init */
$topicData = $data['parentData'];
$forumData = $this->registry->getClass('class_forums')->getForumById($topicData['forum_id']);
$permissionData = $this->registry->getClass('topics')->getPermissionData();
$first = $data['offset'];
$end = $data['limit'];
$fields = $this->getFields();
/* Default - just see all visible posts */
$queued_query_bit = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery('visible', 'archive_');
/* Can we deal with hidden posts? */
if ($this->registry->class_forums->canQueuePosts($topicData['forum_id'])) {
if ($permissionData['softDeleteSee']) {
/* See queued and soft deleted */
$queued_query_bit = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery(array('visible', 'hidden', 'sdeleted'), 'archive_');
} else {
/* Otherwise, see queued and approved */
$queued_query_bit = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery(array('visible', 'hidden'), 'archive_');
}
} else {
/* We cannot see hidden posts */
if ($permissionData['softDeleteSee']) {
/* See queued and soft deleted */
$queued_query_bit = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery(array('approved', 'sdeleted'), 'archive_');
}
}
/* Set up */
/* Ignored Users */
$ignored_users = array();
foreach ($this->member->ignored_users as $_i) {
if ($_i['ignore_topics']) {
$ignored_users[] = $_i['ignore_ignore_id'];
}
}
/* Format */
$this->registry->getClass('topics')->setTopicData('adCodeSet', false);
$this->registry->getClass('topics')->setTopicData('ignoredUsers', $ignored_users);
$posts = array();
$cached = array();
/* Get posts separately */
if (IPSLib::isUsingRemoteArchiveDB()) {
/* Get posts */
$this->remoteDB->build(array('select' => '*', 'from' => 'forums_archive_posts', 'where' => 'archive_topic_id=' . $topicData['tid'] . $queued_query_bit, 'order' => $fields[$data['sortKey']] . ' ' . $data['sortOrder'], 'limit' => array($first, $end)));
$ab = $this->remoteDB->execute();
$mids = array();
while ($p = $this->remoteDB->fetch($ab)) {
$posts[$p['archive_id']] = $p;
$mids[$p['archive_author_id']] = $p['archive_author_id'];
}
if (count($posts)) {
/* Get cached posts */
$this->DB->build(array('select' => 'cache_content_id, cache_content', 'from' => 'content_cache_posts', 'where' => 'cache_content_id IN (' . implode(',', array_keys($posts)) . ')'));
$this->DB->execute();
while ($row = $this->DB->fetch()) {
$cached[$row['cache_content_id']] = $row['cache_content'];
}
/* Get members */
$members = IPSMember::load($mids, 'all');
foreach ($posts as $pid => $pdata) {
$pdata['member_id'] = $pdata['archive_author_id'];
if ($data['goNative']) {
$pdata = $this->archiveToNativeFields($pdata);
}
if ($pdata['author_id']) {
$members[$pdata['author_id']]['cache_content_sig'] = $members[$pdata['author_id']]['cache_content'];
unset($members[$pdata['author_id']]['cache_content']);
$posts[$pid] = array_merge($members[$pdata['author_id']], $pdata);
} else {
$posts[$pid] = $pdata;
}
/* Cached */
if (isset($cached[$pid])) {
$posts[$pid]['cache_content'] = $cached[$pid];
}
}
}
} else {
/* Joins */
$_post_joins = array(array('select' => 'm.member_id as mid,m.name,m.member_group_id,m.email,m.joined,m.posts, m.last_visit, m.last_activity,m.login_anonymous,m.title as member_title, m.warn_level, m.warn_lastwarn, m.members_display_name, m.members_seo_name, m.has_gallery, m.has_blog, m.members_bitoptions,m.mgroup_others', 'from' => array('members' => 'm'), 'where' => 'm.member_id=a.archive_author_id', 'type' => 'left'), array('select' => 'pp.*', 'from' => array('profile_portal' => 'pp'), 'where' => 'm.member_id=pp.pp_member_id', 'type' => 'left'));
/* Cache? */
if (IPSContentCache::isEnabled()) {
if (IPSContentCache::fetchSettingValue('post')) {
$_post_joins[] = IPSContentCache::join('post', 'a.archive_id');
}
if (IPSContentCache::fetchSettingValue('sig')) {
$_post_joins[] = IPSContentCache::join('sig', 'm.member_id', 'ccb', 'left', 'ccb.cache_content as cache_content_sig, ccb.cache_updated as cache_updated_sig');
}
}
/* Get posts */
$this->remoteDB->build(array('select' => 'a.*', 'from' => array('forums_archive_posts' => 'a'), 'where' => 'archive_topic_id=' . $topicData['tid'] . $queued_query_bit, 'order' => $fields[$data['sortKey']] . ' ' . $data['sortOrder'], 'limit' => array($first, $end), 'add_join' => $_post_joins));
$oq = $this->remoteDB->execute();
while ($row = $this->remoteDB->fetch($oq)) {
//.........这里部分代码省略.........