MediaWiki 1.13 and ADOdb 5.05

As of today, MediaWiki at approximately the 1.13 level is working while using the new ADOdb library that was released on 11 July 2008. I say approximately 1.13 because I actually work with the MediaWiki edge code from SubVersion, which is now identified as 1.14alpha. Far fewer changes are required these days to keep everything humming along. Thanks to MediaWiki guru "Simetrical" for incorporating some of my recommended changes, since I still don't have commit access to the shared repository. Very minor changes were required to the ADOdb library, very similar to the changes that I'd made to the 4.94 release that I had been using. These changes are actually very simple. First, after downloading and unzipping adodb5.05, find the file ./adodb.inc.php and change line 954 from
$array_2d = is_array($element0) && !is_object(reset($element0));
to read just
$array_2d = is_array($element0);
. If you don't make that change, you'll see error messages whenever you try to save a new article in your wiki. The last part of that statement apparently has to do with something unique to oci8 (Oracle?) descriptors, but wreaks havoc when used in conjunction with SQL Server. Second, also in ./adodb.inc.php, you'll need to modify the function FetchObject. MediaWiki code always expects objects returned from the database to have attributes named with all-lowercase letters. To make that happen, change line 3571 from
function FetchObject($isupper=true)
function FetchObject($isupper=false)
and change line 3588 from
else $n = $name;
else $n = strtolower($name);
. Without that change, you'll witness lots of member not found error messages. Third, in ./drivers/adodb-ado_mssql.inc.php, you'll have to change line 49 from
return $this->GetOne('select SCOPE_IDENTITY()');
return $this->GetOne('select @@IDENTITY');
or you'll get NULL for the last ID used after inserts. Finally, to get the various pagers to work, you'll have to modify ./drivers/adodb-ado5.inc.php around line 423. Change the code from
       if ($this->_currentRow > $row) return false;
       @$rs->Move((integer)$row - $this->_currentRow-1); //adBookmarkFirst
       $fReturn = $rs->Supports( 0x200 /*adMovePrevious*/ );
       if (! $fReturn )
          return false;
       if ( $row == 0 ) {
       } else {
           @$rs->Move((integer)$row - $this->_currentRow-1); //adBookmarkFirst
      $this->_currentRow = $row;
Without that change, most of the special pages won't work. Note that SQL Server 2000 and SQL Server 2005 will both respond that they support adMovePrevious. That's it, the rest of the changes can be found attached to the MediaWiki BugZilla report 9767, or may become part of the MediaWiki code base. The main attachments of interest are the SQL code and the DatabaseADODB.php file. These are fairly up-to-date as I write this, although I've evolved my schema somewhat since uploading the SQL code. It generally falls a little behind because I make the schema changes through Microsoft SQL Server Management Studio and then wind up reverse-engineering those changes into the SQL file.

No comments: