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


PHP vB_Cache类代码示例

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


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

示例1: getTitles

 /**
  * fetches the help hierarchy, title phrases are included but text phrases are not
  * @return array
  *  * titles contains the hierarchy which sub-help items under the 'children' key
  *  * firstItem contains the first help item to display
  */
 public function getTitles()
 {
     $cache = vB_Cache::instance(vB_Cache::CACHE_LARGE);
     $titles = $cache->read('vb_FAQ_Titles');
     if (empty($titles)) {
         $assertor = vB::getDbAssertor();
         $phrases = $assertor->getColumn('vBForum:phrase', 'text', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT, 'fieldname' => array('faqtext', 'faqtitle'), 'languageid' => array(-1, 0, vB::getCurrentSession()->get('languageid'))), false, 'varname');
         $faqs = $assertor->getRows('vBForum:faq', array(), 'displayorder', 'faqname');
         foreach ($faqs as $faqname => &$faq) {
             if ($faqname == 'faqroot') {
                 continue;
             }
             $faq['title_phrase'] = $faq['faqname'] . '_gfaqtitle';
             $faq['text_phrase'] = $faq['faqname'] . '_gfaqtext';
             $faq['title'] = $phrases[$faq['title_phrase']];
             $faq['text'] = $phrases[$faq['text_phrase']];
             $parentPath = '';
             $parent = $faq['faqparent'];
             while ($parent != 'faqroot' and isset($faqs[$parent])) {
                 $parentPath = $faqs[$parent]['faqname'] . '/' . $parentPath;
                 $parent = $faqs[$parent]['faqparent'];
             }
             $faq['path'] = $parentPath . $faq['faqname'];
             $faqs[$faq['faqparent']]['children'][$faq['faqname']] =& $faq;
         }
         $titles = $faqs['faqroot']['children'];
         $cache->write('vb_FAQ_Titles', $titles, 300, 'vB_FAQ_chg');
     }
     return array('titles' => $titles, 'firstItem' => $this->findFirst($titles));
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:36,代码来源:help.php

