Jump to content

User:MarkAHershberger/Weekly reports/2010-W03

From Wikipedia, the free encyclopedia

After getting a couple more of TimStarlings code reviews, I think I'm starting to understand the sort of code that is expected. It reinforces my own need to test my code thoroughly and to automate those tests to check for regressions. I'm spending more time reading over my code and thinking about it than I have in the past. This is a good thing. The CR process is pushing me to be a better programmer.

I really appreciate the thoroughness and care that he and others (when I touch code they care about) show. At times, it does feel like a “baptism by fire” but I'm hoping to be burned less and less as time goes on. If I'm not, then I'm not learning.

HttpFunctions.php

[edit]

This week I finished up a rewrite of dale's code in HttpFunctions.php that Tim pointed me to. I had committed it before, but because it didn't handle errors from fopen(), etc correctly, it was reverted. Since Http::get() is so widely used (see my test cases for the references I found), I made sure to test proxy handling and any error handling as thoroughly as I could.

Almost immediately after committing, Tim posted his CR, which was pretty thorough. I worked a little extra to make sure I addressed his and the other CR comments I got before calling it a week.

l10n

[edit]

After adding some messages to MessagesEn.php and getting input from Tim in W02, I started looking over mw:Localisation Localisation. I'm impressed with TranslateWiki and think it needs more exposure.

Chunked uploading

[edit]

Following Tim's suggestion from W02 that chunked uploading was probably more important for the 1.16 release than the HttpFunctions.php rewrite, I spent a good deal of time working on groking that code and the protocol. I committed the initial API work and will be writing some tests for it and testing it against Firefogg this week.

One part of that code (the exit()’s) that I added was thoroughly debunked and I learned a bit more about how MW works.

I'm beginning to think that working on different areas of the code, touching as much as possible, is the best way to learn about MW in depth as quickly as possible.

PHP bug?

[edit]

While testing HttpFunctions, I found a possible bug in the URI parsing code. The problem still exists in PHP 5.3.1, so I'll be looking at patching it. Instead of recognizing port 0 in a url (like curl does) parse_url (and any other url-using function, like fopen) does not see a specified port. So if I give it the URL http://example.com:0/ it will (silently) turn the url into http://example.com/. This different from curl's behaviour — curl tries the connection.

Testing framework

[edit]

I'm getting to the point where I'd like to have PHPUnit testing against a live server instead of just things that can happen from the Command line. So far, all I've seen for this is Selenium which seems a little heavy-weight for just making sure the HTTP traffic is correct.

In the same vein, though, I have been giving thought to putting some sort of continuous integration test server in place so that tests could be running continuously — or on every commit — and updating the CR status as necessary.

I'll probably do this on my own equipment initially.


Raw Notes

[edit]

17

[edit]
  • Read over TimStarlings code review of r61078
  • Started addressing the problems.

18

[edit]
  • Started digging into chunked uploading with Firefogg. (Chunked uploading more important than HttpFunctions.php, sez Tim)
    • Wondering how to handle cleanup of canceled uploads
    • interface is wonky with exit() points
    • Looks like it abuses is_file() on FileRepo results

19

[edit]
  • Found a problem with fopen when you have a URL with :0 for the port
  • Tried testing in 5.3.1

20

[edit]
  • Found a bug during installation w/ datadir and sqlite
    • Also updated the way the datadir path is stored in LocalSettings using the $IP prefix or full path if necessary
  • Started tracking down an POST+proxy problem with PhpHttpRequest.
    • Had to parse proxy var before using it for php
  • Read up on Translation work and how mw:i18n works in mediawiki

21

[edit]