(bug 18691) Added support for SVG rasterization using the Imagick PHP extension....
[lhc/web/wiklou.git] / includes / installer / OracleUpdater.php
1 <?php
2 /**
3 * Oracle-specific updater.
4 *
5 * @file
6 * @ingroup Deployment
7 */
8
9 /**
10 * Class for handling updates to Oracle databases.
11 *
12 * @ingroup Deployment
13 * @since 1.17
14 */
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' ),
23 );
24 }
25
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
30 */
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;
37 }
38
39 $this->applyPatch( 'patch_namespace_defaults.sql', false );
40 $this->output( "ok\n" );
41 }
42
43 /**
44 * Uniform FK names + deferrable state
45 */
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;
53 }
54
55 $this->applyPatch( 'patch_fk_rename_deferred.sql', false );
56 $this->output( "ok\n" );
57 }
58
59 /**
60 * Recreate functions to 17 schema layout
61 */
62 protected function doFunctions17() {
63 $this->output( "Recreating functions ... " );
64 $this->applyPatch( 'patch_create_17_functions.sql', false );
65 $this->output( "ok\n" );
66 }
67
68 /**
69 * Schema upgrade 16->17
70 * there are no incremental patches prior to this
71 */
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;
78 }
79 $this->applyPatch( 'patch_16_17_schema_changes.sql', false );
80 $this->output( "ok\n" );
81 }
82
83 /**
84 * Overload: after this action field info table has to be rebuilt
85 */
86 public function doUpdates( $purge = true ) {
87 parent::doUpdates();
88
89 $this->db->query( 'BEGIN fill_wiki_info; END;' );
90 }
91
92 }