Index: trunk/phase3/includes/db/DatabaseMysql.php |
— | — | @@ -558,6 +558,11 @@ |
559 | 559 | return $this->query( "DROP TABLE IF EXISTS " . $this->tableName( $tableName ), $fName ); |
560 | 560 | } |
561 | 561 | |
| 562 | + protected function getDefaultSchemaVars() { |
| 563 | + $vars = parent::getDefaultSchemaVars(); |
| 564 | + $vars['wgDBTableOptions'] = $GLOBALS['wgDBTableOptions']; |
| 565 | + return $vars; |
| 566 | + } |
562 | 567 | } |
563 | 568 | |
564 | 569 | /** |
Index: trunk/phase3/includes/db/DatabaseOracle.php |
— | — | @@ -1331,18 +1331,6 @@ |
1332 | 1332 | return $this->mServer; |
1333 | 1333 | } |
1334 | 1334 | |
1335 | | - public function replaceVars( $ins ) { |
1336 | | - $varnames = array( 'wgDBprefix' ); |
1337 | | - if ( $this->mFlags & DBO_SYSDBA ) { |
1338 | | - $varnames[] = '_OracleDefTS'; |
1339 | | - $varnames[] = '_OracleTempTS'; |
1340 | | - } |
1341 | | - |
1342 | | - $ins = $this->replaceGlobalVars( $ins, $varnames ); |
1343 | | - |
1344 | | - return parent::replaceVars( $ins ); |
1345 | | - } |
1346 | | - |
1347 | 1335 | public function getSearchEngine() { |
1348 | 1336 | return 'SearchOracle'; |
1349 | 1337 | } |
Index: trunk/phase3/includes/db/Database.php |
— | — | @@ -225,6 +225,7 @@ |
226 | 226 | protected $mLBInfo = array(); |
227 | 227 | protected $mFakeSlaveLag = null, $mFakeMaster = false; |
228 | 228 | protected $mDefaultBigSelects = null; |
| 229 | + protected $mSchemaVars = false; |
229 | 230 | |
230 | 231 | # ------------------------------------------------------------------------------ |
231 | 232 | # Accessors |
— | — | @@ -2473,6 +2474,17 @@ |
2474 | 2475 | } |
2475 | 2476 | |
2476 | 2477 | /** |
| 2478 | + * Set variables to be used in sourceFile/sourceStream, in preference to the |
| 2479 | + * ones in $GLOBALS. If an array is set here, $GLOBALS will not be used at |
| 2480 | + * all. If it's set to false, $GLOBALS will be used. |
| 2481 | + * |
| 2482 | + * @param $vars False, or array mapping variable name to value. |
| 2483 | + */ |
| 2484 | + function setSchemaVars( $vars ) { |
| 2485 | + $this->mSchemaVars = $vars; |
| 2486 | + } |
| 2487 | + |
| 2488 | + /** |
2477 | 2489 | * Read and execute commands from an open file handle |
2478 | 2490 | * Returns true on success, error string or exception on failure (depending on object's error ignore settings) |
2479 | 2491 | * @param $fp String: File handle |
— | — | @@ -2547,8 +2559,8 @@ |
2548 | 2560 | } |
2549 | 2561 | |
2550 | 2562 | /** |
2551 | | - * Database independent variable replacement, replaces a set of named variables |
2552 | | - * in a sql statement with the contents of their global variables. |
| 2563 | + * Database independent variable replacement, replaces a set of variables |
| 2564 | + * in a sql statement with their contents as given by $this->getSchemaVars(). |
2553 | 2565 | * Supports '{$var}' `{$var}` and / *$var* / (without the spaces) style variables |
2554 | 2566 | * |
2555 | 2567 | * '{$var}' should be used for text and is passed through the database's addQuotes method |
— | — | @@ -2558,16 +2570,17 @@ |
2559 | 2571 | * / *$var* / is just encoded, besides traditional dbprefix and tableoptions it's use should be avoided |
2560 | 2572 | * |
2561 | 2573 | * @param $ins String: SQL statement to replace variables in |
2562 | | - * @param $varnames Array: Array of global variable names to replace |
2563 | 2574 | * @return String The new SQL statement with variables replaced |
2564 | 2575 | */ |
2565 | | - protected function replaceGlobalVars( $ins, $varnames ) { |
2566 | | - foreach ( $varnames as $var ) { |
2567 | | - if ( isset( $GLOBALS[$var] ) ) { |
2568 | | - $ins = str_replace( '\'{$' . $var . '}\'', $this->addQuotes( $GLOBALS[$var] ), $ins ); // replace '{$var}' |
2569 | | - $ins = str_replace( '`{$' . $var . '}`', $this->addIdentifierQuotes( $GLOBALS[$var] ), $ins ); // replace `{$var}` |
2570 | | - $ins = str_replace( '/*$' . $var . '*/', $this->strencode( $GLOBALS[$var] ) , $ins ); // replace /*$var*/ |
2571 | | - } |
| 2576 | + protected function replaceSchemaVars( $ins ) { |
| 2577 | + $vars = $this->getSchemaVars(); |
| 2578 | + foreach ( $vars as $var => $value ) { |
| 2579 | + // replace '{$var}' |
| 2580 | + $ins = str_replace( '\'{$' . $var . '}\'', $this->addQuotes( $value ), $ins ); |
| 2581 | + // replace `{$var}` |
| 2582 | + $ins = str_replace( '`{$' . $var . '}`', $this->addIdentifierQuotes( $value ), $ins ); |
| 2583 | + // replace /*$var*/ |
| 2584 | + $ins = str_replace( '/*$' . $var . '*/', $this->strencode( $value ) , $ins ); |
2572 | 2585 | } |
2573 | 2586 | return $ins; |
2574 | 2587 | } |
— | — | @@ -2576,14 +2589,8 @@ |
2577 | 2590 | * Replace variables in sourced SQL |
2578 | 2591 | */ |
2579 | 2592 | protected function replaceVars( $ins ) { |
2580 | | - $varnames = array( |
2581 | | - 'wgDBserver', 'wgDBname', 'wgDBintlname', 'wgDBuser', |
2582 | | - 'wgDBpassword', 'wgDBsqluser', 'wgDBsqlpassword', |
2583 | | - 'wgDBadminuser', 'wgDBadminpassword', 'wgDBTableOptions', |
2584 | | - ); |
| 2593 | + $ins = $this->replaceSchemaVars( $ins ); |
2585 | 2594 | |
2586 | | - $ins = $this->replaceGlobalVars( $ins, $varnames ); |
2587 | | - |
2588 | 2595 | // Table prefixes |
2589 | 2596 | $ins = preg_replace_callback( '!/\*(?:\$wgDBprefix|_)\*/([a-zA-Z_0-9]*)!', |
2590 | 2597 | array( $this, 'tableNameCallback' ), $ins ); |
— | — | @@ -2596,6 +2603,27 @@ |
2597 | 2604 | } |
2598 | 2605 | |
2599 | 2606 | /** |
| 2607 | + * Get schema variables. If none have been set via setSchemaVars(), then |
| 2608 | + * use some defaults from the current object. |
| 2609 | + */ |
| 2610 | + protected function getSchemaVars() { |
| 2611 | + if ( $this->mSchemaVars ) { |
| 2612 | + return $this->mSchemaVars; |
| 2613 | + } else { |
| 2614 | + return $this->getDefaultSchemaVars(); |
| 2615 | + } |
| 2616 | + } |
| 2617 | + |
| 2618 | + /** |
| 2619 | + * Get schema variables to use if none have been set via setSchemaVars(). |
| 2620 | + * Override this in derived classes to provide variables for tables.sql |
| 2621 | + * and SQL patch files. |
| 2622 | + */ |
| 2623 | + protected function getDefaultSchemaVars() { |
| 2624 | + return array(); |
| 2625 | + } |
| 2626 | + |
| 2627 | + /** |
2600 | 2628 | * Table name callback |
2601 | 2629 | * @private |
2602 | 2630 | */ |
Index: trunk/phase3/includes/db/LBFactory.php |
— | — | @@ -55,6 +55,14 @@ |
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
| 59 | + * Set the instance to be the given object |
| 60 | + */ |
| 61 | + static function setInstance( $instance ) { |
| 62 | + self::destroyInstance(); |
| 63 | + self::$instance = $instance; |
| 64 | + } |
| 65 | + |
| 66 | + /** |
59 | 67 | * Construct a factory based on a configuration array (typically from $wgLBFactoryConf) |
60 | 68 | */ |
61 | 69 | abstract function __construct( $conf ); |
Index: trunk/phase3/includes/db/LBFactory_Single.php |
— | — | @@ -0,0 +1,57 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * An LBFactory class that always returns a single database object. |
| 6 | + */ |
| 7 | +class LBFactory_Single extends LBFactory { |
| 8 | + protected $lb; |
| 9 | + |
| 10 | + /** |
| 11 | + * @param $conf An associative array with one member: |
| 12 | + * - connection: The DatabaseBase connection object |
| 13 | + */ |
| 14 | + function __construct( $conf ) { |
| 15 | + $this->lb = new LoadBalancer_Single( $conf ); |
| 16 | + } |
| 17 | + |
| 18 | + function newMainLB( $wiki = false ) { |
| 19 | + return $this->lb; |
| 20 | + } |
| 21 | + |
| 22 | + function getMainLB( $wiki = false ) { |
| 23 | + return $this->lb; |
| 24 | + } |
| 25 | + |
| 26 | + function newExternalLB( $cluster, $wiki = false ) { |
| 27 | + return $this->lb; |
| 28 | + } |
| 29 | + |
| 30 | + function &getExternalLB( $cluster, $wiki = false ) { |
| 31 | + return $this->lb; |
| 32 | + } |
| 33 | + |
| 34 | + function forEachLB( $callback, $params = array() ) { |
| 35 | + call_user_func_array( $callback, array_merge( array( $this->lb ), $params ) ); |
| 36 | + } |
| 37 | +} |
| 38 | + |
| 39 | +/** |
| 40 | + * Helper class for LBFactory_Single. |
| 41 | + */ |
| 42 | +class LoadBalancer_Single extends LoadBalancer { |
| 43 | + var $db; |
| 44 | + |
| 45 | + function __construct( $params ) { |
| 46 | + $this->db = $params['connection']; |
| 47 | + parent::__construct( array( 'servers' => array( array( |
| 48 | + 'type' => $this->db->getType(), |
| 49 | + 'host' => $this->db->getServer(), |
| 50 | + 'dbname' => $this->db->getDBname(), |
| 51 | + 'load' => 1, |
| 52 | + ) ) ) ); |
| 53 | + } |
| 54 | + |
| 55 | + function reallyOpenConnection( $server, $dbNameOverride = false ) { |
| 56 | + return $this->db; |
| 57 | + } |
| 58 | +} |
Property changes on: trunk/phase3/includes/db/LBFactory_Single.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 59 | + native |
Index: trunk/phase3/includes/installer/Installer.php |
— | — | @@ -556,6 +556,27 @@ |
557 | 557 | } |
558 | 558 | |
559 | 559 | /** |
| 560 | + * Install step which adds a row to the site_stats table with appropriate |
| 561 | + * initial values. |
| 562 | + */ |
| 563 | + public function populateSiteStats( DatabaseInstaller $installer ) { |
| 564 | + $status = $installer->getConnection(); |
| 565 | + if ( !$status->isOK() ) { |
| 566 | + return $status; |
| 567 | + } |
| 568 | + $status->value->insert( 'site_stats', array( |
| 569 | + 'ss_row_id' => 1, |
| 570 | + 'ss_total_views' => 0, |
| 571 | + 'ss_total_edits' => 0, |
| 572 | + 'ss_good_articles' => 0, |
| 573 | + 'ss_total_pages' => 0, |
| 574 | + 'ss_users' => 0, |
| 575 | + 'ss_admins' => 0, |
| 576 | + 'ss_images' => 0 ) ); |
| 577 | + return Status::newGood(); |
| 578 | + } |
| 579 | + |
| 580 | + /** |
560 | 581 | * Exports all wg* variables stored by the installer into global scope. |
561 | 582 | */ |
562 | 583 | public function exportVars() { |
— | — | @@ -1098,7 +1119,7 @@ |
1099 | 1120 | break; |
1100 | 1121 | } |
1101 | 1122 | |
1102 | | - $text = Http::get( $url . $file ); |
| 1123 | + $text = Http::get( $url . $file, array( 'timeout' => 3 ) ); |
1103 | 1124 | unlink( $dir . $file ); |
1104 | 1125 | |
1105 | 1126 | if ( $text == 'exec' ) { |
— | — | @@ -1202,11 +1223,12 @@ |
1203 | 1224 | * @param $installer DatabaseInstaller so we can make callbacks |
1204 | 1225 | * @return array |
1205 | 1226 | */ |
1206 | | - protected function getInstallSteps( DatabaseInstaller &$installer ) { |
| 1227 | + protected function getInstallSteps( DatabaseInstaller $installer ) { |
1207 | 1228 | $coreInstallSteps = array( |
1208 | 1229 | array( 'name' => 'database', 'callback' => array( $installer, 'setupDatabase' ) ), |
1209 | 1230 | array( 'name' => 'tables', 'callback' => array( $installer, 'createTables' ) ), |
1210 | 1231 | array( 'name' => 'interwiki', 'callback' => array( $installer, 'populateInterwikiTable' ) ), |
| 1232 | + array( 'name' => 'stats', 'callback' => array( $this, 'populateSiteStats' ) ), |
1211 | 1233 | array( 'name' => 'secretkey', 'callback' => array( $this, 'generateSecretKey' ) ), |
1212 | 1234 | array( 'name' => 'upgradekey', 'callback' => array( $this, 'generateUpgradeKey' ) ), |
1213 | 1235 | array( 'name' => 'sysop', 'callback' => array( $this, 'createSysop' ) ), |
— | — | @@ -1254,16 +1276,17 @@ |
1255 | 1277 | $installResults = array(); |
1256 | 1278 | $installer = $this->getDBInstaller(); |
1257 | 1279 | $installer->preInstall(); |
| 1280 | + $installer->setupSchemaVars(); |
1258 | 1281 | $steps = $this->getInstallSteps( $installer ); |
1259 | 1282 | foreach( $steps as $stepObj ) { |
1260 | 1283 | $name = $stepObj['name']; |
1261 | 1284 | call_user_func_array( $startCB, array( $name ) ); |
1262 | 1285 | |
1263 | 1286 | // Perform the callback step |
1264 | | - $status = call_user_func_array( $stepObj['callback'], array( &$installer ) ); |
| 1287 | + $status = call_user_func( $stepObj['callback'], $installer ); |
1265 | 1288 | |
1266 | 1289 | // Output and save the results |
1267 | | - call_user_func_array( $endCB, array( $name, $status ) ); |
| 1290 | + call_user_func( $endCB, $name, $status ); |
1268 | 1291 | $installResults[$name] = $status; |
1269 | 1292 | |
1270 | 1293 | // If we've hit some sort of fatal, we need to bail. |
— | — | @@ -1364,6 +1387,10 @@ |
1365 | 1388 | $user->setEmail( $this->getVar( '_AdminEmail' ) ); |
1366 | 1389 | } |
1367 | 1390 | $user->saveSettings(); |
| 1391 | + |
| 1392 | + // Update user count |
| 1393 | + $ssUpdate = new SiteStatsUpdate( 0, 0, 0, 0, 1 ); |
| 1394 | + $ssUpdate->doUpdate(); |
1368 | 1395 | } |
1369 | 1396 | $status = Status::newGood(); |
1370 | 1397 | |
— | — | @@ -1400,7 +1427,7 @@ |
1401 | 1428 | * |
1402 | 1429 | * @return Status |
1403 | 1430 | */ |
1404 | | - protected function createMainpage( DatabaseInstaller &$installer ) { |
| 1431 | + protected function createMainpage( DatabaseInstaller $installer ) { |
1405 | 1432 | $status = Status::newGood(); |
1406 | 1433 | try { |
1407 | 1434 | // STUPID STUPID $wgTitle. PST calls getUserSig(), which joyfully |
Index: trunk/phase3/includes/installer/Installer.i18n.php |
— | — | @@ -305,8 +305,6 @@ |
306 | 306 | |
307 | 307 | '''MyISAM''' may be faster in single-user or read-only installations. |
308 | 308 | MyISAM databases tend to get corrupted more often than InnoDB databases.", |
309 | | - 'config-mysql-egine-mismatch' => "'''Warning:''' you requested the $1 storage engine, but the existing database uses the $2 engine. |
310 | | -This upgrade script can't convert it, so it will remain $2.", |
311 | 309 | 'config-mysql-charset' => 'Database character set:', |
312 | 310 | 'config-mysql-binary' => 'Binary', |
313 | 311 | 'config-mysql-utf8' => 'UTF-8', |
— | — | @@ -314,8 +312,6 @@ |
315 | 313 | This is more efficient than MySQL's UTF-8 mode, and allows you to use the full range of Unicode characters. |
316 | 314 | |
317 | 315 | In '''UTF-8 mode''', MySQL will know what character set your data is in, and can present and convert it appropriately, but it will not let you store characters above the [http://en.wikipedia.org/wiki/Mapping_of_Unicode_character_planes Basic Multilingual Plane].", |
318 | | - 'config-mysql-charset-mismatch' => "'''Warning:''' you requested the $1 schema, but the existing database has the $2 schema. |
319 | | - This upgrade script can't convert it, so it will remain $2.", |
320 | 316 | 'config-site-name' => 'Name of wiki:', |
321 | 317 | 'config-site-name-help' => "This will appear in the title bar of the browser and in various other places.", |
322 | 318 | 'config-site-name-blank' => 'Enter a site name.', |
— | — | @@ -467,6 +463,7 @@ |
468 | 464 | 'config-install-interwiki-sql' => 'Could not find file <code>interwiki.sql</code>.', |
469 | 465 | 'config-install-interwiki-exists' => "'''Warning''': The interwiki table seems to already have entries. |
470 | 466 | Skipping default list.", |
| 467 | + 'config-install-stats' => 'Initializing statistics', |
471 | 468 | 'config-install-secretkey' => 'Generating secret key', |
472 | 469 | 'config-insecure-secret' => "'''Warning:''' Unable to create a secure <code>$1</code>. |
473 | 470 | Consider changing it manually.", |
— | — | @@ -1125,8 +1122,6 @@ |
1126 | 1123 | |
1127 | 1124 | '''MyISAM''' можа быць хутчэйшай у вікі з адным удзельнікам, ці толькі для чытаньня. |
1128 | 1125 | Базы зьвестак на MyISAM вядомыя тым, што ў іх зьвесткі шкодзяцца нашмат часьцей за InnoDB.", |
1129 | | - 'config-mysql-egine-mismatch' => "'''Папярэджаньне:''' Вы зрабілі запыт на рухавік сховішча $1, але існуючая база зьвестак выкарыстоўвае рухавік $2. |
1130 | | -Гэтае абнаўленьне ня можа вырашыць гэтую праблему, рухавік сховішча застанецца $2.", |
1131 | 1126 | 'config-mysql-charset' => 'Кадаваньне базы зьвестак:', |
1132 | 1127 | 'config-mysql-binary' => 'Двайковае', |
1133 | 1128 | 'config-mysql-utf8' => 'UTF-8', |
— | — | @@ -1134,8 +1129,6 @@ |
1135 | 1130 | Гэта болей эфэктыўна за рэжым MySQL UTF-8, і дазваляе Вам выкарыстоўваць увесь дыяпазон сымбаляў Unicode. |
1136 | 1131 | |
1137 | 1132 | У '''рэжыме UTF-8''', MySQL ведае, якая табліцы сымбаляў выкарыстоўваецца ў Вашых зьвестках, і можа адпаведна прадстаўляць і канвэртаваць іх, але гэта не дазволіць Вам захоўваць сымбалі па-за межамі [http://en.wikipedia.org/wiki/Mapping_of_Unicode_character_planes Базавага шматмоўнага дыяпазону].", |
1138 | | - 'config-mysql-charset-mismatch' => "'''Папярэджаньне:''' Вы зрабілі запыт на схему $1, але існуючая база зьвестак выкарыстоўвае схему $2. |
1139 | | -Гэтае абнаўленьне ня можа вырашыць гэтую праблему, таму будзе пакінутая $2.", |
1140 | 1133 | 'config-site-name' => 'Назва вікі:', |
1141 | 1134 | 'config-site-name-help' => 'Назва будзе паказвацца ў загалоўку браўзэра і ў некаторых іншых месцах.', |
1142 | 1135 | 'config-site-name-blank' => 'Увядзіце назву сайта.', |
— | — | @@ -1542,8 +1535,6 @@ |
1543 | 1536 | Това е по-ефективно от UTF-8 режима на MySQL и позволява използването на пълния набор от символи в Уникод. |
1544 | 1537 | |
1545 | 1538 | В '''UTF-8 режим''' MySQL ще знае в кой набор от символи са данните от уикито и ще може да ги показва и променя по подходящ начин, но няма да позволява складиране на символи извън [http://en.wikipedia.org/wiki/Mapping_of_Unicode_character_planes Основния многоезичен набор].", |
1546 | | - 'config-mysql-charset-mismatch' => "'''Предупреждение:''' заявена е $1 схема, но съществуващата база от данни е с $2 схема. |
1547 | | - Скриптът за надграждане не може да я преобразува, затова тя ще остане $2.", |
1548 | 1539 | 'config-site-name' => 'Име на уикито:', |
1549 | 1540 | 'config-site-name-help' => 'Това име ще се показва в заглавната лента на браузъра и на различни други места.', |
1550 | 1541 | 'config-site-name-blank' => 'Необходимо е да се въведе име на уикито.', |
— | — | @@ -2296,8 +2287,6 @@ |
2297 | 2288 | |
2298 | 2289 | '''MyISAM''' ist in Einzelnutzerumgebungen sowie bei schreibgeschützten Wikis schneller. |
2299 | 2290 | Bei MyISAM-Datenbanken treten tendenziell häufiger Fehler auf als bei InnoDB-Datenbanken.", |
2300 | | - 'config-mysql-egine-mismatch' => "'''Warnung:''' Als Speicher-Engine wurde $1 ausgewählt, während die Datenbank $2 verwendet. |
2301 | | -Das Aktualisierungsskript kann die Speicher-Engine nicht konvertieren, so dass weiterhin $2 verwendet wird.", |
2302 | 2291 | 'config-mysql-charset' => 'Datenbankzeichensatz:', |
2303 | 2292 | 'config-mysql-binary' => 'binär', |
2304 | 2293 | 'config-mysql-utf8' => 'UTF-8', |
— | — | @@ -2306,8 +2295,6 @@ |
2307 | 2296 | |
2308 | 2297 | Im '''UTF-8-Modus''' wird MySQL den Zeichensatz der Daten erkennen und sie richtig anzeigen und konvertieren, |
2309 | 2298 | allerdings können keine Zeichen außerhalb des [http://de.wikipedia.org/wiki/Basic_Multilingual_Plane#Gliederung_in_Ebenen_und_Bl.C3.B6cke ''Basic Multilingual Plane'' (BMP)] gespeichert werden.", |
2310 | | - 'config-mysql-charset-mismatch' => "'''Warnung:''' Als Datenbankzeichensatz wurde $1 ausgewählt, während die Datenbank $2 verwendet. |
2311 | | -Das Aktualisierungsskript kann den Datenbankzeichensatz nicht konvertieren, so dass weiterhin $2 verwendet wird.", |
2312 | 2299 | 'config-site-name' => 'Name des Wikis:', |
2313 | 2300 | 'config-site-name-help' => 'Er wird in der Titelleiste des Browsers, wie auch verschiedenen anderen Stellen, genutzt.', |
2314 | 2301 | 'config-site-name-blank' => 'Sitenamen angeben.', |
— | — | @@ -2702,13 +2689,9 @@ |
2703 | 2690 | |
2704 | 2691 | '''MyISAM''' es más rápido en instalaciones de usuario único o de sólo lectura. |
2705 | 2692 | Las bases de datos MyISAM tienden a corromperse más a menudo que las bases de datos InnoDB.", |
2706 | | - 'config-mysql-egine-mismatch' => "'''Atención:''' Solicitó el motor de almacenamento $1, pero el existente en la base de datos es el motor $2. |
2707 | | -Este código de actualización no lo puede convertir, de modo que permanecerá como $2.", |
2708 | 2693 | 'config-mysql-charset' => 'Conjunto de caracteres de la base de datos:', |
2709 | 2694 | 'config-mysql-binary' => 'Binario', |
2710 | 2695 | 'config-mysql-utf8' => 'UTF-8', |
2711 | | - 'config-mysql-charset-mismatch' => "'''Advertencia:''' Has solicitado el esquema $1, pero la base de datos existente tiene el esquema $2. |
2712 | | -Este script de actualización no puede convertirlo, de modo que permanecerá como $2.", |
2713 | 2696 | 'config-site-name' => 'Nombre del wiki:', |
2714 | 2697 | 'config-site-name-help' => 'Esto aparecerá en la barra de título del navegador y en varios otros lugares.', |
2715 | 2698 | 'config-site-name-blank' => 'Ingresar un nombre de sitio.', |
— | — | @@ -3326,8 +3309,6 @@ |
3327 | 3310 | 'config-mysql-engine-help' => "'''InnoDB''' est presque toujours la meilleure option, car il supporte bien l'[http://fr.wikipedia.org/wiki/Ordonnancement_dans_les_syst%C3%A8mes_d%27exploitation ordonnancement]. |
3328 | 3311 | |
3329 | 3312 | '''MyISAM''' peut être plus rapide dans les installations monoposte ou en lecture seule. Les bases de données MyISAM ont tendance à se corrompre plus souvent que celles d'InnoDB.", |
3330 | | - 'config-mysql-egine-mismatch' => "'''Attention:''' Vous avez demandé le moteur de stockage $1, mais la base de données existante utilise le moteur $2. |
3331 | | -Ce script de mise à niveau ne peut pas le convertir, il restera $2.", |
3332 | 3313 | 'config-mysql-charset' => 'Jeu de caractères de la base de données :', |
3333 | 3314 | 'config-mysql-binary' => 'Binaire', |
3334 | 3315 | 'config-mysql-utf8' => 'UTF-8', |
— | — | @@ -3335,8 +3316,6 @@ |
3336 | 3317 | |
3337 | 3318 | En ''mode binaire'', MediaWiki stocke le texte UTF-8 dans des champs binaires de la base de données. C'est plus efficace que le ''mode UTF-8'' de MySQL, et vous permet d'utiliser toute la gamme des caractères Unicode. |
3338 | 3319 | En ''mode UTF-8'', MySQL connaîtra le jeu de caractères de vos données et pourra présenter et convertir les données de manière appropriée, mais il ne vous laissera pas stocker les caractères au-dessus du [http://en.wikipedia.org/wiki/Mapping_of_Unicode_character_planes plan multilingue de base] (en anglais).", |
3339 | | - 'config-mysql-charset-mismatch' => "'''Attention:''' Vous avez demandé le schéma $1, mais la base de données existante a le schéma $2. |
3340 | | -Ce script de mise à niveau ne peut pas le convertir, il restera $2.", |
3341 | 3320 | 'config-site-name' => 'Nom du wiki :', |
3342 | 3321 | 'config-site-name-help' => 'Il apparaîtra dans la barre de titre du navigateur et en divers autres endroits.', |
3343 | 3322 | 'config-site-name-blank' => 'Entrez un nom de site.', |
— | — | @@ -3789,8 +3768,6 @@ |
3790 | 3769 | |
3791 | 3770 | '''MyISAM''' é máis rápido en instalacións de usuario único e de só lectura. |
3792 | 3771 | As bases de datos MyISAM tenden a se corromper máis a miúdo ca as bases de datos InnoDB.", |
3793 | | - 'config-mysql-egine-mismatch' => "'''Atención:''' Solicitou o motor de almacenamento $1, mais o existente na base de datos é o motor $2. |
3794 | | -Esta escritura de actualización non o pode converter, de modo que permanecerá $2.", |
3795 | 3772 | 'config-mysql-charset' => 'Conxunto de caracteres da base de datos:', |
3796 | 3773 | 'config-mysql-binary' => 'Binario', |
3797 | 3774 | 'config-mysql-utf8' => 'UTF-8', |
— | — | @@ -3799,8 +3776,6 @@ |
3800 | 3777 | |
3801 | 3778 | No '''modo UTF-8''', MySQL saberá o xogo de caracteres dos seus datos e pode presentar e converter os datos de maneira axeitada, |
3802 | 3779 | pero non lle deixará gardar caracteres por riba do [http://en.wikipedia.org/wiki/Mapping_of_Unicode_character_planes plan multilingüe básico].", |
3803 | | - 'config-mysql-charset-mismatch' => "'''Atención:''' Solicitou o esquema $1, mais o existente na base de datos é o esquema $2. |
3804 | | -Esta escritura de actualización non o pode converter, de modo que permanecerá $2.", |
3805 | 3780 | 'config-site-name' => 'Nome do wiki:', |
3806 | 3781 | 'config-site-name-help' => 'Isto aparecerá na barra de títulos do navegador e noutros lugares.', |
3807 | 3782 | 'config-site-name-blank' => 'Escriba o nome do sitio.', |
— | — | @@ -5013,8 +4988,6 @@ |
5014 | 4989 | |
5015 | 4990 | '''MyISAM''' pote esser plus rapide in installationes a usator singule o a lectura solmente. |
5016 | 4991 | Le bases de datos MyISAM tende a esser corrumpite plus frequentemente que le base de datos InnoDB.", |
5017 | | - 'config-mysql-egine-mismatch' => "'''Aviso:''' tu requestava le motor de immagazinage $1, ma le base de datos existente usa le motor $2. |
5018 | | -Iste script de actualisation non pote converter lo, dunque illo remanera $2.", |
5019 | 4992 | 'config-mysql-charset' => 'Codification de characteres in le base de datos:', |
5020 | 4993 | 'config-mysql-binary' => 'Binari', |
5021 | 4994 | 'config-mysql-utf8' => 'UTF-8', |
— | — | @@ -5022,8 +4995,6 @@ |
5023 | 4996 | Isto es plus efficiente que le modo UTF-8 de MySQL, e permitte usar le rango complete de characteres Unicode. |
5024 | 4997 | |
5025 | 4998 | In '''modo UTF-8''', MySQL cognoscera le codification de characteres usate pro tu dats, e pote presentar e converter lo appropriatemente, ma illo non permittera immagazinar characteres supra le [http://en.wikipedia.org/wiki/Mapping_of_Unicode_character_planes Plano Multilingue Basic].", |
5026 | | - 'config-mysql-charset-mismatch' => "'''Aviso:''' tu requestava le schema $1, ma le base de datos existente ha le schema $2. |
5027 | | -Iste script de actualisation non pote converter lo, dunque illo remanera $2.", |
5028 | 4999 | 'config-site-name' => 'Nomine del wiki:', |
5029 | 5000 | 'config-site-name-help' => 'Isto apparera in le barra de titulo del navigator e in varie altere locos.', |
5030 | 5001 | 'config-site-name-blank' => 'Entra un nomine de sito.', |
— | — | @@ -5494,8 +5465,6 @@ |
5495 | 5466 | |
5496 | 5467 | '''MyISAM''' mungkin lebih cepat dalam instalasi pengguna-tunggal atau hanya-baca. |
5497 | 5468 | Basis data MyISAM cenderung lebih sering rusak daripada basis data InnoDB.", |
5498 | | - 'config-mysql-egine-mismatch' => "'''Peringatan:''' Anda meminta mesin penyimpanan $1, tapi basis data yang ada menggunakan mesin $2. |
5499 | | -Skrip pemutakhiran ini tidak dapat mengubahnya, sehingga akan tetap $2.", |
5500 | 5469 | 'config-mysql-charset' => 'Set karakter basis data:', |
5501 | 5470 | 'config-mysql-binary' => 'Biner', |
5502 | 5471 | 'config-mysql-utf8' => 'UTF-8', |
— | — | @@ -5503,8 +5472,6 @@ |
5504 | 5473 | Ini lebih efisien daripada modus UTF-8 MySQL dan memungkinkan Anda untuk menggunakan ragam penuh karakter Unicode. |
5505 | 5474 | |
5506 | 5475 | Dalam '''modus UTF-8''', MySQL akan tahu apa set karakter data dan dapat menampilkan dan mengubahnya sesuai keperluan, tetapi tidak akan mengizinkan Anda menyimpan karakter di atas [http://en.wikipedia.org/wiki/Mapping_of_Unicode_character_planes Basic Multilingual Plane].", |
5507 | | - 'config-mysql-charset-mismatch' => "'''Peringatan:''' Anda meminta skema $1, tapi basis data yang ada menggunakan skema $2. |
5508 | | -Skrip pemutakhiran ini tidak dapat mengubahnya, sehingga akan tetap $2.", |
5509 | 5476 | 'config-site-name' => 'Nama wiki:', |
5510 | 5477 | 'config-site-name-help' => 'Ini akan muncul di bilah judul peramban dan di berbagai tempat lainnya.', |
5511 | 5478 | 'config-site-name-blank' => 'Masukkan nama situs.', |
— | — | @@ -5990,8 +5957,6 @@ |
5991 | 5958 | |
5992 | 5959 | '''MyISAM'''は、利用者が1人の場合、あるいは読み込み専用でインストールする場合に、より処理が早くなるでしょう。 |
5993 | 5960 | ただし、MyISAMのデータベースは、InnoDBより高頻度で破損する傾向があります。", |
5994 | | - 'config-mysql-egine-mismatch' => "'''警告:'''$1ストレージエンジンが要求されましたが、既存のデータベースは$2エンジンを使用します。 |
5995 | | -この更新スクリプトは、これに対応していません、$2のままになります。", |
5996 | 5961 | 'config-mysql-charset' => 'データベースの文字セット:', |
5997 | 5962 | 'config-mysql-binary' => 'バイナリ', |
5998 | 5963 | 'config-mysql-utf8' => 'UTF-8', |
— | — | @@ -6000,8 +5965,6 @@ |
6001 | 5966 | |
6002 | 5967 | '''UTF-8形式'''では、MySQLは、なんの文字集合がデータのなかに含まれているかを知り、それに対して適切な提示と変換をするでしょうが、 |
6003 | 5968 | [http://ja.wikipedia.org/wiki/%E5%9F%BA%E6%9C%AC%E5%A4%9A%E8%A8%80%E8%AA%9E%E9%9D%A2 基本多言語面]の外にある文字を格納できるようにはなりません。", |
6004 | | - 'config-mysql-charset-mismatch' => "'''警告:'''$1スキーマが要求されましたが、既存のデータベースは$2スキーマです。 |
6005 | | -この更新スクリプトは、これに対応していませんので、$2のままになります。", |
6006 | 5969 | 'config-site-name' => 'ウィキの名前:', |
6007 | 5970 | 'config-site-name-help' => 'この事象はブラウザのタイトルバーと他の様々な場所において出現する。', |
6008 | 5971 | 'config-site-name-blank' => 'サイト名を入力してください。', |
— | — | @@ -6814,8 +6777,6 @@ |
6815 | 6778 | |
6816 | 6779 | '''MyISAM''' може да е побрз кај инсталациите наменети за само еден корисник или незаписни инсталации (само читање). |
6817 | 6780 | Базите на податоци од MyISAM почесто се расипуваат од базите на InnoDB.", |
6818 | | - 'config-mysql-egine-mismatch' => "'''Предупредување:''' го побаравте складишниот погон $1, но постоечката база на податоци го користи погонот $2. |
6819 | | -Оваа надградбена скрипта не може да го претвори, и затоа ќе остане на $2.", |
6820 | 6781 | 'config-mysql-charset' => 'Збир знаци за базата:', |
6821 | 6782 | 'config-mysql-binary' => 'Бинарен', |
6822 | 6783 | 'config-mysql-utf8' => 'UTF-8', |
— | — | @@ -6823,8 +6784,6 @@ |
6824 | 6785 | Ова е поефикасно отколку TF-8 режимот на MySQL, и ви овозможува да ја користите целата палета на уникодни знаци. |
6825 | 6786 | |
6826 | 6787 | Во '''UTF-8 режим''', MySQL ќе знае на кој збир знаци припаѓаат вашите податоци, и може соодветно да ги претстави и претвори, но нема да ви дозволи да складиратезнаци над [http://en.wikipedia.org/wiki/Mapping_of_Unicode_character_planes Основната повеќејазична рамнина].", |
6827 | | - 'config-mysql-charset-mismatch' => "'''Предупредување:''' ја побаравте шемата $1, но постоечката база на податоци ја има шемата $2. |
6828 | | -Оваа надградбена скрипта не може да ја претвори, па затоа ќе остане на $2.", |
6829 | 6788 | 'config-site-name' => 'Име на викито:', |
6830 | 6789 | 'config-site-name-help' => 'Ова ќе се појавува во заглавната лента на прелистувачот и на разни други места.', |
6831 | 6790 | 'config-site-name-blank' => 'Внесете име на мрежното место.', |
— | — | @@ -7468,8 +7427,6 @@ |
7469 | 7428 | |
7470 | 7429 | '''MyISAM''' is bij een zeer beperkt aantal gebruikers mogelijk sneller, of als de wiki alleen-lezen is. |
7471 | 7430 | MyISAM-databases raken vaker corrupt dan InnoDB-databases.", |
7472 | | - 'config-mysql-egine-mismatch' => "'''Waarschuwing:''' u wilt de opslagwijze $1 gebruiken, maar de bestaande database gebruikt de opslagwijze $2. |
7473 | | -Dit upgradescript kan de opslagwijze niet converteren, dus het blijft $2.", |
7474 | 7431 | 'config-mysql-charset' => 'Tekenset voor de database:', |
7475 | 7432 | 'config-mysql-binary' => 'Binair', |
7476 | 7433 | 'config-mysql-utf8' => 'UTF-8', |
— | — | @@ -7478,8 +7435,6 @@ |
7479 | 7436 | |
7480 | 7437 | In '''UTF-8-modus''' kent MySQL de tekenset van uw gegevens en kan de databaseserver ze juist weergeven en converteren. |
7481 | 7438 | Het is dat niet mogelijk tekens op te slaan die de \"[http://nl.wikipedia.org/wiki/Lijst_van_Unicode-subbereiken#Basic_Multilingual_Plane Basic Multilingual Plane]\" te boven gaan.", |
7482 | | - 'config-mysql-charset-mismatch' => "'''Waarschuwing:''' u wilt het schema $1 gebruiken, maar de bestaande database gebruikt het schema $2. |
7483 | | -Dit upgradescript kan het schema niet converteren, dus het blijft $2.", |
7484 | 7439 | 'config-site-name' => 'Naam van de wiki:', |
7485 | 7440 | 'config-site-name-help' => 'Deze naam verschijnt in de titelbalk van browsers en op andere plaatsen.', |
7486 | 7441 | 'config-site-name-blank' => 'Geef een naam op voor de site.', |
— | — | @@ -7966,8 +7921,6 @@ |
7967 | 7922 | |
7968 | 7923 | '''MyISAM''' kan være raskere i enbruker- eller les-bare-installasjoner. |
7969 | 7924 | MyISAM-databaser har en tendens til å bli ødelagt oftere enn InnoDB-databaser.", |
7970 | | - 'config-mysql-egine-mismatch' => "'''Advarsel:''' du ba om lagringsmotoren $1, men den eksisterende databasen bruker motoren $2. |
7971 | | -Dette oppgraderingsskriptet kan ikke konvertere den, så den vil forbli $2.", |
7972 | 7925 | 'config-mysql-charset' => 'Databasetegnsett:', |
7973 | 7926 | 'config-mysql-binary' => 'Binær', |
7974 | 7927 | 'config-mysql-utf8' => 'UTF-8', |
— | — | @@ -7976,8 +7929,6 @@ |
7977 | 7930 | |
7978 | 7931 | I '''UTF-8 mode''' vil MySQL vite hvilket tegnsett dataene dine er i og kan presentere og konvertere det på en riktig måte, |
7979 | 7932 | men det vil ikke la deg lagre tegn over «[http://en.wikipedia.org/wiki/Mapping_of_Unicode_character_planes the Basic Multilingual Plane]».", |
7980 | | - 'config-mysql-charset-mismatch' => "'''Advarsel:''' du ba om skjemaet $1, men den eksisterende databasen bruker skjemaet $2. |
7981 | | -Dette oppgraderingsskriptet kan ikke konvertere det, så det vil forbli $2.", |
7982 | 7933 | 'config-site-name' => 'Navn på wiki:', |
7983 | 7934 | 'config-site-name-help' => 'Dette vil vises i tittellinjen i nettleseren og diverse andre steder.', |
7984 | 7935 | 'config-site-name-blank' => 'Skriv inn et nettstedsnavn.', |
— | — | @@ -8706,8 +8657,6 @@ |
8707 | 8658 | |
8708 | 8659 | '''MyISAM''' a peul esse pi lest an instalassion për n'utent sol o mach an letura. |
8709 | 8660 | La base ëd dàit MyISAM a tira a corompse pi 'd soens che la base ëd dàit InnoDB.", |
8710 | | - 'config-mysql-egine-mismatch' => "'''Avis:''' it l'has ciamà ël motor ëd memorisassion $1, ma la base ëd dàit esistenta a deuvra ël motor $2. |
8711 | | -Cost senari d'agiornament a peul pa convertilo, parèj a restrà $2.", |
8712 | 8661 | 'config-mysql-charset' => 'Ansem ëd caràter dla base ëd dàit:', |
8713 | 8662 | 'config-mysql-binary' => 'Binari', |
8714 | 8663 | 'config-mysql-utf8' => 'UTF-8', |
— | — | @@ -8715,8 +8664,6 @@ |
8716 | 8665 | Sòn a l'é pi eficient che la manera UTF-8 ëd MySQL, e a-j përmët ëd dovré l'ansema antregh ëd caràter Unicode. |
8717 | 8666 | |
8718 | 8667 | An '''manera UTF-8''', MySQL a conossrà an che ansem ëd caràter a son ij sò dat, e a peul presenteje e convertije apropriatament, ma a-j lassa pa memorisé ij caràter ëdzora al [http://en.wikipedia.org/wiki/Mapping_of_Unicode_character_planes pian multilenghìstich ëd base].", |
8719 | | - 'config-mysql-charset-mismatch' => "'''Avis:''' a l'ha ciamà lë schema $1, ma la base ëd dàit esistenta a l'ha lë schema $2. |
8720 | | -Cost senari d'agiornament a peul pa convertilo, parèj a restrà $2.", |
8721 | 8668 | 'config-site-name' => 'Nòm ëd la wiki:', |
8722 | 8669 | 'config-site-name-help' => "Sòn a comparirà ant la bara dël tìtol dël navigador e an vàire d'àutri pòst.", |
8723 | 8670 | 'config-site-name-blank' => "Ch'a buta un nòm ëd sit.", |
— | — | @@ -9187,7 +9134,6 @@ |
9188 | 9135 | |
9189 | 9136 | '''MyISAM''' pode ser mais rápido no modo de utilizador único ou em instalações somente para leitura. |
9190 | 9137 | As bases de dados MyISAM tendem a ficar corrompidas com maior frequência do que as bases de dados InnoDB.", |
9191 | | - 'config-mysql-egine-mismatch' => "'''Aviso:''' pediu a plataforma de armazenamento $1, mas a base de dados existente usa a plataforma $2. Este código de actualização não pode fazer a conversão, por isso permanecerá como $2.", |
9192 | 9138 | 'config-mysql-charset' => 'Conjunto de caracteres da base de dados:', |
9193 | 9139 | 'config-mysql-binary' => 'Binary', |
9194 | 9140 | 'config-mysql-utf8' => 'UTF-8', |
— | — | @@ -9196,7 +9142,6 @@ |
9197 | 9143 | |
9198 | 9144 | No modo '''UTF-8''', o MySQL saberá em que conjunto de caracteres os seus dados estão e pode apresentá-los e convertê-los da forma mais adequada, |
9199 | 9145 | mas não lhe permitirá armazenar caracteres acima do [http://en.wikipedia.org/wiki/Mapping_of_Unicode_character_planes Plano Multilingue Básico].", |
9200 | | - 'config-mysql-charset-mismatch' => "'''Aviso:''' pediu o esquema ''(schema)'' $1, mas a base de dados existente usa o esquema $2. Este código de actualização não pode fazer a conversão, por isso permanecerá como $2.", |
9201 | 9146 | 'config-site-name' => 'Nome da wiki:', |
9202 | 9147 | 'config-site-name-help' => 'Este nome aparecerá no título da janela do seu browser e em vários outros sítios.', |
9203 | 9148 | 'config-site-name-blank' => 'Introduza o nome do site.', |
— | — | @@ -9798,8 +9743,6 @@ |
9799 | 9744 | 'config-mysql-engine-help' => "'''InnoDB''' почти всегда предпочтительнее, так как он лучше справляется с параллельным доступом. |
9800 | 9745 | |
9801 | 9746 | '''MyISAM''' может оказаться быстрее для вики с одним пользователем или с минимальным количеством поступающих правок, однако базы данных на нём портятся чаще, чем на InnoDB.", |
9802 | | - 'config-mysql-egine-mismatch' => "'''Внимание:''' Вы запросили метод хранения $1, однако существующая база данных использует $2. |
9803 | | -Этот сценарий обновления не может изменить преобразовать его и поэтому метод хранения останется $2.", |
9804 | 9747 | 'config-mysql-charset' => 'Набор символов (кодовая таблица) базы данных:', |
9805 | 9748 | 'config-mysql-binary' => 'Двоичный', |
9806 | 9749 | 'config-mysql-utf8' => 'UTF-8', |
— | — | @@ -9807,8 +9750,6 @@ |
9808 | 9751 | Это более эффективно, чем ''UTF-8 режим'' MySQL, и позволяет использовать полный набор символов Unicode. |
9809 | 9752 | |
9810 | 9753 | В '''режиме UTF-8''' MySQL будет знать в какой кодировке находятся Ваши данные и может отображать и преобразовывать их соответствующим образом, но это не позволит вам хранить символы выше [http://en.wikipedia.org/wiki/Mapping_of_Unicode_character_planes Базовой Многоязыковой Плоскости].", |
9811 | | - 'config-mysql-charset-mismatch' => "'''Внимание.''' Вы запросили схему $1, но существующая база данных имеет схему $2. |
9812 | | -Этот сценарий обновления не сможет преобразовать схему, она останется типа $2.", |
9813 | 9754 | 'config-site-name' => 'Название вики:', |
9814 | 9755 | 'config-site-name-help' => 'Название будет отображаться в заголовке окна браузера и в некоторых других местах вики.', |
9815 | 9756 | 'config-site-name-blank' => 'Введите название сайта.', |
— | — | @@ -10623,14 +10564,12 @@ |
10624 | 10565 | 'config-mysql-engine-help' => "'''InnoDB'''通常是最佳选项,因为它对并发操作有着良好的支持。 |
10625 | 10566 | |
10626 | 10567 | '''MyISAM'''在单用户或只读环境下可能会有更快的性能表现。但MyISAM数据库出错的概率一般要大于InnoDB数据库。", |
10627 | | - 'config-mysql-egine-mismatch' => "'''警告:'''您选择了使用$1存储引擎,但现有的数据库使用了$2引擎。升级脚本无法转换它,故将保持$2。", |
10628 | 10568 | 'config-mysql-charset' => '数据库字符集:', |
10629 | 10569 | 'config-mysql-binary' => '二进制', |
10630 | 10570 | 'config-mysql-utf8' => 'UTF-8', |
10631 | 10571 | 'config-mysql-charset-help' => "在'''二进制模式'''下,MediaWiki会将UTF-8编码的文本存于数据库的二进制字段中。相对于MySQL的UTF-8模式,这种方法效率更高,并允许您使用全范围的Unicode字符。 |
10632 | 10572 | |
10633 | 10573 | 在'''UTF-8模式'''下,MySQL将知道您数据使用的字符集,并能适当地提供和转换内容。但这样做您将无法在数据库中存储[http://zh.wikipedia.org/wiki/基本多文种平面 基本多文种平面]以外的字符。", |
10634 | | - 'config-mysql-charset-mismatch' => "'''警告:'''您选择了使用$1模式,但现有的数据库使用了$2模式。升级脚本无法转换它,故将保持$2。", |
10635 | 10574 | 'config-site-name' => 'Wiki的名称:', |
10636 | 10575 | 'config-site-name-help' => '填入的内容会出现在浏览器的标题栏以及其他多处位置中。', |
10637 | 10576 | 'config-site-name-blank' => '输入网站的名称。', |
Index: trunk/phase3/includes/installer/SqliteInstaller.php |
— | — | @@ -89,25 +89,20 @@ |
90 | 90 | return Status::newGood(); |
91 | 91 | } |
92 | 92 | |
93 | | - public function getConnection() { |
| 93 | + public function openConnection() { |
94 | 94 | global $wgSQLiteDataDir; |
95 | 95 | |
96 | 96 | $status = Status::newGood(); |
97 | | - if( is_null( $this->db ) ) { |
98 | | - $dir = $this->getVar( 'wgSQLiteDataDir' ); |
99 | | - $dbName = $this->getVar( 'wgDBname' ); |
100 | | - |
101 | | - try { |
102 | | - # FIXME: need more sensible constructor parameters, e.g. single associative array |
103 | | - # Setting globals kind of sucks |
104 | | - $wgSQLiteDataDir = $dir; |
105 | | - $this->db = new DatabaseSqlite( false, false, false, $dbName ); |
106 | | - $status->value = $this->db; |
107 | | - } catch ( DBConnectionError $e ) { |
108 | | - $status->fatal( 'config-sqlite-connection-error', $e->getMessage() ); |
109 | | - } |
110 | | - } else { |
111 | | - $status->value = $this->db; |
| 97 | + $dir = $this->getVar( 'wgSQLiteDataDir' ); |
| 98 | + $dbName = $this->getVar( 'wgDBname' ); |
| 99 | + try { |
| 100 | + # FIXME: need more sensible constructor parameters, e.g. single associative array |
| 101 | + # Setting globals kind of sucks |
| 102 | + $wgSQLiteDataDir = $dir; |
| 103 | + $db = new DatabaseSqlite( false, false, false, $dbName ); |
| 104 | + $status->value = $db; |
| 105 | + } catch ( DBConnectionError $e ) { |
| 106 | + $status->fatal( 'config-sqlite-connection-error', $e->getMessage() ); |
112 | 107 | } |
113 | 108 | return $status; |
114 | 109 | } |
Index: trunk/phase3/includes/installer/DatabaseInstaller.php |
— | — | @@ -95,14 +95,14 @@ |
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
99 | | - * Connect to the database using the administrative user/password currently |
100 | | - * defined in the session. On success, return the connection, on failure, |
| 99 | + * Open a connection to the database using the administrative user/password |
| 100 | + * currently defined in the session, without any caching. Returns a status |
| 101 | + * object. On success, the status object will contain a Database object in |
| 102 | + * its value member. |
101 | 103 | * |
102 | | - * This may be called multiple times, so the result should be cached. |
103 | | - * |
104 | 104 | * @return Status |
105 | 105 | */ |
106 | | - public abstract function getConnection(); |
| 106 | + public abstract function openConnection(); |
107 | 107 | |
108 | 108 | /** |
109 | 109 | * Create the database and return a Status object indicating success or |
— | — | @@ -113,6 +113,29 @@ |
114 | 114 | public abstract function setupDatabase(); |
115 | 115 | |
116 | 116 | /** |
| 117 | + * Connect to the database using the administrative user/password currently |
| 118 | + * defined in the session. Returns a status object. On success, the status |
| 119 | + * object will contain a Database object in its value member. |
| 120 | + * |
| 121 | + * This will return a cached connection if one is available. |
| 122 | + * |
| 123 | + * @return DatabaseBase |
| 124 | + */ |
| 125 | + public function getConnection() { |
| 126 | + if ( $this->db ) { |
| 127 | + return Status::newGood( $this->db ); |
| 128 | + } |
| 129 | + $status = $this->openConnection(); |
| 130 | + if ( $status->isOK() ) { |
| 131 | + $this->db = $status->value; |
| 132 | + // Enable autocommit |
| 133 | + $this->db->clearFlag( DBO_TRX ); |
| 134 | + $this->db->commit(); |
| 135 | + } |
| 136 | + return $status; |
| 137 | + } |
| 138 | + |
| 139 | + /** |
117 | 140 | * Create database tables from scratch. |
118 | 141 | * |
119 | 142 | * @return Status |
— | — | @@ -142,7 +165,7 @@ |
143 | 166 | } |
144 | 167 | // Resume normal operations |
145 | 168 | if( $status->isOk() ) { |
146 | | - LBFactory::enableBackend(); |
| 169 | + $this->enableLB(); |
147 | 170 | } |
148 | 171 | return $status; |
149 | 172 | } |
— | — | @@ -155,13 +178,56 @@ |
156 | 179 | public abstract function getLocalSettings(); |
157 | 180 | |
158 | 181 | /** |
| 182 | + * Override this to provide DBMS-specific schema variables, to be |
| 183 | + * substituted into tables.sql and other schema files. |
| 184 | + */ |
| 185 | + public function getSchemaVars() { |
| 186 | + return array(); |
| 187 | + } |
| 188 | + |
| 189 | + /** |
| 190 | + * Set appropriate schema variables in the current database connection. |
| 191 | + * |
| 192 | + * This should be called after any request data has been imported, but before |
| 193 | + * any write operations to the database. |
| 194 | + */ |
| 195 | + public function setupSchemaVars() { |
| 196 | + $status = $this->getConnection(); |
| 197 | + if ( $status->isOK() ) { |
| 198 | + $status->value->setSchemaVars( $this->getSchemaVars() ); |
| 199 | + } |
| 200 | + } |
| 201 | + |
| 202 | + /** |
| 203 | + * Set up LBFactory so that wfGetDB() etc. works. |
| 204 | + * We set up a special LBFactory instance which returns the current |
| 205 | + * installer connection. |
| 206 | + */ |
| 207 | + public function enableLB() { |
| 208 | + $status = $this->getConnection(); |
| 209 | + if ( !$status->isOK() ) { |
| 210 | + throw new MWException( __METHOD__.': unexpected DB connection error' ); |
| 211 | + } |
| 212 | + LBFactory::setInstance( new LBFactory_Single( array( |
| 213 | + 'connection' => $status->value ) ) ); |
| 214 | + } |
| 215 | + |
| 216 | + /** |
| 217 | + * Get a Database connection object. Throw an exception if we can't get one. |
| 218 | + * |
| 219 | + * @return DatabaseBase |
| 220 | + */ |
| 221 | + public function getConnectionOrDie() { |
| 222 | + } |
| 223 | + |
| 224 | + /** |
159 | 225 | * Perform database upgrades |
160 | 226 | * |
161 | 227 | * @return Boolean |
162 | 228 | */ |
163 | 229 | public function doUpgrade() { |
164 | | - # Maintenance scripts like wfGetDB() |
165 | | - LBFactory::enableBackend(); |
| 230 | + $this->setupSchemaVars(); |
| 231 | + $this->enableLB(); |
166 | 232 | |
167 | 233 | $ret = true; |
168 | 234 | ob_start( array( $this, 'outputHandler' ) ); |
— | — | @@ -201,16 +267,6 @@ |
202 | 268 | } |
203 | 269 | |
204 | 270 | /** |
205 | | - * Return any table options to be applied to all tables that don't |
206 | | - * override them. |
207 | | - * |
208 | | - * @return Array |
209 | | - */ |
210 | | - public function getTableOptions() { |
211 | | - return array(); |
212 | | - } |
213 | | - |
214 | | - /** |
215 | 271 | * Construct and initialise parent. |
216 | 272 | * This is typically only called from Installer::getDBInstaller() |
217 | 273 | */ |
Index: trunk/phase3/includes/installer/MysqlInstaller.php |
— | — | @@ -111,25 +111,21 @@ |
112 | 112 | return $status; |
113 | 113 | } |
114 | 114 | |
115 | | - public function getConnection() { |
| 115 | + public function openConnection() { |
116 | 116 | $status = Status::newGood(); |
117 | | - if( is_null( $this->db ) ) { |
118 | | - try { |
119 | | - $this->db = new DatabaseMysql( |
120 | | - $this->getVar( 'wgDBserver' ), |
121 | | - $this->getVar( '_InstallUser' ), |
122 | | - $this->getVar( '_InstallPassword' ), |
123 | | - false, |
124 | | - false, |
125 | | - 0, |
126 | | - $this->getVar( 'wgDBprefix' ) |
127 | | - ); |
128 | | - $status->value = $this->db; |
129 | | - } catch ( DBConnectionError $e ) { |
130 | | - $status->fatal( 'config-connection-error', $e->getMessage() ); |
131 | | - } |
132 | | - } else { |
133 | | - $status->value = $this->db; |
| 117 | + try { |
| 118 | + $db = new DatabaseMysql( |
| 119 | + $this->getVar( 'wgDBserver' ), |
| 120 | + $this->getVar( '_InstallUser' ), |
| 121 | + $this->getVar( '_InstallPassword' ), |
| 122 | + false, |
| 123 | + false, |
| 124 | + 0, |
| 125 | + $this->getVar( 'wgDBprefix' ) |
| 126 | + ); |
| 127 | + $status->value = $db; |
| 128 | + } catch ( DBConnectionError $e ) { |
| 129 | + $status->fatal( 'config-connection-error', $e->getMessage() ); |
134 | 130 | } |
135 | 131 | return $status; |
136 | 132 | } |
— | — | @@ -158,9 +154,9 @@ |
159 | 155 | if ( preg_match( '/^latin1/', $row->Collation ) ) { |
160 | 156 | $existingSchema = 'mysql4'; |
161 | 157 | } elseif ( preg_match( '/^utf8/', $row->Collation ) ) { |
162 | | - $existingSchema = 'mysql5'; |
| 158 | + $existingSchema = 'utf8'; |
163 | 159 | } elseif ( preg_match( '/^binary/', $row->Collation ) ) { |
164 | | - $existingSchema = 'mysql5-binary'; |
| 160 | + $existingSchema = 'binary'; |
165 | 161 | } else { |
166 | 162 | $existingSchema = false; |
167 | 163 | $this->parent->showMessage( 'config-unknown-collation' ); |
— | — | @@ -177,11 +173,9 @@ |
178 | 174 | } |
179 | 175 | |
180 | 176 | if ( $existingSchema && $existingSchema != $this->getVar( '_MysqlCharset' ) ) { |
181 | | - $this->parent->showMessage( 'config-mysql-charset-mismatch', $this->getVar( '_MysqlCharset' ), $existingSchema ); |
182 | 177 | $this->setVar( '_MysqlCharset', $existingSchema ); |
183 | 178 | } |
184 | 179 | if ( $existingEngine && $existingEngine != $this->getVar( '_MysqlEngine' ) ) { |
185 | | - $this->parent->showMessage( 'config-mysql-egine-mismatch', $this->getVar( '_MysqlEngine' ), $existingEngine ); |
186 | 180 | $this->setVar( '_MysqlEngine', $existingEngine ); |
187 | 181 | } |
188 | 182 | |
— | — | @@ -445,16 +439,36 @@ |
446 | 440 | return $status; |
447 | 441 | } |
448 | 442 | |
449 | | - public function getTableOptions() { |
450 | | - return array( 'engine' => $this->getVar( '_MysqlEngine' ), |
451 | | - 'default charset' => $this->getVar( '_MysqlCharset' ) ); |
| 443 | + /** |
| 444 | + * Return any table options to be applied to all tables that don't |
| 445 | + * override them. |
| 446 | + * |
| 447 | + * @return String |
| 448 | + */ |
| 449 | + protected function getTableOptions() { |
| 450 | + $options = array(); |
| 451 | + if ( $this->getVar( '_MysqlEngine' ) !== null ) { |
| 452 | + $options[] = "ENGINE=" . $this->getVar( '_MysqlEngine' ); |
| 453 | + } |
| 454 | + if ( $this->getVar( '_MysqlCharset' ) !== null ) { |
| 455 | + $options[] = 'DEFAULT CHARSET=' . $this->getVar( '_MysqlCharset' ); |
| 456 | + } |
| 457 | + return implode( ', ', $options ); |
452 | 458 | } |
453 | 459 | |
| 460 | + /** |
| 461 | + * Get variables to substitute into tables.sql and the SQL patch files. |
| 462 | + */ |
| 463 | + public function getSchemaVars() { |
| 464 | + return array( |
| 465 | + 'wgDBTableOptions' => $this->getTableOptions(), |
| 466 | + ); |
| 467 | + } |
| 468 | + |
454 | 469 | public function getLocalSettings() { |
455 | 470 | $dbmysql5 = wfBoolToStr( $this->getVar( 'wgDBmysql5', true ) ); |
456 | | - $prefix = $this->getVar( 'wgDBprefix' ); |
457 | | - $opts = $this->getTableOptions(); |
458 | | - $tblOpts = "ENGINE=" . $opts['engine'] . ', DEFAULT CHARSET=' . $opts['default charset']; |
| 471 | + $prefix = LocalSettingsGenerator::escapePhpString( $this->getVar( 'wgDBprefix' ) ); |
| 472 | + $tblOpts = LocalSettingsGenerator::escapePhpString( $this->getTableOptions() ); |
459 | 473 | return |
460 | 474 | "# MySQL specific settings |
461 | 475 | \$wgDBprefix = \"{$prefix}\"; |
Index: trunk/phase3/includes/installer/OracleInstaller.php |
— | — | @@ -109,11 +109,11 @@ |
110 | 110 | return $status; |
111 | 111 | } |
112 | 112 | |
113 | | - public function getConnection() { |
| 113 | + public function openConnection() { |
114 | 114 | $status = Status::newGood(); |
115 | 115 | try { |
116 | 116 | if ( $this->useSysDBA ) { |
117 | | - $this->db = new DatabaseOracle( |
| 117 | + $db = new DatabaseOracle( |
118 | 118 | $this->getVar( 'wgDBserver' ), |
119 | 119 | $this->getVar( '_InstallUser' ), |
120 | 120 | $this->getVar( '_InstallPassword' ), |
— | — | @@ -122,7 +122,7 @@ |
123 | 123 | $this->getVar( 'wgDBprefix' ) |
124 | 124 | ); |
125 | 125 | } else { |
126 | | - $this->db = new DatabaseOracle( |
| 126 | + $db = new DatabaseOracle( |
127 | 127 | $this->getVar( 'wgDBserver' ), |
128 | 128 | $this->getVar( 'wgDBuser' ), |
129 | 129 | $this->getVar( 'wgDBpassword' ), |
— | — | @@ -131,7 +131,7 @@ |
132 | 132 | $this->getVar( 'wgDBprefix' ) |
133 | 133 | ); |
134 | 134 | } |
135 | | - $status->value = $this->db; |
| 135 | + $status->value = $db; |
136 | 136 | } catch ( DBConnectionError $e ) { |
137 | 137 | $status->fatal( 'config-connection-error', $e->getMessage() ); |
138 | 138 | } |
— | — | @@ -176,12 +176,6 @@ |
177 | 177 | } |
178 | 178 | |
179 | 179 | if ( !$this->db->selectDB( $this->getVar( 'wgDBuser' ) ) ) { |
180 | | - /** |
181 | | - * The variables $_OracleDefTS, $_OracleTempTS are used by maintenance/oracle/user.sql |
182 | | - * Set here for fetching in DatabaseOracle::replaceVars() |
183 | | - */ |
184 | | - $GLOBALS['_OracleDefTS'] = $this->getVar( '_OracleDefTS' ); |
185 | | - $GLOBALS['_OracleTempTS'] = $this->getVar( '_OracleTempTS' ); |
186 | 180 | $this->db->setFlag( DBO_DDLMODE ); |
187 | 181 | $error = $this->db->sourceFile( "$IP/maintenance/oracle/user.sql" ); |
188 | 182 | if ( $error !== true || !$this->db->selectDB( $this->getVar( 'wgDBuser' ) ) ) { |
— | — | @@ -203,6 +197,15 @@ |
204 | 198 | return $status; |
205 | 199 | } |
206 | 200 | |
| 201 | + public function getSchemaVars() { |
| 202 | + /** |
| 203 | + * The variables $_OracleDefTS, $_OracleTempTS are used by maintenance/oracle/user.sql |
| 204 | + */ |
| 205 | + return array( |
| 206 | + '_OracleDefTS' => $this->getVar( '_OracleDefTS' ), |
| 207 | + '_OracleTempTS' => $this->getVar( '_OracleTempTS' ), |
| 208 | + ); |
| 209 | + } |
207 | 210 | |
208 | 211 | public function getLocalSettings() { |
209 | 212 | $prefix = $this->getVar( 'wgDBprefix' ); |
Index: trunk/phase3/includes/installer/PostgresInstaller.php |
— | — | @@ -98,21 +98,17 @@ |
99 | 99 | return $status; |
100 | 100 | } |
101 | 101 | |
102 | | - function getConnection($database = 'template1') { |
| 102 | + function openConnection( $database = 'template1' ) { |
103 | 103 | $status = Status::newGood(); |
104 | | - if( is_null( $this->db ) ) { |
105 | | - try { |
106 | | - $this->db = new DatabasePostgres( |
107 | | - $this->getVar( 'wgDBserver' ), |
108 | | - $this->getVar( '_InstallUser' ), |
109 | | - $this->getVar( '_InstallPassword' ), |
110 | | - $database ); |
111 | | - $status->value = $this->db; |
112 | | - } catch ( DBConnectionError $e ) { |
113 | | - $status->fatal( 'config-connection-error', $e->getMessage() ); |
114 | | - } |
115 | | - } else { |
116 | | - $status->value = $this->db; |
| 104 | + try { |
| 105 | + $db = new DatabasePostgres( |
| 106 | + $this->getVar( 'wgDBserver' ), |
| 107 | + $this->getVar( '_InstallUser' ), |
| 108 | + $this->getVar( '_InstallPassword' ), |
| 109 | + $database ); |
| 110 | + $status->value = $db; |
| 111 | + } catch ( DBConnectionError $e ) { |
| 112 | + $status->fatal( 'config-connection-error', $e->getMessage() ); |
117 | 113 | } |
118 | 114 | return $status; |
119 | 115 | } |
Index: trunk/phase3/includes/AutoLoader.php |
— | — | @@ -396,8 +396,10 @@ |
397 | 397 | 'LBFactory' => 'includes/db/LBFactory.php', |
398 | 398 | 'LBFactory_Multi' => 'includes/db/LBFactory_Multi.php', |
399 | 399 | 'LBFactory_Simple' => 'includes/db/LBFactory.php', |
| 400 | + 'LBFactory_Single' => 'includes/db/LBFactory_Single.php', |
400 | 401 | 'LikeMatch' => 'includes/db/Database.php', |
401 | 402 | 'LoadBalancer' => 'includes/db/LoadBalancer.php', |
| 403 | + 'LoadBalancer_Single' => 'includes/db/LBFactory_Single.php', |
402 | 404 | 'LoadMonitor' => 'includes/db/LoadMonitor.php', |
403 | 405 | 'LoadMonitor_MySQL' => 'includes/db/LoadMonitor.php', |
404 | 406 | 'MySQLField' => 'includes/db/DatabaseMysql.php', |