Rename constructors to __constructor
authorAntoine Musso <hashar@users.mediawiki.org>
Sat, 20 Jan 2007 13:34:31 +0000 (13:34 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Sat, 20 Jan 2007 13:34:31 +0000 (13:34 +0000)
41 files changed:
RELEASE-NOTES
includes/AjaxDispatcher.php
includes/AjaxResponse.php
includes/Article.php
includes/BagOStuff.php
includes/Block.php
includes/Categoryfinder.php
includes/ChangesList.php
includes/Exif.php
includes/Export.php
includes/ExternalEdit.php
includes/Feed.php
includes/ImageGallery.php
includes/Licenses.php
includes/LinkBatch.php
includes/LinkCache.php
includes/Linker.php
includes/LoadBalancer.php
includes/LogPage.php
includes/MacBinary.php
includes/MagicWord.php
includes/Math.php
includes/MimeMagic.php
includes/OutputPage.php
includes/PageHistory.php
includes/ParserCache.php
includes/ParserOptions.php
includes/Profiler.php
includes/ProfilerSimple.php
includes/ProfilerSimpleUDP.php
includes/ProtectionForm.php
includes/QueryPage.php
includes/RawPage.php
includes/SiteStats.php
includes/Skin.php
includes/SquidUpdate.php
includes/Title.php
includes/UserMailer.php
includes/WebRequest.php
includes/Wiki.php
includes/WikiError.php

index f5ea860..097d65f 100644 (file)
@@ -124,6 +124,7 @@ lighter making things easier to read.
 * (bug 8701) Check database lock status when blocking/unblocking users
 * ParserOptions and ParserOutput classes are now in their own files
 * (bug 8708) Namespace translations for Zealandic language
+* Renamed constructor methods to PHP5 __construct reserved name
 
 == Languages updated ==
 
index a14ebdd..0034ecf 100644 (file)
@@ -14,7 +14,7 @@ class AjaxDispatcher {
        var $func_name;
        var $args;
 
-       function AjaxDispatcher() {
+       function __construct() {
                wfProfileIn( __METHOD__ );
 
                $this->mode = "";
index 456ee1f..c3c15ad 100644 (file)
@@ -1,8 +1,9 @@
 <?php
+if( !defined( 'MEDIAWIKI' ) ) {
+       die( 1 );
+}
 
-if( !defined( 'MEDIAWIKI' ) )
-        die( 1 );
-
+/** @todo document */
 class AjaxResponse {
        var $mCacheDuration;
        var $mVary;
@@ -13,7 +14,7 @@ class AjaxResponse {
        var $mLastModified;
        var $mContentType;
 
-       function AjaxResponse( $text = NULL ) {
+       function __construct( $text = NULL ) {
                $this->mCacheDuration = NULL;
                $this->mVary = NULL;
 
index 45b0747..20d09ec 100644 (file)
@@ -43,7 +43,7 @@ class Article {
         * @param $title Reference to a Title object.
         * @param $oldId Integer revision ID, null to fetch from request, zero for current
         */
-       function Article( &$title, $oldId = null ) {
+       function __construct( &$title, $oldId = null ) {
                $this->mTitle =& $title;
                $this->mOldId = $oldId;
                $this->clear();
index ab05ab2..4154990 100644 (file)
@@ -37,7 +37,7 @@
 class BagOStuff {
        var $debugmode;
 
-       function BagOStuff() {
+       function __construct() {
                $this->set_debug( false );
        }
 
index ff813ba..99abda6 100644 (file)
@@ -24,7 +24,7 @@ class Block
        const EB_FOR_UPDATE = 2;
        const EB_RANGE_ONLY = 4;
 
-       function Block( $address = '', $user = 0, $by = 0, $reason = '',
+       function __construct( $address = '', $user = 0, $by = 0, $reason = '',
                $timestamp = '' , $auto = 0, $expiry = '', $anonOnly = 0, $createAccount = 0, $enableAutoblock = 0 )
        {
                $this->mId = 0;
index a8cdf3c..0aaf157 100644 (file)
@@ -35,7 +35,7 @@ class Categoryfinder {
        /**
         * Constructor (currently empty).
        */
-       function Categoryfinder () {
+       function __construct() {
        }
 
        /**
index 52e2627..ca59a53 100644 (file)
@@ -17,8 +17,7 @@ class RCCacheEntry extends RecentChange
        var $curlink , $difflink, $lastlink , $usertalklink , $versionlink ;
        var $userlink, $timestamp, $watched;
 
-       function newFromParent( $rc )
-       {
+       function newFromParent( $rc ) {
                $rc2 = new RCCacheEntry;
                $rc2->mAttribs = $rc->mAttribs;
                $rc2->mExtra = $rc->mExtra;
@@ -34,7 +33,7 @@ class ChangesList {
        #
 
        /** @todo document */
-       function ChangesList( &$skin ) {
+       function __construct( &$skin ) {
                $this->skin =& $skin;
                $this->preCacheMessages();
        }
index 0860d5f..67ddf02 100644 (file)
@@ -106,7 +106,7 @@ class Exif {
         *
         * @param $file String: filename.
         */
-       function Exif( $file ) {
+       function __construct( $file ) {
                /**
                 * Page numbers here refer to pages in the EXIF 2.2 standard
                 *
index ba584e0..315f805 100644 (file)
@@ -51,7 +51,7 @@ class WikiExporter {
         *                         dir: "asc" or "desc" timestamp order
         * @param int $buffer one of WikiExporter::BUFFER or WikiExporter::STREAM
         */
-       function WikiExporter( &$db, $history = WikiExporter::CURRENT,
+       function __construct( &$db, $history = WikiExporter::CURRENT,
                        $buffer = WikiExporter::BUFFER, $text = WikiExporter::TEXT ) {
                $this->db =& $db;
                $this->history = $history;
index 14b55fd..e1841f5 100644 (file)
@@ -22,7 +22,7 @@
 
 class ExternalEdit {
 
-       function ExternalEdit ( $article, $mode ) {
+       function __construct( $article, $mode ) {
                global $wgInputEncoding;
                $this->mArticle =& $article;
                $this->mTitle =& $article->mTitle;
index 5c14865..59b6d83 100644 (file)
@@ -45,7 +45,7 @@ class FeedItem {
        /**#@+
         * @todo document
         */
-       function FeedItem( $Title, $Description, $Url, $Date = '', $Author = '', $Comments = '' ) {
+       function __construct( $Title, $Description, $Url, $Date = '', $Author = '', $Comments = '' ) {
                $this->Title = $Title;
                $this->Description = $Description;
                $this->Url = $Url;
index 9d58b7f..591b015 100644 (file)
@@ -27,7 +27,7 @@ class ImageGallery
        /**
         * Create a new image gallery object.
         */
-       function ImageGallery( ) {
+       function __construct( ) {
                $this->mImages = array();
                $this->mShowBytes = true;
                $this->mShowFilename = true;
index dd1308b..163db39 100644 (file)
@@ -31,12 +31,12 @@ class Licenses {
        /**#@-*/
 
        /**
-        * Constrictor
+        * Constructor
         *
         * @param $str String: the string to build the licenses member from, will use
         *                    wfMsgForContent( 'licenses' ) if null (default: null)
         */
-       function Licenses( $str = null ) {
+       function __construct( $str = null ) {
                // PHP sucks, this should be possible in the constructor
                $this->msg = is_null( $str ) ? wfMsgForContent( 'licenses' ) : $str;
                $this->html = '';
index 61e1c04..fe97d58 100644 (file)
@@ -13,7 +13,7 @@ class LinkBatch {
         */
        var $data = array();
 
-       function LinkBatch( $arr = array() ) {
+       function __construct( $arr = array() ) {
                foreach( $arr as $item ) {
                        $this->addObj( $item );
                }
index 8e56225..0bfb8fa 100644 (file)
@@ -29,7 +29,7 @@ class LinkCache {
                return $instance;
        }
 
-       function LinkCache() {
+       function __construct() {
                $this->mForUpdate = false;
                $this->mPageLinks = array();
                $this->mGoodLinks = array();
index 0764254..c413c48 100644 (file)
@@ -16,7 +16,7 @@
  * @package MediaWiki
  */
 class Linker {
-       function Linker() {}
+       function __construct() {}
 
        /**
         * @deprecated
index 396ef86..ac63bc4 100644 (file)
@@ -24,7 +24,7 @@ class LoadBalancer {
         */
        const AVG_STATUS_POLL = 2000;
 
-       function LoadBalancer( $servers, $failFunction = false, $waitTimeout = 10, $waitForMasterNow = false )
+       function __construct( $servers, $failFunction = false, $waitTimeout = 10, $waitForMasterNow = false )
        {
                $this->mServers = $servers;
                $this->mFailFunction = $failFunction;
index ad0e535..6759ec4 100644 (file)
@@ -44,7 +44,7 @@ class LogPage {
          *               'upload', 'move'
          * @param bool $rc Whether to update recent changes as well as the logging table
          */
-       function LogPage( $type, $rc = true ) {
+       function __construct( $type, $rc = true ) {
                $this->type = $type;
                $this->updateRecentChanges = $rc;
        }
index 05c3ce5..ecd34af 100644 (file)
@@ -27,7 +27,7 @@
  */
 
 class MacBinary {
-       function MacBinary( $filename ) {
+       function __construct( $filename ) {
                $this->open( $filename );
                $this->loadHeader();
        }
@@ -269,4 +269,4 @@ class MacBinary {
        }
 }
 
-?>
\ No newline at end of file
+?>
index 60bfd0f..9b8b6d7 100644 (file)
@@ -108,7 +108,7 @@ class MagicWord {
 
        /**#@-*/
 
-       function MagicWord($id = 0, $syn = '', $cs = false) {
+       function __construct($id = 0, $syn = '', $cs = false) {
                $this->mId = $id;
                $this->mSynonyms = (array)$syn;
                $this->mCaseSensitive = $cs;
index 9fa631f..32deaed 100644 (file)
@@ -22,7 +22,7 @@ class MathRenderer {
        var $mathml = '';
        var $conservativeness = 0;
 
-       function MathRenderer( $tex ) {
+       function __construct( $tex ) {
                $this->tex = $tex;
        }
 
index c7de6ed..6470144 100644 (file)
@@ -105,7 +105,7 @@ class MimeMagic {
        *
        * This constructor parses the mime.types and mime.info files and build internal mappings.
        */
-       function MimeMagic() {
+       function __construct() {
                /*
                *   --- load mime.types ---
                */
index ff6c1e8..e715e3d 100644 (file)
@@ -34,7 +34,7 @@ class OutputPage {
         * Constructor
         * Initialise private variables
         */
-       function OutputPage() {
+       function __construct() {
                $this->mMetatags = $this->mKeywords = $this->mLinktags = array();
                $this->mHTMLtitle = $this->mPagetitle = $this->mBodytext =
                $this->mRedirect = $this->mLastModified =
index 50dd21a..25f35aa 100644 (file)
@@ -33,7 +33,7 @@ class PageHistory {
         * @param Article $article
         * @returns nothing
         */
-       function PageHistory($article) {
+       function __construct($article) {
                global $wgUser;
 
                $this->mArticle =& $article;
index 3d7bdb4..1be48a6 100644 (file)
@@ -28,7 +28,7 @@ class ParserCache {
         *
         * @param object $memCached
         */
-       function ParserCache( &$memCached ) {
+       function __construct( &$memCached ) {
                $this->mMemc =& $memCached;
        }
 
index efa3606..6d584db 100644 (file)
@@ -67,7 +67,7 @@ class ParserOptions
        function setMaxIncludeSize( $x )            { return wfSetVar( $this->mMaxIncludeSize, $x ); }
        function setRemoveComments( $x )            { return wfSetVar( $this->mRemoveComments, $x ); }
 
-       function ParserOptions( $user = null ) {
+       function __construct( $user = null ) {
                $this->initialiseFromUser( $user );
        }
 
index 30cda63..99f9347 100644 (file)
@@ -47,8 +47,7 @@ class Profiler {
        var $mStack = array (), $mWorkStack = array (), $mCollated = array ();
        var $mCalls = array (), $mTotals = array ();
 
-       function Profiler()
-       {
+       function __construct() {
                // Push an entry for the pre-profile setup time onto the stack
                global $wgRequestTime;
                if ( !empty( $wgRequestTime ) ) {
@@ -57,7 +56,6 @@ class Profiler {
                } else {
                        $this->profileIn( '-total' );
                }
-
        }
 
        function profileIn($functionname) {
index e69bfc4..4e14d27 100644 (file)
@@ -14,7 +14,7 @@ class ProfilerSimple extends Profiler {
        var $mMinimumTime = 0;
        var $mProfileID = false;
 
-       function ProfilerSimple() {
+       function __construct() {
                global $wgRequestTime,$wgRUstart;
                if (!empty($wgRequestTime) && !empty($wgRUstart)) {
                        $this->mWorkStack[] = array( '-total', 0, $wgRequestTime,$this->getCpuTime($wgRUstart));
@@ -26,7 +26,6 @@ class ProfilerSimple extends Profiler {
                        if (!is_array($entry)) {
                                $entry = array('cpu'=> 0.0, 'cpu_sq' => 0.0, 'real' => 0.0, 'real_sq' => 0.0, 'count' => 0);
                                $this->mCollated["-setup"] =& $entry;
-                               
                        }
                        $entry['cpu'] += $elapsedcpu;
                        $entry['cpu_sq'] += $elapsedcpu*$elapsedcpu;
@@ -57,7 +56,7 @@ class ProfilerSimple extends Profiler {
                if ($wgDebugFunctionEntry) {
                        $this->debug(str_repeat(' ', count($this->mWorkStack)).'Entering '.$functionname."\n");
                }
-               $this->mWorkStack[] = array($functionname, count( $this->mWorkStack ), microtime(true), $this->getCpuTime());           
+               $this->mWorkStack[] = array($functionname, count( $this->mWorkStack ), microtime(true), $this->getCpuTime());
        }
 
        function profileOut($functionname) {
@@ -87,7 +86,6 @@ class ProfilerSimple extends Profiler {
                        if (!is_array($entry)) {
                                $entry = array('cpu'=> 0.0, 'cpu_sq' => 0.0, 'real' => 0.0, 'real_sq' => 0.0, 'count' => 0);
                                $this->mCollated[$functionname] =& $entry;
-                               
                        }
                        $entry['cpu'] += $elapsedcpu;
                        $entry['cpu_sq'] += $elapsedcpu*$elapsedcpu;
index a8527c3..1a4b610 100644 (file)
@@ -15,8 +15,7 @@ class ProfilerSimpleUDP extends ProfilerSimple {
                        # Less than minimum, ignore
                        return;
                }
-                       
-               
+
                $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
                $plength=0;
                $packet="";
index ef993bf..cf5ce67 100644 (file)
@@ -27,7 +27,7 @@ class ProtectionForm {
        var $mReason = '';
        var $mCascade = false;
 
-       function ProtectionForm( &$article ) {
+       function __construct( &$article ) {
                global $wgRequest, $wgUser;
                global $wgRestrictionTypes, $wgRestrictionLevels;
                $this->mArticle =& $article;
@@ -231,7 +231,7 @@ class ProtectionForm {
        function buildCascadeInput() {
                $id = 'mwProtect-cascade';
                $ci = wfCheckLabel( wfMsg( 'protect-cascade' ), $id, $id, $this->mCascade, $this->disabledAttrib);
-               
+
                return $ci;
        }
 
@@ -269,5 +269,4 @@ class ProtectionForm {
        }
 }
 
-
 ?>
index ff6355e..13b3e96 100644 (file)
@@ -59,7 +59,7 @@ class QueryPage {
         * @var bool
         */
        var $listoutput = false;
-       
+
        /**
         * The offset and limit in use, as passed to the query() function
         *
index b2c8c94..f86c16f 100644 (file)
@@ -20,7 +20,7 @@ class RawPage {
        var $mSmaxage, $mMaxage;
        var $mContentType, $mExpandTemplates;
 
-       function RawPage( &$article, $request = false ) {
+       function __construct( &$article, $request = false ) {
                global $wgRequest, $wgInputEncoding, $wgSquidMaxage, $wgJsMimeType;
                global $wgUser;
 
@@ -39,7 +39,7 @@ class RawPage {
                $maxage = $this->mRequest->getInt( 'maxage', $wgSquidMaxage );
                $this->mExpandTemplates = $this->mRequest->getVal( 'templates' ) === 'expand';
                $this->mUseMessageCache = $this->mRequest->getBool( 'usemsgcache' );
-               
+
                $oldid = $this->mRequest->getInt( 'oldid' );
                switch ( $wgRequest->getText( 'direction' ) ) {
                        case 'next':
index e2774a1..4769652 100644 (file)
@@ -89,7 +89,7 @@ class SiteStatsUpdate {
 
        var $mViews, $mEdits, $mGood, $mPages, $mUsers;
 
-       function SiteStatsUpdate( $views, $edits, $good, $pages = 0, $users = 0 ) {
+       function __construct( $views, $edits, $good, $pages = 0, $users = 0 ) {
                $this->mViews = $views;
                $this->mEdits = $edits;
                $this->mGood = $good;
index 0568928..a5b7fb9 100644 (file)
@@ -27,7 +27,7 @@ class Skin extends Linker {
        /**#@-*/
 
        /** Constructor, call parent constructor */
-       function Skin() { parent::Linker(); }
+       function Skin() { parent::__construct(); }
 
        /**
         * Fetch the set of available skins.
index 2e2a4a5..7d7286a 100644 (file)
@@ -11,7 +11,7 @@
 class SquidUpdate {
        var $urlArr, $mMaxTitles;
 
-       function SquidUpdate( $urlArr = Array(), $maxTitles = false ) {
+       function __construct( $urlArr = Array(), $maxTitles = false ) {
                global $wgMaxSquidPurgeTitles;
                if ( $maxTitles === false ) {
                        $this->mMaxTitles = $wgMaxSquidPurgeTitles;
index 2fafcb7..d63cff0 100644 (file)
@@ -68,7 +68,7 @@ class Title {
         * Constructor
         * @private
         */
-       /* private */ function Title() {
+       /* private */ function __construct() {
                $this->mInterwiki = $this->mUrlform =
                $this->mTextform = $this->mDbkeyform = '';
                $this->mArticleID = -1;
index 0101f74..f0d1995 100644 (file)
@@ -38,7 +38,7 @@ class MailAddress {
         * @param mixed $address String with an email address, or a User object
         * @param string $name Human-readable name if a string address is given
         */
-       function MailAddress( $address, $name=null ) {
+       function __construct( $address, $name=null ) {
                if( is_object( $address ) && $address instanceof User ) {
                        $this->address = $address->getEmail();
                        $this->name = $address->getName();
index 7648b75..b4c58a1 100644 (file)
@@ -44,7 +44,7 @@ if ( !function_exists( '__autoload' ) ) {
 }
 
 class WebRequest {
-       function WebRequest() {
+       function __construct() {
                $this->checkMagicQuotes();
                global $wgUsePathInfo;
                if ( $wgUsePathInfo ) {
index 430dc63..26fd6dd 100644 (file)
@@ -8,10 +8,8 @@ class MediaWiki {
        var $GET; /* Stores the $_GET variables at time of creation, can be changed */
        var $params = array();
 
-       /**
-        * Constructor
-        */
-       function MediaWiki () {
+       /** Constructor. It just save the $_GET variable */
+       function __construct() {
                $this->GET = $_GET;
        }
 
index 029184d..c5a0e31 100644 (file)
@@ -31,7 +31,7 @@ class WikiError {
        /**
         * @param string $message
         */
-       function WikiError( $message ) {
+       function __construct( $message ) {
                $this->mMessage = $message;
        }