Merge "Added ORMIterator interface which can be used for type hinting (in particular...
[lhc/web/wiklou.git] / includes / actions / HistoryAction.php
index c49d232..50d210f 100644 (file)
@@ -3,6 +3,22 @@
  * Page history
  *
  * Split off from Article.php and Skin.php, 2003-12-22
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
  * @file
  */
 
@@ -71,7 +87,7 @@ class HistoryAction extends FormlessAction {
         * Print the history page for an article.
         */
        function onView() {
-               global $wgScript, $wgUseFileCache, $wgSquidMaxage;
+               global $wgScript, $wgUseFileCache;
 
                $out = $this->getOutput();
                $request = $this->getRequest();
@@ -85,10 +101,6 @@ class HistoryAction extends FormlessAction {
 
                wfProfileIn( __METHOD__ );
 
-               if ( $request->getFullRequestURL() == $this->getTitle()->getInternalURL( 'action=history' ) ) {
-                       $out->setSquidMaxage( $wgSquidMaxage );
-               }
-
                $this->preCacheMessages();
 
                # Fill in the file cache if not set already
@@ -192,6 +204,11 @@ class HistoryAction extends FormlessAction {
         * @return ResultWrapper
         */
        function fetchRevisions( $limit, $offset, $direction ) {
+               // Fail if article doesn't exist.
+               if( !$this->getTitle()->exists() ) {
+                       return new FakeResultWrapper( array() );
+               }
+
                $dbr = wfGetDB( DB_SLAVE );
 
                if ( $direction == HistoryPage::DIR_PREV ) {