* Copyright © 2004 Gabriel Wicke <wicke@wikidev.net>
* http://wikidev.net/
*
- * Based on HistoryPage and SpecialExport
+ * Based on HistoryAction and SpecialExport
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
}
function onView() {
- global $wgSquidMaxage, $wgForcedRawSMaxage;
-
$this->getOutput()->disable();
$request = $this->getRequest();
+ $config = $this->context->getConfig();
if ( !$request->checkUrlExtension() ) {
return;
if ( $gen == 'css' || $gen == 'js' ) {
$this->mGen = $gen;
if ( $smaxage === null ) {
- $smaxage = $wgSquidMaxage;
+ $smaxage = $config->get( 'SquidMaxage' );
}
} else {
$this->mGen = false;
# Note: If using a canonical url for userpage css/js, we send an HTCP purge.
if ( $smaxage === null ) {
if ( $contentType == 'text/css' || $contentType == 'text/javascript' ) {
- $smaxage = intval( $wgForcedRawSMaxage );
+ $smaxage = intval( $config->get( 'ForcedRawSMaxage' ) );
} else {
$smaxage = 0;
}
}
- $maxage = $request->getInt( 'maxage', $wgSquidMaxage );
+ $maxage = $request->getInt( 'maxage', $config->get( 'SquidMaxage' ) );
$response = $request->response();
* Get the text that should be returned, or false if the page or revision
* was not found.
*
- * @return String|Bool
+ * @return string|bool
*/
public function getRawText() {
global $wgParser;
/**
* Get the ID of the revision that should used to get the text.
*
- * @return Integer
+ * @return int
*/
public function getOldId() {
$oldid = $this->getRequest()->getInt( 'oldid' );
switch ( $this->getRequest()->getText( 'direction' ) ) {
case 'next':
# output next revision, or nothing if there isn't one
+ $nextid = 0;
if ( $oldid ) {
- $oldid = $this->getTitle()->getNextRevisionID( $oldid );
+ $nextid = $this->getTitle()->getNextRevisionID( $oldid );
}
- $oldid = $oldid ? $oldid : -1;
+ $oldid = $nextid ?: -1;
break;
case 'prev':
# output previous revision, or nothing if there isn't one
# get the current revision so we can get the penultimate one
$oldid = $this->page->getLatest();
}
- $prev = $this->getTitle()->getPreviousRevisionID( $oldid );
- $oldid = $prev ? $prev : -1;
+ $previd = $this->getTitle()->getPreviousRevisionID( $oldid );
+ $oldid = $previd ?: -1;
break;
case 'cur':
$oldid = 0;
/**
* Get the content type to use for the response
*
- * @return String
+ * @return string
*/
public function getContentType() {
$ctype = $this->getRequest()->getVal( 'ctype' );
return $ctype;
}
}
-
-/**
- * Backward compatibility for extensions
- *
- * @deprecated in 1.19
- */
-class RawPage extends RawAction {
- public $mOldId;
-
- /**
- * @param Page $page
- * @param WebRequest|bool $request The WebRequest (default: false).
- */
- function __construct( Page $page, $request = false ) {
- wfDeprecated( __CLASS__, '1.19' );
- parent::__construct( $page );
-
- if ( $request !== false ) {
- $context = new DerivativeContext( $this->getContext() );
- $context->setRequest( $request );
- $this->context = $context;
- }
- }
-
- public function view() {
- $this->onView();
- }
-
- public function getOldId() {
- # Some extensions like to set $mOldId
- if ( $this->mOldId !== null ) {
- return $this->mOldId;
- }
-
- return parent::getOldId();
- }
-}