當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Versioned::prepopulate_versionnumber_cache方法代碼示例

本文整理匯總了PHP中Versioned::prepopulate_versionnumber_cache方法的典型用法代碼示例。如果您正苦於以下問題:PHP Versioned::prepopulate_versionnumber_cache方法的具體用法?PHP Versioned::prepopulate_versionnumber_cache怎麽用?PHP Versioned::prepopulate_versionnumber_cache使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Versioned的用法示例。


在下文中一共展示了Versioned::prepopulate_versionnumber_cache方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testLinkRewritingOnAPublishedPageDoesntMakeItEditedOnDraft

 public function testLinkRewritingOnAPublishedPageDoesntMakeItEditedOnDraft()
 {
     // Publish the source page
     $page = $this->objFromFixture('Page', 'page1');
     $this->assertTrue($page->doPublish());
     $this->assertFalse($page->getIsModifiedOnStage());
     // Rename the file
     $file = $this->objFromFixture('Image', 'file1');
     $file->Name = 'renamed-test-file.jpg';
     $file->write();
     // Caching hack
     Versioned::prepopulate_versionnumber_cache('SiteTree', 'Stage', array($page->ID));
     Versioned::prepopulate_versionnumber_cache('SiteTree', 'Live', array($page->ID));
     // Confirm that the page hasn't gone green.
     $this->assertFalse($page->getIsModifiedOnStage());
 }
開發者ID:helpfulrobot,項目名稱:comperio-silverstripe-cms,代碼行數:16,代碼來源:FileLinkTrackingTest.php

示例2: updateStatusFlags

 public function updateStatusFlags(&$flags)
 {
     static $prepop = true;
     if ($prepop) {
         Versioned::prepopulate_versionnumber_cache('SiteTree', 'Stage');
         Versioned::prepopulate_versionnumber_cache('SiteTree', 'Live');
         $prepop = false;
     }
     $stageVersion = intval(Versioned::get_versionnumber_by_stage('SiteTree', 'Stage', $this->owner->ID));
     $liveVersion = intval(Versioned::get_versionnumber_by_stage('SiteTree', 'Live', $this->owner->ID));
     if ($liveVersion == 0) {
         $flags['status_draft'] = '';
     } elseif ($stageVersion > $liveVersion) {
         $flags['status_draft_published'] = '';
     } else {
         $flags['status_published'] = '';
     }
 }
開發者ID:helpfulrobot,項目名稱:zirak-sitetree-status-icon,代碼行數:18,代碼來源:SiteTreeIconExtension.php

示例3: fixVersionNumberCache

 public function fixVersionNumberCache($page)
 {
     $pages = func_get_args();
     foreach ($pages as $p) {
         Versioned::prepopulate_versionnumber_cache('SiteTree', 'Stage', array($p->ID));
         Versioned::prepopulate_versionnumber_cache('SiteTree', 'Live', array($p->ID));
     }
 }
開發者ID:helpfulrobot,項目名稱:comperio-silverstripe-cms,代碼行數:8,代碼來源:VirtualPageTest.php

示例4: SiteTreeAsUL

 /**
  * Return the entire site tree as a nested set of ULs
  */
 public function SiteTreeAsUL()
 {
     $this->generateDataTreeHints();
     $this->generateTreeStylingJS();
     // Pre-cache sitetree version numbers for querying efficiency
     Versioned::prepopulate_versionnumber_cache("SiteTree", "Stage");
     Versioned::prepopulate_versionnumber_cache("SiteTree", "Live");
     return $this->getSiteTreeFor("SiteTree");
 }
開發者ID:SustainableCoastlines,項目名稱:loveyourwater,代碼行數:12,代碼來源:CMSMain.php

示例5: SiteTreeAsUL

 /**
  * Return the entire site tree as a nested set of ULs
  */
 public function SiteTreeAsUL()
 {
     // Pre-cache sitetree version numbers for querying efficiency
     Versioned::prepopulate_versionnumber_cache("SiteTree", "Stage");
     Versioned::prepopulate_versionnumber_cache("SiteTree", "Live");
     $html = $this->getSiteTreeFor($this->stat('tree_class'));
     $this->extend('updateSiteTreeAsUL', $html);
     return $html;
 }
開發者ID:hemant-chakka,項目名稱:awss,代碼行數:12,代碼來源:CMSMain.php

示例6: filtersitetree

	/**
	 * Returns a filtered Site Tree
	 */
	public function filtersitetree() {
		// Pre-cache sitetree version numbers for querying efficiency
		Versioned::prepopulate_versionnumber_cache("SiteTree", "Stage");
		Versioned::prepopulate_versionnumber_cache("SiteTree", "Live");
		
		$className = 'SiteTree';
		$rootID = null;
		$obj = $rootID ? $this->getRecord($rootID) : singleton($className);
		$obj->setMarkingFilterFunction('cmsMainMarkingFilterFunction');
		$obj->markPartialTree();

		if($p = $this->currentPage()) $obj->markToExpose($p);

		// getChildrenAsUL is a flexible and complex way of traversing the tree
		$siteTree = $obj->getChildrenAsUL("", '
					"<li id=\"record-$child->ID\" class=\"" . $child->CMSTreeClasses($extraArg) . "\">" .
					"<a href=\"" . Director::link(substr($extraArg->Link(),0,-1), "show", $child->ID) . "\" " . (($child->canEdit() || $child->canAddChildren()) ? "" : "class=\"disabled\"") . " title=\"' . _t('LeftAndMain.PAGETYPE') . '".$child->class."\" >" .
					($child->TreeTitle()) .
					"</a>"
'
					,$this, true);

		// Wrap the root if needs be.

		if(!$rootID) {
			$rootLink = $this->Link() . '0';
			$siteTree = "<ul id=\"sitetree\" class=\"tree unformatted\"><li id=\"record-0\" class=\"Root nodelete\"><a href=\"$rootLink\">" .
				 _t('LeftAndMain.TREESITECONTENT',"Site Content",PR_HIGH,'Root node on left') . "</a>"
				. $siteTree . "</li></ul>";
		}

		return $siteTree;

	}
開發者ID:neopba,項目名稱:silverstripe-book,代碼行數:37,代碼來源:CMSMain.php

示例7: SiteTreeAsUL

	/**
	 * Return the entire site tree as a nested set of ULs
	 */
	public function SiteTreeAsUL() {
		$html = '';

		// Include custom CSS for tree icons inline, as the tree might be loaded
		// via Ajax, in which case we can't inject it into the HTML header easily through the HTTP response.
		$css = $this->generateTreeStylingCSS();
		if($this->request->isAjax()) {
			$html .= "<style type=\"text/css\">\n" . $css . "</style>\n";				
		} else {
			Requirements::customCSS($css);
		}

		// Pre-cache sitetree version numbers for querying efficiency
		Versioned::prepopulate_versionnumber_cache("SiteTree", "Stage");
		Versioned::prepopulate_versionnumber_cache("SiteTree", "Live");
		$html .= $this->getSiteTreeFor($this->stat('tree_class'));

		return $html;
	}
開發者ID:redema,項目名稱:silverstripe-cms,代碼行數:22,代碼來源:CMSMain.php


注:本文中的Versioned::prepopulate_versionnumber_cache方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。