Index: trunk/phase3/includes/db/DatabaseSqlite.php |
— | — | @@ -24,10 +24,14 @@ |
25 | 25 | * Parameters $server, $user and $password are not used. |
26 | 26 | */ |
27 | 27 | function __construct( $server = false, $user = false, $password = false, $dbName = false, $failFunction = false, $flags = 0 ) { |
| 28 | + global $wgSharedDB; |
28 | 29 | $this->mFailFunction = $failFunction; |
29 | 30 | $this->mFlags = $flags; |
30 | 31 | $this->mName = $dbName; |
31 | | - $this->open( $server, $user, $password, $dbName ); |
| 32 | + |
| 33 | + if ( $this->open( $server, $user, $password, $dbName ) && $wgSharedDB ) { |
| 34 | + $this->attachDatabase( $wgSharedDB ); |
| 35 | + } |
32 | 36 | } |
33 | 37 | |
34 | 38 | function getType() { |
— | — | @@ -145,6 +149,21 @@ |
146 | 150 | } |
147 | 151 | |
148 | 152 | /** |
| 153 | + * Attaches external database to our connection, see http://sqlite.org/lang_attach.html |
| 154 | + * for details. |
| 155 | + * @param $name: Database name to be used in queries like SELECT foo FROM dbname.table |
| 156 | + * @param $file: Database file name. If omitted, will be generated using $name and $wgSQLiteDataDir |
| 157 | + */ |
| 158 | + function attachDatabase( $name, $file = false, $fname = 'DatabaseSqlite::attachDatabase' ) { |
| 159 | + global $wgSQLiteDataDir; |
| 160 | + if ( !$file ) { |
| 161 | + $file = self::generateFileName( $wgSQLiteDataDir, $name ); |
| 162 | + } |
| 163 | + $file = $this->addQuotes( $file ); |
| 164 | + return $this->query( "ATTACH DATABASE $file AS $name", $fname ); |
| 165 | + } |
| 166 | + |
| 167 | + /** |
149 | 168 | * SQLite doesn't allow buffered results or data seeking etc, so we'll use fetchAll as the result |
150 | 169 | */ |
151 | 170 | function doQuery( $sql ) { |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -93,6 +93,7 @@ |
94 | 94 | * (bug 11641) \dotsc \dotsm \dotsi \dotso can now be used in <math> |
95 | 95 | * (bug 21475) \mathtt and \textsf can now be used in <math> |
96 | 96 | * texvc is now run via ulimit4.sh, to limit execution time. |
| 97 | +* SQLite now supports $wgSharedDB. |
97 | 98 | |
98 | 99 | === Bug fixes in 1.17 === |
99 | 100 | * (bug 17560) Half-broken deletion moved image files to deletion archive |