From 24c464c9ee15b0d204c41fcd212975ebc7864904 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sat, 6 Sep 2008 22:50:34 +0200 Subject: Aktualisierung auf 1.13.1 --- includes/BagOStuff.php | 31 ++++++++++++++++++++++++++----- includes/DefaultSettings.php | 4 ++-- includes/db/DatabasePostgres.php | 21 +++++++++++++++------ includes/db/DatabaseSqlite.php | 11 +++++++++-- includes/parser/Parser.php | 4 ++++ 5 files changed, 56 insertions(+), 15 deletions(-) (limited to 'includes') diff --git a/includes/BagOStuff.php b/includes/BagOStuff.php index b4fefc97..92311329 100644 --- a/includes/BagOStuff.php +++ b/includes/BagOStuff.php @@ -271,12 +271,15 @@ abstract class SqlBagOStuff extends BagOStuff { $exptime += time(); $exp = $this->_fromunixtime($exptime); } - $this->delete( $key ); + $this->_begin(); + $this->_query( + "DELETE FROM $0 WHERE keyname='$1'", $key ); $this->_doinsert($this->getTableName(), array( 'keyname' => $key, 'value' => $this->_blobencode($this->_serialize($value)), 'exptime' => $exp )); + $this->_commit(); return true; /* ? */ } @@ -284,8 +287,10 @@ abstract class SqlBagOStuff extends BagOStuff { if ( $this->_readonly() ) { return false; } + $this->_begin(); $this->_query( "DELETE FROM $0 WHERE keyname='$1'", $key ); + $this->_commit(); return true; /* ? */ } @@ -339,6 +344,9 @@ abstract class SqlBagOStuff extends BagOStuff { abstract function _readonly(); + function _begin() {} + function _commit() {} + function _freeresult($result) { /* stub */ return false; @@ -370,7 +378,9 @@ abstract class SqlBagOStuff extends BagOStuff { return false; } $now = $this->_fromunixtime( time() ); + $this->_begin(); $this->_query( "DELETE FROM $0 WHERE exptime < '$now'" ); + $this->_commit(); } function deleteall() { @@ -378,7 +388,9 @@ abstract class SqlBagOStuff extends BagOStuff { if ( $this->_readonly() ) { return false; } + $this->_begin(); $this->_query( "DELETE FROM $0" ); + $this->_commit(); } /** @@ -422,12 +434,21 @@ abstract class SqlBagOStuff extends BagOStuff { */ class MediaWikiBagOStuff extends SqlBagOStuff { var $tableInitialised = false; + var $lb, $db; function _getDB(){ - static $db; - if( !isset( $db ) ) - $db = wfGetDB( DB_MASTER ); - return $db; + if ( !isset( $this->lb ) ) { + $this->lb = wfGetLBFactory()->newMainLB(); + $this->db = $this->lb->getConnection( DB_MASTER ); + $this->db->clearFlag( DBO_TRX ); + } + return $this->db; + } + function _begin() { + $this->_getDB()->begin(); + } + function _commit() { + $this->_getDB()->commit(); } function _doquery($sql) { return $this->_getDB()->query( $sql, __METHOD__ ); diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index d6db7030..5b7e7d9d 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -31,7 +31,7 @@ require_once( "$IP/includes/SiteConfiguration.php" ); $wgConf = new SiteConfiguration; /** MediaWiki version number */ -$wgVersion = '1.13.0'; +$wgVersion = '1.13.1'; /** Name of the site. It must be changed in LocalSettings.php */ $wgSitename = 'MediaWiki'; @@ -2281,7 +2281,7 @@ $wgAutoloadClasses = array(); * $wgExtensionCredits[$type][] = array( * 'name' => 'Example extension', * 'version' => 1.9, - * 'svn-revision' => '$LastChangedRevision: 39340 $', + * 'svn-revision' => '$LastChangedRevision: 40539 $', * 'author' => 'Foo Barstein', * 'url' => 'http://wwww.example.com/Example%20Extension/', * 'description' => 'An example extension', diff --git a/includes/db/DatabasePostgres.php b/includes/db/DatabasePostgres.php index 065ad56d..7d93fddf 100644 --- a/includes/db/DatabasePostgres.php +++ b/includes/db/DatabasePostgres.php @@ -72,6 +72,7 @@ class DatabasePostgres extends Database { var $mInsertId = NULL; var $mLastResult = NULL; var $numeric_version = NULL; + var $mAffectedRows = NULL; function DatabasePostgres($server = false, $user = false, $password = false, $dbName = false, $failFunction = false, $flags = 0 ) @@ -546,9 +547,11 @@ class DatabasePostgres extends Database { function doQuery( $sql ) { if (function_exists('mb_convert_encoding')) { - return $this->mLastResult=pg_query( $this->mConn , mb_convert_encoding($sql,'UTF-8') ); + $sql = mb_convert_encoding($sql,'UTF-8'); } - return $this->mLastResult=pg_query( $this->mConn , $sql); + $this->mLastResult = pg_query( $this->mConn, $sql); + $this->mAffectedRows = NULL; // use pg_affected_rows(mLastResult) + return $this->mLastResult; } function queryIgnore( $sql, $fname = '' ) { @@ -641,9 +644,12 @@ class DatabasePostgres extends Database { } function affectedRows() { - if( !isset( $this->mLastResult ) or ! $this->mLastResult ) + if ( !is_null( $this->mAffectedRows ) ) { + // Forced result for simulated queries + return $this->mAffectedRows; + } + if( empty( $this->mLastResult ) ) return 0; - return pg_affected_rows( $this->mLastResult ); } @@ -809,7 +815,6 @@ class DatabasePostgres extends Database { $sql .= '(' . $this->makeList( $args ) . ')'; $res = (bool)$this->query( $sql, $fname, $ignore ); - if ( $ignore ) { $bar = pg_last_error(); if ($bar != false) { @@ -821,13 +826,15 @@ class DatabasePostgres extends Database { } } } - if ( $ignore ) { $olde = error_reporting( $olde ); if ($didbegin) { $this->commit(); } + // Set the affected row count for the whole operation + $this->mAffectedRows = $numrowsinserted; + // IGNORE always returns true return true; } @@ -1271,6 +1278,8 @@ END; function addQuotes( $s ) { if ( is_null( $s ) ) { return 'NULL'; + } else if ( is_bool( $s ) ) { + return intval( $s ); } else if ($s instanceof Blob) { return "'".$s->fetch($s)."'"; } diff --git a/includes/db/DatabaseSqlite.php b/includes/db/DatabaseSqlite.php index 5299c688..112c417b 100644 --- a/includes/db/DatabaseSqlite.php +++ b/includes/db/DatabaseSqlite.php @@ -289,15 +289,22 @@ class DatabaseSqlite extends Database { } function encodeBlob($b) { - return $this->strencode($b); + return new Blob( $b ); } function decodeBlob($b) { + if ($b instanceof Blob) { + $b = $b->fetch(); + } return $b; } function addQuotes($s) { - return $this->mConn->quote($s); + if ( $s instanceof Blob ) { + return "x'" . bin2hex( $s->fetch() ) . "'"; + } else { + return $this->mConn->quote($s); + } } function quote_ident($s) { return $s; } diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index e41aa1ac..3ff56a2b 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -133,6 +133,10 @@ class Parser $this->mVarCache = array(); if ( isset( $conf['preprocessorClass'] ) ) { $this->mPreprocessorClass = $conf['preprocessorClass']; + } elseif ( extension_loaded( 'domxml' ) ) { + // PECL extension that conflicts with the core DOM extension (bug 13770) + wfDebug( "Warning: you have the obsolete domxml extension for PHP. Please remove it!\n" ); + $this->mPreprocessorClass = 'Preprocessor_Hash'; } elseif ( extension_loaded( 'dom' ) ) { $this->mPreprocessorClass = 'Preprocessor_DOM'; } else { -- cgit v1.2.3-54-g00ecf