Jack Phoenix | 8 Feb 21:58

Skin system rewrite

Hi all,

MediaWiki's skin system has been quite a mess for some while. I decided to
try rewriting it and you can see the end result on [1]. It's quite a big
patch, which is why I want to encourage all developers to test it and report
(or maybe even fix? :) any and all issues they stumble across. There is also
an example extension on [1] which I've been wanting to do for a long time
but which hasn't been possible with the old skin system. To be exact, it was
partially possible, as I noted on the MediaWiki.org page, but the
implementation was too buggy to be put live on any site IMHO.

What does this patch change exactly? When writing a new skin, you no longer
need to override SkinTemplate and write a class that utilises QuickTemplate,
you can just extend Skin class directly. Old SkinTemplate-based skins will
however continue functioning. I wrote a couple things about writing a new
skin with this new system on MediaWiki.org[2], feel free to check it out.

There are some changes which may cause problems, though. For example,
SkinTemplateToolboxEnd and MonoBookTemplateToolboxEnd hooks both take two
arguments instead of one and the hooks are in Skin.php instead of
SkinTemplate.php. I was also thinking that this could be a great opportunity
to add some new hooks to Skin.php, besides the SkinAfterSidebar hook. See
[3] for my thoughts about what could be improved.

I haven't ported Vector skin to use this new system because it's currently
under development. Because this change is quite a big one, I thought that
I'll commit it to SVN once MediaWiki 1.16 has been released so that it'll
make into the 1.17 release.

What are your thoughts and suggestions for this new skinning system?

[1] http://www.mediawiki.org/wiki/User:Jack_Phoenix/SkinSystemRewrite
[2]
http://www.mediawiki.org/wiki/User:Jack_Phoenix/SkinSystemRewrite/Documentation
[3]
http://www.mediawiki.org/wiki/User:Jack_Phoenix/SkinSystemRewrite/Notes_and_to-do

Thanks and regards,
--
Jack Phoenix
MediaWiki developer
Stefano Ronzoni | 8 Feb 16:58
Picon
Favicon

Wikitech-l] remove me from this mailing list, please!

REMOVE ME FOR MTHIS MAILING LIST!!!!!!!!!!!!!!!!!!!!!

-----Original Message-----
From: "Eric Sun" [esun <at> cs.stanford.edu]
Date: 02/08/2010 12:45 AM
To: "Wikimedia developers" <wikitech-l <at> lists.wikimedia.org>
Subject: Re: [Wikitech-l] importing enwiki into local database

Note: Original message sent as attachment

------------------------------------------------------------
Click here to find experienced pros to help with your home improvement project.
Home Improvement Projects
http://tagline.excite.com/c?cp=Vi6LBh3bdR9Wm_9yHAGY8gAAKZTVS3uidXGi8As47ZJzuXTyAAYAAAAAAAAAAAAAAAAAAADNAAAAAAAAAAAAAAAAAAAShH0Ys_c=
_______________________________________________
Wikitech-l mailing list
Wikitech-l <at> lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Mike.lifeguard | 8 Feb 16:48
Picon
Gravatar

empty .sql.gz dump files


Hello,

While trying to get externallinks.sql.gz for enwiki, I found that the
file was empty. Looking at the hashes, I guess several of these metadata
dumps have failed (but marked as successful, of course):

http://download.wikimedia.org/enwiki/20100130/enwiki-20100130-md5sums.txt

e32d799e86f8d2be5ebb3eed048238c7 is the md5 for these 20-byte files.

Older stuff seems ok (enwiki-20100116-externallinks.sql.gz) - as does
data for other wikis (enwikibooks-20100206-externallinks.sql.gz).

-Mike
Picon
Gravatar

New phpunit tests eat ~1GB of memory

Since the tests were ported from t/ to phpunit's
phase3/maintenance/tests/ in r61938 and other commits running the
tests on my machine takes up to 1GB of memory and grows as it runs
more tests. It seems that phpunit uses the same instance of the php
interpreter for running all the tests.

Is there some way around this? Perhaps phpunit.xml could be tweaked so
that it runs a new php for each test?

