From 2320f5cfe2e2c10fcd0d1b59c2fc1edaa101752a Mon Sep 17 00:00:00 2001 From: umherirrender Date: Wed, 14 Oct 2015 09:40:50 +0200 Subject: [PATCH] Change some line comments to multi line comments This allows empty lines inside the comment as found by the MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.EmptyComment sniff Change-Id: Iac155bbda4a84562db2b452baeae9b8973899453 --- includes/Collation.php | 83 ++++++++++++----------- includes/GlobalFunctions.php | 41 +++++------ includes/OutputPage.php | 25 +++---- maintenance/namespaceDupes.php | 49 ++++++------- maintenance/storage/recompressTracked.php | 15 ++-- opensearch_desc.php | 21 +++--- 6 files changed, 121 insertions(+), 113 deletions(-) diff --git a/includes/Collation.php b/includes/Collation.php index c1f0b3881a..40e8627187 100644 --- a/includes/Collation.php +++ b/includes/Collation.php @@ -406,14 +406,15 @@ class IcuCollation extends Collation { } } - // Sort the letters. - // - // It's impossible to have the precompiled data file properly sorted, - // because the sort order changes depending on ICU version. If the - // array is not properly sorted, the binary search will return random - // results. - // - // We also take this opportunity to remove primary collisions. + /* Sort the letters. + * + * It's impossible to have the precompiled data file properly sorted, + * because the sort order changes depending on ICU version. If the + * array is not properly sorted, the binary search will return random + * results. + * + * We also take this opportunity to remove primary collisions. + */ $letterMap = array(); foreach ( $letters as $letter ) { $key = $this->getPrimarySortKey( $letter ); @@ -428,38 +429,40 @@ class IcuCollation extends Collation { } } ksort( $letterMap, SORT_STRING ); - // Remove duplicate prefixes. Basically if something has a sortkey - // which is a prefix of some other sortkey, then it is an - // expansion and probably should not be considered a section - // header. - // - // For example 'þ' is sometimes sorted as if it is the letters - // 'th'. Other times it is its own primary element. Another - // example is '₨'. Sometimes its a currency symbol. Sometimes it - // is an 'R' followed by an 's'. - // - // Additionally an expanded element should always sort directly - // after its first element due to they way sortkeys work. - // - // UCA sortkey elements are of variable length but no collation - // element should be a prefix of some other element, so I think - // this is safe. See: - // * https://ssl.icu-project.org/repos/icu/icuhtml/trunk/design/collation/ICU_collation_design.htm - // * http://site.icu-project.org/design/collation/uca-weight-allocation - // - // Additionally, there is something called primary compression to - // worry about. Basically, if you have two primary elements that - // are more than one byte and both start with the same byte then - // the first byte is dropped on the second primary. Additionally - // either \x03 or \xFF may be added to mean that the next primary - // does not start with the first byte of the first primary. - // - // This shouldn't matter much, as the first primary is not - // changed, and that is what we are comparing against. - // - // tl;dr: This makes some assumptions about how icu implements - // collations. It seems incredibly unlikely these assumptions - // will change, but nonetheless they are assumptions. + + /* Remove duplicate prefixes. Basically if something has a sortkey + * which is a prefix of some other sortkey, then it is an + * expansion and probably should not be considered a section + * header. + * + * For example 'þ' is sometimes sorted as if it is the letters + * 'th'. Other times it is its own primary element. Another + * example is '₨'. Sometimes its a currency symbol. Sometimes it + * is an 'R' followed by an 's'. + * + * Additionally an expanded element should always sort directly + * after its first element due to they way sortkeys work. + * + * UCA sortkey elements are of variable length but no collation + * element should be a prefix of some other element, so I think + * this is safe. See: + * - https://ssl.icu-project.org/repos/icu/icuhtml/trunk/design/collation/ICU_collation_design.htm + * - http://site.icu-project.org/design/collation/uca-weight-allocation + * + * Additionally, there is something called primary compression to + * worry about. Basically, if you have two primary elements that + * are more than one byte and both start with the same byte then + * the first byte is dropped on the second primary. Additionally + * either \x03 or \xFF may be added to mean that the next primary + * does not start with the first byte of the first primary. + * + * This shouldn't matter much, as the first primary is not + * changed, and that is what we are comparing against. + * + * tl;dr: This makes some assumptions about how icu implements + * collations. It seems incredibly unlikely these assumptions + * will change, but nonetheless they are assumptions. + */ $prev = false; $duplicatePrefixes = array(); diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 243df92827..14327dc848 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -2856,16 +2856,17 @@ function wfShellExec( $cmd, &$retval = null, $environ = array(), $status = false; $logMsg = false; - // According to the documentation, it is possible for stream_select() - // to fail due to EINTR. I haven't managed to induce this in testing - // despite sending various signals. If it did happen, the error - // message would take the form: - // - // stream_select(): unable to select [4]: Interrupted system call (max_fd=5) - // - // where [4] is the value of the macro EINTR and "Interrupted system - // call" is string which according to the Linux manual is "possibly" - // localised according to LC_MESSAGES. + /* According to the documentation, it is possible for stream_select() + * to fail due to EINTR. I haven't managed to induce this in testing + * despite sending various signals. If it did happen, the error + * message would take the form: + * + * stream_select(): unable to select [4]: Interrupted system call (max_fd=5) + * + * where [4] is the value of the macro EINTR and "Interrupted system + * call" is string which according to the Linux manual is "possibly" + * localised according to LC_MESSAGES. + */ $eintr = defined( 'SOCKET_EINTR' ) ? SOCKET_EINTR : 4; $eintrMessage = "stream_select(): unable to select [$eintr]"; @@ -3737,16 +3738,16 @@ function wfScript( $script = 'index' ) { */ function wfGetScriptUrl() { if ( isset( $_SERVER['SCRIPT_NAME'] ) ) { - # - # as it was called, minus the query string. - # - # Some sites use Apache rewrite rules to handle subdomains, - # and have PHP set up in a weird way that causes PHP_SELF - # to contain the rewritten URL instead of the one that the - # outside world sees. - # - # If in this mode, use SCRIPT_URL instead, which mod_rewrite - # provides containing the "before" URL. + /* as it was called, minus the query string. + * + * Some sites use Apache rewrite rules to handle subdomains, + * and have PHP set up in a weird way that causes PHP_SELF + * to contain the rewritten URL instead of the one that the + * outside world sees. + * + * If in this mode, use SCRIPT_URL instead, which mod_rewrite + * provides containing the "before" URL. + */ return $_SERVER['SCRIPT_NAME']; } else { return $_SERVER['URL']; diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 4f99f34a3d..d29ec54d4b 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -3856,18 +3856,19 @@ class OutputPage extends ContextSource { if ( $media == $targetMedia ) { $media = ''; } elseif ( preg_match( $screenMediaQueryRegex, $media ) === 1 ) { - // This regex will not attempt to understand a comma-separated media_query_list - // - // Example supported values for $media: - // 'screen', 'only screen', 'screen and (min-width: 982px)' ), - // Example NOT supported value for $media: - // '3d-glasses, screen, print and resolution > 90dpi' - // - // If it's a print request, we never want any kind of screen stylesheets - // If it's a handheld request (currently the only other choice with a switch), - // we don't want simple 'screen' but we might want screen queries that - // have a max-width or something, so we'll pass all others on and let the - // client do the query. + /* This regex will not attempt to understand a comma-separated media_query_list + * + * Example supported values for $media: + * 'screen', 'only screen', 'screen and (min-width: 982px)' ), + * Example NOT supported value for $media: + * '3d-glasses, screen, print and resolution > 90dpi' + * + * If it's a print request, we never want any kind of screen stylesheets + * If it's a handheld request (currently the only other choice with a switch), + * we don't want simple 'screen' but we might want screen queries that + * have a max-width or something, so we'll pass all others on and let the + * client do the query. + */ if ( $targetMedia == 'print' || $media == 'screen' ) { return null; } diff --git a/maintenance/namespaceDupes.php b/maintenance/namespaceDupes.php index 088f6776cb..184cba8d13 100644 --- a/maintenance/namespaceDupes.php +++ b/maintenance/namespaceDupes.php @@ -179,22 +179,22 @@ class NamespaceConflictChecker extends Maintenance { foreach ( $spaces as $name => $ns ) { if ( $ns != 0 ) { - // Fix up link destinations for non-interwiki links only. - // - // For example if a page has [[Foo:Bar]] and then a Foo namespace - // is introduced, pagelinks needs to be updated to have - // page_namespace = NS_FOO. - // - // If instead an interwiki prefix was introduced called "Foo", - // the link should instead be moved to the iwlinks table. If a new - // language is introduced called "Foo", or if there is a pagelink - // [[fr:Bar]] when interlanguage magic links are turned on, the - // link would have to be moved to the langlinks table. Let's put - // those cases in the too-hard basket for now. The consequences are - // not especially severe. - // - // @fixme Handle interwiki links, and pagelinks to Category:, File: - // which probably need reparsing. + /* Fix up link destinations for non-interwiki links only. + * + * For example if a page has [[Foo:Bar]] and then a Foo namespace + * is introduced, pagelinks needs to be updated to have + * page_namespace = NS_FOO. + * + * If instead an interwiki prefix was introduced called "Foo", + * the link should instead be moved to the iwlinks table. If a new + * language is introduced called "Foo", or if there is a pagelink + * [[fr:Bar]] when interlanguage magic links are turned on, the + * link would have to be moved to the langlinks table. Let's put + * those cases in the too-hard basket for now. The consequences are + * not especially severe. + * @fixme Handle interwiki links, and pagelinks to Category:, File: + * which probably need reparsing. + */ $this->checkLinkTable( 'pagelinks', 'pl', $ns, $name, $options ); $this->checkLinkTable( 'templatelinks', 'tl', $ns, $name, $options ); @@ -592,14 +592,15 @@ class NamespaceConflictChecker extends Maintenance { $this->db->delete( 'page', array( 'page_id' => $id ), __METHOD__ ); - // Call LinksDeletionUpdate to delete outgoing links from the old title, - // and update category counts. - // - // Calling external code with a fake broken Title is a fairly dubious - // idea. It's necessary because it's quite a lot of code to duplicate, - // but that also makes it fragile since it would be easy for someone to - // accidentally introduce an assumption of title validity to the code we - // are calling. + /* Call LinksDeletionUpdate to delete outgoing links from the old title, + * and update category counts. + * + * Calling external code with a fake broken Title is a fairly dubious + * idea. It's necessary because it's quite a lot of code to duplicate, + * but that also makes it fragile since it would be easy for someone to + * accidentally introduce an assumption of title validity to the code we + * are calling. + */ $update = new LinksDeletionUpdate( $wikiPage ); $update->doUpdate(); $this->db->commit( __METHOD__ ); diff --git a/maintenance/storage/recompressTracked.php b/maintenance/storage/recompressTracked.php index 120ccb6cb6..f7907addbf 100644 --- a/maintenance/storage/recompressTracked.php +++ b/maintenance/storage/recompressTracked.php @@ -757,13 +757,14 @@ class CgzCopyTransaction { return; } - // Check to see if the target text_ids have been moved already. - // - // We originally read from the slave, so this can happen when a single - // text_id is shared between multiple pages. It's rare, but possible - // if a delete/move/undelete cycle splits up a null edit. - // - // We do a locking read to prevent closer-run race conditions. + /* Check to see if the target text_ids have been moved already. + * + * We originally read from the slave, so this can happen when a single + * text_id is shared between multiple pages. It's rare, but possible + * if a delete/move/undelete cycle splits up a null edit. + * + * We do a locking read to prevent closer-run race conditions. + */ $dbw = wfGetDB( DB_MASTER ); $dbw->begin( __METHOD__ ); $res = $dbw->select( 'blob_tracking', diff --git a/opensearch_desc.php b/opensearch_desc.php index 0b5697270a..0d6a76c8e7 100644 --- a/opensearch_desc.php +++ b/opensearch_desc.php @@ -44,16 +44,17 @@ print Xml::openElement( 'OpenSearchDescription', 'xmlns' => 'http://a9.com/-/spec/opensearch/1.1/', 'xmlns:moz' => 'http://www.mozilla.org/2006/browser/search/' ) ); -// The spec says the ShortName must be no longer than 16 characters, -// but 16 is *realllly* short. In practice, browsers don't appear to care -// when we give them a longer string, so we're no longer attempting to trim. -// -// Note: ShortName and the need to match; they are used as -// a key for identifying if the search engine has been added already, *and* -// as the display name presented to the end-user. -// -// Behavior seems about the same between Firefox and IE 7/8 here. -// 'Description' doesn't appear to be used by either. +/* The spec says the ShortName must be no longer than 16 characters, + * but 16 is *realllly* short. In practice, browsers don't appear to care + * when we give them a longer string, so we're no longer attempting to trim. + * + * Note: ShortName and the need to match; they are used as + * a key for identifying if the search engine has been added already, *and* + * as the display name presented to the end-user. + * + * Behavior seems about the same between Firefox and IE 7/8 here. + * 'Description' doesn't appear to be used by either. + */ $fullName = wfMessage( 'opensearch-desc' )->inContentLanguage()->text(); print Xml::element( 'ShortName', null, $fullName ); print Xml::element( 'Description', null, $fullName ); -- 2.20.1