public function view() {
global $wgUser, $wgOut, $wgRequest, $wgContLang;
global $wgEnableParserCache, $wgStylePath, $wgParser;
- global $wgUseTrackbacks;
+ global $wgUseTrackbacks, $wgUseFileCache;
wfProfileIn( __METHOD__ );
wfProfileOut( __METHOD__ );
return;
# Try file cache
- } else if( $this->tryFileCache() ) {
+ } else if( $wgUseFileCache && $this->tryFileCache() ) {
wfDebug( __METHOD__.": done file cache\n" );
# tell wgOut that output is taken care of
$wgOut->disable();
# tents of 'pagetitle-view-mainpage' instead of the default (if
# that's not empty).
if( $this->mTitle->equals( Title::newMainPage() )
- && wfMsgForContent( 'pagetitle-view-mainpage' ) !== '' )
+ && ($m=wfMsgForContent( 'pagetitle-view-mainpage' )) !== '' )
{
- $wgOut->setHTMLTitle( wfMsgForContent( 'pagetitle-view-mainpage' ) );
+ $wgOut->setHTMLTitle( $m );
}
$wasRedirected = $this->showRedirectedFromHeader();
* namespace, show the default message text. To be called from Article::view().
*/
public function showMissingArticle() {
- global $wgOut, $wgRequest;
+ global $wgOut, $wgRequest, $wgUser;
+
+ # Show info in user (talk) namespace. Does the user exist?
+ if ( $this->mTitle->getNamespace() == NS_USER || $this->mTitle->getNamespace() == NS_USER_TALK ) {
+ $id = User::idFromName( $this->mTitle->getBaseText() );
+ $ip = User::isIP( $this->mTitle->getBaseText() );
+ if ( $id == 0 && !$ip ) { # User does not exist
+ $wgOut->wrapWikiMsg( '<div class="mw-userpage-userdoesnotexist error">$1</div>',
+ array( 'userpage-userdoesnotexist-view', $this->mTitle->getBaseText() ) );
+ }
+ }
+ wfRunHooks( 'ShowMissingArticle', array( $this ) );
# Show delete and move logs
- $this->showLogs();
+ LogEventsList::showLogExtract( $wgOut, array( 'delete', 'move' ), $this->mTitle->getPrefixedText(), '',
+ array( 'lim' => 10,
+ 'conds' => array( "log_action != 'revision'" ),
+ 'showIfEmpty' => false,
+ 'msgKey' => array( 'moveddeleted-notice' ) )
+ );
# Show error message
$oldid = $this->getOldID();
// Use the default message text
$text = $this->getContent();
} else {
- $text = wfMsgNoTrans( 'noarticletext' );
+ $createErrors = $this->mTitle->getUserPermissionsErrors( 'create', $wgUser );
+ $editErrors = $this->mTitle->getUserPermissionsErrors( 'edit', $wgUser );
+ $errors = array_merge( $createErrors, $editErrors );
+
+ if ( !count($errors) )
+ $text = wfMsgNoTrans( 'noarticletext' );
+ else
+ $text = wfMsgNoTrans( 'noarticletext-nopermission' );
}
$text = "<div class='noarticletext'>\n$text\n</div>";
if( !$this->hasViewableContent() ) {
}
}
- /**
- * Show an excerpt from the deletion and move logs. To be called from the
- * header section on page views of missing pages.
- */
- public function showLogs() {
- global $wgUser, $wgOut;
- $loglist = new LogEventsList( $wgUser->getSkin(), $wgOut );
- $pager = new LogPager( $loglist, array('move', 'delete'), false,
- $this->mTitle->getPrefixedText(), '', array( "log_action != 'revision'" ) );
- if( $pager->getNumRows() > 0 ) {
- $pager->mLimit = 10;
- $wgOut->addHTML( '<div class="mw-warning-with-logexcerpt">' );
- $wgOut->addWikiMsg( 'moveddeleted-notice' );
- $wgOut->addHTML(
- $loglist->beginLogEventsList() .
- $pager->getBody() .
- $loglist->endLogEventsList()
- );
- if( $pager->getNumRows() > 10 ) {
- $wgOut->addHTML( $wgUser->getSkin()->link(
- SpecialPage::getTitleFor( 'Log' ),
- wfMsgHtml( 'log-fulllog' ),
- array(),
- array( 'page' => $this->mTitle->getPrefixedText() )
- ) );
- }
- $wgOut->addHTML( '</div>' );
- }
- }
-
/*
* Should the parser cache be used?
*/
$dbw = wfGetDB( DB_MASTER );
$now = wfTimestampNow();
+ $this->mTimestamp=$now;
if( $flags & EDIT_UPDATE ) {
# Update article, but only if changed.
if( $latest === false ) {
$wgOut->showFatalError( wfMsgExt( 'cannotdelete', array( 'parse' ) ) );
$wgOut->addHTML( Xml::element( 'h2', null, LogPage::logName( 'delete' ) ) );
- LogEventsList::showLogExtract( $wgOut, 'delete', $this->mTitle->getPrefixedText() );
+ LogEventsList::showLogExtract(
+ $wgOut,
+ 'delete',
+ $this->mTitle->getPrefixedText()
+ );
return;
}
$wgOut->addHTML( $form );
$wgOut->addHTML( Xml::element( 'h2', null, LogPage::logName( 'delete' ) ) );
- LogEventsList::showLogExtract( $wgOut, 'delete', $this->mTitle->getPrefixedText() );
+ LogEventsList::showLogExtract(
+ $wgOut,
+ 'delete',
+ $this->mTitle->getPrefixedText()
+ );
}
/**
if( $error == '' ) {
$wgOut->showFatalError( wfMsgExt( 'cannotdelete', array( 'parse' ) ) );
$wgOut->addHTML( Xml::element( 'h2', null, LogPage::logName( 'delete' ) ) );
- LogEventsList::showLogExtract( $wgOut, 'delete', $this->mTitle->getPrefixedText() );
+ LogEventsList::showLogExtract(
+ $wgOut,
+ 'delete',
+ $this->mTitle->getPrefixedText()
+ );
} else {
$wgOut->showFatalError( $error );
}
*/
public function isFileCacheable() {
$cacheable = false;
- global $wgUseFileCache;
- if( $wgUseFileCache and HTMLFileCache::useFileCache() ) {
+ if( HTMLFileCache::useFileCache() ) {
$cacheable = $this->getID() && !$this->mRedirectedFrom;
// Extension may have reason to disable file caching on some pages.
if( $cacheable ) {