Furthermore when I run `make test' I get this:

    Time: 03:35, Memory: 1849.25Mb

    There were 2 failures:

    1) LanguageConverterTest::testGetPreferredVariantUserOption
    Failed asserting that two strings are equal.
    --- Expected
    +++ Actual
    @@ @@
    -tg-latn
    +tg

    /home/avar/src/mw/trunk/phase3/maintenance/tests/LanguageConverterTest.php:82

    2) Warning
    No tests found in class "ParserUnitTest".

    FAILURES!
    Tests: 686, Assertions: 3431, Failures: 2, Incomplete: 34

But when I run phpunit manually on the test then all tests pass:

    $ phpunit LanguageConverterTest.php
    PHPUnit 3.4.5 by Sebastian Bergmann.

    .........

    Time: 23 seconds, Memory: 23.75Mb

    OK (9 tests, 34 assertions)

Also after I get "Tests: 686, Assertions: 3431, Failures: 2,
Incomplete: 34" in the first output phpunit doesn't exit and continues
hugging my memory. Why is it still running? It has already run all the
tests.

On Wed, Feb 3, 2010 at 17:35,  <ialex <at> svn.wikimedia.org> wrote:
> http://www.mediawiki.org/wiki/Special:Code/MediaWiki/61938
>
> Revision: 61938
> Author:   ialex
> Date:     2010-02-03 17:35:59 +0000 (Wed, 03 Feb 2010)
>
> Log Message:
> -----------
> * Port tests from t/inc/
> * Added new tests to XmlTest
>
> Added Paths:
> -----------
>    trunk/phase3/tests/LicensesTest.php
>    trunk/phase3/tests/SanitizerTest.php
>    trunk/phase3/tests/TimeAdjustTest.php
>    trunk/phase3/tests/TitleTest.php
>    trunk/phase3/tests/XmlTest.php
>
> Added: trunk/phase3/tests/LicensesTest.php
> ===================================================================
> --- trunk/phase3/tests/LicensesTest.php                         (rev 0)
> +++ trunk/phase3/tests/LicensesTest.php 2010-02-03 17:35:59 UTC (rev 61938)
> @@ -0,0 +1,17 @@
> +<?php
> +
> +/**
> + * @group Broken
> + */
> +class LicensesTest extends PHPUnit_Framework_TestCase {
> +
> +       function testLicenses() {
> +               $str = "
> +* Free licenses:
> +** GFLD|Debian disagrees
> +";
> +
> +               $lc = new Licenses( $str );
> +               $this->assertTrue( is_a( $lc, 'Licenses' ), 'Correct class' );
> +       }
> +}
> \ No newline at end of file
>
>
> Property changes on: trunk/phase3/tests/LicensesTest.php
> ___________________________________________________________________
> Added: svn:eol-style
>   + native
>
> Added: trunk/phase3/tests/SanitizerTest.php
> ===================================================================
> --- trunk/phase3/tests/SanitizerTest.php                                (rev 0)
> +++ trunk/phase3/tests/SanitizerTest.php        2010-02-03 17:35:59 UTC (rev 61938)
> @@ -0,0 +1,71 @@
> +<?php
> +
> +global $IP;
> +require_once( "$IP/includes/Sanitizer.php" );
> +
> +class SanitizerTest extends PHPUnit_Framework_TestCase {
> +
> +       function testDecodeNamedEntities() {
> +               $this->assertEquals(
> +                       "\xc3\xa9cole",
> +                       Sanitizer::decodeCharReferences( '&eacute;cole' ),
> +                       'decode named entities'
> +               );
> +       }
> +
> +       function testDecodeNumericEntities() {
> +               $this->assertEquals(
> +                       "\xc4\x88io bonas dans l'\xc3\xa9cole!",
> +                       Sanitizer::decodeCharReferences( "&#x108;io bonas dans l'&#233;cole!" ),
> +                       'decode numeric entities'
> +               );
> +       }
> +
> +       function testDecodeMixedEntities() {
> +               $this->assertEquals(
> +                       "\xc4\x88io bonas dans l'\xc3\xa9cole!",
> +                       Sanitizer::decodeCharReferences( "&#x108;io bonas dans
l'&eacute;cole!" ),
> +                       'decode mixed numeric/named entities'
> +               );
> +       }
> +
> +       function testDecodeMixedComplexEntities() {
> +               $this->assertEquals(
> +                       "\xc4\x88io bonas dans l'\xc3\xa9cole! (mais pas &#x108;io dans l'&eacute;cole)",
> +                       Sanitizer::decodeCharReferences(
> +                               "&#x108;io bonas dans l'&eacute;cole! (mais pas &amp;#x108;io
dans l'&#38;eacute;cole)"
> +                       ),
> +                       'decode mixed complex entities'
> +               );
> +       }
> +
> +       function testInvalidAmpersand() {
> +               $this->assertEquals(
> +                       'a & b',
> +                       Sanitizer::decodeCharReferences( 'a & b' ),
> +                       'Invalid ampersand'
> +               );
> +       }
> +
> +       function testInvalidEntities() {
> +               $this->assertEquals(
> +                       '&foo;',
> +                       Sanitizer::decodeCharReferences( '&foo;' ),
> +                       'Invalid named entity'
> +               );
> +       }
> +
> +       function testInvalidNumberedEntities() {
> +               $this->assertEquals( UTF8_REPLACEMENT, Sanitizer::decodeCharReferences(
"&#88888888888888;" ), 'Invalid numbered entity' );
> +       }
> +
> +       function testSelfClosingTag() {
> +               $GLOBALS['wgUseTidy'] = false;
> +               $this->assertEquals(
> +                       '<div>Hello world</div>',
> +                       Sanitizer::removeHTMLtags( '<div>Hello world</div />' ),
> +                       'Self-closing closing div'
> +               );
> +       }
> +}
> +
>
>
> Property changes on: trunk/phase3/tests/SanitizerTest.php
> ___________________________________________________________________
> Added: svn:eol-style
>   + native
>
> Added: trunk/phase3/tests/TimeAdjustTest.php
> ===================================================================
> --- trunk/phase3/tests/TimeAdjustTest.php                               (rev 0)
> +++ trunk/phase3/tests/TimeAdjustTest.php       2010-02-03 17:35:59 UTC (rev 61938)
> @@ -0,0 +1,40 @@
> +<?php
> +
> +class TimeAdjustTest extends PHPUnit_Framework_TestCase {
> +
> +       public function setUp() {
> +               $this->iniSet( 'precision', 15 );
> +       }
> +
> +       # Test offset usage for a given language::userAdjust
> +       function testUserAdjust() {
> +               global $wgLocalTZoffset, $wgContLang, $wgUser;
> +
> +               $wgContLang = $en = Language::factory( 'en' );
> +
> +               # Collection of parameters for Language_t_Offset.
> +               # Format: date to be formatted, localTZoffset value, expected date
> +               $userAdjust_tests = array(
> +                       array( 20061231235959,   0, 20061231235959 ),
> +                       array( 20061231235959,   5, 20070101000459 ),
> +                       array( 20061231235959,  15, 20070101001459 ),
> +                       array( 20061231235959,  60, 20070101005959 ),
> +                       array( 20061231235959,  90, 20070101012959 ),
> +                       array( 20061231235959, 120, 20070101015959 ),
> +                       array( 20061231235959, 540, 20070101085959 ),
> +                       array( 20061231235959,  -5, 20061231235459 ),
> +                       array( 20061231235959, -30, 20061231232959 ),
> +                       array( 20061231235959, -60, 20061231225959 ),
> +               );
> +
> +               foreach( $userAdjust_tests as $data ) {
> +                       $wgLocalTZoffset = $data[1];
> +
> +                       $this->assertEquals(
> +                               strval( $data[2] ),
> +                               strval( $en->userAdjust( $data[0], '' ) ),
> +                               "User adjust {$data[0]} by {$data[1]} minutes should give {$data[2]}"
> +                       );
> +               }
> +       }
> +}
>
>
> Property changes on: trunk/phase3/tests/TimeAdjustTest.php
> ___________________________________________________________________
> Added: svn:eol-style
>   + native
>
> Added: trunk/phase3/tests/TitleTest.php
> ===================================================================
> --- trunk/phase3/tests/TitleTest.php                            (rev 0)
> +++ trunk/phase3/tests/TitleTest.php    2010-02-03 17:35:59 UTC (rev 61938)
> @@ -0,0 +1,17 @@
> +<?php
> +
> +class TitleTest extends PHPUnit_Framework_TestCase {
> +
> +       function testLegalChars() {
> +               $titlechars = Title::legalChars();
> +
> +               foreach ( range( 1, 255 ) as $num ) {
> +                       $chr = chr( $num );
> +                       if ( strpos( "#[]{}<>|", $chr ) !== false || preg_match(
"/[\\x00-\\x1f\\x7f]/", $chr ) ) {
> +                               $this->assertFalse( (bool)preg_match( "/[$titlechars]/", $chr
), "chr($num) = $chr is not a valid titlechar" );
> +                       } else {
> +                               $this->assertTrue( (bool)preg_match( "/[$titlechars]/", $chr
), "chr($num) = $chr is a valid titlechar" );
> +                       }
> +               }
> +       }
> +}
>
>
> Property changes on: trunk/phase3/tests/TitleTest.php
> ___________________________________________________________________
> Added: svn:eol-style
>   + native
>
> Added: trunk/phase3/tests/XmlTest.php
> ===================================================================
> --- trunk/phase3/tests/XmlTest.php                              (rev 0)
> +++ trunk/phase3/tests/XmlTest.php      2010-02-03 17:35:59 UTC (rev 61938)
> @@ -0,0 +1,115 @@
> +<?php
> +
> +class XmlTest extends PHPUnit_Framework_TestCase {
> +
> +       function testElementOpen() {
> +               $this->assertEquals(
> +                       '<element>',
> +                       Xml::element( 'element', null, null ),
> +                       'Opening element with no attributes'
> +               );
> +       }
> +
> +       function testElementEmpty() {
> +               $this->assertEquals(
> +                       '<element />',
> +                       Xml::element( 'element', null, '' ),
> +                       'Terminated empty element'
> +               );
> +       }
> +
> +       function testElementEscaping() {
> +               $this->assertEquals(
> +                       '<element>hello &lt;there&gt; you &amp; you</element>',
> +                       Xml::element( 'element', null, 'hello <there> you & you' ),
> +                       'Element with no attributes and content that needs escaping'
> +               );
> +       }
> +
> +       function testElementAttributes() {
> +               $this->assertEquals(
> +                       '<element key="value" <>="&lt;&gt;">',
> +                       Xml::element( 'element', array( 'key' => 'value', '<>' => '<>' ), null ),
> +                       'Element attributes, keys are not escaped'
> +               );
> +       }
> +
> +       function testOpenElement() {
> +               $this->assertEquals(
> +                       '<element k="v">',
> +                       Xml::openElement( 'element', array( 'k' => 'v' ) ),
> +                       'openElement() shortcut'
> +               );
> +       }
> +
> +       function testCloseElement() {
> +               $this->assertEquals( '</element>', Xml::closeElement( 'element' ),
'closeElement() shortcut' );
> +       }
> +
> +       #
> +       # textarea
> +       #
> +       function testTextareaNoContent() {
> +               $this->assertEquals(
> +                       '<textarea name="name" id="name" cols="40" rows="5"></textarea>',
> +                       Xml::textarea( 'name', '' ),
> +                       'textarea() with not content'
> +               );
> +       }
> +
> +       function testTextareaAttribs() {
> +               $this->assertEquals(
> +                       '<textarea name="name" id="name" cols="20" rows="10">&lt;txt&gt;</textarea>',
> +                       Xml::textarea( 'name', '<txt>', 20, 10 ),
> +                       'textarea() with custom attribs'
> +               );
> +       }
> +
> +       #
> +       # JS
> +       #
> +       function testEscapeJsStringSpecialChars() {
> +               $this->assertEquals(
> +                       '\\\\\r\n',
> +                       Xml::escapeJsString( "\\\r\n" ),
> +                       'escapeJsString() with special characters'
> +               );
> +       }
> +
> +       function testEncodeJsVarBoolean() {
> +               $this->assertEquals(
> +                       'true',
> +                       Xml::encodeJsVar( true ),
> +                       'encodeJsVar() with boolean'
> +               );
> +       }
> +
> +       function testEncodeJsVarNull() {
> +               $this->assertEquals(
> +                       'null',
> +                       Xml::encodeJsVar( null ),
> +                       'encodeJsVar() with null'
> +               );
> +       }
> +
> +       function testEncodeJsVarArray() {
> +               $this->assertEquals(
> +                       '["a", 1]',
> +                       Xml::encodeJsVar( array( 'a', 1 ) ),
> +                       'encodeJsVar() with array'
> +               );
> +               $this->assertEquals(
> +                       '{"a": "a", "b": 1}',
> +                       Xml::encodeJsVar( array( 'a' => 'a', 'b' => 1 ) ),
> +                       'encodeJsVar() with associative array'
> +               );
> +       }
> +
> +       function testEncodeJsVarObject() {
> +               $this->assertEquals(
> +                       '{"a": "a", "b": 1}',
> +                       Xml::encodeJsVar( (object)array( 'a' => 'a', 'b' => 1 ) ),
> +                       'encodeJsVar() with object'
> +               );
> +       }
> +}
>
>
> Property changes on: trunk/phase3/tests/XmlTest.php
> ___________________________________________________________________
> Added: svn:eol-style
>   + native
>
>
>
> _______________________________________________
> MediaWiki-CVS mailing list
> MediaWiki-CVS <at> lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
>
_______________________________________________
Wikitech-l mailing list
Wikitech-l <at> lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
David Gerard | 5 Feb 21:39
Picon
Gravatar

Theora video in IE? Use Silverlight!

This is clever-ish:

http://www.atoker.com/blog/2010/02/04/html5-theora-video-codec-for-silverlight/

He says there that this will Just Work on ~40% of Windows boxes. Not bad.

- d.
Eric Sun | 5 Feb 03:12
Picon

importing enwiki into local database

Hi,

I saw this thread back in October where someone was having trouble
importing the English Wikipedia XML dump:
http://lists.wikimedia.org/pipermail/wikitech-l/2009-October/045594.html
The thread back in October seemed to end without resolution, and the
tools still seem to be broken, so has anyone found a solution in the
meantime?

I'm using mediawiki-1.15.1 and attempting to import
enwiki-20100130-pages-articles.xml.bz2.

None of these options seem to work:
1) importDump.php
fails by spewing "Warning: xml_parse(): Unable to call handler in_()
in ./includes/Import.php on line 437" repeatedly

2) xml2sql (http://meta.wikimedia.org/wiki/Xml2sql):
Fails with error:
xml2sql: parsing aborted at line 33 pos 16.
due to the new <redirect> tag introduced in the new dumps?

3) mwdumper (http://www.mediawiki.org/wiki/MWDumper):
Current XML is schema v0.4, but the documentation says that it's for 0.3

4) mwimport (http://meta.wikimedia.org/wiki/Data_dumps/mwimport):
Fails immediately:
siteinfo: untested generator 'MediaWiki 1.16alpha-wmf', expect trouble ahead
page: expected closing tag in line 35

Any tips?
Thanks!
Eric
Max Semenik | 4 Feb 21:42
Picon

Version control

Since there are some talks about migration from SVN anyway[1], I
decided to unshelf my essay on this matter.[2] It discusses possible
alternatives to Subversion and is in no way complete, everyone is
invited to participate in drafting and discussing. Some sections need
input of those who have practical experience with those systems, as
for example I've never used Bazaar.

------
[1] http://www.mediawiki.org/w/index.php?curid=44222&diff=301482&oldid=301369
[2] http://www.mediawiki.org/wiki/Source_control_considerations

--

-- 
  Max Semenik ([[User:MaxSem]])
Rayson Ho | 4 Feb 04:10
Picon

Flattening a wikimedia category

Seems like it is no easy way to display all the media files under a
wikimedia category -- for example if someone wants a picture of a
library, he or she will need to go into each sub-category under
"Libraries":

http://commons.wikimedia.org/wiki/Category:Libraries

While Wikimedia is not yet the most popular stock photo source, IMO
having this flattening functionality would be useful to those who are
looking for stock photos.

Rayson
Nimish Gautam | 3 Feb 22:17
Picon
Favicon

Chrome frame support?

Hey all,

I really want to turn on Google chrome frame support for the mediawiki 
projects:

http://code.google.com/chrome/chromeframe/

Basically, it would just involve us putting in a meta tag on our pages 
that would trigger an IE plugin Google wrote, assuming the IE user had 
that plugin installed. The plugin essentially causes IE to use google's 
HTML renderer and JS engine, which are much nicer to develop for than 
IE. This won't really solve IE development issues, but would be a good 
move in the right direction as far as I'm concerned.

Any thoughts or compelling reasons why this might not be a good thing to do?

-Nimish
Stefano Ronzoni | 3 Feb 17:34
Picon
Favicon

remove me from your mailing list

Remove me from your mailing list! 

Right here right now!

It's 2 months I asked for that!

------------------------------------------------------------
Best Weight Loss Program - Click Here!
Weight Loss Program
http://tagline.excite.com/c?cp=SRruNMfZB97_s2ppl-MuGAAAKZTVS3uidXGi8As47ZJzuXTyAAYAAAAAAAAAAAAAAAAAAADNAAAAAAAAAAAAAAAAAAAEUlNdBcg=
Sam Reed | 2 Feb 16:30

Re: "Google phases out support for IE6"

And in related news, the BBC have reported [1] that the UK Government have
been petitioned to upgrade away from IE6 [2]

Sam Reed

[1] http://news.bbc.co.uk/1/hi/technology/8492862.stm
[2] http://petitions.number10.gov.uk/ie6upgrade/

Gmane