示例2: createChannel

 /**
  * Create a blog channel.
  *
  * @param array $input
  * @param int $channelid
  * @param int $channelConvTemplateid
  * @param int $channelPgTemplateId
  * @param int $ownerSystemGroupId
  *
  * @return int The nodeid of the new blog channel
  */
 public function createChannel($input, $channelid, $channelConvTemplateid, $channelPgTemplateId, $ownerSystemGroupId)
 {
     $input['parentid'] = $channelid;
     $input['inlist'] = 1;
     // we don't want it to be shown in channel list, but we want to move them
     $input['protected'] = 0;
     if (empty($input['userid'])) {
         $input['userid'] = vB::getCurrentSession()->get('userid');
     }
     if (!isset($input['publishdate'])) {
         $input['publishdate'] = vB::getRequest()->getTimeNow();
     }
     $input['templates']['vB5_Route_Channel'] = $channelPgTemplateId;
     $input['templates']['vB5_Route_Conversation'] = $channelConvTemplateid;
     // add channel node
     $channelLib = vB_Library::instance('content_channel');
     $input['page_parentid'] = 0;
     $result = $channelLib->add($input, array('skipFloodCheck' => true, 'skipDupCheck' => true));
     //Make the current user the channel owner.
     $userApi = vB_Api::instanceInternal('user');
     $usergroup = vB::getDbAssertor()->getRow('usergroup', array('systemgroupid' => $ownerSystemGroupId));
     if (empty($usergroup) or !empty($usergroup['errors'])) {
         //This should never happen. It would mean an invalid parameter was passed
         throw new vB_Exception_Api('invalid_request');
     }
     vB_User::setGroupInTopic($input['userid'], $result['nodeid'], $usergroup['usergroupid']);
     vB_Cache::allCacheEvent(array('nodeChg_' . $this->blogChannel, "nodeChg_{$channelid}"));
     vB::getUserContext()->rebuildGroupAccess();
     vB_Channel::rebuildChannelTypes();
     // clear follow cache
     vB_Api::instanceInternal('follow')->clearFollowCache(array($input['userid']));
     return $result['nodeid'];
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:44,代码来源:blog.php

示例3: createChannel

 /**
  * Create an article category channel. This function works basically like the blog library's version
  *
  * @param array 	$input						data array, should have standard channel data like title, parentid, 
  * @param int 		$channelid					parentid that the new channel should fall under. 
  * @param int		$channelConvTemplateid		"Conversation" level pagetemplate to use. Typically vB_Page::getArticleConversPageTemplate()
  * @param int 		$channelPgTemplateId		"Channel" level pagetemplate to use. Typically  vB_Page::getArticleChannelPageTemplate()
  * @param int 		$ownerSystemGroupId
  *
  * @return int The nodeid of the new blog channel
  */
 public function createChannel($input, $channelid, $channelConvTemplateid, $channelPgTemplateId, $ownerSystemGroupId)
 {
     if (!isset($input['parentid']) or intval($input['parentid']) < 1) {
         $input['parentid'] = $channelid;
     }
     $input['inlist'] = 1;
     // we don't want it to be shown in channel list, but we want to move them
     $input['protected'] = 0;
     if (empty($input['userid'])) {
         $input['userid'] = vB::getCurrentSession()->get('userid');
     }
     if (!isset($input['publishdate'])) {
         $input['publishdate'] = vB::getRequest()->getTimeNow();
     }
     $input['templates']['vB5_Route_Channel'] = $channelPgTemplateId;
     $input['templates']['vB5_Route_Article'] = $channelConvTemplateid;
     $input['childroute'] = 'vB5_Route_Article';
     // add channel node
     $channelLib = vB_Library::instance('content_channel');
     $input['page_parentid'] = 0;
     $result = $channelLib->add($input, array('skipNotifications' => true, 'skipFloodCheck' => true, 'skipDupCheck' => true));
     //Make the current user the channel owner.
     $userApi = vB_Api::instanceInternal('user');
     $usergroup = vB::getDbAssertor()->getRow('usergroup', array('systemgroupid' => $ownerSystemGroupId));
     vB_Cache::allCacheEvent(array('nodeChg_' . $this->articleHomeChannel, "nodeChg_{$channelid}"));
     vB::getUserContext()->rebuildGroupAccess();
     vB_Channel::rebuildChannelTypes();
     // clear follow cache
     vB_Api::instanceInternal('follow')->clearFollowCache(array($input['userid']));
     return $result['nodeid'];
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:42,代码来源:article.php

示例4: parse

 public static function parse($text, $options = array(), $attachments = array(), $cacheInfo = array())
 {
     //if we have a nodeid, let's try to cache this.
     if (!empty($cacheInfo)) {
         //TODO- Find a caching method that doesn't break collapsed mode.
         if (!empty($cacheInfo['nodeid'])) {
             $cacheKey = 'vbNodeText' . $cacheInfo['nodeid'];
         } else {
             if (!empty($cacheInfo['signatureid'])) {
                 $cacheKey = 'vbSig' . $cacheInfo['signatureid'];
             }
         }
         if (!empty($cacheKey)) {
             $cacheKey .= strval($options);
             $parsed = vB_Cache::instance()->read($cacheKey);
             if ($parsed) {
                 return $parsed;
             }
         }
     }
     $result = self::parseInternal(new vB5_Template_BbCode(), $text, $options, $attachments);
     if (!empty($cacheKey)) {
         if (!empty($cacheInfo['nodeid'])) {
             $cacheEvent = 'nodeChg_' . $cacheInfo['nodeid'];
         } else {
             if (!empty($cacheInfo['signatureid'])) {
                 $cacheEvent = 'userChg_' . $cacheInfo['signatureid'];
             }
         }
         vB_Cache::instance()->write($cacheKey, $result, 86400, $cacheEvent);
     }
     return $result;
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:33,代码来源:bbcode.php

示例5: getRedirect301

 /**
  * discard all query parameters
  * caches the new route and return it every time
  * this is the simplest form of redirection
  * if subclass is any complicate than this, override is needed
  */
 public function getRedirect301()
 {
     $this->queryParameters = array();
     $cache = vB_Cache::instance(vB_Cache::CACHE_STD);
     $cacheKey = get_class($this);
     $data = $cache->read($cacheKey);
     if (!$data) {
         $data = $this->getNewRouteInfo();
         $cache->write($cacheKey, $data, 86400);
     }
     return $data;
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:18,代码来源:legacy.php

示例6: __construct

 /**
  * Constructor public to allow for separate automated unit testing. Actual code should use
  * vB_Cache::instance();
  * @see vB_Cache::instance()
  */
 public function __construct($cachetype)
 {
     parent::__construct($cachetype);
     $this->requestStart = vB::getRequest()->getTimeNow();
     $config = vB::getConfig();
     $this->cachetype = $cachetype;
     if (!isset($config['Cache']['fileCachePath'])) {
         throw new vB_Exception_Cache('need_filecache_location');
     }
     $this->cacheLocation = $config['Cache']['fileCachePath'];
     if (!is_dir($this->cacheLocation) or !is_writable($this->cacheLocation)) {
         throw new vB_Exception_Cache('invalid_filecache_location- ' . $this->cacheLocation);
     }
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:19,代码来源:filesystem.php

示例7: instance

 /**
  * Returns an instance of the global cache.
  * The cache type used is defined in options.
  *
  * @return vB_Cache							- Reference to instance of the cache handler
  */
 public static function instance()
 {
     if (!isset(self::$instance)) {
         // TODO: Use config to determine the cache types to use
         self::$instance = vB_Cache_Db::instance();
         // TODO: Get appropriate class from options
         self::$instance->attachObserver(vB_Cache_Observer_Db::instance(self::$instance));
         vB::$vbulletin->shutdown->add(array(self::$instance, 'shutdown'));
     }
     if (vB::$vbulletin->debug and $_REQUEST['nocache']) {
         vB::$vbulletin->options['nocache'] = 1;
     }
     return self::$instance;
 }
开发者ID:Kheros,项目名称:MMOver,代码行数:20,代码来源:cache.php

示例8: getFullCategoryList

function getFullCategoryList(&$channelInfoArray = array(), $tabsize = 1, $tabchar = "--", $tabspace = " ")
{
    $cache = vB_Cache::instance(vB_Cache::CACHE_STD);
    $cacheKey = "vBAdminCP_CMS_Categories";
    $categories = $cache->read($cacheKey);
    $writeCache = false;
    $cacheEvents = array();
    if (empty($categories)) {
        $categories = vB::getDbAssertor()->getRows('vBAdminCP:getCMSChannels', array('articleChannelId' => vB_Api::instanceInternal('node')->fetchArticleChannel(), 'channelcontenttype' => vB_Api::instanceInternal('ContentType')->fetchContentTypeIdFromClass('Channel')));
        $writeCache = true;
    }
    $categoriesList = array();
    // The query result is sorted by depth first. We have to group/sort into a hierarchical order, such that
    // children come immediately after a parent.
    $parent_position = array();
    // parentid => position
    $nodeid_index = array();
    // nodeid => search result index
    foreach ($categories as $index => $category) {
        $cacheEvents[] = 'nodeChg_' . $category['nodeid'];
        $parentid = $category['parentid'];
        $nodeid_index[$category['nodeid']] = $index;
        if (empty($parent_position)) {
            $parent_position[$category['nodeid']] = 0;
        } else {
            $position = $parent_position[$parentid] + 1;
            // increment positions of parents whose positions are after $position
            foreach ($parent_position as $pid => $pos) {
                if ($pos >= $position) {
                    $parent_position[$pid]++;
                }
            }
            // node will be positioned after its parent, but above any siblings. This is why all but the depth is sort order DESC in the query.
            $parent_position[$category['nodeid']] = $position;
        }
    }
    // sort parent_position by position
    asort($parent_position);
    foreach ($parent_position as $nodeid => $position) {
        $category = $categories[$nodeid_index[$nodeid]];
        $channelInfoArray[$category['nodeid']] = array("title" => $category['htmltitle'], "parentid" => $category['parentid'], "showpublished" => $category['showpublished'], "textcount" => $category['textcount'], "displayorder" => $category['displayorder'], "description" => $category['description']);
        $tab = str_repeat($tabchar, $category['depth'] * $tabsize) . $tabspace;
        $categoriesList[$category['nodeid']] = $tab . $category['htmltitle'];
    }
    if ($writeCache) {
        $cache->write($cacheKey, $categories, 1440, $cacheEvents);
    }
    return $categoriesList;
}
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:49,代码来源:cms.php

示例9: getUrl

 public function getUrl()
 {
     $cache = vB_Cache::instance(vB_Cache::CACHE_FAST);
     $hashKey = 'vbRouteURLIndent_' . $this->arguments['nodeid'];
     $urlident = $cache->read($hashKey);
     if (empty($urlident)) {
         $node = vB_Library::instance('node')->getNodeBare($this->arguments['nodeid']);
         $urlident = $node['urlident'];
         $cache->write($hashKey, $urlident);
     } elseif (is_array($urlident) and !empty($urlident['urlident'])) {
         $urlident = $urlident['urlident'];
     }
     $url = '/album/' . $this->arguments['nodeid'] . '-' . $urlident;
     if (strtolower(vB_String::getCharset()) != 'utf-8') {
         $url = vB_String::encodeUtf8Url($url);
     }
     return $url;
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:18,代码来源:album.php

示例10: deletePerms

 /** this deletes an existing permission
  *
  * 	@return	mixed		either permissionid(single or array), or nodeid and usergroupid. A single Nodeid is required and usergroup is optional and may be an array
  ***/
 public function deletePerms($params)
 {
     if (!empty($params['permissionid'])) {
         //We don't allow deleting permissions from page 1.
         $existing = vB::getDbAssertor()->getRow('vBForum:permission', array('permissionid' => $params['permissionid']));
         if (empty($existing) or !empty($existing['errors']) or $existing['nodeid'] == 1) {
             return false;
         }
         $qryParams['permissionid'] = $params['permissionid'];
     } else {
         if (!empty($params['nodeid']) and intval($params['nodeid'])) {
             $qryParams['nodeid'] = intval($params['nodeid']);
             if (!empty($params['groupid'])) {
                 $qryParams['groupid'] = $params['groupid'];
             }
         } else {
             return false;
         }
     }
     $qryParams[vB_dB_Query::TYPE_KEY] = vB_dB_Query::QUERY_DELETE;
     $result = vB::getDbAssertor()->assertQuery('vBForum:permission', $qryParams);
     vB_Cache::instance()->event('perms_changed');
     //force reloading the group access cache
     vB::getUserContext()->rebuildGroupAccess();
     return $result;
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:30,代码来源:channelpermission.php

示例11: foreach

     }
 }
 foreach ($productcodes_versions as $version) {
     foreach ($productcodes_grouped["{$version}"] as $productcode) {
         eval($productcode['uninstallcode']);
     }
 }
 //remove some common resources that a product may have registered.
 //tags
 $db->query_write("\r\n\t\tDELETE tagcontent\r\n\t\tFROM " . TABLE_PREFIX . "package AS package JOIN\r\n\t\t\t" . TABLE_PREFIX . "contenttype AS contenttype ON\r\n\t\t\t\tcontenttype.packageid = package.packageid JOIN\r\n\t\t\t" . TABLE_PREFIX . "tagcontent AS tagcontent ON\r\n\t\t\t\tcontenttype.contenttypeid = tagcontent.contenttypeid\r\n\t\tWHERE productid = '{$safe_productid}'\r\n\t");
 // Packages, routes, actions, contenttypes
 $db->query_write("\r\n\t\tDELETE package, route, action, contenttype\r\n\t\tFROM " . TABLE_PREFIX . "package AS package\r\n\t\tLEFT JOIN " . TABLE_PREFIX . "route AS route\r\n\t\t\tON route.packageid = package.packageid\r\n\t\tLEFT JOIN " . TABLE_PREFIX . "action AS action\r\n\t\t\tON action.routeid = route.routeid\r\n\t\tLEFT JOIN " . TABLE_PREFIX . "contenttype AS contenttype\r\n\t\t\tON contenttype.packageid = package.packageid\r\n\t\tWHERE productid = '{$safe_productid}'\r\n\t");
 // Clear routes from datastore
 build_datastore('routes', serialize(array()), 1);
 //clear the type cache.
 vB_Cache::instance()->purge('vb_types.types');
 // need to remove the language columns for this product as well
 require_once DIR . '/includes/class_dbalter.php';
 $db_alter = new vB_Database_Alter_MySQL($db);
 if ($db_alter->fetch_table_info('language')) {
     $phrasetypes = $db->query_read("\r\n\t\t\tSELECT fieldname\r\n\t\t\tFROM " . TABLE_PREFIX . "phrasetype\r\n\t\t\tWHERE product = '" . $db->escape_string($vbulletin->GPC['productid']) . "'\r\n\t\t");
     while ($phrasetype = $db->fetch_array($phrasetypes)) {
         $db_alter->drop_field("phrasegroup_{$phrasetype['fieldname']}");
     }
 }
 delete_product($vbulletin->GPC['productid']);
 build_all_styles();
 vBulletinHook::build_datastore($db);
 require_once DIR . '/includes/adminfunctions_language.php';
 build_language();
 build_options();
开发者ID:Kheros,项目名称:MMOver,代码行数:31,代码来源:plugin.php

示例12: preDelete

	/**
	* Additional tasks to perform before a delete.
	*
	* Return false to indicate that the entire delete process was not a success.
	*
	* @param mixed								- The result of execDelete()
	*/
	protected function preDelete($result)
	{
		$this->assertItem();

		require_once DIR . '/includes/class_taggablecontent.php';
		$taggable = vB_Taggable_Content_Item::create(vB::$vbulletin,
			vB_Types::instance()->getContentTypeID("vBCms_Article"),
			intval($this->item->getId()));
		$taggable->delete_tag_attachments();

		vB::$db->query_write("
			DELETE FROM " . TABLE_PREFIX . "cms_nodecategory
			WHERE nodeid = " . intval($this->item->getNodeId())
		);

		vB::$db->query_write("
			DELETE FROM " . TABLE_PREFIX . "cms_article
			WHERE contentid = " . intval($this->item->getId())
		);
		vB_Cache::instance()->event('categories_updated');

		return parent::preDelete($result);
	}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:30,代码来源:article.php

示例13: fetchCommonRoutes

 /** Returns a list of common routes. We check these to see if we can avoid the far most expensive selectBestRoute call
  *
  * 	#return array of string => string	map of url to route class.
  **/
 public static function fetchCommonRoutes()
 {
     if ($common = vB_Cache::instance(vB_Cache::CACHE_STD)->read('vB_CommonRoutes') and !empty($common)) {
         return $common;
     }
     $guids = array(vB_Channel::MAIN_CHANNEL, vB_Channel::DEFAULT_FORUM_PARENT, vB_Channel::MAIN_FORUM, vB_Channel::MAIN_FORUM_CATEGORY, vB_Channel::DEFAULT_BLOG_PARENT, vB_Channel::DEFAULT_SOCIALGROUP_PARENT, vB_Channel::PRIVATEMESSAGE_CHANNEL, vB_Channel::VISITORMESSAGE_CHANNEL);
     // todo, also add empty prefix channel route for when home page has been changed?
     $routes = vB::getDbAssertor()->assertQuery('vBForum:getRouteFromChGuid', array('guid' => $guids));
     $common = array();
     foreach ($routes as $route) {
         $common[$route['prefix']] = $route;
         $common[$route['prefix']]['length'] = strlen($route['prefix']);
     }
     vB_Cache::instance(vB_Cache::CACHE_STD)->write('vB_CommonRoutes', $common, 1440, 'vB_routesChgMultiple');
     return $common;
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:20,代码来源:route.php

示例14: updateContentRoute

 protected static function updateContentRoute($oldRouteInfo, $newRouteInfo)
 {
     $db = vB::getDbAssertor();
     $events = array();
     // update redirect301 fields
     $updateIds = $db->assertQuery('get_update_route_301', array('oldrouteid' => $oldRouteInfo['routeid']));
     if (!empty($updateIds)) {
         $routeIds = array();
         foreach ($updateIds as $route) {
             $routeid = $route['routeid'];
             $events[] = "routeChg_{$routeid}";
             $routeIds[] = $routeid;
         }
         $db->update('routenew', array('redirect301' => $newRouteInfo['routeid'], 'name' => vB_dB_Query::VALUE_ISNULL), array('routeid' => $routeIds));
     }
     // don't modify the routeid for default pages, as it will still be used
     $updateIds = $db->assertQuery('page', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT, vB_dB_Query::COLUMNS_KEY => array('pageid'), vB_dB_Query::CONDITIONS_KEY => array('routeid' => $oldRouteInfo['routeid'], 'pagetype' => vB_Page::TYPE_CUSTOM)));
     if (!empty($updateIds)) {
         $pageIds = array();
         foreach ($updateIds as $page) {
             $pageid = $page['pageid'];
             $events[] = "pageChg_{$pageid}";
             $pageIds[] = $pageid;
         }
         $db->update('page', array('routeid' => $newRouteInfo['routeid']), array('pageid' => $pageIds));
     }
     vB_Cache::allCacheEvent($events);
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:28,代码来源:settings.php

示例15: getComments

	private static function getComments($nodeid, $userinfo, &$permissions, $associatedthreadid)
	{
		require_once DIR . '/vb/cache.php';
		if ($comments = vB_Cache::instance()->read(
			self::getStaticHash($nodeid), true))
		{
			return $comments;
		}

		$sql = "SELECT distinct post.postid, post.visible, post.dateline
			FROM " . TABLE_PREFIX .	"post AS post
			WHERE threadid = $associatedthreadid AND parentid != 0 AND visible = 1 ORDER BY post.dateline ASC";

		if (! ($rst = vB::$vbulletin->db->query_read($sql)))
		{
			return false;
		}

		$ids = array();

		//Now we compare the fields. We need to check fields from the third
		// to the end of the row. If the value is different from the previous row,
		// we add a record.
		while($row =  vB::$vbulletin->db->fetch_array($rst))
		{
			if (self::canViewPost($row, $permissions))
			{
				$ids[] = $row['postid'];
			}
		}

		if ((count($ids) == 1) and !intval($ids[0]))
		{
			$ids = false;
		}

		//Now we have a list of posts.
		vB_Cache::instance()->write(self::getStaticHash($nodeid),
			   $ids, self::$static_cache_ttl, array('cms_comments_change_' . $associatedthreadid));
		return $ids;

	}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:42,代码来源:comments.php


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