From b144fcb85da4316289421284d156e3eecf94e3da Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Sat, 20 Jan 2007 13:34:31 +0000 Subject: [PATCH] Rename constructors to __constructor --- RELEASE-NOTES | 1 + includes/AjaxDispatcher.php | 2 +- includes/AjaxResponse.php | 9 +++++---- includes/Article.php | 2 +- includes/BagOStuff.php | 2 +- includes/Block.php | 2 +- includes/Categoryfinder.php | 2 +- includes/ChangesList.php | 5 ++--- includes/Exif.php | 2 +- includes/Export.php | 2 +- includes/ExternalEdit.php | 2 +- includes/Feed.php | 2 +- includes/ImageGallery.php | 2 +- includes/Licenses.php | 4 ++-- includes/LinkBatch.php | 2 +- includes/LinkCache.php | 2 +- includes/Linker.php | 2 +- includes/LoadBalancer.php | 2 +- includes/LogPage.php | 2 +- includes/MacBinary.php | 4 ++-- includes/MagicWord.php | 2 +- includes/Math.php | 2 +- includes/MimeMagic.php | 2 +- includes/OutputPage.php | 2 +- includes/PageHistory.php | 2 +- includes/ParserCache.php | 2 +- includes/ParserOptions.php | 2 +- includes/Profiler.php | 4 +--- includes/ProfilerSimple.php | 6 ++---- includes/ProfilerSimpleUDP.php | 3 +-- includes/ProtectionForm.php | 5 ++--- includes/QueryPage.php | 2 +- includes/RawPage.php | 4 ++-- includes/SiteStats.php | 2 +- includes/Skin.php | 2 +- includes/SquidUpdate.php | 2 +- includes/Title.php | 2 +- includes/UserMailer.php | 2 +- includes/WebRequest.php | 2 +- includes/Wiki.php | 6 ++---- includes/WikiError.php | 2 +- 41 files changed, 52 insertions(+), 59 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index f5ea8600e0..097d65f1a3 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 == diff --git a/includes/AjaxDispatcher.php b/includes/AjaxDispatcher.php index a14ebdd69a..0034ecf4e3 100644 --- a/includes/AjaxDispatcher.php +++ b/includes/AjaxDispatcher.php @@ -14,7 +14,7 @@ class AjaxDispatcher { var $func_name; var $args; - function AjaxDispatcher() { + function __construct() { wfProfileIn( __METHOD__ ); $this->mode = ""; diff --git a/includes/AjaxResponse.php b/includes/AjaxResponse.php index 456ee1f15a..c3c15ad3af 100644 --- a/includes/AjaxResponse.php +++ b/includes/AjaxResponse.php @@ -1,8 +1,9 @@ mCacheDuration = NULL; $this->mVary = NULL; diff --git a/includes/Article.php b/includes/Article.php index 45b0747336..20d09ec5c5 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -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(); diff --git a/includes/BagOStuff.php b/includes/BagOStuff.php index ab05ab2094..4154990da5 100644 --- a/includes/BagOStuff.php +++ b/includes/BagOStuff.php @@ -37,7 +37,7 @@ class BagOStuff { var $debugmode; - function BagOStuff() { + function __construct() { $this->set_debug( false ); } diff --git a/includes/Block.php b/includes/Block.php index ff813ba3e4..99abda6c46 100644 --- a/includes/Block.php +++ b/includes/Block.php @@ -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; diff --git a/includes/Categoryfinder.php b/includes/Categoryfinder.php index a8cdf3ce4d..0aaf157546 100644 --- a/includes/Categoryfinder.php +++ b/includes/Categoryfinder.php @@ -35,7 +35,7 @@ class Categoryfinder { /** * Constructor (currently empty). */ - function Categoryfinder () { + function __construct() { } /** diff --git a/includes/ChangesList.php b/includes/ChangesList.php index 52e2627a50..ca59a53a72 100644 --- a/includes/ChangesList.php +++ b/includes/ChangesList.php @@ -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(); } diff --git a/includes/Exif.php b/includes/Exif.php index 0860d5f7e5..67ddf02b9a 100644 --- a/includes/Exif.php +++ b/includes/Exif.php @@ -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 * diff --git a/includes/Export.php b/includes/Export.php index ba584e0961..315f805d25 100644 --- a/includes/Export.php +++ b/includes/Export.php @@ -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; diff --git a/includes/ExternalEdit.php b/includes/ExternalEdit.php index 14b55fdbde..e1841f5273 100644 --- a/includes/ExternalEdit.php +++ b/includes/ExternalEdit.php @@ -22,7 +22,7 @@ class ExternalEdit { - function ExternalEdit ( $article, $mode ) { + function __construct( $article, $mode ) { global $wgInputEncoding; $this->mArticle =& $article; $this->mTitle =& $article->mTitle; diff --git a/includes/Feed.php b/includes/Feed.php index 5c14865d8f..59b6d83183 100644 --- a/includes/Feed.php +++ b/includes/Feed.php @@ -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; diff --git a/includes/ImageGallery.php b/includes/ImageGallery.php index 9d58b7f6d4..591b015efc 100644 --- a/includes/ImageGallery.php +++ b/includes/ImageGallery.php @@ -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; diff --git a/includes/Licenses.php b/includes/Licenses.php index dd1308b44e..163db39bfd 100644 --- a/includes/Licenses.php +++ b/includes/Licenses.php @@ -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 = ''; diff --git a/includes/LinkBatch.php b/includes/LinkBatch.php index 61e1c040d4..fe97d588ed 100644 --- a/includes/LinkBatch.php +++ b/includes/LinkBatch.php @@ -13,7 +13,7 @@ class LinkBatch { */ var $data = array(); - function LinkBatch( $arr = array() ) { + function __construct( $arr = array() ) { foreach( $arr as $item ) { $this->addObj( $item ); } diff --git a/includes/LinkCache.php b/includes/LinkCache.php index 8e56225ba0..0bfb8fac96 100644 --- a/includes/LinkCache.php +++ b/includes/LinkCache.php @@ -29,7 +29,7 @@ class LinkCache { return $instance; } - function LinkCache() { + function __construct() { $this->mForUpdate = false; $this->mPageLinks = array(); $this->mGoodLinks = array(); diff --git a/includes/Linker.php b/includes/Linker.php index 076425428c..c413c48173 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -16,7 +16,7 @@ * @package MediaWiki */ class Linker { - function Linker() {} + function __construct() {} /** * @deprecated diff --git a/includes/LoadBalancer.php b/includes/LoadBalancer.php index 396ef865be..ac63bc47d5 100644 --- a/includes/LoadBalancer.php +++ b/includes/LoadBalancer.php @@ -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; diff --git a/includes/LogPage.php b/includes/LogPage.php index ad0e535a57..6759ec42ec 100644 --- a/includes/LogPage.php +++ b/includes/LogPage.php @@ -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; } diff --git a/includes/MacBinary.php b/includes/MacBinary.php index 05c3ce5cfd..ecd34af944 100644 --- a/includes/MacBinary.php +++ b/includes/MacBinary.php @@ -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 +?> diff --git a/includes/MagicWord.php b/includes/MagicWord.php index 60bfd0f4c5..9b8b6d73c4 100644 --- a/includes/MagicWord.php +++ b/includes/MagicWord.php @@ -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; diff --git a/includes/Math.php b/includes/Math.php index 9fa631f7f1..32deaed982 100644 --- a/includes/Math.php +++ b/includes/Math.php @@ -22,7 +22,7 @@ class MathRenderer { var $mathml = ''; var $conservativeness = 0; - function MathRenderer( $tex ) { + function __construct( $tex ) { $this->tex = $tex; } diff --git a/includes/MimeMagic.php b/includes/MimeMagic.php index c7de6edd2a..6470144daf 100644 --- a/includes/MimeMagic.php +++ b/includes/MimeMagic.php @@ -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 --- */ diff --git a/includes/OutputPage.php b/includes/OutputPage.php index ff6c1e8e2e..e715e3df2f 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -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 = diff --git a/includes/PageHistory.php b/includes/PageHistory.php index 50dd21af7c..25f35aa67c 100644 --- a/includes/PageHistory.php +++ b/includes/PageHistory.php @@ -33,7 +33,7 @@ class PageHistory { * @param Article $article * @returns nothing */ - function PageHistory($article) { + function __construct($article) { global $wgUser; $this->mArticle =& $article; diff --git a/includes/ParserCache.php b/includes/ParserCache.php index 3d7bdb4240..1be48a6e64 100644 --- a/includes/ParserCache.php +++ b/includes/ParserCache.php @@ -28,7 +28,7 @@ class ParserCache { * * @param object $memCached */ - function ParserCache( &$memCached ) { + function __construct( &$memCached ) { $this->mMemc =& $memCached; } diff --git a/includes/ParserOptions.php b/includes/ParserOptions.php index efa3606046..6d584dbc00 100644 --- a/includes/ParserOptions.php +++ b/includes/ParserOptions.php @@ -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 ); } diff --git a/includes/Profiler.php b/includes/Profiler.php index 30cda63f6c..99f93477e9 100644 --- a/includes/Profiler.php +++ b/includes/Profiler.php @@ -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) { diff --git a/includes/ProfilerSimple.php b/includes/ProfilerSimple.php index e69bfc475b..4e14d2775e 100644 --- a/includes/ProfilerSimple.php +++ b/includes/ProfilerSimple.php @@ -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; diff --git a/includes/ProfilerSimpleUDP.php b/includes/ProfilerSimpleUDP.php index a8527c3891..1a4b610df6 100644 --- a/includes/ProfilerSimpleUDP.php +++ b/includes/ProfilerSimpleUDP.php @@ -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=""; diff --git a/includes/ProtectionForm.php b/includes/ProtectionForm.php index ef993bf0e4..cf5ce6768f 100644 --- a/includes/ProtectionForm.php +++ b/includes/ProtectionForm.php @@ -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 { } } - ?> diff --git a/includes/QueryPage.php b/includes/QueryPage.php index ff6355e754..13b3e96829 100644 --- a/includes/QueryPage.php +++ b/includes/QueryPage.php @@ -59,7 +59,7 @@ class QueryPage { * @var bool */ var $listoutput = false; - + /** * The offset and limit in use, as passed to the query() function * diff --git a/includes/RawPage.php b/includes/RawPage.php index b2c8c942ca..f86c16f3f3 100644 --- a/includes/RawPage.php +++ b/includes/RawPage.php @@ -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': diff --git a/includes/SiteStats.php b/includes/SiteStats.php index e2774a1423..4769652ccf 100644 --- a/includes/SiteStats.php +++ b/includes/SiteStats.php @@ -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; diff --git a/includes/Skin.php b/includes/Skin.php index 05689285dc..a5b7fb96d2 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -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. diff --git a/includes/SquidUpdate.php b/includes/SquidUpdate.php index 2e2a4a5d86..7d7286aa98 100644 --- a/includes/SquidUpdate.php +++ b/includes/SquidUpdate.php @@ -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; diff --git a/includes/Title.php b/includes/Title.php index 2fafcb7bd7..d63cff084e 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -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; diff --git a/includes/UserMailer.php b/includes/UserMailer.php index 0101f74412..f0d1995206 100644 --- a/includes/UserMailer.php +++ b/includes/UserMailer.php @@ -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(); diff --git a/includes/WebRequest.php b/includes/WebRequest.php index 7648b75f1c..b4c58a19ab 100644 --- a/includes/WebRequest.php +++ b/includes/WebRequest.php @@ -44,7 +44,7 @@ if ( !function_exists( '__autoload' ) ) { } class WebRequest { - function WebRequest() { + function __construct() { $this->checkMagicQuotes(); global $wgUsePathInfo; if ( $wgUsePathInfo ) { diff --git a/includes/Wiki.php b/includes/Wiki.php index 430dc6392a..26fd6dd64b 100644 --- a/includes/Wiki.php +++ b/includes/Wiki.php @@ -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; } diff --git a/includes/WikiError.php b/includes/WikiError.php index 029184d465..c5a0e31ec3 100644 --- a/includes/WikiError.php +++ b/includes/WikiError.php @@ -31,7 +31,7 @@ class WikiError { /** * @param string $message */ - function WikiError( $message ) { + function __construct( $message ) { $this->mMessage = $message; } -- 2.20.1