enwikipedia-acc/waca — pull request #89 by stwalkerster (2013-11-13 19:40:43+00:00)
Title: Integrate GeoLocation into the tool

This removes the geolocation link from the IP link set, and replaces it with some API calls to ipinfodb.com (the target of the old geolocation link).

As the number of API calls has a restriction on it (1/sec-ish), we cache the results in a database table so that repeated calls for the same data are not made.

This adds PDO support to the tool, then uses the PDO support as the base for the caching table. It also adds an autoloader, and the DataObject class from another project of mine, which provides a wrapper around each database row, exposing save() and delete() operations, and the static method getById($id) which aid the database calls.

PDO support with this implementation relies on a different method of naming the database tables and columns, but we can get around this by using simplistic views to wrap around the database tables for now, and when we've completely switched we can drop the views and rename the tables. See the header of DataObject.php for details.

Due to the autoloader messing with variable scope, the old $ACC=1 method of seeing if a file was being included incorrectly stopped working due to the variables being out of scope. Instead of patching it with lots of global calls, I've just replaced it with defined() calls - which is inherently global in nature anyway.

This should fix issue #73, and introduce the support needed for issue #5 .

Some of the older commits in this set also begin to convert parts of the code over to PDO.