-<?php\r
-/**\r
- * IBM_DB2-specific installer.\r
- *\r
- * @file\r
- * @ingroup Deployment\r
- */\r
-\r
-/**\r
- * Class for setting up the MediaWiki database using IBM_DB2.\r
- *\r
- * @ingroup Deployment\r
- * @since 1.17\r
- */\r
-class Ibm_db2Installer extends DatabaseInstaller {\r
-\r
-\r
- protected $globalNames = array(\r
- 'wgDBserver',\r
- 'wgDBport',\r
- 'wgDBname',\r
- 'wgDBuser',\r
- 'wgDBpassword',\r
- 'wgDBmwschema',\r
- );\r
-\r
- /**\r
- * Get the DB2 database extension name\r
- * @return string\r
- */\r
- public function getName(){\r
- return 'ibm_db2';\r
- }\r
-\r
- /**\r
- * Determine whether the DB2 database extension is currently available in PHP\r
- * @return boolean\r
- */\r
- public function isCompiled() {\r
- return self::checkExtension( 'ibm_db2' );\r
- }\r
-\r
- /**\r
- * Generate a connection form for a DB2 database\r
- * @return string\r
- */\r
- public function getConnectForm() {\r
- return\r
- $this->getTextBox( 'wgDBserver', 'config-db-host', array(), $this->parent->getHelpBox( 'config-db-host-help' ) ) .\r
- $this->getTextBox( 'wgDBport', 'config-db-port', array(), $this->parent->getHelpBox( 'config-db-port' ) ) .\r
- Html::openElement( 'fieldset' ) .\r
- Html::element( 'legend', array(), wfMsg( 'config-db-wiki-settings' ) ) .\r
- $this->getTextBox( 'wgDBname', 'config-db-name', array(), $this->parent->getHelpBox( 'config-db-name-help' ) ) .\r
- $this->getTextBox( 'wgDBmwschema', 'config-db-schema', array(), $this->parent->getHelpBox( 'config-db-schema-help' ) ) .\r
- Html::closeElement( 'fieldset' ) .\r
- $this->getInstallUserBox();\r
- }\r
-\r
- /**\r
- * Validate and then execute the connection form for a DB2 database\r
- * @return Status\r
- */\r
- public function submitConnectForm() {\r
- // Get variables from the request\r
- $newValues = $this->setVarsFromRequest( \r
- array( 'wgDBserver', 'wgDBport', 'wgDBname', \r
- 'wgDBmwschema', 'wgDBuser', 'wgDBpassword' ) );\r
-\r
- // Validate them\r
- $status = Status::newGood();\r
- if ( !strlen( $newValues['wgDBname'] ) ) {\r
- $status->fatal( 'config-missing-db-name' );\r
- } elseif ( !preg_match( '/^[a-zA-Z0-9_]+$/', $newValues['wgDBname'] ) ) {\r
- $status->fatal( 'config-invalid-db-name', $newValues['wgDBname'] );\r
- }\r
- if ( !strlen( $newValues['wgDBmwschema'] ) ) {\r
- $status->fatal( 'config-invalid-schema' );\r
- }\r
- elseif ( !preg_match( '/^[a-zA-Z0-9_]*$/', $newValues['wgDBmwschema'] ) ) {\r
- $status->fatal( 'config-invalid-schema', $newValues['wgDBmwschema'] );\r
- }\r
- if ( !strlen( $newValues['wgDBport'] ) ) {\r
- $status->fatal( 'config-invalid-port' );\r
- }\r
- elseif ( !preg_match( '/^[0-9_]*$/', $newValues['wgDBport'] ) ) {\r
- $status->fatal( 'config-invalid-port', $newValues['wgDBport'] );\r
- }\r
-\r
- // Submit user box\r
- if ( $status->isOK() ) {\r
- $status->merge( $this->submitInstallUserBox() );\r
- }\r
- if ( !$status->isOK() ) {\r
- return $status;\r
- }\r
-\r
- global $wgDBport;\r
- $wgDBport = $newValues['wgDBport'];\r
-\r
- // Try to connect\r
- $status->merge( $this->getConnection() );\r
- if ( !$status->isOK() ) {\r
- return $status;\r
- }\r
-\r
- $this->parent->setVar( 'wgDBuser', $this->getVar( '_InstallUser' ) );\r
- $this->parent->setVar( 'wgDBpassword', $this->getVar( '_InstallPassword' ) );\r
-\r
- return $status;\r
- \r
- }\r
-\r
- /**\r
- * Open a DB2 database connection\r
- * @return Status\r
- */\r
- public function openConnection() {\r
- $status = Status::newGood();\r
- try {\r
- $db = new DatabaseIbm_db2(\r
- $this->getVar( 'wgDBserver' ),\r
- $this->getVar( '_InstallUser' ),\r
- $this->getVar( '_InstallPassword' ),\r
- $this->getVar( 'wgDBname' ),\r
- 0,\r
- $this->getVar( 'wgDBmwschema' )\r
- );\r
- $status->value = $db;\r
- } catch ( DBConnectionError $e ) {\r
- $status->fatal( 'config-connection-error', $e->getMessage() );\r
- }\r
- return $status;\r
- }\r
-\r
- /**\r
- * Create a DB2 database for MediaWiki\r
- * @return Status\r
- */\r
- public function setupDatabase() {\r
- $status = $this->getConnection();\r
- if ( !$status->isOK() ) {\r
- return $status;\r
- }\r
- $conn = $status->value;\r
- $dbName = $this->getVar( 'wgDBname' );\r
- if( !$conn->selectDB( $dbName ) ) {\r
- $conn->query( "CREATE DATABASE "\r
- . $conn->addIdentifierQuotes( $dbName ) \r
- . " AUTOMATIC STORAGE YES"\r
- . " USING CODESET UTF-8 TERRITORY US COLLATE USING SYSTEM"\r
- . " PAGESIZE 32768", __METHOD__ );\r
- $conn->selectDB( $dbName );\r
- }\r
- $this->setupSchemaVars();\r
- return $status;\r
- }\r
-\r
- /**\r
- * Create tables from scratch.\r
- * First check if pagesize >= 32k.\r
- *\r
- * @return Status\r
- */\r
- public function createTables() {\r
- $status = $this->getConnection();\r
- if ( !$status->isOK() ) {\r
- return $status;\r
- }\r
- $this->db->selectDB( $this->getVar( 'wgDBname' ) );\r
-\r
- if( $this->db->tableExists( 'user' ) ) {\r
- $status->warning( 'config-install-tables-exist' );\r
- return $status;\r
- }\r
-\r
- /* Check for pagesize */\r
- $status = $this->checkPageSize();\r
- if ( !$status->isOK() ) {\r
- return $status;\r
- }\r
-\r
- $this->db->setFlag( DBO_DDLMODE ); // For Oracle's handling of schema files\r
- $this->db->begin( __METHOD__ );\r
-\r
- $error = $this->db->sourceFile( $this->db->getSchema() );\r
- if( $error !== true ) {\r
- $this->db->reportQueryError( $error, 0, '', __METHOD__ );\r
- $this->db->rollback( __METHOD__ );\r
- $status->fatal( 'config-install-tables-failed', $error );\r
- } else {\r
- $this->db->commit( __METHOD__ );\r
- }\r
- // Resume normal operations\r
- if( $status->isOk() ) {\r
- $this->enableLB();\r
- }\r
- return $status;\r
- }\r
-\r
- /**\r
- * Check if database has a tablspace with pagesize >= 32k.\r
- *\r
- * @return Status\r
- */\r
- public function checkPageSize() {\r
- $status = $this->getConnection();\r
- if ( !$status->isOK() ) {\r
- return $status;\r
- }\r
- $this->db->selectDB( $this->getVar( 'wgDBname' ) );\r
-\r
- try {\r
- $result = $this->db->query( 'SELECT PAGESIZE FROM SYSCAT.TABLESPACES' );\r
- if( $result == false ) {\r
- $status->fatal( 'config-connection-error', '' );\r
- }\r
- else {\r
- $nRows = $this->db->numRows( $result );\r
- while ( $row = $row = $this->db->fetchRow( $result ) ) {\r
- if( $row[0] >= 32768 ) {\r
- return $status;\r
- }\r
- }\r
- $status->fatal( 'config-ibm_db2-low-db-pagesize', '' );\r
- }\r
- } catch ( DBUnexpectedError $e ) {\r
- $status->fatal( 'config-connection-error', $e->getMessage() );\r
- }\r
-\r
- return $status;\r
- }\r
-\r
- /**\r
- * Generate the code to store the DB2-specific settings defined by the configuration form\r
- * @return string\r
- */\r
- public function getLocalSettings() {\r
- $schema = LocalSettingsGenerator::escapePhpString( $this->getVar( 'wgDBmwschema' ) );\r
- $port = LocalSettingsGenerator::escapePhpString( $this->getVar( 'wgDBport' ) );\r
- return\r
-"# IBM_DB2 specific settings\r
-\$wgDBmwschema = \"{$schema}\";\r
-\$wgDBport = \"{$port}\";";\r
- }\r
-\r
- public function __construct($parent) {\r
- parent::__construct($parent);\r
- }\r
-}\r
-?>\r
+<?php
+/**
+ * IBM_DB2-specific installer.
+ *
+ * @file
+ * @ingroup Deployment
+ */
+
+/**
+ * Class for setting up the MediaWiki database using IBM_DB2.
+ *
+ * @ingroup Deployment
+ * @since 1.17
+ */
+class Ibm_db2Installer extends DatabaseInstaller {
+
+
+ protected $globalNames = array(
+ 'wgDBserver',
+ 'wgDBport',
+ 'wgDBname',
+ 'wgDBuser',
+ 'wgDBpassword',
+ 'wgDBmwschema',
+ );
+
+ /**
+ * Get the DB2 database extension name
+ * @return string
+ */
+ public function getName(){
+ return 'ibm_db2';
+ }
+
+ /**
+ * Determine whether the DB2 database extension is currently available in PHP
+ * @return boolean
+ */
+ public function isCompiled() {
+ return self::checkExtension( 'ibm_db2' );
+ }
+
+ /**
+ * Generate a connection form for a DB2 database
+ * @return string
+ */
+ public function getConnectForm() {
+ return
+ $this->getTextBox( 'wgDBserver', 'config-db-host', array(), $this->parent->getHelpBox( 'config-db-host-help' ) ) .
+ $this->getTextBox( 'wgDBport', 'config-db-port', array(), $this->parent->getHelpBox( 'config-db-port' ) ) .
+ Html::openElement( 'fieldset' ) .
+ Html::element( 'legend', array(), wfMsg( 'config-db-wiki-settings' ) ) .
+ $this->getTextBox( 'wgDBname', 'config-db-name', array(), $this->parent->getHelpBox( 'config-db-name-help' ) ) .
+ $this->getTextBox( 'wgDBmwschema', 'config-db-schema', array(), $this->parent->getHelpBox( 'config-db-schema-help' ) ) .
+ Html::closeElement( 'fieldset' ) .
+ $this->getInstallUserBox();
+ }
+
+ /**
+ * Validate and then execute the connection form for a DB2 database
+ * @return Status
+ */
+ public function submitConnectForm() {
+ // Get variables from the request
+ $newValues = $this->setVarsFromRequest(
+ array( 'wgDBserver', 'wgDBport', 'wgDBname',
+ 'wgDBmwschema', 'wgDBuser', 'wgDBpassword' ) );
+
+ // Validate them
+ $status = Status::newGood();
+ if ( !strlen( $newValues['wgDBname'] ) ) {
+ $status->fatal( 'config-missing-db-name' );
+ } elseif ( !preg_match( '/^[a-zA-Z0-9_]+$/', $newValues['wgDBname'] ) ) {
+ $status->fatal( 'config-invalid-db-name', $newValues['wgDBname'] );
+ }
+ if ( !strlen( $newValues['wgDBmwschema'] ) ) {
+ $status->fatal( 'config-invalid-schema' );
+ }
+ elseif ( !preg_match( '/^[a-zA-Z0-9_]*$/', $newValues['wgDBmwschema'] ) ) {
+ $status->fatal( 'config-invalid-schema', $newValues['wgDBmwschema'] );
+ }
+ if ( !strlen( $newValues['wgDBport'] ) ) {
+ $status->fatal( 'config-invalid-port' );
+ }
+ elseif ( !preg_match( '/^[0-9_]*$/', $newValues['wgDBport'] ) ) {
+ $status->fatal( 'config-invalid-port', $newValues['wgDBport'] );
+ }
+
+ // Submit user box
+ if ( $status->isOK() ) {
+ $status->merge( $this->submitInstallUserBox() );
+ }
+ if ( !$status->isOK() ) {
+ return $status;
+ }
+
+ global $wgDBport;
+ $wgDBport = $newValues['wgDBport'];
+
+ // Try to connect
+ $status->merge( $this->getConnection() );
+ if ( !$status->isOK() ) {
+ return $status;
+ }
+
+ $this->parent->setVar( 'wgDBuser', $this->getVar( '_InstallUser' ) );
+ $this->parent->setVar( 'wgDBpassword', $this->getVar( '_InstallPassword' ) );
+
+ return $status;
+
+ }
+
+ /**
+ * Open a DB2 database connection
+ * @return Status
+ */
+ public function openConnection() {
+ $status = Status::newGood();
+ try {
+ $db = new DatabaseIbm_db2(
+ $this->getVar( 'wgDBserver' ),
+ $this->getVar( '_InstallUser' ),
+ $this->getVar( '_InstallPassword' ),
+ $this->getVar( 'wgDBname' ),
+ 0,
+ $this->getVar( 'wgDBmwschema' )
+ );
+ $status->value = $db;
+ } catch ( DBConnectionError $e ) {
+ $status->fatal( 'config-connection-error', $e->getMessage() );
+ }
+ return $status;
+ }
+
+ /**
+ * Create a DB2 database for MediaWiki
+ * @return Status
+ */
+ public function setupDatabase() {
+ $status = $this->getConnection();
+ if ( !$status->isOK() ) {
+ return $status;
+ }
+ $conn = $status->value;
+ $dbName = $this->getVar( 'wgDBname' );
+ if( !$conn->selectDB( $dbName ) ) {
+ $conn->query( "CREATE DATABASE "
+ . $conn->addIdentifierQuotes( $dbName )
+ . " AUTOMATIC STORAGE YES"
+ . " USING CODESET UTF-8 TERRITORY US COLLATE USING SYSTEM"
+ . " PAGESIZE 32768", __METHOD__ );
+ $conn->selectDB( $dbName );
+ }
+ $this->setupSchemaVars();
+ return $status;
+ }
+
+ /**
+ * Create tables from scratch.
+ * First check if pagesize >= 32k.
+ *
+ * @return Status
+ */
+ public function createTables() {
+ $status = $this->getConnection();
+ if ( !$status->isOK() ) {
+ return $status;
+ }
+ $this->db->selectDB( $this->getVar( 'wgDBname' ) );
+
+ if( $this->db->tableExists( 'user' ) ) {
+ $status->warning( 'config-install-tables-exist' );
+ return $status;
+ }
+
+ /* Check for pagesize */
+ $status = $this->checkPageSize();
+ if ( !$status->isOK() ) {
+ return $status;
+ }
+
+ $this->db->setFlag( DBO_DDLMODE ); // For Oracle's handling of schema files
+ $this->db->begin( __METHOD__ );
+
+ $error = $this->db->sourceFile( $this->db->getSchema() );
+ if( $error !== true ) {
+ $this->db->reportQueryError( $error, 0, '', __METHOD__ );
+ $this->db->rollback( __METHOD__ );
+ $status->fatal( 'config-install-tables-failed', $error );
+ } else {
+ $this->db->commit( __METHOD__ );
+ }
+ // Resume normal operations
+ if( $status->isOk() ) {
+ $this->enableLB();
+ }
+ return $status;
+ }
+
+ /**
+ * Check if database has a tablspace with pagesize >= 32k.
+ *
+ * @return Status
+ */
+ public function checkPageSize() {
+ $status = $this->getConnection();
+ if ( !$status->isOK() ) {
+ return $status;
+ }
+ $this->db->selectDB( $this->getVar( 'wgDBname' ) );
+
+ try {
+ $result = $this->db->query( 'SELECT PAGESIZE FROM SYSCAT.TABLESPACES' );
+ if( $result == false ) {
+ $status->fatal( 'config-connection-error', '' );
+ }
+ else {
+ $nRows = $this->db->numRows( $result );
+ while ( $row = $row = $this->db->fetchRow( $result ) ) {
+ if( $row[0] >= 32768 ) {
+ return $status;
+ }
+ }
+ $status->fatal( 'config-ibm_db2-low-db-pagesize', '' );
+ }
+ } catch ( DBUnexpectedError $e ) {
+ $status->fatal( 'config-connection-error', $e->getMessage() );
+ }
+
+ return $status;
+ }
+
+ /**
+ * Generate the code to store the DB2-specific settings defined by the configuration form
+ * @return string
+ */
+ public function getLocalSettings() {
+ $schema = LocalSettingsGenerator::escapePhpString( $this->getVar( 'wgDBmwschema' ) );
+ $port = LocalSettingsGenerator::escapePhpString( $this->getVar( 'wgDBport' ) );
+ return
+"# IBM_DB2 specific settings
+\$wgDBmwschema = \"{$schema}\";
+\$wgDBport = \"{$port}\";";
+ }
+
+ public function __construct($parent) {
+ parent::__construct($parent);
+ }
+}
\ No newline at end of file
-<?php\r
-/**\r
- * IBM_DB2-specific updater.\r
- *\r
- * @file\r
- * @ingroup Deployment\r
- */\r
-\r
-/**\r
- * Class for handling updates to IBM_DB2 databases.\r
- *\r
- * @ingroup Deployment\r
- * @since 1.17\r
- */\r
-class Ibm_db2Updater extends DatabaseUpdater {\r
-\r
- /**\r
- * Get the changes in the DB2 database scheme since MediaWiki 1.14\r
- * @return array \r
- */\r
- protected function getCoreUpdateList() {\r
- return array(\r
- // 1.14\r
- array( 'addField', 'site_stats', 'ss_active_users', 'patch-ss_active_users.sql' ),\r
- array( 'addField', 'ipblocks', 'ipb_allow_usertalk', 'patch-ipb_allow_usertalk.sql' ),\r
- \r
- // 1.15\r
- array( 'addTable', 'change_tag', 'patch-change_tag.sql' ),\r
- array( 'addTable', 'tag_summary', 'patch-change_tag_summary.sql' ),\r
- array( 'addTable', 'valid_tag', 'patch-change_valid_tag.sql' ),\r
- \r
- // 1.16\r
- array( 'addTable', 'user_properties', 'patch-user_properties.sql' ),\r
- array( 'addTable', 'log_search', 'patch-log_search.sql' ),\r
- array( 'addField', 'logging', 'log_user_text', 'patch-log_user_text.sql' ),\r
- array( 'addTable', 'l10n_cache', 'patch-l10n_cache.sql' ),\r
- array( 'addTable', 'external_user', 'patch-external_user.sql' ),\r
- array( 'addIndex', 'log_search', 'ls_field_val', 'patch-log_search-rename-index.sql' ),\r
- array( 'addIndex', 'change_tag', 'change_tag_rc_tag', 'patch-change_tag-indexes.sql' ),\r
- array( 'addField', 'redirect', 'rd_interwiki', 'patch-rd_interwiki.sql' ),\r
- \r
- // 1.17\r
- array( 'addTable', 'iwlinks', 'patch-iwlinks.sql' ),\r
- array( 'addField', 'updatelog', 'ul_value', 'patch-ul_value.sql' ),\r
- array( 'addField', 'interwiki', 'iw_api', 'patch-iw_api_and_wikiid.sql' ),\r
- array( 'addField', 'categorylinks', 'cl_collation', 'patch-categorylinks-better-collation.sql' ),\r
- array( 'addTable', 'msg_resource', 'patch-msg_resource.sql' ),\r
- array( 'addTable', 'module_deps', 'patch-module_deps.sql' ),\r
-\r
- // Tables\r
- array( 'addTable', 'iwlinks', 'patch-iwlinks.sql' ),\r
- array( 'addTable', 'msg_resource_links', 'patch-msg_resource_links.sql' ),\r
- array( 'addTable', 'msg_resource', 'patch-msg_resource.sql' ),\r
- array( 'addTable', 'module_deps', 'patch-module_deps.sql' ),\r
- \r
- // Indexes\r
- array( 'addIndex', 'msg_resource_links', 'uq61_msg_resource_links', 'patch-uq_61_msg_resource_links.sql' ),\r
- array( 'addIndex', 'msg_resource', 'uq81_msg_resource', 'patch-uq_81_msg_resource.sql' ),\r
- array( 'addIndex', 'module_deps', 'uq96_module_deps', 'patch-uq_96_module_deps.sql' ),\r
- \r
- // Fields\r
- array( 'addField', 'categorylinks', 'cl_sortkey_prefix', 'patch-cl_sortkey_prefix-field.sql' ),\r
- array( 'addField', 'categorylinks', 'cl_collation', 'patch-cl_collation-field.sql' ),\r
- array( 'addField', 'categorylinks', 'cl_type', 'patch-cl_type-field.sql' ),\r
- array( 'addField', 'interwiki', 'iw_api', 'patch-iw_api-field.sql' ),\r
- array( 'addField', 'interwiki', 'iw_wikiid', 'patch-iw_wikiid-field.sql' )\r
- );\r
- }\r
-}\r
-?>\r
+<?php
+/**
+ * IBM_DB2-specific updater.
+ *
+ * @file
+ * @ingroup Deployment
+ */
+
+/**
+ * Class for handling updates to IBM_DB2 databases.
+ *
+ * @ingroup Deployment
+ * @since 1.17
+ */
+class Ibm_db2Updater extends DatabaseUpdater {
+
+ /**
+ * Get the changes in the DB2 database scheme since MediaWiki 1.14
+ * @return array
+ */
+ protected function getCoreUpdateList() {
+ return array(
+ // 1.14
+ array( 'addField', 'site_stats', 'ss_active_users', 'patch-ss_active_users.sql' ),
+ array( 'addField', 'ipblocks', 'ipb_allow_usertalk', 'patch-ipb_allow_usertalk.sql' ),
+
+ // 1.15
+ array( 'addTable', 'change_tag', 'patch-change_tag.sql' ),
+ array( 'addTable', 'tag_summary', 'patch-change_tag_summary.sql' ),
+ array( 'addTable', 'valid_tag', 'patch-change_valid_tag.sql' ),
+
+ // 1.16
+ array( 'addTable', 'user_properties', 'patch-user_properties.sql' ),
+ array( 'addTable', 'log_search', 'patch-log_search.sql' ),
+ array( 'addField', 'logging', 'log_user_text', 'patch-log_user_text.sql' ),
+ array( 'addTable', 'l10n_cache', 'patch-l10n_cache.sql' ),
+ array( 'addTable', 'external_user', 'patch-external_user.sql' ),
+ array( 'addIndex', 'log_search', 'ls_field_val', 'patch-log_search-rename-index.sql' ),
+ array( 'addIndex', 'change_tag', 'change_tag_rc_tag', 'patch-change_tag-indexes.sql' ),
+ array( 'addField', 'redirect', 'rd_interwiki', 'patch-rd_interwiki.sql' ),
+
+ // 1.17
+ array( 'addTable', 'iwlinks', 'patch-iwlinks.sql' ),
+ array( 'addField', 'updatelog', 'ul_value', 'patch-ul_value.sql' ),
+ array( 'addField', 'interwiki', 'iw_api', 'patch-iw_api_and_wikiid.sql' ),
+ array( 'addField', 'categorylinks', 'cl_collation', 'patch-categorylinks-better-collation.sql' ),
+ array( 'addTable', 'msg_resource', 'patch-msg_resource.sql' ),
+ array( 'addTable', 'module_deps', 'patch-module_deps.sql' ),
+
+ // Tables
+ array( 'addTable', 'iwlinks', 'patch-iwlinks.sql' ),
+ array( 'addTable', 'msg_resource_links', 'patch-msg_resource_links.sql' ),
+ array( 'addTable', 'msg_resource', 'patch-msg_resource.sql' ),
+ array( 'addTable', 'module_deps', 'patch-module_deps.sql' ),
+
+ // Indexes
+ array( 'addIndex', 'msg_resource_links', 'uq61_msg_resource_links', 'patch-uq_61_msg_resource_links.sql' ),
+ array( 'addIndex', 'msg_resource', 'uq81_msg_resource', 'patch-uq_81_msg_resource.sql' ),
+ array( 'addIndex', 'module_deps', 'uq96_module_deps', 'patch-uq_96_module_deps.sql' ),
+
+ // Fields
+ array( 'addField', 'categorylinks', 'cl_sortkey_prefix', 'patch-cl_sortkey_prefix-field.sql' ),
+ array( 'addField', 'categorylinks', 'cl_collation', 'patch-cl_collation-field.sql' ),
+ array( 'addField', 'categorylinks', 'cl_type', 'patch-cl_type-field.sql' ),
+ array( 'addField', 'interwiki', 'iw_api', 'patch-iw_api-field.sql' ),
+ array( 'addField', 'interwiki', 'iw_wikiid', 'patch-iw_wikiid-field.sql' )
+ );
+ }
+}
\ No newline at end of file
---\r
--- patch-categorylinks-better-collation.sql\r
---\r
---\r
--- Track category inclusions *used inline*\r
--- This tracks a single level of category membership\r
--- (folksonomic tagging, really).\r
---\r
-CREATE TABLE categorylinks (\r
- cl_from BIGINT NOT NULL DEFAULT 0,\r
- -- REFERENCES page(page_id) ON DELETE CASCADE,\r
- cl_to VARCHAR(255) NOT NULL,\r
- -- cl_sortkey has to be at least 86 wide \r
- -- in order to be compatible with the old MySQL schema from MW 1.10\r
- --cl_sortkey VARCHAR(86),\r
- cl_sortkey VARCHAR(230) FOR BIT DATA NOT NULL ,\r
- cl_sortkey_prefix VARCHAR(255) FOR BIT DATA NOT NULL ,\r
- cl_timestamp TIMESTAMP(3) NOT NULL,\r
- cl_collation VARCHAR(32) FOR BIT DATA NOT NULL ,\r
- cl_type VARCHAR(6) FOR BIT DATA NOT NULL\r
-);\r
+--
+-- patch-categorylinks-better-collation.sql
+--
+--
+-- Track category inclusions *used inline*
+-- This tracks a single level of category membership
+-- (folksonomic tagging, really).
+--
+CREATE TABLE categorylinks (
+ cl_from BIGINT NOT NULL DEFAULT 0,
+ -- REFERENCES page(page_id) ON DELETE CASCADE,
+ cl_to VARCHAR(255) NOT NULL,
+ -- cl_sortkey has to be at least 86 wide
+ -- in order to be compatible with the old MySQL schema from MW 1.10
+ --cl_sortkey VARCHAR(86),
+ cl_sortkey VARCHAR(230) FOR BIT DATA NOT NULL ,
+ cl_sortkey_prefix VARCHAR(255) FOR BIT DATA NOT NULL ,
+ cl_timestamp TIMESTAMP(3) NOT NULL,
+ cl_collation VARCHAR(32) FOR BIT DATA NOT NULL ,
+ cl_type VARCHAR(6) FOR BIT DATA NOT NULL
+);
-CREATE UNIQUE INDEX change_tag_rc_tag ON change_tag (ct_rc_id,ct_tag);\r
-CREATE UNIQUE INDEX change_tag_log_tag ON change_tag (ct_log_id,ct_tag);\r
-CREATE UNIQUE INDEX change_tag_rev_tag ON change_tag (ct_rev_id,ct_tag);\r
--- Covering index, so we can pull all the info only out of the index.\r
-CREATE INDEX change_tag_tag_id ON change_tag (ct_tag,ct_rc_id,ct_rev_id,ct_log_id);\r
+CREATE UNIQUE INDEX change_tag_rc_tag ON change_tag (ct_rc_id,ct_tag);
+CREATE UNIQUE INDEX change_tag_log_tag ON change_tag (ct_log_id,ct_tag);
+CREATE UNIQUE INDEX change_tag_rev_tag ON change_tag (ct_rev_id,ct_tag);
+-- Covering index, so we can pull all the info only out of the index.
+CREATE INDEX change_tag_tag_id ON change_tag (ct_tag,ct_rc_id,ct_rev_id,ct_log_id);
--- A table to track tags for revisions, logs and recent changes.\r
-CREATE TABLE change_tag (\r
- ct_rc_id INTEGER,\r
- ct_log_id INTEGER,\r
- ct_rev_id INTEGER,\r
- ct_tag varchar(255) NOT NULL,\r
- ct_params CLOB(64K) INLINE LENGTH 4096\r
-);\r
+-- A table to track tags for revisions, logs and recent changes.
+CREATE TABLE change_tag (
+ ct_rc_id INTEGER,
+ ct_log_id INTEGER,
+ ct_rev_id INTEGER,
+ ct_tag varchar(255) NOT NULL,
+ ct_params CLOB(64K) INLINE LENGTH 4096
+);
--- Rollup table to pull a LIST of tags simply\r
-CREATE TABLE tag_summary (\r
- ts_rc_id INTEGER,\r
- ts_log_id INTEGER,\r
- ts_rev_id INTEGER,\r
- ts_tags CLOB(64K) INLINE LENGTH 4096 NOT NULL\r
-);\r
+-- Rollup table to pull a LIST of tags simply
+CREATE TABLE tag_summary (
+ ts_rc_id INTEGER,
+ ts_log_id INTEGER,
+ ts_rev_id INTEGER,
+ ts_tags CLOB(64K) INLINE LENGTH 4096 NOT NULL
+);
-CREATE TABLE valid_tag (\r
- vt_tag varchar(255) NOT NULL PRIMARY KEY\r
-);\r
+CREATE TABLE valid_tag (
+ vt_tag varchar(255) NOT NULL PRIMARY KEY
+);
-ALTER TABLE categorylinks ADD cl_collation VARCHAR(32) FOR BIT DATA NOT NULL\r
+ALTER TABLE categorylinks ADD cl_collation VARCHAR(32) FOR BIT DATA NOT NULL
-ALTER TABLE categorylinks ADD cl_sortkey_prefix VARCHAR(255) FOR BIT DATA NOT NULL\r
+ALTER TABLE categorylinks ADD cl_sortkey_prefix VARCHAR(255) FOR BIT DATA NOT NULL
-ALTER TABLE categorylinks ADD cl_type VARCHAR(6) FOR BIT DATA NOT NULL\r
+ALTER TABLE categorylinks ADD cl_type VARCHAR(6) FOR BIT DATA NOT NULL
-CREATE TABLE external_user (\r
- -- Foreign key to user_id\r
- eu_local_id BIGINT NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (START WITH 1),\r
-\r
- -- Some opaque identifier provided by the external database\r
- eu_external_id VARCHAR(255) NOT NULL\r
-);\r
+CREATE TABLE external_user (
+ -- Foreign key to user_id
+ eu_local_id BIGINT NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (START WITH 1),
+
+ -- Some opaque identifier provided by the external database
+ eu_external_id VARCHAR(255) NOT NULL
+);
-CREATE TABLE ipblocks (\r
- ipb_id INTEGER NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (START WITH 1),\r
- --DEFAULT nextval('ipblocks_ipb_id_val'),\r
- ipb_address VARCHAR(1024),\r
- ipb_user BIGINT NOT NULL DEFAULT 0,\r
- -- REFERENCES user(user_id) ON DELETE SET NULL,\r
- ipb_by BIGINT NOT NULL DEFAULT 0,\r
- -- REFERENCES user(user_id) ON DELETE CASCADE,\r
- ipb_by_text VARCHAR(255) NOT NULL DEFAULT '',\r
- ipb_reason VARCHAR(1024) NOT NULL,\r
- ipb_timestamp TIMESTAMP(3) NOT NULL,\r
- ipb_auto SMALLINT NOT NULL DEFAULT 0,\r
- ipb_anon_only SMALLINT NOT NULL DEFAULT 0,\r
- ipb_create_account SMALLINT NOT NULL DEFAULT 1,\r
- ipb_enable_autoblock SMALLINT NOT NULL DEFAULT 1,\r
- ipb_expiry TIMESTAMP(3) NOT NULL,\r
- ipb_range_start VARCHAR(1024),\r
- ipb_range_end VARCHAR(1024),\r
- ipb_deleted SMALLINT NOT NULL DEFAULT 0,\r
- ipb_block_email SMALLINT NOT NULL DEFAULT 0,\r
- ipb_allow_usertalk SMALLINT NOT NULL DEFAULT 0\r
-\r
-);\r
+CREATE TABLE ipblocks (
+ ipb_id INTEGER NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (START WITH 1),
+ --DEFAULT nextval('ipblocks_ipb_id_val'),
+ ipb_address VARCHAR(1024),
+ ipb_user BIGINT NOT NULL DEFAULT 0,
+ -- REFERENCES user(user_id) ON DELETE SET NULL,
+ ipb_by BIGINT NOT NULL DEFAULT 0,
+ -- REFERENCES user(user_id) ON DELETE CASCADE,
+ ipb_by_text VARCHAR(255) NOT NULL DEFAULT '',
+ ipb_reason VARCHAR(1024) NOT NULL,
+ ipb_timestamp TIMESTAMP(3) NOT NULL,
+ ipb_auto SMALLINT NOT NULL DEFAULT 0,
+ ipb_anon_only SMALLINT NOT NULL DEFAULT 0,
+ ipb_create_account SMALLINT NOT NULL DEFAULT 1,
+ ipb_enable_autoblock SMALLINT NOT NULL DEFAULT 1,
+ ipb_expiry TIMESTAMP(3) NOT NULL,
+ ipb_range_start VARCHAR(1024),
+ ipb_range_end VARCHAR(1024),
+ ipb_deleted SMALLINT NOT NULL DEFAULT 0,
+ ipb_block_email SMALLINT NOT NULL DEFAULT 0,
+ ipb_allow_usertalk SMALLINT NOT NULL DEFAULT 0
+
+);
-ALTER TABLE interwiki ADD iw_api CLOB(64K) INLINE LENGTH 4096 NOT NULL\r
+ALTER TABLE interwiki ADD iw_api CLOB(64K) INLINE LENGTH 4096 NOT NULL
-CREATE TABLE interwiki (\r
- iw_prefix VARCHAR(32) NOT NULL UNIQUE,\r
- iw_url CLOB(64K) INLINE LENGTH 4096 NOT NULL,\r
- iw_api CLOB(64K) INLINE LENGTH 4096 NOT NULL,\r
- iw_wikiid varchar(64) NOT NULL,\r
- iw_local SMALLINT NOT NULL,\r
- iw_trans SMALLINT NOT NULL DEFAULT 0\r
-);\r
+CREATE TABLE interwiki (
+ iw_prefix VARCHAR(32) NOT NULL UNIQUE,
+ iw_url CLOB(64K) INLINE LENGTH 4096 NOT NULL,
+ iw_api CLOB(64K) INLINE LENGTH 4096 NOT NULL,
+ iw_wikiid varchar(64) NOT NULL,
+ iw_local SMALLINT NOT NULL,
+ iw_trans SMALLINT NOT NULL DEFAULT 0
+);
-ALTER TABLE interwiki ADD iw_wikiid varchar(64) NOT NULL\r
+ALTER TABLE interwiki ADD iw_wikiid varchar(64) NOT NULL
-CREATE TABLE "IWLINKS"\r
-(\r
-"IWL_FROM" INT NOT NULL ,\r
-"IWL_PREFIX" VARCHAR(20) FOR BIT DATA NOT NULL ,\r
-"IWL_TITLE" VARCHAR(255) FOR BIT DATA NOT NULL\r
-)\r
-;\r
+CREATE TABLE "IWLINKS"
+(
+"IWL_FROM" INT NOT NULL ,
+"IWL_PREFIX" VARCHAR(20) FOR BIT DATA NOT NULL ,
+"IWL_TITLE" VARCHAR(255) FOR BIT DATA NOT NULL
+)
+;
-CREATE TABLE l10n_cache (\r
- -- Language code\r
- lc_lang VARCHAR(32) NOT NULL,\r
- -- Cache key\r
- lc_key VARCHAR(255) NOT NULL,\r
- -- Value\r
- lc_value CLOB(16M) INLINE LENGTH 4096 NOT NULL\r
-);\r
+CREATE TABLE l10n_cache (
+ -- Language code
+ lc_lang VARCHAR(32) NOT NULL,
+ -- Cache key
+ lc_key VARCHAR(255) NOT NULL,
+ -- Value
+ lc_value CLOB(16M) INLINE LENGTH 4096 NOT NULL
+);
-CREATE TABLE log_search (\r
- -- The type of ID (rev ID, log ID, rev TIMESTAMP(3), username)\r
- ls_field VARCHAR(32) FOR BIT DATA NOT NULL,\r
- -- The value of the ID\r
- ls_value varchar(255) NOT NULL,\r
- -- Key to log_id\r
- ls_log_id BIGINT NOT NULL default 0\r
-);\r
+CREATE TABLE log_search (
+ -- The type of ID (rev ID, log ID, rev TIMESTAMP(3), username)
+ ls_field VARCHAR(32) FOR BIT DATA NOT NULL,
+ -- The value of the ID
+ ls_value varchar(255) NOT NULL,
+ -- Key to log_id
+ ls_log_id BIGINT NOT NULL default 0
+);
-CREATE TABLE log_search (\r
- -- The type of ID (rev ID, log ID, rev TIMESTAMP(3), username)\r
- ls_field VARCHAR(32) FOR BIT DATA NOT NULL,\r
- -- The value of the ID\r
- ls_value varchar(255) NOT NULL,\r
- -- Key to log_id\r
- ls_log_id BIGINT NOT NULL default 0\r
-);\r
+CREATE TABLE log_search (
+ -- The type of ID (rev ID, log ID, rev TIMESTAMP(3), username)
+ ls_field VARCHAR(32) FOR BIT DATA NOT NULL,
+ -- The value of the ID
+ ls_value varchar(255) NOT NULL,
+ -- Key to log_id
+ ls_log_id BIGINT NOT NULL default 0
+);
-CREATE TABLE logging (\r
- log_id BIGINT NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (START WITH 1),\r
- --PRIMARY KEY DEFAULT nextval('log_log_id_seq'),\r
- log_type VARCHAR(32) NOT NULL,\r
- log_action VARCHAR(32) NOT NULL,\r
- log_timestamp TIMESTAMP(3) NOT NULL,\r
- log_user BIGINT NOT NULL DEFAULT 0,\r
- -- REFERENCES user(user_id) ON DELETE SET NULL,\r
- -- Name of the user who performed this action\r
- log_user_text VARCHAR(255) NOT NULL default '',\r
- log_namespace SMALLINT NOT NULL,\r
- log_title VARCHAR(255) NOT NULL,\r
- log_page BIGINT,\r
- log_comment VARCHAR(255),\r
- log_params CLOB(64K) INLINE LENGTH 4096,\r
- log_deleted SMALLINT NOT NULL DEFAULT 0\r
-);\r
+CREATE TABLE logging (
+ log_id BIGINT NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (START WITH 1),
+ --PRIMARY KEY DEFAULT nextval('log_log_id_seq'),
+ log_type VARCHAR(32) NOT NULL,
+ log_action VARCHAR(32) NOT NULL,
+ log_timestamp TIMESTAMP(3) NOT NULL,
+ log_user BIGINT NOT NULL DEFAULT 0,
+ -- REFERENCES user(user_id) ON DELETE SET NULL,
+ -- Name of the user who performed this action
+ log_user_text VARCHAR(255) NOT NULL default '',
+ log_namespace SMALLINT NOT NULL,
+ log_title VARCHAR(255) NOT NULL,
+ log_page BIGINT,
+ log_comment VARCHAR(255),
+ log_params CLOB(64K) INLINE LENGTH 4096,
+ log_deleted SMALLINT NOT NULL DEFAULT 0
+);
-CREATE TABLE "MODULE_DEPS" (\r
-"MD_MODULE" VARCHAR(255) FOR BIT DATA NOT NULL ,\r
-"MD_SKIN" VARCHAR(32) FOR BIT DATA NOT NULL ,\r
-"MD_DEPS" CLOB(16M) INLINE LENGTH 4096 NOT NULL\r
-)\r
-;\r
+CREATE TABLE "MODULE_DEPS" (
+"MD_MODULE" VARCHAR(255) FOR BIT DATA NOT NULL ,
+"MD_SKIN" VARCHAR(32) FOR BIT DATA NOT NULL ,
+"MD_DEPS" CLOB(16M) INLINE LENGTH 4096 NOT NULL
+)
+;
-CREATE TABLE "MSG_RESOURCE"\r
-(\r
-"MR_RESOURCE" VARCHAR(255) FOR BIT DATA NOT NULL ,\r
-"MR_LANG" VARCHAR(32) FOR BIT DATA NOT NULL ,\r
-"MR_BLOB" BLOB NOT NULL ,\r
-"MR_TIMESTAMP" TIMESTAMP(3) NOT NULL\r
-)\r
-;\r
+CREATE TABLE "MSG_RESOURCE"
+(
+"MR_RESOURCE" VARCHAR(255) FOR BIT DATA NOT NULL ,
+"MR_LANG" VARCHAR(32) FOR BIT DATA NOT NULL ,
+"MR_BLOB" BLOB NOT NULL ,
+"MR_TIMESTAMP" TIMESTAMP(3) NOT NULL
+)
+;
-CREATE TABLE "MSG_RESOURCE_LINKS"\r
-(\r
-"MRL_RESOURCE" VARCHAR(255) FOR BIT DATA NOT NULL ,\r
-"MRL_MESSAGE" VARCHAR(255) FOR BIT DATA NOT NULL\r
-)\r
-;\r
+CREATE TABLE "MSG_RESOURCE_LINKS"
+(
+"MRL_RESOURCE" VARCHAR(255) FOR BIT DATA NOT NULL ,
+"MRL_MESSAGE" VARCHAR(255) FOR BIT DATA NOT NULL
+)
+;
-CREATE TABLE redirect (\r
- rd_from BIGINT NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (START WITH 1),\r
- --REFERENCES page(page_id) ON DELETE CASCADE,\r
- rd_namespace SMALLINT NOT NULL DEFAULT 0,\r
- rd_title VARCHAR(255) NOT NULL DEFAULT '',\r
- rd_interwiki varchar(32),\r
- rd_fragment VARCHAR(255)\r
-);\r
+CREATE TABLE redirect (
+ rd_from BIGINT NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (START WITH 1),
+ --REFERENCES page(page_id) ON DELETE CASCADE,
+ rd_namespace SMALLINT NOT NULL DEFAULT 0,
+ rd_title VARCHAR(255) NOT NULL DEFAULT '',
+ rd_interwiki varchar(32),
+ rd_fragment VARCHAR(255)
+);
-CREATE TABLE site_stats (\r
- ss_row_id BIGINT NOT NULL UNIQUE,\r
- ss_total_views BIGINT DEFAULT 0,\r
- ss_total_edits BIGINT DEFAULT 0,\r
- ss_good_articles BIGINT DEFAULT 0,\r
- ss_total_pages INTEGER DEFAULT -1,\r
- ss_users INTEGER DEFAULT -1,\r
- ss_active_users INTEGER DEFAULT -1,\r
- ss_admins INTEGER DEFAULT -1,\r
- ss_images INTEGER DEFAULT 0\r
-);\r
+CREATE TABLE site_stats (
+ ss_row_id BIGINT NOT NULL UNIQUE,
+ ss_total_views BIGINT DEFAULT 0,
+ ss_total_edits BIGINT DEFAULT 0,
+ ss_good_articles BIGINT DEFAULT 0,
+ ss_total_pages INTEGER DEFAULT -1,
+ ss_users INTEGER DEFAULT -1,
+ ss_active_users INTEGER DEFAULT -1,
+ ss_admins INTEGER DEFAULT -1,
+ ss_images INTEGER DEFAULT 0
+);
-CREATE TABLE updatelog (\r
- ul_key VARCHAR(255) NOT NULL PRIMARY KEY\r
-);\r
+CREATE TABLE updatelog (
+ ul_key VARCHAR(255) NOT NULL PRIMARY KEY
+);
-CREATE UNIQUE INDEX "UQ61_MSG_RESOURCE_LINKS" ON "MSG_RESOURCE_LINKS"\r
-(\r
-"MRL_MESSAGE",\r
-"MRL_RESOURCE"\r
-)\r
-ALLOW REVERSE SCANS\r
-;\r
+CREATE UNIQUE INDEX "UQ61_MSG_RESOURCE_LINKS" ON "MSG_RESOURCE_LINKS"
+(
+"MRL_MESSAGE",
+"MRL_RESOURCE"
+)
+ALLOW REVERSE SCANS
+;
-CREATE UNIQUE INDEX "UQ81_MSG_RESOURCE" ON "MSG_RESOURCE"\r
-(\r
-"MR_RESOURCE"\r
-,"MR_LANG"\r
-)\r
-ALLOW REVERSE SCANS\r
-;\r
+CREATE UNIQUE INDEX "UQ81_MSG_RESOURCE" ON "MSG_RESOURCE"
+(
+"MR_RESOURCE"
+,"MR_LANG"
+)
+ALLOW REVERSE SCANS
+;
-CREATE UNIQUE INDEX "UQ96_MODULE_DEPS" ON "MODULE_DEPS"\r
-(\r
-"MD_MODULE"\r
-,"MD_SKIN"\r
-)\r
-ALLOW REVERSE SCANS\r
-;\r
+CREATE UNIQUE INDEX "UQ96_MODULE_DEPS" ON "MODULE_DEPS"
+(
+"MD_MODULE"
+,"MD_SKIN"
+)
+ALLOW REVERSE SCANS
+;
-CREATE TABLE user_properties (\r
- -- Foreign key to user.user_id\r
- up_user BIGINT NOT NULL,\r
- \r
- -- Name of the option being saved. This is indexed for bulk lookup.\r
- up_property VARCHAR(32) FOR BIT DATA NOT NULL,\r
- \r
- -- Property value as a string.\r
- up_value CLOB(64K) INLINE LENGTH 4096\r
-);\r
+CREATE TABLE user_properties (
+ -- Foreign key to user.user_id
+ up_user BIGINT NOT NULL,
+
+ -- Name of the option being saved. This is indexed for bulk lookup.
+ up_property VARCHAR(32) FOR BIT DATA NOT NULL,
+
+ -- Property value as a string.
+ up_value CLOB(64K) INLINE LENGTH 4096
+);