r24302 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r24301‎ | r24302 | r24303 >
Date:03:42, 21 July 2007
Author:david
Status:old
Tags:
Comment:
Merged revisions 24276-24301 via svnmerge from
svn+ssh://david@svn.wikimedia.org/svnroot/mediawiki/trunk/phase3

........
r24277 | avar | 2007-07-19 17:05:45 -0700 (Thu, 19 Jul 2007) | 2 lines

Report the lines win32 newlines are found at
........
r24278 | avar | 2007-07-19 17:05:48 -0700 (Thu, 19 Jul 2007) | 2 lines

don't slurp the whole file, we only need to test line 1, this speeds things up immensely
........
r24279 | avar | 2007-07-19 17:15:12 -0700 (Thu, 19 Jul 2007) | 2 lines

this has been replaced by t/inc/Sanitizer.t
........
r24285 | brion | 2007-07-20 06:42:13 -0700 (Fri, 20 Jul 2007) | 3 lines

* Removed obsolete maintenance/changeuser.sql script; use RenameUser extension
........
r24286 | brion | 2007-07-20 08:15:09 -0700 (Fri, 20 Jul 2007) | 2 lines

pretty up the hook error message with an explanation of what it should do instead
........
r24293 | robchurch | 2007-07-20 17:44:35 -0700 (Fri, 20 Jul 2007) | 1 line

Remove green blob from the centre (was supposed to be part of the "scaled-down flower" concept, but just looks odd at this size)
........
r24294 | robchurch | 2007-07-20 18:00:42 -0700 (Fri, 20 Jul 2007) | 1 line

Introduce 'UserGetRights' hook; see docs/hooks.txt for more information
........
Modified paths:
  • /branches/liquidthreads (modified) (history)
  • /branches/liquidthreads/RELEASE-NOTES (modified) (history)
  • /branches/liquidthreads/docs/hooks.txt (modified) (history)
  • /branches/liquidthreads/includes/Hooks.php (modified) (history)
  • /branches/liquidthreads/includes/User.php (modified) (history)
  • /branches/liquidthreads/maintenance/changeuser.sql (deleted) (history)
  • /branches/liquidthreads/skins/common/images/spinner.gif (modified) (history)
  • /branches/liquidthreads/t/maint/bom.t (modified) (history)
  • /branches/liquidthreads/t/maint/unix-newlines.t (modified) (history)
  • /branches/liquidthreads/tests/SanitizerTest.php (deleted) (history)

Diff [purge]

Index: branches/liquidthreads/maintenance/changeuser.sql
@@ -1,12 +0,0 @@
2 -set @oldname = 'At18';
3 -set @newname = 'Alfio';
4 -
5 -update low_priority /*$wgDBprefix*/user set user_name=@newname where user_name=@oldname;
6 -update low_priority /*$wgDBprefix*/user_newtalk set user_ip=@newname where user_ip=@oldname;
7 -update low_priority /*$wgDBprefix*/cur set cur_user_text=@newname where cur_user_text=@oldname;
8 -update low_priority /*$wgDBprefix*/old set old_user_text=@newname where old_user_text=@oldname;
9 -update low_priority /*$wgDBprefix*/archive set ar_user_text=@newname where ar_user_text=@oldname;
10 -update low_priority /*$wgDBprefix*/ipblocks set ipb_address=@newname where ipb_address=@oldname;
11 -update low_priority /*$wgDBprefix*/oldimage set oi_user_text=@newname where oi_user_text=@oldname;
12 -update low_priority /*$wgDBprefix*/recentchanges set rc_user_text=@newname where rc_user_text=@oldname;
13 -
Index: branches/liquidthreads/skins/common/images/spinner.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: branches/liquidthreads/docs/hooks.txt
@@ -650,6 +650,10 @@
651651 $user: user that watched
652652 $article: article object that was watched
653653
 654+'UserGetRights': Called in User::getRights()
 655+$user: User to get rights for
 656+&$rights: Current rights
 657+
654658 'UserEffectiveGroups': Called in User::getEffectiveGroups()
655659 $user: User to get groups for
656660 &$groups: Current effective groups
Index: branches/liquidthreads/tests/SanitizerTest.php
@@ -1,49 +0,0 @@
2 -<?php
3 -
4 -class SanitizerTest extends PHPUnit_Framework_TestCase {
5 - function testDecodeNamed() {
6 - $this->assertEquals(
7 - "\xc3\xa9cole",
8 - Sanitizer::decodeCharReferences( '&eacute;cole' ) );
9 - }
10 -
11 - function testDecodeNumbered() {
12 - $this->assertEquals(
13 - "\xc4\x88io bonas dans l'\xc3\xa9cole!",
14 - Sanitizer::decodeCharReferences( "&#x108;io bonas dans l'&#233;cole!" ) );
15 - }
16 -
17 - function testDecodeMixed() {
18 - $this->assertEquals(
19 - "\xc4\x88io bonas dans l'\xc3\xa9cole!",
20 - Sanitizer::decodeCharReferences( "&#x108;io bonas dans l'&eacute;cole!" ) );
21 - }
22 -
23 - function testDecodeMixedComplex() {
24 - $this->assertEquals(
25 - "\xc4\x88io bonas dans l'\xc3\xa9cole! (mais pas &#x108;io dans l'&eacute;cole)",
26 - Sanitizer::decodeCharReferences( "&#x108;io bonas dans l'&eacute;cole! (mais pas &amp;#x108;io dans l'&#38;eacute;cole)" ) );
27 - }
28 -
29 - function testDecodeInvalidAmp() {
30 - $this->assertEquals(
31 - "a & b",
32 - Sanitizer::decodeCharReferences( "a & b" ) );
33 - }
34 -
35 - function testDecodeInvalidNamed() {
36 - $this->assertEquals(
37 - "&foo;",
38 - Sanitizer::decodeCharReferences( "&foo;" ) );
39 - }
40 -
41 - function testDecodeInvalidNumbered() {
42 - $this->assertEquals(
43 - UTF8_REPLACEMENT,
44 - Sanitizer::decodeCharReferences( "&#88888888888888;" ) );
45 - }
46 -
47 - /* TODO: many more! */
48 -}
49 -
50 -
Index: branches/liquidthreads/includes/User.php
@@ -1595,6 +1595,7 @@
15961596 function getRights() {
15971597 if ( is_null( $this->mRights ) ) {
15981598 $this->mRights = self::getGroupPermissions( $this->getEffectiveGroups() );
 1599+ wfRunHooks( 'UserGetRights', array( $this, &$this->mRights ) );
15991600 }
16001601 return $this->mRights;
16011602 }
Index: branches/liquidthreads/includes/Hooks.php
@@ -130,7 +130,9 @@
131131 } else {
132132 $prettyFunc = strval( $callback );
133133 }
134 - throw new MWException( "Invalid NULL return from broken hook $prettyFunc" );
 134+ throw new MWException( "Detected bug in an extension! " .
 135+ "Hook $prettyFunc failed to return a value; " .
 136+ "should return true to continue hook processing or false to abort." );
