AutoLoad RawPage, EditPage, ExternalEdit, PageHistory, move DIR_NEXT and DIR_PREV...
authorDomas Mituzas <midom@users.mediawiki.org>
Tue, 6 Jun 2006 12:28:44 +0000 (12:28 +0000)
committerDomas Mituzas <midom@users.mediawiki.org>
Tue, 6 Jun 2006 12:28:44 +0000 (12:28 +0000)
includes/ImagePage.php
includes/PageHistory.php
includes/Wiki.php

index 9b91c87..3c31e95 100644 (file)
@@ -674,7 +674,6 @@ END
        }
 
        function blockedIPpage() {
-               require_once( 'EditPage.php' );
                $edit = new EditPage( $this );
                return $edit->blockedIPpage();
        }
index f6cf419..4cd9a3f 100644 (file)
@@ -6,9 +6,6 @@
  * @package MediaWiki
  */
 
-define('DIR_PREV', 0);
-define('DIR_NEXT', 1);
-
 /**
  * This class handles printing the history page for an article.  In order to
  * be efficient, it uses timestamps rather than offsets for paging, to avoid
@@ -21,6 +18,9 @@ define('DIR_NEXT', 1);
  */
 
 class PageHistory {
+       const DIR_PREV = 0;
+       const DIR_NEXT = 1;
+       
        var $mArticle, $mTitle, $mSkin;
        var $lastdate;
        var $linesonpage;
@@ -146,7 +146,7 @@ class PageHistory {
                        $this->linesonpage = count($revisions) - 1;
 
                /* Un-reverse revisions */
-               if ($direction == DIR_PREV)
+               if ($direction == PageHistory::DIR_PREV)
                        $revisions = array_reverse($revisions);
 
                /*
@@ -432,9 +432,9 @@ class PageHistory {
        function getDirection() {
                global $wgRequest;
                if ($wgRequest->getText("dir") == "prev")
-                       return DIR_PREV;
+                       return PageHistory::DIR_PREV;
                else
-                       return DIR_NEXT;
+                       return PageHistory::DIR_NEXT;
        }
 
        /** @todo document */
@@ -443,9 +443,9 @@ class PageHistory {
 
                $dbr =& wfGetDB( DB_SLAVE );
 
-               if ($direction == DIR_PREV)
+               if ($direction == PageHistory::DIR_PREV)
                        list($dirs, $oper) = array("ASC", ">=");
-               else /* $direction == DIR_NEXT */
+               else /* $direction == PageHistory::DIR_NEXT */
                        list($dirs, $oper) = array("DESC", "<=");
 
                if ($offset)
@@ -510,7 +510,7 @@ class PageHistory {
                 * When we're displaying previous revisions, we need to reverse
                 * the array, because it's queried in reverse order.
                 */
-               if ($direction == DIR_PREV)
+               if ($direction == PageHistory::DIR_PREV)
                        $revisions = array_reverse($revisions);
 
                /*
@@ -591,7 +591,7 @@ class PageHistory {
                        wfMsgForContent( 'history-feed-description' ),
                        $this->mTitle->getFullUrl( 'action=history' ) );
 
-               $items = $this->fetchRevisions(10, 0, DIR_NEXT);
+               $items = $this->fetchRevisions(10, 0, PageHistory::DIR_NEXT);
                $feed->outHeader();
                if( $items ) {
                        foreach( $items as $row ) {
index 8014e3e..682b76a 100644 (file)
@@ -371,11 +371,9 @@ class MediaWiki {
                                $oldid = $request->getVal( 'oldid' );
                                if( !$this->getVal( 'UseExternalEditor' ) || $action=='submit' || $internal ||
                                   $section || $oldid || ( !$user->getOption( 'externaleditor' ) && !$external ) ) {
-                                       require_once( 'includes/EditPage.php' );
                                        $editor = new EditPage( $article );
                                        $editor->submit();
                                } elseif( $this->getVal( 'UseExternalEditor' ) && ( $external || $user->getOption( 'externaleditor' ) ) ) {
-                                       require_once( 'includes/ExternalEdit.php' );
                                        $mode = $request->getVal( 'mode' );
                                        $extedit = new ExternalEdit( $article, $mode );
                                        $extedit->edit();
@@ -385,12 +383,10 @@ class MediaWiki {
                                if( $_SERVER['REQUEST_URI'] == $title->getInternalURL( 'action=history' ) ) {
                                        $output->setSquidMaxage( $this->getVal( 'SquidMaxage' ) );
                                }
-                               require_once( 'includes/PageHistory.php' );
                                $history = new PageHistory( $article );
                                $history->history();
                                break;
                        case 'raw':
-                               require_once( 'includes/RawPage.php' );
                                $raw = new RawPage( $article );
                                $raw->view();
                                break;