Get rid of PHP4-style constructors
authorChad Horohoe <demon@users.mediawiki.org>
Mon, 30 Aug 2010 16:52:51 +0000 (16:52 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Mon, 30 Aug 2010 16:52:51 +0000 (16:52 +0000)
32 files changed:
includes/EditPage.php
includes/Exif.php
includes/Export.php
includes/HistoryBlob.php
includes/Licenses.php
includes/LinksUpdate.php
includes/Revision.php
includes/SpecialPage.php
includes/User.php
includes/WikiError.php
includes/ZhClient.php
includes/db/Database.php
includes/db/DatabasePostgres.php
includes/diff/DifferenceEngine.php
includes/filerepo/ArchivedFile.php
includes/json/Services_JSON.php
includes/media/MediaTransformOutput.php
includes/parser/DateFormatter.php
includes/parser/ParserOutput.php
includes/search/SearchEngine.php
includes/search/SearchMySQL.php
includes/search/SearchSqlite.php
includes/search/SearchUpdate.php
includes/specials/SpecialFileDuplicateSearch.php
includes/specials/SpecialMIMEsearch.php
includes/specials/SpecialUncategorizedcategories.php
includes/specials/SpecialUserlogin.php
includes/specials/SpecialWantedpages.php
languages/Language.php
maintenance/importDump.php
maintenance/rebuildImages.php
profileinfo.php

index 4aeb8e0..e3c8b62 100644 (file)
@@ -96,7 +96,7 @@ class EditPage {
         * @todo document
         * @param $article
         */
-       function EditPage( $article ) {
+       function __construct( $article ) {
                $this->mArticle =& $article;
                $this->mTitle = $article->getTitle();
                $this->action = 'submit';
index 50a3361..630821c 100644 (file)
@@ -620,7 +620,7 @@ class FormatExif {
         * @param $exif Array: the Exif data to format ( as returned by
         *                    Exif::getFilteredData() )
         */
-       function FormatExif( $exif ) {
+       function __construct( $exif ) {
                $this->mExif = $exif;
        }
 
index daeadc5..2342817 100644 (file)
@@ -663,7 +663,7 @@ class DumpOutput {
 class DumpFileOutput extends DumpOutput {
        var $handle;
 
-       function DumpFileOutput( $file ) {
+       function __construct( $file ) {
                $this->handle = fopen( $file, "wt" );
        }
 
@@ -679,7 +679,7 @@ class DumpFileOutput extends DumpOutput {
  * @ingroup Dump
  */
 class DumpPipeOutput extends DumpFileOutput {
-       function DumpPipeOutput( $command, $file = null ) {
+       function __construct( $command, $file = null ) {
                if( !is_null( $file ) ) {
                        $command .=  " > " . wfEscapeShellArg( $file );
                }
@@ -692,8 +692,8 @@ class DumpPipeOutput extends DumpFileOutput {
  * @ingroup Dump
  */
 class DumpGZipOutput extends DumpPipeOutput {
-       function DumpGZipOutput( $file ) {
-               parent::DumpPipeOutput( "gzip", $file );
+       function __construct( $file ) {
+               parent::__construct( "gzip", $file );
        }
 }
 
@@ -702,8 +702,8 @@ class DumpGZipOutput extends DumpPipeOutput {
  * @ingroup Dump
  */
 class DumpBZip2Output extends DumpPipeOutput {
-       function DumpBZip2Output( $file ) {
-               parent::DumpPipeOutput( "bzip2", $file );
+       function __construct( $file ) {
+               parent::__construct( "bzip2", $file );
        }
 }
 
@@ -712,12 +712,12 @@ class DumpBZip2Output extends DumpPipeOutput {
  * @ingroup Dump
  */
 class Dump7ZipOutput extends DumpPipeOutput {
-       function Dump7ZipOutput( $file ) {
+       function __construct( $file ) {
                $command = "7za a -bd -si " . wfEscapeShellArg( $file );
                // Suppress annoying useless crap from p7zip
                // Unfortunately this could suppress real error messages too
                $command .= ' >' . wfGetNull() . ' 2>&1';
-               parent::DumpPipeOutput( $command );
+               parent::__construct( $command );
        }
 }
 
@@ -730,7 +730,7 @@ class Dump7ZipOutput extends DumpPipeOutput {
  * @ingroup Dump
  */
 class DumpFilter {
-       function DumpFilter( &$sink ) {
+       function __construct( &$sink ) {
                $this->sink =& $sink;
        }
 
@@ -793,8 +793,8 @@ class DumpNamespaceFilter extends DumpFilter {
        var $invert = false;
        var $namespaces = array();
 
-       function DumpNamespaceFilter( &$sink, $param ) {
-               parent::DumpFilter( $sink );
+       function __construct( &$sink, $param ) {
+               parent::__construct( $sink );
 
                $constants = array(
                        "NS_MAIN"           => NS_MAIN,
@@ -879,7 +879,7 @@ class DumpLatestFilter extends DumpFilter {
  * @ingroup Dump
  */
 class DumpMultiWriter {
-       function DumpMultiWriter( $sinks ) {
+       function __construct( $sinks ) {
                $this->sinks = $sinks;
                $this->count = count( $sinks );
        }
index 13bf167..fe2b48b 100644 (file)
@@ -157,7 +157,7 @@ class HistoryBlobStub {
         * @param $hash Strng: the content hash of the text
         * @param $oldid Integer: the old_id for the CGZ object
         */
-       function HistoryBlobStub( $hash = '', $oldid = 0 ) {
+       function __construct( $hash = '', $oldid = 0 ) {
                $this->mHash = $hash;
        }
 
@@ -253,7 +253,7 @@ class HistoryBlobCurStub {
        /**
         * @param $curid Integer: the cur_id pointed to
         */
-       function HistoryBlobCurStub( $curid = 0 ) {
+       function __construct( $curid = 0 ) {
                $this->mCurId = $curid;
        }
 
index 33325d2..96ee124 100644 (file)
@@ -166,7 +166,7 @@ class License {
         *
         * @param $str String: license name??
         */
-       function License( $str ) {
+       function __construct( $str ) {
                list( $text, $template ) = explode( '|', strrev( $str ), 2 );
 
                $this->template = strrev( $template );
index af05746..7092d3d 100644 (file)
@@ -30,7 +30,7 @@ class LinksUpdate {
         * @param $parserOutput ParserOutput: output from a full parse of this page
         * @param $recursive Boolean: queue jobs for recursive updates?
         */
-       function LinksUpdate( $title, $parserOutput, $recursive = true ) {
+       function __construct( $title, $parserOutput, $recursive = true ) {
                global $wgAntiLockFlags;
 
                if ( $wgAntiLockFlags & ALF_NO_LINK_LOCK ) {
index 31814fe..54709de 100644 (file)
@@ -290,7 +290,7 @@ class Revision {
         * @param $row Mixed: either a database row or an array
         * @access private
         */
-       function Revision( $row ) {
+       function __construct( $row ) {
                if( is_object( $row ) ) {
                        $this->mId        = intval( $row->rev_id );
                        $this->mPage      = intval( $row->rev_page );
index e273f28..e3174db 100644 (file)
@@ -703,7 +703,7 @@ class SpecialPage {
         * @param $file String: file which is included by execute(). It is also constructed from $name by default
         * @param $includable Boolean: whether the page can be included in normal pages
         */
-       function SpecialPage( $name = '', $restriction = '', $listed = true, $function = false, $file = 'default', $includable = false ) {
+       function __construct( $name = '', $restriction = '', $listed = true, $function = false, $file = 'default', $includable = false ) {
                $this->mName = $name;
                $this->mRestriction = $restriction;
                $this->mListed = $listed;
@@ -914,8 +914,8 @@ class SpecialPage {
  */
 class UnlistedSpecialPage extends SpecialPage
 {
-       function UnlistedSpecialPage( $name, $restriction = '', $function = false, $file = 'default' ) {
-               parent::SpecialPage( $name, $restriction, false, $function, $file );
+       function __construct( $name, $restriction = '', $function = false, $file = 'default' ) {
+               parent::__construct( $name, $restriction, false, $function, $file );
        }
 }
 
@@ -925,8 +925,8 @@ class UnlistedSpecialPage extends SpecialPage
  */
 class IncludableSpecialPage extends SpecialPage
 {
-       function IncludableSpecialPage( $name, $restriction = '', $listed = true, $function = false, $file = 'default' ) {
-               parent::SpecialPage( $name, $restriction, $listed, $function, $file, true );
+       function __construct( $name, $restriction = '', $listed = true, $function = false, $file = 'default' ) {
+               parent::__construct( $name, $restriction, $listed, $function, $file, true );
        }
 }
 
index 675ccfd..bb98175 100644 (file)
@@ -178,7 +178,7 @@ class User {
         * @see newFromSession()
         * @see newFromRow()
         */
-       function User() {
+       function __construct() {
                $this->clearInstanceCache( 'defaults' );
        }
 
index 726a79c..adda36b 100644 (file)
@@ -73,7 +73,7 @@ class WikiErrorMsg extends WikiError {
         * @param $message String: wiki message name
         * @param ... parameters to pass to wfMsg()
         */
-       function WikiErrorMsg( $message/*, ... */ ) {
+       function __construct( $message/*, ... */ ) {
                $args = func_get_args();
                array_shift( $args );
                $this->mMessage = wfMsgReal( $message, $args, true );
@@ -102,7 +102,7 @@ class WikiXmlError extends WikiError {
         * @param $context
         * @param $offset Int
         */
-       function WikiXmlError( $parser, $message = 'XML parsing error', $context = null, $offset = 0 ) {
+       function __construct( $parser, $message = 'XML parsing error', $context = null, $offset = 0 ) {
                $this->mXmlError = xml_get_error_code( $parser );
                $this->mColumn = xml_get_current_column_number( $parser );
                $this->mLine = xml_get_current_line_number( $parser );
index a029be1..729213e 100644 (file)
@@ -12,7 +12,7 @@ class ZhClient {
         *
         * @access private
         */
-       function ZhClient($host, $port) {
+       function __construct($host, $port) {
                $this->mHost = $host;
                $this->mPort = $port;
                $this->mConnected = $this->connect();
index 642b4b6..42bd7d0 100644 (file)
@@ -2278,7 +2278,7 @@ abstract class DatabaseBase implements DatabaseType {
 class DBObject {
        public $mData;
 
-       function DBObject($data) {
+       function __construct($data) {
                $this->mData = $data;
        }
 
@@ -2635,7 +2635,7 @@ class ResultWrapper implements Iterator {
        /**
         * Create a new result object from a result resource and a Database object
         */
-       function ResultWrapper( $database, $result ) {
+       function __construct( $database, $result ) {
                $this->db = $database;
                if ( $result instanceof ResultWrapper ) {
                        $this->result = $result->result;
index e6c1cc2..88535e7 100644 (file)
@@ -96,7 +96,7 @@ class DatabasePostgres extends DatabaseBase {
        var $numeric_version = null;
        var $mAffectedRows = null;
 
-       function DatabasePostgres($server = false, $user = false, $password = false, $dbName = false,
+       function __construct($server = false, $user = false, $password = false, $dbName = false,
                $failFunction = false, $flags = 0 )
        {
 
index 1c9c2c9..a1f5276 100644 (file)
@@ -41,7 +41,7 @@ class _DiffOp {
 class _DiffOp_Copy extends _DiffOp {
        var $type = 'copy';
 
-       function _DiffOp_Copy ($orig, $closing = false) {
+       function __construct ($orig, $closing = false) {
                if (!is_array($closing))
                $closing = $orig;
                $this->orig = $orig;
@@ -61,7 +61,7 @@ class _DiffOp_Copy extends _DiffOp {
 class _DiffOp_Delete extends _DiffOp {
        var $type = 'delete';
 
-       function _DiffOp_Delete ($lines) {
+       function __construct ($lines) {
                $this->orig = $lines;
                $this->closing = false;
        }
@@ -79,7 +79,7 @@ class _DiffOp_Delete extends _DiffOp {
 class _DiffOp_Add extends _DiffOp {
        var $type = 'add';
 
-       function _DiffOp_Add ($lines) {
+       function __construct ($lines) {
                $this->closing = $lines;
                $this->orig = false;
        }
@@ -97,7 +97,7 @@ class _DiffOp_Add extends _DiffOp {
 class _DiffOp_Change extends _DiffOp {
        var $type = 'change';
 
-       function _DiffOp_Change ($orig, $closing) {
+       function __construct ($orig, $closing) {
                $this->orig = $orig;
                $this->closing = $closing;
        }
@@ -568,7 +568,7 @@ class Diff
         *                (Typically these are lines from a file.)
         * @param $to_lines array An array of strings.
         */
-       function Diff($from_lines, $to_lines) {
+       function __construct($from_lines, $to_lines) {
                $eng = new _DiffEngine;
                $this->edits = $eng->diff($from_lines, $to_lines);
                //$this->_check($from_lines, $to_lines);
@@ -720,14 +720,14 @@ class MappedDiff extends Diff
         * @param $mapped_to_lines array This array should
         *      have the same number of elements as $to_lines.
         */
-       function MappedDiff($from_lines, $to_lines,
+       function __construct($from_lines, $to_lines,
        $mapped_from_lines, $mapped_to_lines) {
                wfProfileIn( __METHOD__ );
 
                assert(sizeof($from_lines) == sizeof($mapped_from_lines));
                assert(sizeof($to_lines) == sizeof($mapped_to_lines));
 
-               $this->Diff($mapped_from_lines, $mapped_to_lines);
+               parent::__construct($mapped_from_lines, $mapped_to_lines);
 
                $xi = $yi = 0;
                for ($i = 0; $i < sizeof($this->edits); $i++) {
@@ -992,7 +992,7 @@ define('NBSP', '&#160;'); // iso-8859-x non-breaking space.
  * @ingroup DifferenceEngine
  */
 class _HWLDF_WordAccumulator {
-       function _HWLDF_WordAccumulator () {
+       function __construct () {
                $this->_lines = array();
                $this->_line = '';
                $this->_group = '';
@@ -1055,13 +1055,13 @@ class _HWLDF_WordAccumulator {
 class WordLevelDiff extends MappedDiff {
        const MAX_LINE_LENGTH = 10000;
 
-       function WordLevelDiff ($orig_lines, $closing_lines) {
+       function __construct ($orig_lines, $closing_lines) {
                wfProfileIn( __METHOD__ );
 
                list ($orig_words, $orig_stripped) = $this->_split($orig_lines);
                list ($closing_words, $closing_stripped) = $this->_split($closing_lines);
 
-               $this->MappedDiff($orig_words, $closing_words,
+               parent::__construct($orig_words, $closing_words,
                $orig_stripped, $closing_stripped);
                wfProfileOut( __METHOD__ );
        }
@@ -1136,7 +1136,7 @@ class WordLevelDiff extends MappedDiff {
  * @ingroup DifferenceEngine
  */
 class TableDiffFormatter extends DiffFormatter {
-       function TableDiffFormatter() {
+       function __construct() {
                $this->leading_context_lines = 2;
                $this->trailing_context_lines = 2;
        }
index 368a561..d26810e 100644 (file)
@@ -29,7 +29,7 @@ class ArchivedFile
 
        /**#@-*/
 
-       function ArchivedFile( $title, $id=0, $key='' ) {
+       function __construct( $title, $id=0, $key='' ) {
                $this->id = -1;
                $this->title = false;
                $this->name = false;
index 3407dd6..a0433b0 100644 (file)
@@ -132,7 +132,7 @@ class Services_JSON
         *                      bubble up with an error, so all return values
         *                      from encode() should be checked with isError()
         */
-       function Services_JSON($use = 0)
+       function __construct($use = 0)
        {
                $this->use = $use;
        }
index 927db92..276d254 100644 (file)
@@ -115,7 +115,7 @@ class ThumbnailImage extends MediaTransformOutput {
         * @param $page Integer: page number, for multipage files
         * @private
         */
-       function ThumbnailImage( $file, $url, $width, $height, $path = false, $page = false ) {
+       function __construct( $file, $url, $width, $height, $path = false, $page = false ) {
                $this->file = $file;
                $this->url = $url;
                # These should be integers when they get here.
index c1b07db..a6fb7df 100644 (file)
@@ -34,7 +34,7 @@ class DateFormatter
        /**
         * @todo document
         */
-       function DateFormatter() {
+       function __construct() {
                global $wgContLang;
 
                $this->monthNames = $this->getMonthRegex();
index dc9b124..6b84c22 100644 (file)
@@ -123,7 +123,7 @@ class ParserOutput extends CacheTime
                $mTOCHTML = '';               # HTML of the TOC
        private $mIndexPolicy = '';           # 'index' or 'noindex'?  Any other value will result in no change.
 
-       function ParserOutput( $text = '', $languageLinks = array(), $categoryLinks = array(),
+       function __construct( $text = '', $languageLinks = array(), $categoryLinks = array(),
                $containsOldMagic = false, $titletext = '' )
        {
                $this->mText = $text;
index 188512c..635fbff 100644 (file)
@@ -847,7 +847,7 @@ class SearchNearMatchResultSet extends SearchResultSet {
 class SearchHighlighter {
        var $mCleanWikitext = true;
 
-       function SearchHighlighter( $cleanupWikitext = true ) {
+       function __construct( $cleanupWikitext = true ) {
                $this->mCleanWikitext = $cleanupWikitext;
        }
 
index 8ff0be9..bb079c0 100644 (file)
@@ -402,7 +402,7 @@ class SearchMySQL extends SearchEngine {
  * @ingroup Search
  */
 class MySQLSearchResultSet extends SqlSearchResultSet {
-       function MySQLSearchResultSet( $resultSet, $terms, $totalHits=null ) {
+       function __construct( $resultSet, $terms, $totalHits=null ) {
                parent::__construct( $resultSet, $terms );
                $this->mTotalHits = $totalHits;
        }
index ea2aa8f..a7c09ba 100644 (file)
@@ -323,7 +323,7 @@ class SearchSqlite extends SearchEngine {
  * @ingroup Search
  */
 class SqliteSearchResultSet extends SqlSearchResultSet {
-       function SqliteSearchResultSet( $resultSet, $terms, $totalHits=null ) {
+       function __construct( $resultSet, $terms, $totalHits=null ) {
                parent::__construct( $resultSet, $terms );
                $this->mTotalHits = $totalHits;
        }
index 0379bb2..2467725 100644 (file)
@@ -18,7 +18,7 @@ class SearchUpdate {
        /* private */ var $mId = 0, $mNamespace, $mTitle, $mText;
        /* private */ var $mTitleWords;
 
-       function SearchUpdate( $id, $title, $text = false ) {
+       function __construct( $id, $title, $text = false ) {
                $nt = Title::newFromText( $title );
                if( $nt ) {
                        $this->mId = $id;
index df0cb95..06b096f 100644 (file)
@@ -31,7 +31,7 @@
 class FileDuplicateSearchPage extends QueryPage {
        var $hash, $filename;
 
-       function FileDuplicateSearchPage( $hash, $filename ) {
+       function __construct( $hash, $filename ) {
                $this->hash = $hash;
                $this->filename = $filename;
        }
index 459057a..77ce2e8 100644 (file)
@@ -30,7 +30,7 @@
 class MIMEsearchPage extends QueryPage {
        var $major, $minor;
 
-       function MIMEsearchPage( $major, $minor ) {
+       function __construct( $major, $minor ) {
                $this->major = $major;
                $this->minor = $minor;
        }
index bea916b..9574af7 100644 (file)
@@ -27,7 +27,7 @@
  * @ingroup SpecialPage
  */
 class UncategorizedCategoriesPage extends UncategorizedPagesPage {
-       function UncategorizedCategoriesPage() {
+       function __construct() {
                $this->requestedNamespace = NS_CATEGORY;
        }
 
index 5e41e3f..5e5f6a6 100644 (file)
@@ -68,7 +68,7 @@ class LoginForm {
         * @param $request WebRequest: a WebRequest object passed by reference
         * @param $par String: subpage parameter
         */
-       function LoginForm( &$request, $par = '' ) {
+       function __construct( &$request, $par = '' ) {
                global $wgAuth, $wgHiddenPrefs, $wgEnableEmail, $wgRedirectOnLogin;
 
                $this->mType = ( $par == 'signup' ) ? $par : $request->getText( 'type' ); # Check for [[Special:Userlogin/signup]]
index fb988b7..4e1611b 100644 (file)
@@ -29,7 +29,7 @@
 class WantedPagesPage extends WantedQueryPage {
        var $nlinks;
 
-       function WantedPagesPage( $inc = false, $nlinks = true ) {
+       function __construct( $inc = false, $nlinks = true ) {
                $this->setListoutput( $inc );
                $this->nlinks = $nlinks;
        }
index 71793e2..74cdb75 100644 (file)
@@ -38,7 +38,7 @@ if ( function_exists( 'mb_strtoupper' ) ) {
  */
 class FakeConverter {
        var $mLang;
-       function FakeConverter( $langobj ) { $this->mLang = $langobj; }
+       function __construct( $langobj ) { $this->mLang = $langobj; }
        function autoConvertToAllVariants( $text ) { return array( $this->mLang->getCode() => $text ); }
        function convert( $t ) { return $t; }
        function convertTitle( $t ) { return $t->getPrefixedText(); }
index 17c0404..030962b 100644 (file)
@@ -38,7 +38,7 @@ class BackupReader {
        var $debug     = false;
        var $uploads   = false;
 
-       function BackupReader() {
+       function __construct() {
                $this->stderr = fopen( "php://stderr", "wt" );
        }
 
index 9cfec70..1fbd186 100644 (file)
@@ -36,7 +36,7 @@ require_once( dirname( __FILE__ ) . '/commandLine.inc' );
 require_once( 'FiveUpgrade.inc' );
 
 class ImageBuilder extends FiveUpgrade {
-       function ImageBuilder( $dryrun = false ) {
+       function __construct( $dryrun = false ) {
                parent::FiveUpgrade();
 
                $this->maxLag = 10; # if slaves are lagged more than 10 secs, wait
index 0b3609a..2329f6a 100644 (file)
@@ -83,7 +83,7 @@ class profile_point {
        var $time;
        var $children;
 
-       function profile_point( $name, $count, $time, $memory ) {
+       function __construct( $name, $count, $time, $memory ) {
                $this->name = $name;
                $this->count = $count;
                $this->time = $time;