135137 } else if (!$retval) {
136138 return false;
137139 }
Index: branches/liquidthreads/t/maint/bom.t
@@ -14,14 +14,12 @@
1515 use Test::More;
1616
1717 use File::Find;
18 -use File::Slurp qw< slurp >;
1918
2019 # Files for wich we want to check the BOM char ( 0xFE 0XFF )
2120 my $ext = qr/(?:php|inc)/x ;
2221
2322 my $bomchar = qr/\xef\xbb\xbf/ ;
2423
25 -
2624 my @files;
2725
2826 find( sub{ push @files, $File::Find::name if -f && /\.$ext$/ }, '.' );
@@ -30,10 +28,11 @@
3129 plan tests => scalar @files ;
3230
3331 for my $file (@files) {
34 - my $content = slurp $file ;
35 - if( $content =~ /$bomchar/ ) {
36 - fail "$file got a Byte Order Mark";
 32+ open my $fh, "<", $file or die "Couln't open $file: $!";
 33+ my $line = <$fh>;
 34+ if( $line =~ /$bomchar/ ) {
 35+ fail "$file has a Byte Order Mark at line $.";
3736 } else {
38 - pass "$file BOM less";
 37+ pass "$file has no Byte Order Mark!";
3938 }
4039 }
Index: branches/liquidthreads/t/maint/unix-newlines.t
@@ -5,23 +5,28 @@
66 use Test::More;;
77
88 use File::Find;
9 -use File::Slurp qw< slurp >;
10 -use Socket qw< $CRLF $LF >;
 9+use Socket '$CRLF';
1110
1211 my $ext = qr/(?: t | pm | sql | js | php | inc | xml )/x;
1312
1413 my @files;
1514 find( sub { push @files, $File::Find::name if -f && /\. $ext $/x }, '.' );
1615
17 -plan tests => scalar @files;
 16+plan 'no_plan';
1817
1918 for my $file (@files) {
20 - my $cont = slurp $file;
21 - if ( $cont and $cont =~ $CRLF ) {
22 - pass "$file contains windows newlines";
23 - } else {
24 - fail "$file is made of unix newlines and win";
25 - }
 19+ open my $fh, "<", $file or die "Can't open $file: $!";
 20+ binmode $fh;
 21+
 22+ my $ok = 1;
 23+ while (<$fh>) {
 24+ if (/$CRLF/) {
 25+ fail "$file has \\r\\n on line $.";
 26+ $ok = 0;
 27+ }
 28+ }
 29+
 30+ pass "$file has only unix newlines" if $ok;
2631 }
2732
2833
Index: branches/liquidthreads/RELEASE-NOTES
@@ -151,6 +151,7 @@
152152 inline, as in most browsers
153153 * Pass the user as an argument to 'isValidPassword' hook callbacks; see
154154 docs/hooks.txt for more information
 155+* Introduce 'UserGetRights' hook; see docs/hooks.txt for more information
155156
156157 == Bugfixes since 1.10 ==
157158
@@ -316,6 +317,7 @@
317318 * (bug 10591) Use Arabic numerals (0,1,2...) for the Malayam language
318319 * (bug 10642) Fix shift-click checkbox behavior for Opera 9.0+ and 6.0
319320 * Work around Safari bug with pages ending in ".gz" or ".tgz"
 321+* Removed obsolete maintenance/changeuser.sql script; use RenameUser extension
320322
321323
322324 == API changes since 1.10 ==
Property changes on: branches/liquidthreads
___________________________________________________________________
Name: svnmerge-integrated
323325 - /trunk/phase3:1-24275
324326 + /trunk/phase3:1-24301

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r24277Report the lines win32 newlines are found atavar00:05, 20 July 2007
r24278don't slurp the whole file, we only need to test line 1, this speeds things u...avar00:05, 20 July 2007
r24279this has been replaced by t/inc/Sanitizer.tavar00:15, 20 July 2007
r24285* Removed obsolete maintenance/changeuser.sql script; use RenameUser extensionbrion13:42, 20 July 2007
r24286pretty up the hook error message with an explanation of what it should do ins...brion15:15, 20 July 2007
r24293Remove green blob from the centre (was supposed to be part of the "scaled-dow...robchurch00:44, 21 July 2007
r24294Introduce 'UserGetRights' hook; see docs/hooks.txt for more informationrobchurch01:00, 21 July 2007

Status & tagging log