Revert r64853 (add $wgLogAutocreatedAccounts to enable/disable account autocreation...
[mediawiki.git] / includes / installer / OracleUpdater.php
blob331c79808e30c8ae96e2a883ed89a29a682f4855
1 <?php
2 /**
3 * Oracle-specific updater.
5 * @file
6 * @ingroup Deployment
7 */
9 /**
10 * Class for handling updates to Oracle databases.
12 * @ingroup Deployment
13 * @since 1.17
15 class OracleUpdater extends DatabaseUpdater {
16 protected function getCoreUpdateList() {
17 return array(
18 // 1.16
19 array( 'doNamespaceDefaults' ),
20 array( 'doFKRenameDeferr' ),
21 array( 'doFunctions17' ),
22 array( 'doSchemaUpgrade17' ),
26 /**
27 * MySQL uses datatype defaults for NULL inserted into NOT NULL fields
28 * In namespace case that results into insert of 0 which is default namespace
29 * Oracle inserts NULL, so namespace fields should have a default value
31 protected function doNamespaceDefaults() {
32 $this->output( "Altering namespace fields with default value ... " );
33 $meta = $this->db->fieldInfo( 'page', 'page_namespace' );
34 if ( $meta->defaultValue() != null ) {
35 $this->output( "defaults seem to present on namespace fields\n" );
36 return;
39 $this->applyPatch( 'patch_namespace_defaults.sql', false );
40 $this->output( "ok\n" );
43 /**
44 * Uniform FK names + deferrable state
46 protected function doFKRenameDeferr() {
47 $this->output( "Altering foreign keys ... " );
48 $meta = $this->db->query( 'SELECT COUNT(*) cnt FROM user_constraints WHERE constraint_type = \'R\' AND deferrable = \'DEFERRABLE\'' );
49 $row = $meta->fetchRow();
50 if ( $row && $row['cnt'] > 0 ) {
51 $this->output( "at least one FK is deferrable, considering up to date\n" );
52 return;
55 $this->applyPatch( 'patch_fk_rename_deferred.sql', false );
56 $this->output( "ok\n" );
59 /**
60 * Recreate functions to 17 schema layout
62 protected function doFunctions17() {
63 $this->output( "Recreating functions ... " );
64 $this->applyPatch( 'patch_create_17_functions.sql', false );
65 $this->output( "ok\n" );
68 /**
69 * Schema upgrade 16->17
70 * there are no incremental patches prior to this
72 protected function doSchemaUpgrade17() {
73 $this->output( "Updating schema to 17 ... " );
74 // check if iwlinks table exists which was added in 1.17
75 if ( $this->db->tableExists( trim( $this->db->tableName( 'iwlinks' ) ) ) ) {
76 $this->output( "schema seem to be up to date.\n" );
77 return;
79 $this->applyPatch( 'patch_16_17_schema_changes.sql', false );
80 $this->output( "ok\n" );
83 /**
84 * Overload: after this action field info table has to be rebuilt
86 public function doUpdates( $what = array( 'core', 'extensions', 'purge' ) ) {
87 parent::doUpdates( $what );
89 $this->db->query( 'BEGIN fill_wiki_info; END;' );