$updated = Article::flattenRestrictions( $limit );
$changed = ( $current != $updated );
- $changed = $changed || ($this->mTitle->getRestrictionCascadingFlags() != $cascade);
+ $changed = $changed || ($this->mTitle->areRestrictionsCascading() != $cascade);
$protect = ( $updated != '' );
# If nothing's changed, do nothing
/**
* Add the primary page-view wikitext to the output buffer
* Saves the text into the parser cache if possible.
+ * Updates templatelinks if it is out of date.
*
* @param string $text
* @param Article $article
public function outputWikiText( $text, $cache = true ) {
global $wgParser, $wgUser, $wgOut;
- $article = $this;
-
$popts = $wgOut->parserOptions();
$popts->setTidy(true);
- $parserOutput = $wgParser->parse( $text, $article->mTitle,
- $popts, true, true, $this->mRevisionId );
+ $parserOutput = $wgParser->parse( $text, $this->mTitle,
+ $popts, true, true, $this->getRevIdFetched() );
$popts->setTidy(false);
if ( $cache && $article && $parserOutput->getCacheTime() != -1 ) {
$parserCache =& ParserCache::singleton();
if ( !wfReadOnly() ) {
# Get templates from templatelinks
- $tlTemplates_titles = $this->getUsedTemplates();
+ $result = array();
+ $id = $this->mTitle->getArticleID();
+
+ if( $id == 0 ) {
+ $tlTemplates = array();
+ }
- $tlTemplates = array ();
- foreach( $tlTemplates_titles as $template_title) {
- $tlTemplates[] = $template_title->getDBkey();
+ $dbr =& wfGetDB( DB_SLAVE );
+ $res = $dbr->select( array( 'templatelinks' ),
+ array( 'tl_namespace', 'tl_title' ),
+ array( 'tl_from' => $id ),
+ 'Article:getUsedTemplates' );
+
+ if ( false !== $res ) {
+ if ( $dbr->numRows( $res ) ) {
+ while ( $row = $dbr->fetchObject( $res ) ) {
+ $tlTemplates[] = $wgContLang->getNsText( $row->tl_namespace ) . ':' . $row->tl_title ;
+ }
+ }
}
# Get templates from parser output.
// but the db allows multiples separated by commas.
$this->mRestrictions[$action] = implode( '', $this->mTitle->getRestrictions( $action ) );
}
- $this->mCascade = $this->mTitle->getRestrictionCascadingFlags() & 1;
+ $this->mCascade = $this->mTitle->areRestrictionsCascading();
}
// The form will be available in read-only to show levels.
# reset the cache.
define( 'MW_TITLECACHE_MAX', 1000 );
+# Constants for pr_cascade bitfield
+define( 'CASCADE', 1 );
+
/**
* Title class
* - Represents a title, which may contain an interwiki designation or namespace
var $mArticleID; # Article ID, fetched from the link cache on demand
var $mLatestID; # ID of most recent revision
var $mRestrictions; # Array of groups allowed to edit this article
- var $mCascadeRestrictionFlags;
+ var $mCascadeRestriction;
var $mRestrictionsLoaded; # Boolean for initialisation on demand
var $mPrefixedText; # Text form including namespace/interwiki, initialised on demand
var $mDefaultNamespace; # Namespace index when there is no namespace
function isCascadeProtectedImage() {
global $wgEnableCascadingProtection;
if (!$wgEnableCascadingProtection)
- return;
+ return false;
wfProfileIn(__METHOD__);
$res = $dbr->select( $tables, $cols, $where_clauses, __METHOD__);
- //die($dbr->numRows($res));
-
if ($dbr->numRows($res)) {
wfProfileOut(__METHOD__);
return true;
function isCascadeProtectedPage() {
global $wgEnableCascadingProtection;
if (!$wgEnableCascadingProtection)
- return;
+ return false;
wfProfileIn(__METHOD__);
}
}
- function getRestrictionCascadingFlags() {
+ function areRestrictionsCascading() {
if (!$this->mRestrictionsLoaded) {
$this->loadRestrictions();
}
- return $this->mCascadeRestrictionFlags;
+ return $this->mCascadeRestriction;
}
/**
$this->mRestrictions[$row->pr_type] = explode( ',', trim( $row->pr_level ) );
- $this->mCascadeRestrictionFlags |= $row->pr_cascade;
+ $this->mCascadeRestriction |= $row->pr_cascade;
}
$this->mRestrictionsLoaded = true;
array( 'filearchive', 'patch-filearchive.sql' ),
array( 'redirect', 'patch-redirect.sql' ),
array( 'querycachetwo', 'patch-querycachetwo.sql' ),
-# array( 'page_restrictions', 'patch-page_restrictions.sql' ),
);
$wgNewFields = array(