Document a few things
[lhc/web/wiklou.git] / includes / Export.php
index e8e7428..b4f28be 100644 (file)
@@ -152,15 +152,14 @@ class WikiExporter {
        # Not called by default (depends on $this->list_authors)
        # Can be set by Special:Export when not exporting whole history
        protected function do_list_authors( $page , $revision , $cond ) {
-               $fname = "do_list_authors" ;
-               wfProfileIn( $fname );
+               wfProfileIn( __METHOD__ );
                $this->author_list = "<contributors>";
                //rev_deleted
                $nothidden = '('.$this->db->bitAnd('rev_deleted', Revision::DELETED_USER) . ') = 0';
 
                $sql = "SELECT DISTINCT rev_user_text,rev_user FROM {$page},{$revision} 
                WHERE page_id=rev_page AND $nothidden AND " . $cond ;
-               $result = $this->db->query( $sql, $fname );
+               $result = $this->db->query( $sql, __METHOD__ );
                $resultset = $this->db->resultObject( $result );
                while( $row = $resultset->fetchObject() ) {
                        $this->author_list .= "<contributor>" .
@@ -172,7 +171,7 @@ class WikiExporter {
                                "</id>" .
                                "</contributor>";
                }
-               wfProfileOut( $fname );
+               wfProfileOut( __METHOD__ );
                $this->author_list .= "</contributors>";
        }
 
@@ -363,7 +362,7 @@ class XmlDumpWriter {
         * @return string
         */
        function openStream() {
-               global $wgContLanguageCode;
+               global $wgLanguageCode;
                $ver = $this->schemaVersion();
                return Xml::element( 'mediawiki', array(
                        'xmlns'              => "http://www.mediawiki.org/xml/export-$ver/",
@@ -371,7 +370,7 @@ class XmlDumpWriter {
                        'xsi:schemaLocation' => "http://www.mediawiki.org/xml/export-$ver/ " .
                                                "http://www.mediawiki.org/xml/export-$ver.xsd",
                        'version'            => $ver,
-                       'xml:lang'           => $wgContLanguageCode ),
+                       'xml:lang'           => $wgLanguageCode ),
                        null ) .
                        "\n" .
                        $this->siteInfo();
@@ -477,8 +476,7 @@ class XmlDumpWriter {
         * @access private
         */
        function writeRevision( $row ) {
-               $fname = 'WikiExporter::dumpRev';
-               wfProfileIn( $fname );
+               wfProfileIn( __METHOD__ );
 
                $out  = "    <revision>\n";
                $out .= "      " . Xml::element( 'id', null, strval( $row->rev_id ) ) . "\n";
@@ -520,7 +518,7 @@ class XmlDumpWriter {
 
                $out .= "    </revision>\n";
 
-               wfProfileOut( $fname );
+               wfProfileOut( __METHOD__ );
                return $out;
        }
        
@@ -533,8 +531,7 @@ class XmlDumpWriter {
         * @access private
         */
        function writeLogItem( $row ) {
-               $fname = 'WikiExporter::writeLogItem';
-               wfProfileIn( $fname );
+               wfProfileIn( __METHOD__ );
 
                $out  = "    <logitem>\n";
                $out .= "      " . Xml::element( 'id', null, strval( $row->log_id ) ) . "\n";
@@ -568,7 +565,7 @@ class XmlDumpWriter {
 
                $out .= "    </logitem>\n";
 
-               wfProfileOut( $fname );
+               wfProfileOut( __METHOD__ );
                return $out;
        }
 
@@ -666,7 +663,7 @@ class DumpOutput {
 class DumpFileOutput extends DumpOutput {
        var $handle;
 
-       function DumpFileOutput( $file ) {
+       function __construct( $file ) {
                $this->handle = fopen( $file, "wt" );
        }
 
@@ -682,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 );
                }
@@ -695,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 );
        }
 }
 
@@ -705,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 );
        }
 }
 
@@ -715,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 );
        }
 }
 
@@ -733,7 +730,7 @@ class Dump7ZipOutput extends DumpPipeOutput {
  * @ingroup Dump
  */
 class DumpFilter {
-       function DumpFilter( &$sink ) {
+       function __construct( &$sink ) {
                $this->sink =& $sink;
        }
 
@@ -796,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,
@@ -882,7 +879,7 @@ class DumpLatestFilter extends DumpFilter {
  * @ingroup Dump
  */
 class DumpMultiWriter {
-       function DumpMultiWriter( $sinks ) {
+       function __construct( $sinks ) {
                $this->sinks = $sinks;
                $this->count = count( $sinks );
        }
@@ -919,8 +916,7 @@ class DumpMultiWriter {
 }
 
 function xmlsafe( $string ) {
-       $fname = 'xmlsafe';
-       wfProfileIn( $fname );
+       wfProfileIn( __FUNCTION__ );
 
        /**
         * The page may contain old data which has not been properly normalized.
@@ -930,6 +926,6 @@ function xmlsafe( $string ) {
        $string = UtfNormal::cleanUp( $string );
 
        $string = htmlspecialchars( $string );
-       wfProfileOut( $fname );
+       wfProfileOut( __FUNCTION__ );
        return $string;
 }