Add, update, tweak documentation
authorSam Reed <reedy@users.mediawiki.org>
Wed, 26 Oct 2011 03:45:13 +0000 (03:45 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Wed, 26 Oct 2011 03:45:13 +0000 (03:45 +0000)
Fix document comment blocks

Tweak some returns

18 files changed:
includes/WebRequest.php
includes/WikiFilePage.php
includes/WikiMap.php
includes/WikiPage.php
includes/ZhClient.php
includes/ZipDirectoryReader.php
index.php5
maintenance/fetchText.php
resources/mediawiki/mediawiki.js
skins/common/upload.js
tests/parser/parserTest.inc
tests/phpunit/includes/IPTest.php
tests/phpunit/includes/SeleniumConfigurationTest.php
tests/phpunit/includes/parser/NewParserTest.php
tests/phpunit/includes/search/SearchEngineTest.php
tests/selenium/SeleniumConfig.php
tests/selenium/suites/MediawikiCoreSmokeTestCase.php
tests/selenium/suites/SimpleSeleniumTestCase.php

index daab86f..8f2bafd 100644 (file)
@@ -1192,6 +1192,10 @@ class FauxRequest extends WebRequest {
                        $this->session = $session;
        }
 
+       /**
+        * @param $method string
+        * @throws MWException
+        */
        private function notImplemented( $method ) {
                throw new MWException( "{$method}() not implemented" );
        }
index 4997145..87b5487 100644 (file)
@@ -25,13 +25,15 @@ class WikiFilePage extends WikiPage {
 
        /**
         * @param $file File:
-        * @return void
         */
        public function setFile( $file ) {
                $this->mFile = $file;
                $this->mFileLoaded = true;
        }
 
+       /**
+        * @return bool
+        */
        protected function loadFile() {
                if ( $this->mFileLoaded ) {
                        return true;
@@ -49,6 +51,9 @@ class WikiFilePage extends WikiPage {
                return true;
        }
 
+       /**
+        * @return mixed|null|Title
+        */
        public function getRedirectTarget() {
                $this->loadFile();
                if ( $this->mFile->isLocal() ) {
@@ -63,6 +68,9 @@ class WikiFilePage extends WikiPage {
                return $this->mRedirectTarget = Title::makeTitle( NS_FILE, $to );
        }
 
+       /**
+        * @return bool|mixed|Title
+        */
        public function followRedirect() {
                $this->loadFile();
                if ( $this->mFile->isLocal() ) {
@@ -76,6 +84,10 @@ class WikiFilePage extends WikiPage {
                return Title::makeTitle( NS_FILE, $to );
        }
 
+       /**
+        * @param bool $text
+        * @return bool
+        */
        public function isRedirect( $text = false ) {
                $this->loadFile();
                if ( $this->mFile->isLocal() ) {
@@ -85,16 +97,25 @@ class WikiFilePage extends WikiPage {
                return (bool)$this->mFile->getRedirected();
        }
 
+       /**
+        * @return bool
+        */
        public function isLocal() {
                $this->loadFile();
                return $this->mFile->isLocal();
        }
 
+       /**
+        * @return bool|File
+        */
        public function getFile() {
                $this->loadFile();
                return $this->mFile;
        }
 
+       /**
+        * @return array|null
+        */
        public function getDuplicates() {
                $this->loadFile();
                if ( !is_null( $this->mDupes ) ) {
@@ -108,6 +129,10 @@ class WikiFilePage extends WikiPage {
                // Remove duplicates with self and non matching file sizes
                $self = $this->mFile->getRepoName() . ':' . $this->mFile->getName();
                $size = $this->mFile->getSize();
+
+               /**
+                * @var $file File
+                */
                foreach ( $dupes as $index => $file ) {
                        $key = $file->getRepoName() . ':' . $file->getName();
                        if ( $key == $self ) {
index 94907ad..6c7f23b 100644 (file)
@@ -28,7 +28,7 @@ class WikiMap {
                        array( 'lang' => $minor, 'site' => $major ) );
                return new WikiReference( $major, $minor, $canonicalServer, $path, $server );
        }
-       
+
        /**
         * Convenience to get the wiki's display name
         *
@@ -87,11 +87,11 @@ class WikiMap {
         */
        public static function getForeignURL( $wikiID, $page ) {
                $wiki = WikiMap::getWiki( $wikiID );
-               
+
                if ( $wiki ) {
                        return $wiki->getUrl( $page );
                }
-                       
+
                return false;
        }
 }
@@ -114,6 +114,10 @@ class WikiReference {
                $this->mServer = $server === null ? $canonicalServer : $server;
        }
 
+       /**
+        * @return string
+        * @throws MWException
+        */
        public function getHostname() {
                $prefixes = array( 'http://', 'https://' );
                foreach ( $prefixes as $prefix ) {
@@ -159,22 +163,21 @@ class WikiReference {
         * @return String: Url
         */
        public function getCanonicalUrl( $page ) {
-               return
-                       $this->mCanonicalServer .
-                       $this->getLocalUrl( $page );
+               return $this->mCanonicalServer . $this->getLocalUrl( $page );
        }
-       
+
        /**
         * Alias for getCanonicalUrl(), for backwards compatibility.
+        * @return String
         */
        public function getUrl( $page ) {
                return $this->getCanonicalUrl( $page );
        }
-       
+
        /**
         * Get a URL based on $wgServer, like Title::getFullUrl() would produce
         * when called locally on the wiki.
-        * 
+        *
         * @param $page String: page name (must be normalized before calling this function!)
         * @return String: URL
         */
index e1ec64d..3462427 100644 (file)
@@ -26,8 +26,17 @@ class WikiPage extends Page {
        public $mIsRedirect = false;         // !< Boolean
        public $mLatest = false;             // !< Boolean
        public $mPreparedEdit = false;           // !< Array
-       public $mRedirectTarget = null;          // !< Title object
-       public $mLastRevision = null;            // !< Revision object
+
+       /**
+        * @var Title
+        */
+       public $mRedirectTarget = null;
+
+       /**
+        * @var Revision
+        */
+       public $mLastRevision = null;
+
        public $mTimestamp = '';             // !< String
        public $mTouched = '19700101000000'; // !< String
        /**@}}*/
@@ -700,6 +709,7 @@ class WikiPage extends Page {
         * Should the parser cache be used?
         *
         * @param $user User The relevant user
+        * @param $oldid int
         * @return boolean
         */
        public function isParserCacheUsed( User $user, $oldid ) {
@@ -756,7 +766,6 @@ class WikiPage extends Page {
         *
         * @param $dbw DatabaseBase
         * @return int The newly created page_id key, or false if the title already existed
-        * @private
         */
        public function insertOn( $dbw ) {
                wfProfileIn( __METHOD__ );
@@ -1585,7 +1594,7 @@ class WikiPage extends Page {
         * Deletes the article with database consistency, writes logs, purges caches
         *
         * @param $reason string delete reason for deletion log
-        * @param suppress bitfield
+        * @param $suppress bitfield
         *      Revision::DELETED_TEXT
         *      Revision::DELETED_COMMENT
         *      Revision::DELETED_USER
@@ -2585,7 +2594,7 @@ class WikiPage extends Page {
         * Updates cascading protections
         *
         * @param $parserOutput ParserOutput object for the current version
-        **/
+        */
        public function doCascadeProtectionUpdates( ParserOutput $parserOutput ) {
                if ( wfReadOnly() || !$this->mTitle->areRestrictionsCascading() ) {
                        return;
@@ -2632,25 +2641,25 @@ class WikiPage extends Page {
                }
        }
 
-       /*
-       * @deprecated since 1.18
-       */
+       /**
+        * @deprecated since 1.18
+        */
        public function quickEdit( $text, $comment = '', $minor = 0 ) {
                global $wgUser;
                return $this->doQuickEdit( $text, $wgUser, $comment, $minor );
        }
 
-       /*
-       * @deprecated since 1.18
-       */
+       /**
+        * @deprecated since 1.18
+        */
        public function viewUpdates() {
                global $wgUser;
                return $this->doViewUpdates( $wgUser );
        }
 
-       /*
-       * @deprecated since 1.18
-       */
+       /**
+        * @deprecated since 1.18
+        */
        public function useParserCache( $oldid ) {
                global $wgUser;
                return $this->isParserCacheUsed( $wgUser, $oldid );
index 8bb36b2..d3d7916 100644 (file)
@@ -41,10 +41,7 @@ class ZhClient {
                $errno = $errstr = '';
                $this->mFP = fsockopen( $this->mHost, $this->mPort, $errno, $errstr, 30 );
                wfRestoreWarnings();
-               if ( !$this->mFP ) {
-                       return false;
-               }
-               return true;
+               return !$this->mFP;
        }
 
        /**
@@ -77,10 +74,7 @@ class ZhClient {
                        $data .= $str;
                }
                // data should be of length $len. otherwise something is wrong
-               if ( strlen( $data ) != $len ) {
-                       return false;
-               }
-               return $data;
+               return strlen( $data ) == $len;
        }
 
        /**
@@ -124,6 +118,7 @@ class ZhClient {
                }
                return $ret;
        }
+
        /**
         * Perform word segmentation
         *
index d21cf3b..37934ae 100644 (file)
@@ -1,8 +1,8 @@
 <?php
 
 /**
- * A class for reading ZIP file directories, for the purposes of upload 
- * verification. 
+ * A class for reading ZIP file directories, for the purposes of upload
+ * verification.
  *
  * Only a functional interface is provided: ZipFileReader::read(). No access is
  * given to object instances.
@@ -12,7 +12,7 @@ class ZipDirectoryReader {
        /**
         * Read a ZIP file and call a function for each file discovered in it.
         *
-        * Because this class is aimed at verification, an error is raised on 
+        * Because this class is aimed at verification, an error is raised on
         * suspicious or ambiguous input, instead of emulating some standard
         * behaviour.
         *
@@ -20,7 +20,7 @@ class ZipDirectoryReader {
         * @param $callback Array The callback function. It will be called for each file
         *   with a single associative array each time, with members:
         *
-        *      - name: The file name. Directories conventionally have a trailing 
+        *      - name: The file name. Directories conventionally have a trailing
         *        slash.
         *
         *      - mtime: The file modification time, in MediaWiki 14-char format
@@ -30,18 +30,18 @@ class ZipDirectoryReader {
         * @param $options Array An associative array of read options, with the option
         *    name in the key. This may currently contain:
         *
-        *      - zip64: If this is set to true, then we will emulate a 
-        *        library with ZIP64 support, like OpenJDK 7. If it is set to 
-        *        false, then we will emulate a library with no knowledge of 
+        *      - zip64: If this is set to true, then we will emulate a
+        *        library with ZIP64 support, like OpenJDK 7. If it is set to
+        *        false, then we will emulate a library with no knowledge of
         *        ZIP64.
         *
-        *        NOTE: The ZIP64 code is untested and probably doesn't work. It 
-        *        turned out to be easier to just reject ZIP64 archive uploads, 
-        *        since they are likely to be very rare. Confirming safety of a 
-        *        ZIP64 file is fairly complex. What do you do with a file that is 
-        *        ambiguous and broken when read with a non-ZIP64 reader, but valid 
-        *        when read with a ZIP64 reader? This situation is normal for a 
-        *        valid ZIP64 file, and working out what non-ZIP64 readers will make 
+        *        NOTE: The ZIP64 code is untested and probably doesn't work. It
+        *        turned out to be easier to just reject ZIP64 archive uploads,
+        *        since they are likely to be very rare. Confirming safety of a
+        *        ZIP64 file is fairly complex. What do you do with a file that is
+        *        ambiguous and broken when read with a non-ZIP64 reader, but valid
+        *        when read with a ZIP64 reader? This situation is normal for a
+        *        valid ZIP64 file, and working out what non-ZIP64 readers will make
         *        of such a file is not trivial.
         *
         * @return Status object. The following fatal errors are defined:
@@ -50,20 +50,20 @@ class ZipDirectoryReader {
         *
         *      - zip-wrong-format: The file does not appear to be a ZIP file.
         *
-        *      - zip-bad: There was something wrong or ambiguous about the file 
+        *      - zip-bad: There was something wrong or ambiguous about the file
         *        data.
         *
-        *      - zip-unsupported: The ZIP file uses features which 
+        *      - zip-unsupported: The ZIP file uses features which
         *        ZipDirectoryReader does not support.
         *
-        * The default messages for those fatal errors are written in a way that 
+        * The default messages for those fatal errors are written in a way that
         * makes sense for upload verification.
         *
-        * If a fatal error is returned, more information about the error will be 
+        * If a fatal error is returned, more information about the error will be
         * available in the debug log.
         *
         * Note that the callback function may be called any number of times before
-        * a fatal error is returned. If this occurs, the data sent to the callback 
+        * a fatal error is returned. If this occurs, the data sent to the callback
         * function should be discarded.
         */
        public static function read( $fileName, $callback, $options = array() ) {
@@ -92,6 +92,8 @@ class ZipDirectoryReader {
        /** Stored headers */
        var $eocdr, $eocdr64, $eocdr64Locator;
 
+       var $data;
+
        /** The "extra field" ID for ZIP64 central directory entries */
        const ZIP64_EXTRA_HEADER = 0x0001;
 
@@ -104,7 +106,6 @@ class ZipDirectoryReader {
        /** The index of the "general field" bit for central directory encryption */
        const GENERAL_CD_ENCRYPTED = 13;
 
-
        /**
         * Private constructor
         */
@@ -165,8 +166,8 @@ class ZipDirectoryReader {
        }
 
        /**
-        * Read the header which is at the end of the central directory, 
-        * unimaginatively called the "end of central directory record" by the ZIP 
+        * Read the header which is at the end of the central directory,
+        * unimaginatively called the "end of central directory record" by the ZIP
         * spec.
         */
        function readEndOfCentralDirectoryRecord() {
@@ -189,7 +190,7 @@ class ZipDirectoryReader {
                $block = $this->getBlock( $startPos );
                $sigPos = strrpos( $block, "PK\x05\x06" );
                if ( $sigPos === false ) {
-                       $this->error( 'zip-wrong-format', 
+                       $this->error( 'zip-wrong-format',
                                "zip file lacks EOCDR signature. It probably isn't a zip file." );
                }
 
@@ -212,7 +213,7 @@ class ZipDirectoryReader {
        }
 
        /**
-        * Read the header called the "ZIP64 end of central directory locator". An 
+        * Read the header called the "ZIP64 end of central directory locator". An
         * error will be raised if it does not exist.
         */
        function readZip64EndOfCentralDirectoryLocator() {
@@ -224,20 +225,20 @@ class ZipDirectoryReader {
                );
                $structSize = $this->getStructSize( $info );
 
-               $block = $this->getBlock( $this->getFileLength() - $this->eocdr['EOCDR size'] 
+               $block = $this->getBlock( $this->getFileLength() - $this->eocdr['EOCDR size']
                        - $structSize, $structSize );
                $this->eocdr64Locator = $data = $this->unpack( $block, $info );
 
                if ( $data['signature'] !== "PK\x06\x07" ) {
-                       // Note: Java will allow this and continue to read the 
-                       // EOCDR64, so we have to reject the upload, we can't 
+                       // Note: Java will allow this and continue to read the
+                       // EOCDR64, so we have to reject the upload, we can't
                        // just use the EOCDR header instead.
                        $this->error( 'zip-bad', 'wrong signature on Zip64 end of central directory locator' );
                }
        }
 
        /**
-        * Read the header called the "ZIP64 end of central directory record". It 
+        * Read the header called the "ZIP64 end of central directory record". It
         * may replace the regular "end of central directory record" in ZIP64 files.
         */
        function readZip64EndOfCentralDirectoryRecord() {
@@ -266,14 +267,14 @@ class ZipDirectoryReader {
                        $this->error( 'zip-bad', 'wrong signature on Zip64 end of central directory record' );
                }
                if (   $data['disk'] !== 0
-                       || $data['CD start disk'] !== 0 ) 
+                       || $data['CD start disk'] !== 0 )
                {
                        $this->error( 'zip-unsupported', 'more than one disk (in EOCDR64)' );
                }
        }
 
        /**
-        * Find the location of the central directory, as would be seen by a 
+        * Find the location of the central directory, as would be seen by a
         * non-ZIP64 reader.
         *
         * @return List containing offset, size and end position.
@@ -286,27 +287,27 @@ class ZipDirectoryReader {
                // Some readers use the EOCDR position instead of the offset field
                // to find the directory, so to be safe, we check if they both agree.
                if ( $offset + $size != $endPos ) {
-                       $this->error( 'zip-bad', 'the central directory does not immediately precede the end ' . 
+                       $this->error( 'zip-bad', 'the central directory does not immediately precede the end ' .
                                'of central directory record' );
                }
                return array( $offset, $size );
        }
 
        /**
-        * Find the location of the central directory, as would be seen by a 
+        * Find the location of the central directory, as would be seen by a
         * ZIP64-compliant reader.
         *
         * @return List containing offset, size and end position.
         */
        function findZip64CentralDirectory() {
-               // The spec is ambiguous about the exact rules of precedence between the 
-               // ZIP64 headers and the original headers. Here we follow zip_util.c 
+               // The spec is ambiguous about the exact rules of precedence between the
+               // ZIP64 headers and the original headers. Here we follow zip_util.c
                // from OpenJDK 7.
                $size = $this->eocdr['CD size'];
                $offset = $this->eocdr['CD offset'];
                $numEntries = $this->eocdr['CD entries total'];
                $endPos = $this->eocdr['position'];
-               if (   $size == 0xffffffff 
+               if (   $size == 0xffffffff
                        || $offset == 0xffffffff
                        || $numEntries == 0xffff )
                {
@@ -324,7 +325,7 @@ class ZipDirectoryReader {
                // Some readers use the EOCDR position instead of the offset field
                // to find the directory, so to be safe, we check if they both agree.
                if ( $offset + $size != $endPos ) {
-                       $this->error( 'zip-bad', 'the central directory does not immediately precede the end ' . 
+                       $this->error( 'zip-bad', 'the central directory does not immediately precede the end ' .
                                'of central directory record' );
                }
                return array( $offset, $size );
@@ -390,7 +391,7 @@ class ZipDirectoryReader {
                        }
 
                        // Convert the timestamp into MediaWiki format
-                       // For the format, please see the MS-DOS 2.0 Programmer's Reference, 
+                       // For the format, please see the MS-DOS 2.0 Programmer's Reference,
                        // pages 3-5 and 3-6.
                        $time = $data['mod time'];
                        $date = $data['mod date'];
@@ -405,8 +406,8 @@ class ZipDirectoryReader {
                                $year, $month, $day, $hour, $minute, $second );
 
                        // Convert the character set in the file name
-                       if ( !function_exists( 'iconv' ) 
-                               || $this->testBit( $data['general bits'], self::GENERAL_UTF8 ) ) 
+                       if ( !function_exists( 'iconv' )
+                               || $this->testBit( $data['general bits'], self::GENERAL_UTF8 ) )
                        {
                                $name = $data['name'];
                        } else {
@@ -444,7 +445,7 @@ class ZipDirectoryReader {
                while ( $extraPos < strlen( $extraField ) ) {
                        $extra = $this->unpack( $extraField, $extraHeaderInfo, $extraPos );
                        $extraPos += $extraHeaderSize;
-                       $extra += $this->unpack( $extraField, 
+                       $extra += $this->unpack( $extraField,
                                array( 'data' => array( 'string', $extra['size'] ) ),
                                $extraPos );
                        $extraPos += $extra['size'];
@@ -473,7 +474,7 @@ class ZipDirectoryReader {
         * in the file to satisfy the request, an exception will be thrown.
         *
         * @param $start The byte offset of the start of the block.
-        * @param $length The number of bytes to return. If omitted, the remainder 
+        * @param $length The number of bytes to return. If omitted, the remainder
         *    of the file will be returned.
         *
         * @return string
@@ -500,10 +501,10 @@ class ZipDirectoryReader {
                        $block .= $this->getSegment( $segIndex );
                }
 
-               $block = substr( $block, 
+               $block = substr( $block,
                        $start - $startSeg * self::SEGSIZE,
                        $length );
-               
+
                if ( strlen( $block ) < $length ) {
                        $this->error( 'zip-bad', 'getBlock() returned an unexpectedly small amount of data' );
                }
@@ -512,12 +513,12 @@ class ZipDirectoryReader {
        }
 
        /**
-        * Get a section of the file starting at position $segIndex * self::SEGSIZE, 
-        * of length self::SEGSIZE. The result is cached. This is a helper function 
+        * Get a section of the file starting at position $segIndex * self::SEGSIZE,
+        * of length self::SEGSIZE. The result is cached. This is a helper function
         * for getBlock().
         *
-        * If there are not enough bytes in the file to satsify the request, the 
-        * return value will be truncated. If a request is made for a segment beyond 
+        * If there are not enough bytes in the file to satsify the request, the
+        * return value will be truncated. If a request is made for a segment beyond
         * the end of the file, an empty string will be returned.
         */
        function getSegment( $segIndex ) {
@@ -556,25 +557,25 @@ class ZipDirectoryReader {
        }
 
        /**
-        * Unpack a binary structure. This is like the built-in unpack() function 
+        * Unpack a binary structure. This is like the built-in unpack() function
         * except nicer.
         *
         * @param $string The binary data input
         *
-        * @param $struct An associative array giving structure members and their 
-        *    types. In the key is the field name. The value may be either an 
-        *    integer, in which case the field is a little-endian unsigned integer 
-        *    encoded in the given number of bytes, or an array, in which case the 
-        *    first element of the array is the type name, and the subsequent 
+        * @param $struct An associative array giving structure members and their
+        *    types. In the key is the field name. The value may be either an
+        *    integer, in which case the field is a little-endian unsigned integer
+        *    encoded in the given number of bytes, or an array, in which case the
+        *    first element of the array is the type name, and the subsequent
         *    elements are type-dependent parameters. Only one such type is defined:
-        *       - "string": The second array element gives the length of string. 
+        *       - "string": The second array element gives the length of string.
         *          Not null terminated.
         *
         * @param $offset The offset into the string at which to start unpacking.
         *
-        * @return Unpacked associative array. Note that large integers in the input 
-        *    may be represented as floating point numbers in the return value, so 
-        *    the use of weak comparison is advised. 
+        * @return Unpacked associative array. Note that large integers in the input
+        *    may be represented as floating point numbers in the return value, so
+        *    the use of weak comparison is advised.
         */
        function unpack( $string, $struct, $offset = 0 ) {
                $size = $this->getStructSize( $struct );
@@ -600,8 +601,8 @@ class ZipDirectoryReader {
                                $length = intval( $type );
                                $bytes = substr( $string, $pos, $length );
 
-                               // Calculate the value. Use an algorithm which automatically 
-                               // upgrades the value to floating point if necessary. 
+                               // Calculate the value. Use an algorithm which automatically
+                               // upgrades the value to floating point if necessary.
                                $value = 0;
                                for ( $i = $length - 1; $i >= 0; $i-- ) {
                                        $value *= 256;
@@ -623,7 +624,7 @@ class ZipDirectoryReader {
        }
 
        /**
-        * Returns a bit from a given position in an integer value, converted to 
+        * Returns a bit from a given position in an integer value, converted to
         * boolean.
         *
         * @param $value integer
@@ -678,6 +679,9 @@ class ZipDirectoryReaderError extends Exception {
                parent::__construct( "ZipDirectoryReader error: $code" );
        }
 
+       /**
+        * @return mixed
+        */
        function getErrorCode() {
                return $this->code;
        }
index 58f3233..a738b06 100644 (file)
@@ -1 +1 @@
-<?php require './index.php';
\ No newline at end of file
+<?php require './index.php';
index 067ffe4..3b43bcd 100644 (file)
@@ -29,7 +29,7 @@ class FetchText extends Maintenance {
                $this->mDescription = "Fetch the revision text from an old_id";
        }
 
-       /*
+       /**
         * returns a string containing the following in order:
         *       textid
         *       \n
index 5770fc8..2073378 100644 (file)
@@ -222,7 +222,7 @@ window.mw = window.mediaWiki = new ( function( $ ) {
 
        /* Public Members */
 
-       /*
+       /**
         * Dummy function which in debug mode can be replaced with a function that
         * emulates console.log in console-less environments.
         */
@@ -249,7 +249,7 @@ window.mw = window.mediaWiki = new ( function( $ ) {
         */
        this.libs = {};
 
-       /*
+       /**
         * Localization system
         */
        this.messages = new this.Map();
@@ -556,7 +556,7 @@ window.mw = window.mediaWiki = new ( function( $ ) {
                                                        callback();
                                                        return;
                                                }
-                                               
+
                                                addScript( arr[i], function() {
                                                        nestedAddScript( arr, callback, i + 1 );
                                                } );
@@ -1175,7 +1175,7 @@ window.mw = window.mediaWiki = new ( function( $ ) {
                        } );
                        return names;
                };
-               
+
                /**
                 * For backwards-compatibility with Squid-cached pages. Loads mw.user
                 */
index 99917c7..2e8f54e 100644 (file)
@@ -34,46 +34,45 @@ window.wgUploadSetup = function() {
                        }
                }
        }
-       
-       
+
        // AJAX wpDestFile warnings
        if ( wgAjaxUploadDestCheck ) {
                // Insert an event handler that fetches upload warnings when wpDestFile
                // has been changed
-               document.getElementById( 'wpDestFile' ).onchange = function ( e ) { 
+               document.getElementById( 'wpDestFile' ).onchange = function ( e ) {
                        wgUploadWarningObj.checkNow(this.value);
                };
-               // Insert a row where the warnings will be displayed just below the 
+               // Insert a row where the warnings will be displayed just below the
                // wpDestFile row
                var optionsTable = document.getElementById( 'mw-htmlform-description' ).tBodies[0];
                var row = optionsTable.insertRow( 1 );
                var td = document.createElement( 'td' );
                td.id = 'wpDestFile-warning';
                td.colSpan = 2;
-               
+
                row.appendChild( td );
        }
-       
+
        var wpLicense = document.getElementById( 'wpLicense' );
        if ( wgAjaxLicensePreview && wpLicense ) {
                // License selector check
                wpLicense.onchange = licenseSelectorCheck;
-       
+
                // License selector table row
                var wpLicenseRow = wpLicense.parentNode.parentNode;
                var wpLicenseTbody = wpLicenseRow.parentNode;
-               
+
                var row = document.createElement( 'tr' );
                var td = document.createElement( 'td' );
                row.appendChild( td );
                td = document.createElement( 'td' );
                td.id = 'mw-license-preview';
                row.appendChild( td );
-               
+
                wpLicenseTbody.insertBefore( row, wpLicenseRow.nextSibling );
        }
-       
-       
+
+
        // fillDestFile setup
        for ( var i = 0; i < wgUploadSourceIds.length; i++ )
                document.getElementById( wgUploadSourceIds[i] ).onchange = function (e) {
@@ -150,7 +149,7 @@ window.wgUploadWarningObj = {
                var ackElt = document.getElementsByName( 'wpDestFileWarningAck' );
 
                this.setInnerHTML(warningElt, warning);
-               
+
                // Set a value in the form indicating that the warning is acknowledged and
                // doesn't need to be redisplayed post-upload
                if ( warning == '' || warning == '&nbsp;' ) {
@@ -196,7 +195,7 @@ window.fillDestFilename = function(id) {
        }
 
        // Clear the filename if it does not have a valid extension.
-       // URLs are less likely to have a useful extension, so don't include them in the 
+       // URLs are less likely to have a useful extension, so don't include them in the
        // extension check.
        if( wgStrictFileExtensions && wgFileExtensions && id != 'wpUploadFileURL' ) {
                var found = false;
@@ -262,15 +261,15 @@ window.wgUploadLicenseObj = {
                        }
                }
                injectSpinner( document.getElementById( 'wpLicense' ), 'license' );
-               
+
                var title = document.getElementById('wpDestFile').value;
                if ( !title ) title = 'File:Sample.jpg';
-               
+
                var url = wgScriptPath + '/api' + wgScriptExtension
                        + '?action=parse&text={{' + encodeURIComponent( license ) + '}}'
-                       + '&title=' + encodeURIComponent( title ) 
+                       + '&title=' + encodeURIComponent( title )
                        + '&prop=text&pst&format=json';
-               
+
                var req = sajax_init_object();
                req.onreadystatechange = function() {
                        if ( req.readyState == 4 && req.status == 200 )
@@ -284,7 +283,6 @@ window.wgUploadLicenseObj = {
                removeSpinner( 'license' );
                this.responseCache[license] = result['parse']['text']['*'];
                this.showPreview( this.responseCache[license] );
-
        },
 
        'showPreview' : function( preview ) {
index 8af2846..dae512f 100644 (file)
@@ -1199,7 +1199,7 @@ class ParserTest {
                return true;
        }
 
-       /*
+       /**
         * Run the "tidy" command on text if the $wgUseTidy
         * global is true
         *
index d0d28f6..4397b87 100644 (file)
@@ -43,20 +43,20 @@ class IPTest extends MediaWikiTestCase {
                $this->assertFalse( IP::isIPv6( 'fc:100:::' ), 'IPv6 ending with a ":::"' );
                $this->assertFalse( IP::isIPv6( 'fc:300' ), 'IPv6 with only 2 words' );
                $this->assertFalse( IP::isIPv6( 'fc:100:300' ), 'IPv6 with only 3 words' );
-               
+
                $this->assertTrue( IP::isIPv6( 'fc:100::' ) );
                $this->assertTrue( IP::isIPv6( 'fc:100:a::' ) );
                $this->assertTrue( IP::isIPv6( 'fc:100:a:d::' ) );
                $this->assertTrue( IP::isIPv6( 'fc:100:a:d:1::' ) );
                $this->assertTrue( IP::isIPv6( 'fc:100:a:d:1:e::' ) );
                $this->assertTrue( IP::isIPv6( 'fc:100:a:d:1:e:ac::' ) );
-               
+
                $this->assertFalse( IP::isIPv6( 'fc:100:a:d:1:e:ac:0::' ), 'IPv6 with 8 words ending with "::"' );
                $this->assertFalse( IP::isIPv6( 'fc:100:a:d:1:e:ac:0:1::' ), 'IPv6 with 9 words ending with "::"' );
 
                $this->assertFalse( IP::isIPv6( ':::' ) );
                $this->assertFalse( IP::isIPv6( '::0:' ), 'IPv6 ending in a lone ":"' );
-               
+
                $this->assertTrue( IP::isIPv6( '::' ), 'IPv6 zero address' );
                $this->assertTrue( IP::isIPv6( '::0' ) );
                $this->assertTrue( IP::isIPv6( '::fc' ) );
@@ -66,14 +66,14 @@ class IPTest extends MediaWikiTestCase {
                $this->assertTrue( IP::isIPv6( '::fc:100:a:d:1' ) );
                $this->assertTrue( IP::isIPv6( '::fc:100:a:d:1:e' ) );
                $this->assertTrue( IP::isIPv6( '::fc:100:a:d:1:e:ac' ) );
-               
+
                $this->assertFalse( IP::isIPv6( '::fc:100:a:d:1:e:ac:0' ), 'IPv6 with "::" and 8 words' );
                $this->assertFalse( IP::isIPv6( '::fc:100:a:d:1:e:ac:0:1' ), 'IPv6 with 9 words' );
 
                $this->assertFalse( IP::isIPv6( ':fc::100' ), 'IPv6 starting with lone ":"' );
                $this->assertFalse( IP::isIPv6( 'fc::100:' ), 'IPv6 ending with lone ":"' );
                $this->assertFalse( IP::isIPv6( 'fc:::100' ), 'IPv6 with ":::" in the middle' );
-               
+
                $this->assertTrue( IP::isIPv6( 'fc::100' ), 'IPv6 with "::" and 2 words' );
                $this->assertTrue( IP::isIPv6( 'fc::100:a' ), 'IPv6 with "::" and 3 words' );
                $this->assertTrue( IP::isIPv6( 'fc::100:a:d', 'IPv6 with "::" and 4 words' ) );
@@ -83,7 +83,7 @@ class IPTest extends MediaWikiTestCase {
                $this->assertTrue( IP::isIPv6( '2001::df'), 'IPv6 with "::" and 2 words' );
                $this->assertTrue( IP::isIPv6( '2001:5c0:1400:a::df'), 'IPv6 with "::" and 5 words' );
                $this->assertTrue( IP::isIPv6( '2001:5c0:1400:a::df:2'), 'IPv6 with "::" and 6 words' );
-               
+
                $this->assertFalse( IP::isIPv6( 'fc::100:a:d:1:e:ac:0' ), 'IPv6 with "::" and 8 words' );
                $this->assertFalse( IP::isIPv6( 'fc::100:a:d:1:e:ac:0:1' ), 'IPv6 with 9 words' );
 
@@ -135,11 +135,11 @@ class IPTest extends MediaWikiTestCase {
                $this->assertFalse( IP::isValid( 'fc:100:::' ), 'IPv6 ending with a ":::"' );
                $this->assertFalse( IP::isValid( 'fc:300' ), 'IPv6 with only 2 words' );
                $this->assertFalse( IP::isValid( 'fc:100:300' ), 'IPv6 with only 3 words' );
-               
+
                $this->assertTrue( IP::isValid( 'fc:100::' ) );
                $this->assertTrue( IP::isValid( 'fc:100:a:d:1:e::' ) );
                $this->assertTrue( IP::isValid( 'fc:100:a:d:1:e:ac::' ) );
-               
+
                $this->assertTrue( IP::isValid( 'fc::100' ), 'IPv6 with "::" and 2 words' );
                $this->assertTrue( IP::isValid( 'fc::100:a' ), 'IPv6 with "::" and 3 words' );
                $this->assertTrue( IP::isValid( '2001::df'), 'IPv6 with "::" and 2 words' );
@@ -147,7 +147,7 @@ class IPTest extends MediaWikiTestCase {
                $this->assertTrue( IP::isValid( '2001:5c0:1400:a::df:2'), 'IPv6 with "::" and 6 words' );
                $this->assertTrue( IP::isValid( 'fc::100:a:d:1' ), 'IPv6 with "::" and 5 words' );
                $this->assertTrue( IP::isValid( 'fc::100:a:d:1:e:ac' ), 'IPv6 with "::" and 7 words' );
-               
+
                $this->assertFalse( IP::isValid( 'fc:100:a:d:1:e:ac:0::' ), 'IPv6 with 8 words ending with "::"' );
                $this->assertFalse( IP::isValid( 'fc:100:a:d:1:e:ac:0:1::' ), 'IPv6 with 9 words ending with "::"' );
        }
@@ -332,7 +332,7 @@ class IPTest extends MediaWikiTestCase {
                $this->assertEquals( '0:0:0:0:0:0:FCCF:FAFF', IP::hexToOctet( 'FCCFFAFF' ) );
        }
 
-       /*
+       /**
         * IP::parseCIDR() returns an array containing a signed IP address
         * representing the network mask and the bit mask.
         * @covers IP::parseCIDR
@@ -391,7 +391,7 @@ class IPTest extends MediaWikiTestCase {
        }
 
        /**
-        * Issues there are most probably from IP::toHex() or IP::parseRange()          
+        * Issues there are most probably from IP::toHex() or IP::parseRange()
         * @covers IP::isInRange
         * @dataProvider provideIPsAndRanges
         */
@@ -464,9 +464,9 @@ class IPTest extends MediaWikiTestCase {
         */
        function testCombineHostAndPort( $expected, $input, $description ) {
                list( $host, $port, $defaultPort ) = $input;
-               $this->assertEquals( 
-                       $expected, 
-                       IP::combineHostAndPort( $host, $port, $defaultPort ), 
+               $this->assertEquals(
+                       $expected,
+                       IP::combineHostAndPort( $host, $port, $defaultPort ),
                        $description );
        }
 
index 750524e..8589c18 100644 (file)
@@ -2,13 +2,13 @@
 
 class SeleniumConfigurationTest extends MediaWikiTestCase {
 
-       /*
+       /**
         * The file where the test temporarity stores the selenium config.
         * This should be cleaned up as part of teardown.
         */
        private $tempFileName;
 
-       /*
+       /**
         * String containing the a sample selenium settings
         */
        private $testConfig0 =
@@ -32,14 +32,14 @@ runAgainstGrid      = false
 testSuite[SimpleSeleniumTestSuite] = "tests/selenium/SimpleSeleniumTestSuite.php"
 testSuite[TestSuiteName] = "testSuitePath"
 ';
-       /*
+       /**
         * Array of expected browsers from $testConfig0
         */
        private $testBrowsers0 = array( 'firefox' => '*firefox',
                                                        'iexplorer' => '*iexploreproxy',
                                                        'chrome' => '*chrome'
        );
-       /*
+       /**
         * Array of expected selenium settings from $testConfig0
         */
        private $testSettings0 = array(
@@ -55,7 +55,7 @@ testSuite[TestSuiteName] = "testSuitePath"
                'jUnitLogFile' => null,
                'runAgainstGrid' => null
        );
-       /*
+       /**
         * Array of expected testSuites from $testConfig0
         */
        private $testSuites0 = array(
@@ -64,7 +64,7 @@ testSuite[TestSuiteName] = "testSuitePath"
        );
 
 
-       /*
+       /**
         * Another sample selenium settings file contents
         */
        private $testConfig1 =
@@ -73,11 +73,11 @@ testSuite[TestSuiteName] = "testSuitePath"
 host                           = "localhost"
 testBrowser            = "firefox"
 ';
-       /*
+       /**
         * Expected browsers from $testConfig1
         */
        private $testBrowsers1 = null;
-       /*
+       /**
         * Expected selenium settings from $testConfig1
         */
        private $testSettings1 = array(
@@ -93,7 +93,7 @@ testBrowser           = "firefox"
                'jUnitLogFile' => null,
                'runAgainstGrid' => null
        );
-       /*
+       /**
         * Expected test suites from $testConfig1
         */
        private $testSuites1 = null;
@@ -105,7 +105,7 @@ testBrowser                 = "firefox"
                }
        }
 
-       /*
+       /**
         * Clean up the temporary file used to store the selenium settings.
         */
        public function tearDown() {
@@ -199,7 +199,7 @@ testBrowser                 = "firefox"
 
        }
 
-       /*
+       /**
         * create a temp file and write text to it.
         * @param $testToWrite the text to write to the temp file
         */
@@ -210,7 +210,7 @@ testBrowser                 = "firefox"
                fclose($tempFile);
        }
 
-       /*
+       /**
         * Returns an array containing:
         *      The contents of the selenium cingiguration ini file
         *  The expected selenium configuration array that getSeleniumSettings should return
index 0500711..e23bad7 100644 (file)
@@ -729,7 +729,7 @@ class NewParserTest extends MediaWikiTestCase {
        }
        //Various "cleanup" functions
 
-       /*
+       /**
         * Run the "tidy" command on text if the $wgUseTidy
         * global is true
         *
index 2cbb900..e3684c9 100644 (file)
@@ -12,7 +12,7 @@ class SearchEngineTest extends MediaWikiTestCase {
                unset( $this->search );
        }
 
-       /*
+       /**
         * Checks for database type & version.
         * Will skip current test if DB does not support search.
         */
index b8cdf1c..b148715 100644 (file)
@@ -5,7 +5,7 @@ if ( !defined( 'SELENIUMTEST' ) ) {
 
 class SeleniumConfig {
 
-       /*
+       /**
         * Retreives the Selenium configuration values from an ini file.
         * See sample config file in selenium_settings.ini.sample
         *
@@ -72,14 +72,14 @@ class SeleniumConfig {
                        return false;
                }
                $header = '';
-               
+
                $configArray = array();
-               
+
                while ( ( $line = fgets( $file ) ) !== false ) {
                        $line = strtok( $line, "\r\n" );
-                       
+
                        if ( !$line || $line[0] == ';' ) continue;
-                       
+
                        if ( $line[0] == '[' && substr( $line, -1 ) == ']' ) {
                                $header = substr( $line, 1, -1 );
                                $configArray[$header] = array();
@@ -95,19 +95,19 @@ class SeleniumConfig {
                list( $key, $value ) = explode( '=', $iniLine, 2 );
                $key = trim( $key );
                $value = trim( $value );
-               
+
                if ( isset( $specialValues[$value] ) ) {
                        $value = $specialValues[$value];
                } else {
                        $value = trim( $value, '"' );
                }
-               
+
                /* Support one-level arrays */
                if ( preg_match( '/^([A-Za-z]+)\[([A-Za-z]+)\]/', $key, $m ) ) {
                        $key = $m[1];
                        $value = array( $m[2] => $value );
                }
-               
+
                return array( $key => $value );
        }
 }
index 7b9525a..5fc1a5a 100644 (file)
@@ -1,44 +1,44 @@
 <?php
-/* 
+/*
  * Stub of tests be need as part of the hack-a-ton
  */
 class MediawikiCoreSmokeTestCase extends SeleniumTestCase {
        public function testUserLogin() {
-               
+
        }
-       
+
        public function testChangeUserPreference() {
-               
+
        }
-       
-       /*
+
+       /**
         * TODO: generalize this test to be reusable for different skins
         */
        public function testCreateNewPageVector() {
-               
+
        }
-       
-       /*
+
+       /**
         * TODO: generalize this test to be reusable for different skins
         */
        public function testEditExistingPageVector() {
-               
+
        }
-       
-       /*
+
+       /**
         * TODO: generalize this test to be reusable for different skins
         */
        public function testCreateNewPageMonobook() {
-               
+
        }
-       
-       /*
+
+       /**
         * TODO: generalize this test to be reusable for different skins
         */
        public function testEditExistingPageMonobook() {
-               
+
        }
-       
+
        public function testImageUpload() {
                $this->login();
                $this->open( $this->getUrl() .
@@ -48,10 +48,10 @@ class MediawikiCoreSmokeTestCase extends SeleniumTestCase {
                $this->check( 'wpIgnoreWarning' );
                $this->click( 'wpUpload' );
                $this->waitForPageToLoad( 30000 );
-               
+
                $this->assertSeleniumHTMLContains(
                                '//h1[@class="firstHeading"]', "Wikipedia-logo-v2-de.png" );
-               
+
                /*
                $this->open( $this->getUrl() . '/index.php?title=Image:'
                        . ucfirst( $this->filename ) . '&action=delete' );
@@ -64,6 +64,6 @@ class MediawikiCoreSmokeTestCase extends SeleniumTestCase {
                        ucfirst( $this->filename ) . '.*has been deleted.' );
                 */
        }
-       
+
 
 }
index 99a75c1..b87172e 100644 (file)
@@ -1,11 +1,11 @@
 <?php
-/* 
+/*
  * This test case is part of the SimpleSeleniumTestSuite.
  * Configuration for these tests are documented as part of SimpleSeleniumTestSuite.php
  */
 class SimpleSeleniumTestCase extends SeleniumTestCase {
        public function testBasic() {
-               $this->open( $this->getUrl() . 
+               $this->open( $this->getUrl() .
                        '/index.php?title=Selenium&action=edit' );
                $this->type( "wpTextbox1", "This is a basic test" );
                $this->click( "wpPreview" );
@@ -16,8 +16,8 @@ class SimpleSeleniumTestCase extends SeleniumTestCase {
                $correct = strstr( $source, "This is a basic test" );
                $this->assertEquals( $correct, true );
        }
-       
-       /*
+
+       /**
         * All this test really does is verify that a global var was set.
         * It depends on $wgDefaultSkin = 'chick'; being set
         */
@@ -26,9 +26,9 @@ class SimpleSeleniumTestCase extends SeleniumTestCase {
                $bodyClass = $this->getAttribute( "//body/@class" );
                $this-> assertContains('skin-chick', $bodyClass, 'Chick skin not set');
        }
-       
-       /*
-        * Just verify that the test db was loaded correctly 
+
+       /**
+        * Just verify that the test db was loaded correctly
         */
        public function testDatabaseResourceLoadedCorrectly() {
                $this->open( $this->getUrl() . '/index.php/TestResources?action=purge' );