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