r63374 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63373‎ | r63374 | r63375 >
Date:22:31, 7 March 2010
Author:freakolowsky
Status:ok (Comments)
Tags:
Comment:
Started working on Oracle support.
Modified paths:
  • /branches/new-installer/phase3/includes/AutoLoader.php (modified) (history)
  • /branches/new-installer/phase3/includes/GlobalFunctions.php (modified) (history)
  • /branches/new-installer/phase3/includes/db/SchemaBuilder.php (modified) (history)
  • /branches/new-installer/phase3/includes/installer/Installer.php (modified) (history)
  • /branches/new-installer/phase3/languages/messages/MessagesEn.php (modified) (history)

Diff [purge]

Index: branches/new-installer/phase3/includes/GlobalFunctions.php
@@ -3362,3 +3362,14 @@
33633363 $langCode = implode ( '-' , $codeBCP );
33643364 return $langCode;
33653365 }
 3366+
 3367+function wfArrayMap( $function, $input ) {
 3368+ $ret = array_map( $function, $input );
 3369+ foreach ( $ret as $key => $value ) {
 3370+ $taint = istainted( $input[$key] );
 3371+ if ( $taint ) {
 3372+ taint( $ret[$key], $taint );
 3373+ }
 3374+ }
 3375+ return $ret;
 3376+}
Index: branches/new-installer/phase3/includes/db/SchemaBuilder.php
@@ -485,4 +485,89 @@
486486 protected function updateTable( $name, $definition, $db ) {
487487 return '';
488488 }
489 -}
\ No newline at end of file
 489+}
 490+
 491+class OracleSchema extends SchemaBuilder {
 492+
 493+ public function getType() {
 494+ return 'oracle';
 495+ }
 496+
 497+ protected function adjustTablesForDatabase() {
 498+ $this->tables['searchindex'] = array(
 499+ 'prefix' => 'si',
 500+ 'fields' => array(
 501+ 'page' => array(
 502+ 'type' => 'int',
 503+ 'null' => false,
 504+ ),
 505+ 'title' => array(
 506+ 'type' => 'varchar',
 507+ 'length' => 255,
 508+ 'null' => false,
 509+ 'default' => '',
 510+ ),
 511+ 'text' => array(
 512+ 'type' => 'text',
 513+ 'null' => false,
 514+ ),
 515+ ),
 516+ 'indexes' => array(
 517+ 'si_page' => array(
 518+ 'UNIQUE', 'page',
 519+ ),
 520+ 'si_title' => array(
 521+ 'CTXSYS.CONTEXT', 'title',
 522+ ),
 523+ 'si_text' => array(
 524+ 'CTXSYS.CONTEXT', 'text',
 525+ ),
 526+ ),
 527+ );
 528+ }
 529+
 530+ protected function createTable( $name, $def ) {
 531+ $prefix = $def['prefix'] ? $def['prefix'] . '_' : '';
 532+ $tblName = $this->tblPrefix . $name;
 533+
 534+ $sql = "CREATE TABLE $tblName (";
 535+ foreach( $def['fields'] as $field => $attribs ) {
 536+ $sql .= "\n\t{$prefix}{$field} " . $this->getFieldDefinition( $attribs );
 537+ }
 538+ $sql = rtrim( $sql, ',' );
 539+ $sql .= ");\n";
 540+
 541+ $idx_i = 0;
 542+ $idx_u = 0;
 543+ if( isset( $def['indexes'] ) ) {
 544+ foreach( $def['indexes'] as $idx => $idxDef ) {
 545+ $idxType = '';
 546+ if (isset($idxDef[1])) {
 547+ $idxType = array_shift( $idxDef );
 548+ }
 549+
 550+ if( $idxType === 'UNIQUE' ) {
 551+ $sql .= "CREATE UNIQUE INDEX {$tblName}_u".
 552+ str_pad(++$idx_u, 2, "0", STR_PAD_LEFT).
 553+ " ON {$tblName} (";
 554+ } elseif ($idxType !== '') {
 555+ $sql .= "CREATE INDEX {$this->tblPrefix}{$idx} ON {$tblName} (";
 556+ } else {
 557+ $sql .= "CREATE INDEX {$tblName}_u".
 558+ str_pad(++$idx_i, 2, "0", STR_PAD_LEFT).
 559+ " ON {$tblName} (";
 560+ }
 561+
 562+ foreach( $idxDef as $col ) {
 563+ $sql .= "{$prefix}{$col}, ";
 564+ }
 565+ $sql = rtrim( $sql, ', ' );
 566+ $sql .= ");\n";
 567+ }
 568+ }
 569+ return $sql . "\n";
 570+ }
 571+
 572+ protected function updateTable( $name, $definition, $db ) {}
 573+
 574+}
Index: branches/new-installer/phase3/includes/installer/Installer.php
@@ -82,7 +82,8 @@
8383 var $dbTypes = array(
8484 'mysql',
8585 'postgres',
86 - 'sqlite'
 86+ 'sqlite',
 87+ 'oracle'
8788 );
8889
8990 /**
Index: branches/new-installer/phase3/includes/AutoLoader.php
@@ -433,6 +433,7 @@
434434 'MysqlInstaller' => 'includes/installer/MysqlInstaller.php',
435435 'PostgresInstaller' => 'includes/installer/PostgresInstaller.php',
436436 'SqliteInstaller' => 'includes/installer/SqliteInstaller.php',
 437+ 'OracleInstaller' => 'includes/installer/OracleInstaller.php',
437438
438439 # includes/media
439440 'BitmapHandler' => 'includes/media/Bitmap.php',
Index: branches/new-installer/phase3/languages/messages/MessagesEn.php
@@ -4274,9 +4274,11 @@
42754275 'config-type-mysql' => 'MySQL',
42764276 'config-type-postgres' => 'PostgreSQL',
42774277 'config-type-sqlite' => 'SQLite',
 4278+'config-type-oracle' => 'Oracle',
42784279 'config-header-mysql' => 'MySQL settings',
42794280 'config-header-postgres' => 'PostgreSQL settings',
42804281 'config-header-sqlite' => 'SQLite settings',
 4282+'config-header-oracle' => 'Oracle settings',
42814283 'config-invalid-db-type' => 'Invalid database type',
42824284 'config-missing-db-name' => 'You must enter a value for "Database name"',
42834285 'config-invalid-db-name' => 'Invalid database name "$1". It may only contain numbers, letters and underscores.',

Follow-up revisions

RevisionCommit summaryAuthorDate
r63392Followup r63374, add keys to messages.incdemon14:18, 8 March 2010

Comments

#Comment by 😂 (talk | contribs)   02:10, 8 March 2010
  1. Is there a reason you're introducing wfArrayMap() in this commit?
  2. New messages need adding to messages.inc.
#Comment by Freakolowsky (talk | contribs)   08:23, 8 March 2010

wfArrayMap was used in Installer.php (in the installer branch), but was declared in Installer.php (in old config). I was getting function not declared error.

Always forget about that messages.inc. Will fix

Status & tagging log