From: IAlex Date: Sat, 20 Oct 2012 14:47:08 +0000 (+0000) Subject: Merge "Add filearchive.fa_sha1 to PostgreSQL as well." X-Git-Tag: 1.31.0-rc.0~21931 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dcompta/comptes/journal.php?a=commitdiff_plain;h=08d9eb261cb93363f6152e7bd48fc665ffeda8fc;hp=b5df3f37d1cc4cfe48c280775682e23d3b13065f;p=lhc%2Fweb%2Fwiklou.git Merge "Add filearchive.fa_sha1 to PostgreSQL as well." --- diff --git a/INSTALL b/INSTALL index c4bb8be987..e393631d5c 100644 --- a/INSTALL +++ b/INSTALL @@ -18,7 +18,7 @@ work on Windows as well. If your PHP is configured as a CGI plug-in rather than an Apache module you may experience problems, as this configuration is not well tested. safe_mode is also -not tested and unlikely to work. +not tested and unlikely to work. If you want math support see the instructions in math/README @@ -34,7 +34,7 @@ http://www.mediawiki.org/wiki/Manual:Installation_guide ******************* WARNING ******************* -REMEMBER: ALWAYS BACK UP YOUR DATABASE BEFORE +REMEMBER: ALWAYS BACK UP YOUR DATABASE BEFORE ATTEMPTING TO INSTALL OR UPGRADE!!! ******************* WARNING ******************* diff --git a/README b/README index 805b8ee411..c9ce5db474 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -For system requirements, installation and upgrade details, see the files +For system requirements, installation and upgrade details, see the files RELEASE-NOTES, INSTALL, and UPGRADE. == MediaWiki == @@ -62,7 +62,7 @@ Sections of code written exclusively by Lee Crocker or Erik Moeller are also released into the public domain, which does not impair the obligations of users under the GPL for use of the whole code or other sections thereof. -MediaWiki makes use of the Sajax Toolkit by modernmethod, +MediaWiki makes use of the Sajax Toolkit by modernmethod, http://www.modernmethod.com/sajax/ which has the following license: 'This work is licensed under the Creative Commons Attribution diff --git a/StartProfiler.sample b/StartProfiler.sample index 6bce634d4e..ba8fe8bbac 100644 --- a/StartProfiler.sample +++ b/StartProfiler.sample @@ -12,7 +12,7 @@ * } else { * $wgProfiler['class'] = 'ProfilerStub'; * } - * + * * Configuration of the profiler output can be done in LocalSettings.php */ diff --git a/UPGRADE b/UPGRADE index cdaf4f919e..46f5e65aa5 100644 --- a/UPGRADE +++ b/UPGRADE @@ -53,8 +53,8 @@ deleted file archives, and any custom skins. ==== From the web ==== -If you browse to the web-based installation script (usually at -/mw-config/index.php) from your wiki installation you can follow the script and +If you browse to the web-based installation script (usually at +/mw-config/index.php) from your wiki installation you can follow the script and upgrade your database in place. ==== From the command line ==== @@ -141,7 +141,7 @@ the web upgrader. If you absolutely cannot make the UTF-8 upgrade work, you can try doing it by hand: dump your old database, convert the dump file -using iconv as described here: +using iconv as described here: http://portal.suse.com/sdb/en/2004/05/jbartsh_utf-8.html and then reimport it. You can also convert filenames using convmv, but note that the old directory hashes will no longer be valid, diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index fdddfc9309..cea63e07a3 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -1411,9 +1411,9 @@ $wgAllDBsAreLocalhost = false; * $wgSharedPrefix is the table prefix for the shared database. It defaults to * $wgDBprefix. * - * @deprecated In new code, use the $wiki parameter to wfGetLB() to access - * remote databases. Using wfGetLB() allows the shared database to reside on - * separate servers to the wiki's own database, with suitable configuration + * @deprecated In new code, use the $wiki parameter to wfGetLB() to access + * remote databases. Using wfGetLB() allows the shared database to reside on + * separate servers to the wiki's own database, with suitable configuration * of $wgLBFactoryConf. */ $wgSharedDB = null; @@ -2067,12 +2067,12 @@ $wgMaxSquidPurgeTitles = 400; /** * Whether to use a Host header in purge requests sent to the proxy servers - * configured in $wgSquidServers. Set this to false to support Squid + * configured in $wgSquidServers. Set this to false to support Squid * configured in forward-proxy mode. * * If this is set to true, a Host header will be sent, and only the path * component of the URL will appear on the request line, as if the request - * were a non-proxy HTTP 1.1 request. Varnish only supports this style of + * were a non-proxy HTTP 1.1 request. Varnish only supports this style of * request. Squid supports this style of request only if reverse-proxy mode * (http_port ... accel) is enabled. * @@ -2080,7 +2080,7 @@ $wgMaxSquidPurgeTitles = 400; * will be sent in the request line, as is the standard for an HTTP proxy * request in both HTTP 1.0 and 1.1. This style of request is not supported * by Varnish, but is supported by Squid in either configuration (forward or - * reverse). + * reverse). * * @since 1.21 */ diff --git a/includes/HistoryBlob.php b/includes/HistoryBlob.php index bb8ec5e3dd..05c27feacb 100644 --- a/includes/HistoryBlob.php +++ b/includes/HistoryBlob.php @@ -19,10 +19,10 @@ * * @file */ - + /** - * Base class for general text storage via the "object" flag in old_flags, or - * two-part external storage URLs. Used for represent efficient concatenated + * Base class for general text storage via the "object" flag in old_flags, or + * two-part external storage URLs. Used for represent efficient concatenated * storage, and migration-related pointer objects. */ interface HistoryBlob @@ -178,7 +178,7 @@ class ConcatenatedGzipHistoryBlob implements HistoryBlob * @return bool */ public function isHappy() { - return $this->mSize < $this->mMaxSize + return $this->mSize < $this->mMaxSize && count( $this->mItems ) < $this->mMaxCount; } } @@ -341,12 +341,12 @@ class DiffHistoryBlob implements HistoryBlob { /** Total uncompressed size */ var $mSize = 0; - /** - * Array of diffs. If a diff D from A to B is notated D = B - A, and Z is + /** + * Array of diffs. If a diff D from A to B is notated D = B - A, and Z is * an empty string: * * { item[map[i]] - item[map[i-1]] where i > 0 - * diff[i] = { + * diff[i] = { * { item[map[i]] - Z where i = 0 */ var $mDiffs; @@ -379,7 +379,7 @@ class DiffHistoryBlob implements HistoryBlob { * The maximum number of text items before the object becomes sad */ var $mMaxCount = 100; - + /** Constants from xdiff.h */ const XDL_BDOP_INS = 1; const XDL_BDOP_CPY = 2; @@ -433,7 +433,7 @@ class DiffHistoryBlob implements HistoryBlob { * @throws MWException */ function compress() { - if ( !function_exists( 'xdiff_string_rabdiff' ) ){ + if ( !function_exists( 'xdiff_string_rabdiff' ) ){ throw new MWException( "Need xdiff 1.5+ support to write DiffHistoryBlob\n" ); } if ( isset( $this->mDiffs ) ) { @@ -534,7 +534,7 @@ class DiffHistoryBlob implements HistoryBlob { # Pure PHP implementation $header = unpack( 'Vofp/Vcsize', substr( $diff, 0, 8 ) ); - + # Check the checksum if hash/mhash is available $ofp = $this->xdiffAdler32( $base ); if ( $ofp !== false && $ofp !== substr( $diff, 0, 4 ) ) { @@ -545,7 +545,7 @@ class DiffHistoryBlob implements HistoryBlob { wfDebug( __METHOD__. ": incorrect base length\n" ); return false; } - + $p = 8; $out = ''; while ( $p < strlen( $diff ) ) { @@ -579,7 +579,7 @@ class DiffHistoryBlob implements HistoryBlob { } /** - * Compute a binary "Adler-32" checksum as defined by LibXDiff, i.e. with + * Compute a binary "Adler-32" checksum as defined by LibXDiff, i.e. with * the bytes backwards and initialised with 0 instead of 1. See bug 34428. * * Returns false if no hashing library is available @@ -589,8 +589,8 @@ class DiffHistoryBlob implements HistoryBlob { if ( $init === null ) { $init = str_repeat( "\xf0", 205 ) . "\xee" . str_repeat( "\xf0", 67 ) . "\x02"; } - // The real Adler-32 checksum of $init is zero, so it initialises the - // state to zero, as it is at the start of LibXDiff's checksum + // The real Adler-32 checksum of $init is zero, so it initialises the + // state to zero, as it is at the start of LibXDiff's checksum // algorithm. Appending the subject string then simulates LibXDiff. if ( function_exists( 'hash' ) ) { $hash = hash( 'adler32', $init . $s, true ); @@ -664,7 +664,7 @@ class DiffHistoryBlob implements HistoryBlob { if ( isset( $info['base'] ) ) { // Old format $this->mDiffMap = range( 0, count( $this->mDiffs ) - 1 ); - array_unshift( $this->mDiffs, + array_unshift( $this->mDiffs, pack( 'VVCV', 0, 0, self::XDL_BDOP_INSB, strlen( $info['base'] ) ) . $info['base'] ); } else { @@ -687,7 +687,7 @@ class DiffHistoryBlob implements HistoryBlob { * @return bool */ function isHappy() { - return $this->mSize < $this->mMaxSize + return $this->mSize < $this->mMaxSize && count( $this->mItems ) < $this->mMaxCount; } diff --git a/includes/Html.php b/includes/Html.php index a07dd4c2d3..5be67ab6d9 100644 --- a/includes/Html.php +++ b/includes/Html.php @@ -480,7 +480,7 @@ class Html { 'class', // html4, html5 'accesskey', // as of html5, multiple space-separated values allowed // html4-spec doesn't document rel= as space-separated - // but has been used like that and is now documented as such + // but has been used like that and is now documented as such // in the html5-spec. 'rel', ); @@ -493,7 +493,6 @@ class Html { // values. Implode/explode to get those into the main array as well. if ( is_array( $value ) ) { // If input wasn't an array, we can skip this step - $newValue = array(); foreach ( $value as $k => $v ) { if ( is_string( $v ) ) { @@ -576,7 +575,6 @@ class Html { # @todo FIXME: Is this really true? $map['<'] = '<'; } - $ret .= " $key=$quote" . strtr( $value, $map ) . $quote; } } diff --git a/includes/LinkFilter.php b/includes/LinkFilter.php index b19f6c4de2..c2f6b1ebee 100644 --- a/includes/LinkFilter.php +++ b/includes/LinkFilter.php @@ -23,7 +23,7 @@ /** * Some functions to help implement an external link filter for spam control. - * + * * @todo implement the filter. Currently these are just some functions to help * maintenance/cleanupSpam.php remove links to a single specified domain. The * next thing is to implement functions for checking a given page against a big @@ -119,17 +119,17 @@ class LinkFilter { // Reverse the labels in the hostname, convert to lower case // For emails reverse domainpart only if ( $prot == 'mailto:' && strpos($host, '@') ) { - // complete email adress + // complete email adress $mailparts = explode( '@', $host ); $domainpart = strtolower( implode( '.', array_reverse( explode( '.', $mailparts[1] ) ) ) ); $host = $domainpart . '@' . $mailparts[0]; $like = array( "$prot$host", $db->anyString() ); } elseif ( $prot == 'mailto:' ) { // domainpart of email adress only. do not add '.' - $host = strtolower( implode( '.', array_reverse( explode( '.', $host ) ) ) ); - $like = array( "$prot$host", $db->anyString() ); + $host = strtolower( implode( '.', array_reverse( explode( '.', $host ) ) ) ); + $like = array( "$prot$host", $db->anyString() ); } else { - $host = strtolower( implode( '.', array_reverse( explode( '.', $host ) ) ) ); + $host = strtolower( implode( '.', array_reverse( explode( '.', $host ) ) ) ); if ( substr( $host, -1, 1 ) !== '.' ) { $host .= '.'; } diff --git a/includes/Linker.php b/includes/Linker.php index bd5b57115f..28c59855d7 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -1764,7 +1764,7 @@ class Linker { */ public static function buildRollbackLink( $rev, IContextSource $context = null ) { global $wgShowRollbackEditCount, $wgMiserMode; - + // To config which pages are effected by miser mode $disableRollbackEditCountSpecialPage = array( 'Recentchanges', 'Watchlist' ); @@ -2121,7 +2121,7 @@ class Linker { */ static function makeBrokenLink( $title, $text = '', $query = '', $trail = '' ) { wfDeprecated( __METHOD__, '1.16' ); - + $nt = Title::newFromText( $title ); if ( $nt instanceof Title ) { return self::makeBrokenLinkObj( $nt, $text, $query, $trail ); @@ -2150,7 +2150,7 @@ class Linker { */ static function makeLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) { # wfDeprecated( __METHOD__, '1.16' ); // See r105985 and it's revert. Somewhere still used. - + wfProfileIn( __METHOD__ ); $query = wfCgiToArray( $query ); list( $inside, $trail ) = self::splitTrail( $trail ); @@ -2184,7 +2184,7 @@ class Linker { $title, $text = '', $query = '', $trail = '', $prefix = '' , $aprops = '', $style = '' ) { # wfDeprecated( __METHOD__, '1.16' ); // See r105985 and it's revert. Somewhere still used. - + wfProfileIn( __METHOD__ ); if ( $text == '' ) { @@ -2220,7 +2220,7 @@ class Linker { */ static function makeBrokenLinkObj( $title, $text = '', $query = '', $trail = '', $prefix = '' ) { wfDeprecated( __METHOD__, '1.16' ); - + wfProfileIn( __METHOD__ ); list( $inside, $trail ) = self::splitTrail( $trail ); @@ -2252,7 +2252,7 @@ class Linker { */ static function makeColouredLinkObj( $nt, $colour, $text = '', $query = '', $trail = '', $prefix = '' ) { wfDeprecated( __METHOD__, '1.16' ); - + if ( $colour != '' ) { $style = self::getInternalLinkAttributesObj( $nt, $text, $colour ); } else { diff --git a/includes/MimeMagic.php b/includes/MimeMagic.php index 1873e7bfef..88383d8f38 100644 --- a/includes/MimeMagic.php +++ b/includes/MimeMagic.php @@ -25,17 +25,17 @@ * This is used as a fallback to mime.types files. * An extensive list of well known mime types is provided by * the file mime.types in the includes directory. - * + * * This list concatenated with mime.types is used to create a mime <-> ext * map. Each line contains a mime type followed by a space separated list of - * extensions. If multiple extensions for a single mime type exist or if + * extensions. If multiple extensions for a single mime type exist or if * multiple mime types exist for a single extension then in most cases * MediaWiki assumes that the first extension following the mime type is the * canonical extension, and the first time a mime type appears for a certain * extension is considered the canonical mime type. - * + * * (Note that appending $wgMimeTypeFile to the end of MM_WELL_KNOWN_MIME_TYPES - * sucks because you can't redefine canonical types. This could be fixed by + * sucks because you can't redefine canonical types. This could be fixed by * appending MM_WELL_KNOWN_MIME_TYPES behind $wgMimeTypeFile, but who knows * what will break? In practice this probably isn't a problem anyway -- Bryan) */ @@ -70,7 +70,7 @@ image/x-bmp bmp image/gif gif image/jpeg jpeg jpg jpe image/png png -image/svg+xml svg +image/svg+xml svg image/svg svg image/tiff tiff tif image/vnd.djvu djvu @@ -352,11 +352,11 @@ class MimeMagic { return self::$instance; } - /** - * Returns a list of file extensions for a given mime type as a space + /** + * Returns a list of file extensions for a given mime type as a space * separated string or null if the mime type was unrecognized. Resolves * mime type aliases. - * + * * @param $mime string * @return string|null */ @@ -379,10 +379,10 @@ class MimeMagic { return null; } - /** - * Returns a list of mime types for a given file extension as a space + /** + * Returns a list of mime types for a given file extension as a space * separated string or null if the extension was unrecognized. - * + * * @param $ext string * @return string|null */ @@ -393,10 +393,10 @@ class MimeMagic { return $r; } - /** + /** * Returns a single mime type for a given file extension or null if unknown. * This is always the first type from the list returned by getTypesForExtension($ext). - * + * * @param $ext string * @return string|null */ @@ -414,11 +414,11 @@ class MimeMagic { } - /** - * Tests if the extension matches the given mime type. Returns true if a - * match was found, null if the mime type is unknown, and false if the + /** + * Tests if the extension matches the given mime type. Returns true if a + * match was found, null if the mime type is unknown, and false if the * mime type is known but no matches where found. - * + * * @param $extension string * @param $mime string * @return bool|null @@ -436,12 +436,12 @@ class MimeMagic { return in_array( $extension, $ext ); } - /** - * Returns true if the mime type is known to represent an image format + /** + * Returns true if the mime type is known to represent an image format * supported by the PHP GD library. * * @param $mime string - * + * * @return bool */ public function isPHPImageType( $mime ) { @@ -489,19 +489,19 @@ class MimeMagic { return in_array( strtolower( $extension ), $types ); } - /** + /** * Improves a mime type using the file extension. Some file formats are very generic, - * so their mime type is not very meaningful. A more useful mime type can be derived - * by looking at the file extension. Typically, this method would be called on the + * so their mime type is not very meaningful. A more useful mime type can be derived + * by looking at the file extension. Typically, this method would be called on the * result of guessMimeType(). - * + * * Currently, this method does the following: * * If $mime is "unknown/unknown" and isRecognizableExtension( $ext ) returns false, - * return the result of guessTypesForExtension($ext). + * return the result of guessTypesForExtension($ext). * * If $mime is "application/x-opc+zip" and isMatchingExtension( $ext, $mime ) - * gives true, return the result of guessTypesForExtension($ext). + * gives true, return the result of guessTypesForExtension($ext). * * @param $mime String: the mime type, typically guessed from a file's content. * @param $ext String: the file extension, as taken from the file name @@ -511,10 +511,10 @@ class MimeMagic { public function improveTypeFromExtension( $mime, $ext ) { if ( $mime === 'unknown/unknown' ) { if ( $this->isRecognizableExtension( $ext ) ) { - wfDebug( __METHOD__. ': refusing to guess mime type for .' . + wfDebug( __METHOD__. ': refusing to guess mime type for .' . "$ext file, we should have recognized it\n" ); } else { - // Not something we can detect, so simply + // Not something we can detect, so simply // trust the file extension $mime = $this->guessTypesForExtension( $ext ); } @@ -525,7 +525,7 @@ class MimeMagic { // find the proper mime type for that file extension $mime = $this->guessTypesForExtension( $ext ); } else { - wfDebug( __METHOD__. ": refusing to guess better type for $mime file, " . + wfDebug( __METHOD__. ": refusing to guess better type for $mime file, " . ".$ext is not a known OPC extension.\n" ); $mime = 'application/zip'; } @@ -539,16 +539,16 @@ class MimeMagic { return $mime; } - /** - * Mime type detection. This uses detectMimeType to detect the mime type - * of the file, but applies additional checks to determine some well known - * file formats that may be missed or misinterpreter by the default mime - * detection (namely XML based formats like XHTML or SVG, as well as ZIP + /** + * Mime type detection. This uses detectMimeType to detect the mime type + * of the file, but applies additional checks to determine some well known + * file formats that may be missed or misinterpreter by the default mime + * detection (namely XML based formats like XHTML or SVG, as well as ZIP * based formats like OPC/ODF files). * * @param $file String: the file to check * @param $ext Mixed: the file extension, or true (default) to extract it from the filename. - * Set it to false to ignore the extension. DEPRECATED! Set to false, use + * Set it to false to ignore the extension. DEPRECATED! Set to false, use * improveTypeFromExtension($mime, $ext) later to improve mime type. * * @return string the mime type of $file @@ -587,7 +587,7 @@ class MimeMagic { // @todo FIXME: Shouldn't this be rb? $f = fopen( $file, 'rt' ); wfRestoreWarnings(); - + if( !$f ) { return 'unknown/unknown'; } @@ -750,7 +750,7 @@ class MimeMagic { return false; } - + /** * Detect application-specific file type of a given ZIP file from its * header data. Currently works for OpenDocument and OpenXML types... @@ -759,7 +759,7 @@ class MimeMagic { * @param $header String: some reasonably-sized chunk of file header * @param $tail String: the tail of the file * @param $ext Mixed: the file extension, or true to extract it from the filename. - * Set it to false (default) to ignore the extension. DEPRECATED! Set to false, + * Set it to false (default) to ignore the extension. DEPRECATED! Set to false, * use improveTypeFromExtension($mime, $ext) later to improve mime type. * * @return string @@ -800,8 +800,8 @@ class MimeMagic { wfDebug( __METHOD__.": detected $mime from ZIP archive\n" ); } elseif ( preg_match( $openxmlRegex, substr( $header, 30 ) ) ) { $mime = "application/x-opc+zip"; - # TODO: remove the block below, as soon as improveTypeFromExtension is used everywhere - if ( $ext !== true && $ext !== false ) { + # TODO: remove the block below, as soon as improveTypeFromExtension is used everywhere + if ( $ext !== true && $ext !== false ) { /** This is the mode used by getPropsFromPath * These mime's are stored in the database, where we don't really want * x-opc+zip, because we use it only for internal purposes @@ -815,12 +815,12 @@ class MimeMagic { } } wfDebug( __METHOD__.": detected an Open Packaging Conventions archive: $mime\n" ); - } elseif ( substr( $header, 0, 8 ) == "\xd0\xcf\x11\xe0\xa1\xb1\x1a\xe1" && + } elseif ( substr( $header, 0, 8 ) == "\xd0\xcf\x11\xe0\xa1\xb1\x1a\xe1" && ($headerpos = strpos( $tail, "PK\x03\x04" ) ) !== false && preg_match( $openxmlRegex, substr( $tail, $headerpos + 30 ) ) ) { if ( substr( $header, 512, 4) == "\xEC\xA5\xC1\x00" ) { $mime = "application/msword"; - } + } switch( substr( $header, 512, 6) ) { case "\xEC\xA5\xC1\x00\x0E\x00": case "\xEC\xA5\xC1\x00\x1C\x00": @@ -850,20 +850,20 @@ class MimeMagic { return $mime; } - /** - * Internal mime type detection. Detection is done using an external - * program, if $wgMimeDetectorCommand is set. Otherwise, the fileinfo - * extension and mime_content_type are tried (in this order), if they - * are available. If the dections fails and $ext is not false, the mime + /** + * Internal mime type detection. Detection is done using an external + * program, if $wgMimeDetectorCommand is set. Otherwise, the fileinfo + * extension and mime_content_type are tried (in this order), if they + * are available. If the dections fails and $ext is not false, the mime * type is guessed from the file extension, using guessTypesForExtension. - * - * If the mime type is still unknown, getimagesize is used to detect the - * mime type if the file is an image. If no mime type can be determined, + * + * If the mime type is still unknown, getimagesize is used to detect the + * mime type if the file is an image. If no mime type can be determined, * this function returns 'unknown/unknown'. * * @param $file String: the file to check * @param $ext Mixed: the file extension, or true (default) to extract it from the filename. - * Set it to false to ignore the extension. DEPRECATED! Set to false, use + * Set it to false to ignore the extension. DEPRECATED! Set to false, use * improveTypeFromExtension($mime, $ext) later to improve mime type. * * @return string the mime type of $file @@ -1037,7 +1037,7 @@ class MimeMagic { return $type; } - /** + /** * Returns a media code matching the given mime type or file extension. * File extensions are represented by a string starting with a dot (.) to * distinguish them from mime types. @@ -1047,7 +1047,7 @@ class MimeMagic { * @return int|string */ function findMediaType( $extMime ) { - if ( strpos( $extMime, '.' ) === 0 ) { + if ( strpos( $extMime, '.' ) === 0 ) { // If it's an extension, look up the mime types $m = $this->getTypesForExtension( substr( $extMime, 1 ) ); if ( !$m ) { @@ -1076,7 +1076,7 @@ class MimeMagic { } /** - * Get the MIME types that various versions of Internet Explorer would + * Get the MIME types that various versions of Internet Explorer would * detect from a chunk of the content. * * @param $fileName String: the file name (unused at present) diff --git a/includes/SeleniumWebSettings.php b/includes/SeleniumWebSettings.php index 7b98568d74..0e4decfbe2 100644 --- a/includes/SeleniumWebSettings.php +++ b/includes/SeleniumWebSettings.php @@ -38,7 +38,7 @@ $cookieName = $cookiePrefix . 'Selenium'; // this is a fallback SQL file $testSqlFile = false; $testImageZip = false; - + // if we find a request parameter containing the test name, set a cookie with the test name if ( isset( $_GET['setupTestSuite'] ) ) { $setupTestSuiteName = $_GET['setupTestSuite']; @@ -62,7 +62,7 @@ if ( isset( $_GET['setupTestSuite'] ) ) { true ); } - + $testIncludes = array(); // array containing all the includes needed for this test $testGlobalConfigs = array(); // an array containg all the global configs needed for this test $testResourceFiles = array(); // an array containing all the resource files needed for this test @@ -72,11 +72,11 @@ if ( isset( $_GET['setupTestSuite'] ) ) { if ( isset( $testResourceFiles['images'] ) ) { $testImageZip = $testResourceFiles['images']; } - + if ( isset( $testResourceFiles['db'] ) ) { $testSqlFile = $testResourceFiles['db']; $testResourceName = getTestResourceNameFromTestSuiteName( $setupTestSuiteName ); - + switchToTestResources( $testResourceName, false ); // false means do not switch database yet setupTestResources( $testResourceName, $testSqlFile, $testImageZip ); } @@ -86,7 +86,7 @@ if ( isset( $_GET['setupTestSuite'] ) ) { if ( isset( $_GET['clearTestSuite'] ) ) { $testSuiteName = getTestSuiteNameFromCookie( $cookieName ); - $expire = time() - 600; + $expire = time() - 600; setcookie( $cookieName, '', @@ -96,22 +96,22 @@ if ( isset( $_GET['clearTestSuite'] ) ) { $wgCookieSecure, true ); - + $testResourceName = getTestResourceNameFromTestSuiteName( $testSuiteName ); teardownTestResources( $testResourceName ); } // if a cookie is found, run the appropriate callback to get the config params. -if ( isset( $_COOKIE[$cookieName] ) ) { +if ( isset( $_COOKIE[$cookieName] ) ) { $testSuiteName = getTestSuiteNameFromCookie( $cookieName ); if ( !isset( $wgSeleniumTestConfigs[$testSuiteName] ) ) { return; } - + $testIncludes = array(); // array containing all the includes needed for this test $testGlobalConfigs = array(); // an array containg all the global configs needed for this test $testResourceFiles = array(); // an array containing all the resource files needed for this test - $callback = $wgSeleniumTestConfigs[$testSuiteName]; + $callback = $wgSeleniumTestConfigs[$testSuiteName]; call_user_func_array( $callback, array( &$testIncludes, &$testGlobalConfigs, &$testResourceFiles)); if ( isset( $testResourceFiles['db'] ) ) { @@ -123,9 +123,8 @@ if ( isset( $_COOKIE[$cookieName] ) ) { require_once( $file ); } foreach ( $testGlobalConfigs as $key => $value ) { - if ( is_array( $value ) ) { + if ( is_array( $value ) ) { $GLOBALS[$key] = array_merge( $GLOBALS[$key], $value ); - } else { $GLOBALS[$key] = $value; } @@ -166,7 +165,7 @@ function setupTestResources( $testResourceName, $testSqlFile, $testImageZip ) { if ( $testResourceName == '' ) { die( 'Cannot identify a test the resources should be installed for.' ); } - + // create tables $dbw = wfGetDB( DB_MASTER ); $dbw->query( 'DROP DATABASE IF EXISTS ' . $testResourceName ); diff --git a/includes/Status.php b/includes/Status.php index 147b0df6e0..763c95cd2c 100644 --- a/includes/Status.php +++ b/includes/Status.php @@ -226,7 +226,7 @@ class Status { } /** - * Get the error message as HTML. This is done by parsing the wikitext error + * Get the error message as HTML. This is done by parsing the wikitext error * message. */ public function getHTML( $shortContext = false, $longContext = false ) { diff --git a/includes/Title.php b/includes/Title.php index ee3e01fdd1..c3e37a0f2b 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -2922,7 +2922,7 @@ class Title { $linkCache = LinkCache::singleton(); $cached = $linkCache->getGoodLinkFieldObj( $this, 'redirect' ); - if ( $cached === null ) { + if ( $cached === null ) { // TODO: check the assumption that the cache actually knows about this title // and handle this, such as get the title from the database. // See https://bugzilla.wikimedia.org/show_bug.cgi?id=37209 diff --git a/includes/User.php b/includes/User.php index 0a02dd2b88..3b1e03462d 100644 --- a/includes/User.php +++ b/includes/User.php @@ -3013,8 +3013,8 @@ class User { } /** - * Add this existing user object to the database. If the user already - * exists, a fatal status object is returned, and the user object is + * Add this existing user object to the database. If the user already + * exists, a fatal status object is returned, and the user object is * initialised with the data from the database. * * Previously, this function generated a DB error due to a key conflict @@ -3027,12 +3027,12 @@ class User { * } * // do something with $user... * - * However, this was vulnerable to a race condition (bug 16020). By + * However, this was vulnerable to a race condition (bug 16020). By * initialising the user object if the user exists, we aim to support this * calling sequence as far as possible. * * Note that if the user exists, this function will acquire a write lock, - * so it is still advisable to make the call conditional on isLoggedIn(), + * so it is still advisable to make the call conditional on isLoggedIn(), * and to commit the transaction after calling. * * @return Status @@ -3062,7 +3062,7 @@ class User { array( 'IGNORE' ) ); if ( !$dbw->affectedRows() ) { - $this->mId = $dbw->selectField( 'user', 'user_id', + $this->mId = $dbw->selectField( 'user', 'user_id', array( 'user_name' => $this->mName ), __METHOD__ ); $loaded = false; if ( $this->mId ) { diff --git a/includes/api/ApiQueryImageInfo.php b/includes/api/ApiQueryImageInfo.php index ee55fb5476..de0261413f 100644 --- a/includes/api/ApiQueryImageInfo.php +++ b/includes/api/ApiQueryImageInfo.php @@ -172,7 +172,7 @@ class ApiQueryImageInfo extends ApiQueryBase { $data = $this->getResultData(); foreach ( $data['query']['pages'] as $pageid => $arr ) { - if ( !isset( $arr['imagerepository'] ) ) { + if ( is_array( $arr ) && !isset( $arr['imagerepository'] ) ) { $result->addValue( array( 'query', 'pages', $pageid ), 'imagerepository', '' diff --git a/includes/extauth/MediaWiki.php b/includes/extauth/MediaWiki.php index 0a5efae6ee..c7f6a20417 100644 --- a/includes/extauth/MediaWiki.php +++ b/includes/extauth/MediaWiki.php @@ -36,15 +36,15 @@ * 'DBprefix' => '', * ); * - * All fields must be present. These mean the same things as $wgDBtype, - * $wgDBserver, etc. This implementation is quite crude; it could easily - * support multiple database servers, for instance, and memcached, and it - * probably has bugs. Kind of hard to reuse code when things might rely on who + * All fields must be present. These mean the same things as $wgDBtype, + * $wgDBserver, etc. This implementation is quite crude; it could easily + * support multiple database servers, for instance, and memcached, and it + * probably has bugs. Kind of hard to reuse code when things might rely on who * knows what configuration globals. * - * If either wiki uses the UserComparePasswords hook, password authentication - * might fail unexpectedly unless they both do the exact same validation. - * There may be other corner cases like this where this will fail, but it + * If either wiki uses the UserComparePasswords hook, password authentication + * might fail unexpectedly unless they both do the exact same validation. + * There may be other corner cases like this where this will fail, but it * should be unlikely. * * @ingroup ExternalUser @@ -62,8 +62,8 @@ class ExternalUser_MediaWiki extends ExternalUser { * @return bool */ protected function initFromName( $name ) { - # We might not need the 'usable' bit, but let's be safe. Theoretically - # this might return wrong results for old versions, but it's probably + # We might not need the 'usable' bit, but let's be safe. Theoretically + # this might return wrong results for old versions, but it's probably # good enough. $name = User::getCanonicalName( $name, 'usable' ); @@ -130,14 +130,14 @@ class ExternalUser_MediaWiki extends ExternalUser { } public function authenticate( $password ) { - # This might be wrong if anyone actually uses the UserComparePasswords hook + # This might be wrong if anyone actually uses the UserComparePasswords hook # (on either end), so don't use this if you those are incompatible. return User::comparePasswords( $this->mRow->user_password, $password, - $this->mRow->user_id ); + $this->mRow->user_id ); } public function getPref( $pref ) { - # @todo FIXME: Return other prefs too. Lots of global-riddled code that does + # @todo FIXME: Return other prefs too. Lots of global-riddled code that does # this normally. if ( $pref === 'emailaddress' && $this->row->user_email_authenticated !== null ) { diff --git a/includes/filebackend/FSFile.php b/includes/filebackend/FSFile.php index e07c99d42d..fda356e0a7 100644 --- a/includes/filebackend/FSFile.php +++ b/includes/filebackend/FSFile.php @@ -86,8 +86,8 @@ class FSFile { /** * Guess the MIME type from the file contents alone - * - * @return string + * + * @return string */ public function getMimeType() { return MimeMagic::singleton()->guessMimeType( $this->path, false ); @@ -211,7 +211,7 @@ class FSFile { /** * Get the final file extension from a file system path - * + * * @param $path string * @return string */ diff --git a/includes/filerepo/FSRepo.php b/includes/filerepo/FSRepo.php index 9c8d85dc2a..635cb95efe 100644 --- a/includes/filerepo/FSRepo.php +++ b/includes/filerepo/FSRepo.php @@ -24,9 +24,9 @@ /** * A repository for files accessible via the local filesystem. * Does not support database access or registration. - * + * * This is a mostly a legacy class. New uses should not be added. - * + * * @ingroup FileRepo * @deprecated since 1.19 */ diff --git a/includes/filerepo/ForeignDBRepo.php b/includes/filerepo/ForeignDBRepo.php index 4b206c3d0e..18659852d2 100644 --- a/includes/filerepo/ForeignDBRepo.php +++ b/includes/filerepo/ForeignDBRepo.php @@ -86,7 +86,7 @@ class ForeignDBRepo extends LocalRepo { /** * Get a key on the primary cache for this repository. - * Returns false if the repository's cache is not accessible at this site. + * Returns false if the repository's cache is not accessible at this site. * The parameters are the parts of the key, as for wfMemcKey(). * @return bool|mixed */ diff --git a/includes/filerepo/ForeignDBViaLBRepo.php b/includes/filerepo/ForeignDBViaLBRepo.php index bd76fce7fe..7951fb1383 100644 --- a/includes/filerepo/ForeignDBViaLBRepo.php +++ b/includes/filerepo/ForeignDBViaLBRepo.php @@ -61,7 +61,7 @@ class ForeignDBViaLBRepo extends LocalRepo { /** * Get a key on the primary cache for this repository. - * Returns false if the repository's cache is not accessible at this site. + * Returns false if the repository's cache is not accessible at this site. * The parameters are the parts of the key, as for wfMemcKey(). * @return bool|string */ diff --git a/includes/filerepo/LocalRepo.php b/includes/filerepo/LocalRepo.php index 0954422d4f..118e9810c3 100644 --- a/includes/filerepo/LocalRepo.php +++ b/includes/filerepo/LocalRepo.php @@ -238,7 +238,7 @@ class LocalRepo extends FileRepo { __METHOD__, array( 'ORDER BY' => 'img_name' ) ); - + $result = array(); foreach ( $res as $row ) { $result[] = $this->newFileFromRow( $row ); @@ -299,7 +299,7 @@ class LocalRepo extends FileRepo { /** * Get a key on the primary cache for this repository. - * Returns false if the repository's cache is not accessible at this site. + * Returns false if the repository's cache is not accessible at this site. * The parameters are the parts of the key, as for wfMemcKey(). * * @return string diff --git a/includes/libs/JavaScriptMinifier.php b/includes/libs/JavaScriptMinifier.php index 0b4be9ae74..db5326c7cf 100644 --- a/includes/libs/JavaScriptMinifier.php +++ b/includes/libs/JavaScriptMinifier.php @@ -59,7 +59,7 @@ class JavaScriptMinifier { const TYPE_DO = 15; // keywords: case, var, finally, else, do, try const TYPE_FUNC = 16; // keywords: function const TYPE_LITERAL = 17; // all literals, identifiers and unrecognised tokens - + // Sanity limit to avoid excessive memory usage const STACK_LIMIT = 1000; @@ -385,7 +385,7 @@ class JavaScriptMinifier { self::TYPE_LITERAL => true ) ); - + // Rules for when newlines should be inserted if // $statementsOnOwnLine is enabled. // $newlineBefore is checked before switching state, @@ -514,7 +514,7 @@ class JavaScriptMinifier { return self::parseError($s, $end, 'Number with several E' ); } $end++; - + // + sign is optional; - sign is required. $end += strspn( $s, '-+', $end ); $len = strspn( $s, '0123456789', $end ); @@ -564,13 +564,13 @@ class JavaScriptMinifier { $out .= ' '; $lineLength++; } - + $out .= $token; $lineLength += $end - $pos; // += strlen( $token ) $last = $s[$end - 1]; $pos = $end; $newlineFound = false; - + // Output a newline after the token if required // This is checked before AND after switching state $newlineAdded = false; @@ -589,7 +589,7 @@ class JavaScriptMinifier { } elseif( isset( $goto[$state][$type] ) ) { $state = $goto[$state][$type]; } - + // Check for newline insertion again if ( $statementsOnOwnLine && !$newlineAdded && isset( $newlineAfter[$state][$type] ) ) { $out .= "\n"; @@ -598,7 +598,7 @@ class JavaScriptMinifier { } return $out; } - + static function parseError($fullJavascript, $position, $errorMsg) { // TODO: Handle the error: trigger_error, throw exception, return false... return false; diff --git a/includes/media/BitmapMetadataHandler.php b/includes/media/BitmapMetadataHandler.php index d2edc9f140..2b04f78b53 100644 --- a/includes/media/BitmapMetadataHandler.php +++ b/includes/media/BitmapMetadataHandler.php @@ -240,7 +240,7 @@ class BitmapMetadataHandler { unset( $baseArray['comment'] ); unset( $baseArray['xmp'] ); - + $baseArray['metadata'] = $meta->getMetadataArray(); $baseArray['metadata']['_MW_GIF_VERSION'] = GIFMetadataExtractor::VERSION; return $baseArray; diff --git a/includes/media/DjVuImage.php b/includes/media/DjVuImage.php index 6aef562b12..e2fcaa932c 100644 --- a/includes/media/DjVuImage.php +++ b/includes/media/DjVuImage.php @@ -228,7 +228,7 @@ class DjVuImage { function retrieveMetaData() { global $wgDjvuToXML, $wgDjvuDump, $wgDjvuTxt; wfProfileIn( __METHOD__ ); - + if ( isset( $wgDjvuDump ) ) { # djvudump is faster as of version 3.5 # http://sourceforge.net/tracker/index.php?func=detail&aid=1704049&group_id=32953&atid=406583 @@ -247,7 +247,7 @@ class DjVuImage { $xml = null; } # Text layer - if ( isset( $wgDjvuTxt ) ) { + if ( isset( $wgDjvuTxt ) ) { wfProfileIn( 'djvutxt' ); $cmd = wfEscapeShellArg( $wgDjvuTxt ) . ' --detail=page ' . wfEscapeShellArg( $this->mFilename ) ; wfDebug( __METHOD__.": $cmd\n" ); @@ -260,7 +260,7 @@ class DjVuImage { $reg = << # Text to match is composed of atoms of either: - \\\\. # - any escaped character + \\\\. # - any escaped character | # - any character different from " and \ [^"\\\\]+ )*?) diff --git a/includes/media/Exif.php b/includes/media/Exif.php index 104ba555f6..bdacbc86d9 100644 --- a/includes/media/Exif.php +++ b/includes/media/Exif.php @@ -389,7 +389,7 @@ class Exif { $this->charCodeString( 'UserComment' ); $this->charCodeString( 'GPSProcessingMethod'); $this->charCodeString( 'GPSAreaInformation' ); - + //ComponentsConfiguration should really be an array instead of a string... //This turns a string of binary numbers into an array of numbers. @@ -402,7 +402,7 @@ class Exif { $ccVals['_type'] = 'ol'; //this is for formatting later. $this->mFilteredExifData['ComponentsConfiguration'] = $ccVals; } - + //GPSVersion(ID) is treated as the wrong type by php exif support. //Go through each byte turning it into a version string. //For example: "\x02\x02\x00\x00" -> "2.2.0.0" @@ -451,8 +451,7 @@ class Exif { } $charCode = substr( $this->mFilteredExifData[$prop], 0, 8); $val = substr( $this->mFilteredExifData[$prop], 8); - - + switch ($charCode) { case "\x4A\x49\x53\x00\x00\x00\x00\x00": //JIS @@ -481,7 +480,7 @@ class Exif { wfRestoreWarnings(); } } - + //trim and check to make sure not only whitespace. $val = trim($val); if ( strlen( $val ) === 0 ) { @@ -749,10 +748,10 @@ class Exif { return false; } if( $count > 1 ) { - foreach( $val as $v ) { + foreach( $val as $v ) { if( !$this->validate( $section, $tag, $v, true ) ) { - return false; - } + return false; + } } return true; } diff --git a/includes/media/GIF.php b/includes/media/GIF.php index 84b9b8ca7d..da8fc6f87b 100644 --- a/includes/media/GIF.php +++ b/includes/media/GIF.php @@ -29,7 +29,7 @@ class GIFHandler extends BitmapHandler { const BROKEN_FILE = '0'; // value to store in img_metadata if error extracting metadata. - + function getMetadata( $image, $filename ) { try { $parsedGIFMetadata = BitmapMetadataHandler::GIF( $filename ); @@ -143,7 +143,7 @@ class GIFHandler extends BitmapHandler { wfSuppressWarnings(); $metadata = unserialize($image->getMetadata()); wfRestoreWarnings(); - + if (!$metadata || $metadata['frameCount'] <= 1) { return $original; } @@ -151,19 +151,19 @@ class GIFHandler extends BitmapHandler { /* Preserve original image info string, but strip the last char ')' so we can add even more */ $info = array(); $info[] = $original; - + if ( $metadata['looped'] ) { $info[] = wfMessage( 'file-info-gif-looped' )->parse(); } - + if ( $metadata['frameCount'] > 1 ) { $info[] = wfMessage( 'file-info-gif-frames' )->numParams( $metadata['frameCount'] )->parse(); } - + if ( $metadata['duration'] ) { $info[] = $wgLang->formatTimePeriod( $metadata['duration'] ); } - + return $wgLang->commaList( $info ); } } diff --git a/includes/media/GIFMetadataExtractor.php b/includes/media/GIFMetadataExtractor.php index f6ca7753d3..7a162c3fcb 100644 --- a/includes/media/GIFMetadataExtractor.php +++ b/includes/media/GIFMetadataExtractor.php @@ -58,7 +58,7 @@ class GIFMetadataExtractor { $isLooped = false; $xmp = ""; $comment = array(); - + if ( !$filename ) { throw new Exception( "No file name specified" ); } elseif ( !file_exists( $filename ) || is_dir( $filename ) ) { @@ -107,7 +107,7 @@ class GIFMetadataExtractor { ## Read GCT self::readGCT( $fh, $bpp ); fread( $fh, 1 ); - self::skipBlock( $fh ); + self::skipBlock( $fh ); } elseif ( $buf == self::$gif_extension_sep ) { $buf = fread( $fh, 1 ); if ( strlen( $buf ) < 1 ) throw new Exception( "Ran out of input" ); @@ -182,23 +182,22 @@ class GIFMetadataExtractor { // NETSCAPE2.0 (application name for animated gif) if ( $data == 'NETSCAPE2.0' ) { - $data = fread( $fh, 2 ); // Block length and introduction, should be 03 01 if ($data != "\x03\x01") { throw new Exception( "Expected \x03\x01, got $data" ); } - + // Unsigned little-endian integer, loop count or zero for "forever" $loopData = fread( $fh, 2 ); if ( strlen( $loopData ) < 2 ) throw new Exception( "Ran out of input" ); $loopData = unpack( 'v', $loopData ); $loopCount = $loopData[1]; - + if ($loopCount != 1) { $isLooped = true; } - + // Read out terminator byte fread( $fh, 1 ); } elseif ( $data == 'XMP DataXMP' ) { diff --git a/includes/media/JpegMetadataExtractor.php b/includes/media/JpegMetadataExtractor.php index ecf216ad53..60fd2a0f7b 100644 --- a/includes/media/JpegMetadataExtractor.php +++ b/includes/media/JpegMetadataExtractor.php @@ -129,7 +129,7 @@ class JpegMetadataExtractor { // whatever... $segments["XMP"] = substr( $temp, 29 ); wfDebug( __METHOD__ . ' Found XMP section with wrong app identifier ' - . "Using anyways.\n" ); + . "Using anyways.\n" ); } elseif ( substr( $temp, 0, 6 ) === "Exif\0\0" ) { // Just need to find out what the byte order is. // because php's exif plugin sucks... diff --git a/includes/media/PNG.php b/includes/media/PNG.php index 1b329e57b5..a23821f4fb 100644 --- a/includes/media/PNG.php +++ b/includes/media/PNG.php @@ -88,11 +88,11 @@ class PNGHandler extends BitmapHandler { function canAnimateThumbnail( $image ) { return false; } - + function getMetadataType( $image ) { return 'parsed-png'; } - + function isMetadataValid( $image, $metadata ) { if ( $metadata === self::BROKEN_FILE ) { @@ -134,21 +134,21 @@ class PNGHandler extends BitmapHandler { $info = array(); $info[] = $original; - + if ( $metadata['loopCount'] == 0 ) { $info[] = wfMessage( 'file-info-png-looped' )->parse(); } elseif ( $metadata['loopCount'] > 1 ) { $info[] = wfMessage( 'file-info-png-repeat' )->numParams( $metadata['loopCount'] )->parse(); } - + if ( $metadata['frameCount'] > 0 ) { $info[] = wfMessage( 'file-info-png-frames' )->numParams( $metadata['frameCount'] )->parse(); } - + if ( $metadata['duration'] ) { $info[] = $wgLang->formatTimePeriod( $metadata['duration'] ); } - + return $wgLang->commaList( $info ); } diff --git a/includes/media/PNGMetadataExtractor.php b/includes/media/PNGMetadataExtractor.php index 9dcde40694..55f087ad2e 100644 --- a/includes/media/PNGMetadataExtractor.php +++ b/includes/media/PNGMetadataExtractor.php @@ -124,7 +124,7 @@ class PNGMetadataExtractor { case 0: $colorType = 'greyscale'; break; - case 2: + case 2: $colorType = 'truecolour'; break; case 3: diff --git a/includes/media/SVGMetadataExtractor.php b/includes/media/SVGMetadataExtractor.php index 871d419e48..456c0166c2 100644 --- a/includes/media/SVGMetadataExtractor.php +++ b/includes/media/SVGMetadataExtractor.php @@ -75,9 +75,9 @@ class SVGReader { $this->reader->open( $source, null, LIBXML_NOERROR | LIBXML_NOWARNING ); } - // Expand entities, since Adobe Illustrator uses them for xmlns - // attributes (bug 31719). Note that libxml2 has some protection - // against large recursive entity expansions so this is not as + // Expand entities, since Adobe Illustrator uses them for xmlns + // attributes (bug 31719). Note that libxml2 has some protection + // against large recursive entity expansions so this is not as // insecure as it might appear to be. $this->reader->setParserProperty( XMLReader::SUBST_ENTITIES, true ); diff --git a/includes/media/XMPInfo.php b/includes/media/XMPInfo.php index 83b8a102d0..aa411dfdf9 100644 --- a/includes/media/XMPInfo.php +++ b/includes/media/XMPInfo.php @@ -669,7 +669,7 @@ class XMPInfo { * 'validate' => 'validateClosed', * 'choices' => array( '1' => true, '2' => true ), * ), - */ + */ ), 'http://ns.adobe.com/exif/1.0/aux/' => array( 'Lens' => array( diff --git a/includes/media/XMPValidate.php b/includes/media/XMPValidate.php index 5ce3c00bde..e3fd59fdad 100644 --- a/includes/media/XMPValidate.php +++ b/includes/media/XMPValidate.php @@ -153,7 +153,7 @@ class XMPValidate { //check if its in a numeric range $inRange = false; - if ( isset( $info['rangeLow'] ) + if ( isset( $info['rangeLow'] ) && isset( $info['rangeHigh'] ) && is_numeric( $val ) && ( intval( $val ) <= $info['rangeHigh'] ) @@ -342,7 +342,7 @@ class XMPValidate { } $m = array(); - if ( preg_match( + if ( preg_match( '/(\d{1,3}),(\d{1,2}),(\d{1,2})([NWSE])/D', $val, $m ) ) { @@ -354,7 +354,7 @@ class XMPValidate { } $val = $coord; return; - } elseif ( preg_match( + } elseif ( preg_match( '/(\d{1,3}),(\d{1,2}(?:.\d*)?)([NWSE])/D', $val, $m ) ) { @@ -367,7 +367,7 @@ class XMPValidate { return; } else { - wfDebugLog( 'XMP', __METHOD__ + wfDebugLog( 'XMP', __METHOD__ . " Expected GPSCoordinate, but got $val." ); $val = null; return; diff --git a/includes/normal/Utf8CaseGenerate.php b/includes/normal/Utf8CaseGenerate.php index 368d0bcdff..d9deb3c36f 100644 --- a/includes/normal/Utf8CaseGenerate.php +++ b/includes/normal/Utf8CaseGenerate.php @@ -49,7 +49,7 @@ while( false !== ($line = fgets( $in ) ) ) { $name = $columns[1]; $simpleUpper = $columns[12]; $simpleLower = $columns[13]; - + $source = codepointToUtf8( hexdec( $codepoint ) ); if( $simpleUpper ) { $wikiUpperChars[$source] = codepointToUtf8( hexdec( $simpleUpper ) ); diff --git a/includes/normal/UtfNormal.php b/includes/normal/UtfNormal.php index 08f85bd342..64d96187d5 100644 --- a/includes/normal/UtfNormal.php +++ b/includes/normal/UtfNormal.php @@ -765,7 +765,7 @@ class UtfNormal { * @param $string String The string * @return String String with the character codes replaced. */ - private static function replaceForNativeNormalize( $string ) { + private static function replaceForNativeNormalize( $string ) { $string = preg_replace( '/[\x00-\x08\x0b\x0c\x0e-\x1f]/', UTF8_REPLACEMENT, diff --git a/includes/normal/UtfNormalBench.php b/includes/normal/UtfNormalBench.php index 944c443530..6642844e2b 100644 --- a/includes/normal/UtfNormalBench.php +++ b/includes/normal/UtfNormalBench.php @@ -19,7 +19,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * http://www.gnu.org/copyleft/gpl.html - * + * * @file * @ingroup UtfNormal */ diff --git a/includes/normal/UtfNormalDefines.php b/includes/normal/UtfNormalDefines.php index 5142a4143b..64624b8a14 100644 --- a/includes/normal/UtfNormalDefines.php +++ b/includes/normal/UtfNormalDefines.php @@ -2,7 +2,7 @@ /** * Some constant definitions for the unicode normalization module. * - * Note: these constants must all be resolvable at compile time by HipHop, + * Note: these constants must all be resolvable at compile time by HipHop, * since this file will not be executed during request startup for a compiled * MediaWiki. * diff --git a/includes/normal/UtfNormalGenerate.php b/includes/normal/UtfNormalGenerate.php index e4c1138ea3..11d06d4ccd 100644 --- a/includes/normal/UtfNormalGenerate.php +++ b/includes/normal/UtfNormalGenerate.php @@ -177,7 +177,7 @@ if( $out ) { * * @file */ - + UtfNormal::\$utfCombiningClass = unserialize( '$serCombining' ); UtfNormal::\$utfCanonicalComp = unserialize( '$serComp' ); UtfNormal::\$utfCanonicalDecomp = unserialize( '$serCanon' ); diff --git a/includes/objectcache/EhcacheBagOStuff.php b/includes/objectcache/EhcacheBagOStuff.php index 156c39ec02..60d0645c90 100644 --- a/includes/objectcache/EhcacheBagOStuff.php +++ b/includes/objectcache/EhcacheBagOStuff.php @@ -28,9 +28,9 @@ * @ingroup Cache */ class EhcacheBagOStuff extends BagOStuff { - var $servers, $cacheName, $connectTimeout, $timeout, $curlOptions, + var $servers, $cacheName, $connectTimeout, $timeout, $curlOptions, $requestData, $requestDataPos; - + var $curls = array(); /** @@ -49,7 +49,7 @@ class EhcacheBagOStuff extends BagOStuff { } $this->servers = $params['servers']; $this->cacheName = isset( $params['cache'] ) ? $params['cache'] : 'mw'; - $this->connectTimeout = isset( $params['connectTimeout'] ) + $this->connectTimeout = isset( $params['connectTimeout'] ) ? $params['connectTimeout'] : 1; $this->timeout = isset( $params['timeout'] ) ? $params['timeout'] : 1; $this->curlOptions = array( @@ -77,7 +77,7 @@ class EhcacheBagOStuff extends BagOStuff { if ( $response['http_code'] >= 300 ) { wfDebug( __METHOD__.": GET failure, got HTTP {$response['http_code']}\n" ); wfProfileOut( __METHOD__ ); - return false; + return false; } $body = $response['body']; $type = $response['content_type']; @@ -203,9 +203,9 @@ class EhcacheBagOStuff extends BagOStuff { * @return int */ protected function attemptPut( $key, $data, $type, $ttl ) { - // In initial benchmarking, it was 30 times faster to use CURLOPT_POST + // In initial benchmarking, it was 30 times faster to use CURLOPT_POST // than CURLOPT_UPLOAD with CURLOPT_READFUNCTION. This was because - // CURLOPT_UPLOAD was pushing the request headers first, then waiting + // CURLOPT_UPLOAD was pushing the request headers first, then waiting // for an ACK packet, then sending the data, whereas CURLOPT_POST just // sends the headers and the data in a single send(). $response = $this->doItemRequest( $key, @@ -232,7 +232,7 @@ class EhcacheBagOStuff extends BagOStuff { */ protected function createCache( $key ) { wfDebug( __METHOD__.": creating cache for $key\n" ); - $response = $this->doCacheRequest( $key, + $response = $this->doCacheRequest( $key, array( CURLOPT_POST => 1, CURLOPT_CUSTOMREQUEST => 'PUT', @@ -280,7 +280,7 @@ class EhcacheBagOStuff extends BagOStuff { if ( array_diff_key( $curlOptions, $this->curlOptions ) ) { // var_dump( array_diff_key( $curlOptions, $this->curlOptions ) ); throw new MWException( __METHOD__.": to prevent options set in one doRequest() " . - "call from affecting subsequent doRequest() calls, only options listed " . + "call from affecting subsequent doRequest() calls, only options listed " . "in \$this->curlOptions may be specified in the \$curlOptions parameter." ); } $curlOptions += $this->curlOptions; diff --git a/includes/objectcache/MemcachedBagOStuff.php b/includes/objectcache/MemcachedBagOStuff.php index 813c2727c4..643d2e94bf 100644 --- a/includes/objectcache/MemcachedBagOStuff.php +++ b/includes/objectcache/MemcachedBagOStuff.php @@ -101,7 +101,7 @@ class MemcachedBagOStuff extends BagOStuff { * @return Mixed */ public function replace( $key, $value, $exptime = 0 ) { - return $this->client->replace( $this->encodeKey( $key ), $value, + return $this->client->replace( $this->encodeKey( $key ), $value, $this->fixExpiry( $exptime ) ); } diff --git a/includes/objectcache/MemcachedClient.php b/includes/objectcache/MemcachedClient.php index 536ba6ea07..9ac8ad87ce 100644 --- a/includes/objectcache/MemcachedClient.php +++ b/includes/objectcache/MemcachedClient.php @@ -897,7 +897,7 @@ class MWMemcached { return false; } if ( substr( $data, -2 ) !== "\r\n" ) { - $this->_handle_error( $sock, + $this->_handle_error( $sock, 'line ending missing from data block from $1' ); return false; } @@ -1096,7 +1096,7 @@ class MWMemcached { } /** - * Read the specified number of bytes from a stream. If there is an error, + * Read the specified number of bytes from a stream. If there is an error, * mark the socket dead. * * @param $sock The socket @@ -1137,7 +1137,7 @@ class MWMemcached { function _fgets( $sock ) { $result = fgets( $sock ); // fgets() may return a partial line if there is a select timeout after - // a successful recv(), so we have to check for a timeout even if we + // a successful recv(), so we have to check for a timeout even if we // got a string response. $data = stream_get_meta_data( $sock ); if ( $data['timed_out'] ) { diff --git a/includes/objectcache/MemcachedPhpBagOStuff.php b/includes/objectcache/MemcachedPhpBagOStuff.php index a46dc71628..5a9ee508b9 100644 --- a/includes/objectcache/MemcachedPhpBagOStuff.php +++ b/includes/objectcache/MemcachedPhpBagOStuff.php @@ -81,7 +81,7 @@ class MemcachedPhpBagOStuff extends MemcachedBagOStuff { public function unlock( $key ) { return $this->client->unlock( $this->encodeKey( $key ) ); } - + /** * @param $key string * @param $value int diff --git a/includes/objectcache/MultiWriteBagOStuff.php b/includes/objectcache/MultiWriteBagOStuff.php index e496ddd8ab..2f37c23b27 100644 --- a/includes/objectcache/MultiWriteBagOStuff.php +++ b/includes/objectcache/MultiWriteBagOStuff.php @@ -22,8 +22,8 @@ */ /** - * A cache class that replicates all writes to multiple child caches. Reads - * are implemented by reading from the caches in the order they are given in + * A cache class that replicates all writes to multiple child caches. Reads + * are implemented by reading from the caches in the order they are given in * the configuration until a cache gives a positive result. * * @ingroup Cache diff --git a/includes/objectcache/ObjectCache.php b/includes/objectcache/ObjectCache.php index 9b360f3234..83b6016401 100644 --- a/includes/objectcache/ObjectCache.php +++ b/includes/objectcache/ObjectCache.php @@ -139,8 +139,8 @@ class ObjectCache { /** * Factory function that creates a memcached client object. * - * This always uses the PHP client, since the PECL client has a different - * hashing scheme and a different interpretation of the flags bitfield, so + * This always uses the PHP client, since the PECL client has a different + * hashing scheme and a different interpretation of the flags bitfield, so * switching between the two clients randomly would be disasterous. * * @param $params array diff --git a/includes/resourceloader/ResourceLoader.php b/includes/resourceloader/ResourceLoader.php index f98266ead6..92e7fcf8fd 100644 --- a/includes/resourceloader/ResourceLoader.php +++ b/includes/resourceloader/ResourceLoader.php @@ -39,7 +39,7 @@ class ResourceLoader { /** Associative array mapping module name to info associative array */ protected $moduleInfos = array(); - + /** Associative array mapping framework ids to a list of names of test suite modules */ /** like array( 'qunit' => array( 'mediawiki.tests.qunit.suites', 'ext.foo.tests', .. ), .. ) */ protected $testModuleNames = array(); @@ -346,7 +346,7 @@ class ResourceLoader { public function getModuleNames() { return array_keys( $this->moduleInfos ); } - + /** * Get a list of test module names for one (or all) frameworks. * If the given framework id is unknkown, or if the in-object variable is not an array, diff --git a/includes/resourceloader/ResourceLoaderModule.php b/includes/resourceloader/ResourceLoaderModule.php index c570f0ac40..8fec0d6bf7 100644 --- a/includes/resourceloader/ResourceLoaderModule.php +++ b/includes/resourceloader/ResourceLoaderModule.php @@ -376,7 +376,7 @@ abstract class ResourceLoaderModule { * NOTE: The mtime of the module's messages is NOT automatically included. * If you want this to happen, you'll need to call getMsgBlobMtime() * yourself and take its result into consideration. - * + * * @param $context ResourceLoaderContext: Context object * @return Integer: UNIX timestamp */ diff --git a/includes/resourceloader/ResourceLoaderNoscriptModule.php b/includes/resourceloader/ResourceLoaderNoscriptModule.php index 8e81c8d927..bd026f3fe3 100644 --- a/includes/resourceloader/ResourceLoaderNoscriptModule.php +++ b/includes/resourceloader/ResourceLoaderNoscriptModule.php @@ -45,7 +45,7 @@ class ResourceLoaderNoscriptModule extends ResourceLoaderWikiModule { /** * Gets group name - * + * * @return String: Name of group */ public function getGroup() { diff --git a/includes/resourceloader/ResourceLoaderSiteModule.php b/includes/resourceloader/ResourceLoaderSiteModule.php index 03fe1fe565..1cc5c1a982 100644 --- a/includes/resourceloader/ResourceLoaderSiteModule.php +++ b/includes/resourceloader/ResourceLoaderSiteModule.php @@ -47,8 +47,8 @@ class ResourceLoaderSiteModule extends ResourceLoaderWikiModule { 'MediaWiki:Print.css' => array( 'type' => 'style', 'media' => 'print' ), ); if ( $wgHandheldStyle ) { - $pages['MediaWiki:Handheld.css'] = array( - 'type' => 'style', + $pages['MediaWiki:Handheld.css'] = array( + 'type' => 'style', 'media' => 'handheld' ); } return $pages; @@ -58,7 +58,7 @@ class ResourceLoaderSiteModule extends ResourceLoaderWikiModule { /** * Gets group name - * + * * @return String: Name of group */ public function getGroup() { diff --git a/includes/resourceloader/ResourceLoaderUserCSSPrefsModule.php b/includes/resourceloader/ResourceLoaderUserCSSPrefsModule.php index 139048c28e..d90e8c40a7 100644 --- a/includes/resourceloader/ResourceLoaderUserCSSPrefsModule.php +++ b/includes/resourceloader/ResourceLoaderUserCSSPrefsModule.php @@ -48,7 +48,7 @@ class ResourceLoaderUserCSSPrefsModule extends ResourceLoaderModule { global $wgUser; return $this->modifiedTime[$hash] = wfTimestamp( TS_UNIX, $wgUser->getTouched() ); } - + /** * @param $context ResourceLoaderContext * @return array diff --git a/includes/search/SearchIBM_DB2.php b/includes/search/SearchIBM_DB2.php index 51ed000f62..368d900feb 100644 --- a/includes/search/SearchIBM_DB2.php +++ b/includes/search/SearchIBM_DB2.php @@ -186,10 +186,10 @@ class SearchIBM_DB2 extends SearchEngine { $searchon = $this->db->strencode(join(',', $q)); $field = $this->getIndexField($fulltext); - + // requires Net Search Extender or equivalent //return " CONTAINS($field, '$searchon') > 0 "; - + return " lcase($field) LIKE lcase('%$searchon%')"; } diff --git a/includes/search/SearchMssql.php b/includes/search/SearchMssql.php index 69c92ba324..4edce35f97 100644 --- a/includes/search/SearchMssql.php +++ b/includes/search/SearchMssql.php @@ -78,7 +78,7 @@ class SearchMssql extends SearchEngine { * Return a partial WHERE clause to limit the search to the given namespaces * * @return String - * @private + * @private */ function queryNamespaces() { $namespaces = implode( ',', $this->namespaces ); @@ -146,7 +146,7 @@ class SearchMssql extends SearchEngine { $match = $this->parseQuery( $filteredTerm, $fulltext ); $page = $this->db->tableName( 'page' ); $searchindex = $this->db->tableName( 'searchindex' ); - + return 'SELECT page_id, page_namespace, page_title, ftindex.[RANK]' . "FROM $page,FREETEXTTABLE($searchindex , $match, LANGUAGE 'English') as ftindex " . 'WHERE page_id=ftindex.[KEY] '; @@ -196,7 +196,7 @@ class SearchMssql extends SearchEngine { */ function update( $id, $title, $text ) { // We store the column data as UTF-8 byte order marked binary stream - // because we are invoking the plain text IFilter on it so that, and we want it + // because we are invoking the plain text IFilter on it so that, and we want it // to properly decode the stream as UTF-8. SQL doesn't support UTF8 as a data type // but the indexer will correctly handle it by this method. Since all we are doing // is passing this data to the indexer and never retrieving it via PHP, this will save space diff --git a/includes/search/SearchOracle.php b/includes/search/SearchOracle.php index a2db52f364..29070e1ad1 100644 --- a/includes/search/SearchOracle.php +++ b/includes/search/SearchOracle.php @@ -29,32 +29,32 @@ * @ingroup Search */ class SearchOracle extends SearchEngine { - - private $reservedWords = array ('ABOUT' => 1, - 'ACCUM' => 1, - 'AND' => 1, - 'BT' => 1, - 'BTG' => 1, - 'BTI' => 1, + + private $reservedWords = array ('ABOUT' => 1, + 'ACCUM' => 1, + 'AND' => 1, + 'BT' => 1, + 'BTG' => 1, + 'BTI' => 1, 'BTP' => 1, - 'FUZZY' => 1, - 'HASPATH' => 1, - 'INPATH' => 1, - 'MINUS' => 1, - 'NEAR' => 1, + 'FUZZY' => 1, + 'HASPATH' => 1, + 'INPATH' => 1, + 'MINUS' => 1, + 'NEAR' => 1, 'NOT' => 1, - 'NT' => 1, - 'NTG' => 1, - 'NTI' => 1, - 'NTP' => 1, - 'OR' => 1, - 'PT' => 1, - 'RT' => 1, + 'NT' => 1, + 'NTG' => 1, + 'NTI' => 1, + 'NTP' => 1, + 'OR' => 1, + 'PT' => 1, + 'RT' => 1, 'SQE' => 1, - 'SYN' => 1, - 'TR' => 1, - 'TRSYN' => 1, - 'TT' => 1, + 'SYN' => 1, + 'TR' => 1, + 'TRSYN' => 1, + 'TT' => 1, 'WITHIN' => 1); /** @@ -254,13 +254,13 @@ class SearchOracle extends SearchEngine { ), 'SearchOracle::update' ); // Sync the index - // We need to specify the DB name (i.e. user/schema) here so that + // We need to specify the DB name (i.e. user/schema) here so that // it can work from the installer, where // ALTER SESSION SET CURRENT_SCHEMA = ... // was used. - $dbw->query( "CALL ctx_ddl.sync_index(" . + $dbw->query( "CALL ctx_ddl.sync_index(" . $dbw->addQuotes( $dbw->getDBname() . '.' . $dbw->tableName( 'si_text_idx', 'raw' ) ) . ")" ); - $dbw->query( "CALL ctx_ddl.sync_index(" . + $dbw->query( "CALL ctx_ddl.sync_index(" . $dbw->addQuotes( $dbw->getDBname() . '.' . $dbw->tableName( 'si_title_idx', 'raw' ) ) . ")" ); } diff --git a/includes/templates/Usercreate.php b/includes/templates/Usercreate.php index 98727f1706..6e1094f6c0 100644 --- a/includes/templates/Usercreate.php +++ b/includes/templates/Usercreate.php @@ -40,7 +40,7 @@ class UsercreateTemplate extends QuickTemplate { 'helptext' => $helptext, ); } - + function execute() { if( $this->data['message'] ) { ?> @@ -187,9 +187,9 @@ class UsercreateTemplate extends QuickTemplate { if ( isset( $this->data['extraInput'] ) && is_array( $this->data['extraInput'] ) ) { foreach ( $this->data['extraInput'] as $inputItem ) { ?> -