{"id":152,"date":"2012-12-31T14:36:07","date_gmt":"2012-12-31T13:36:07","guid":{"rendered":"http:\/\/www.dolicapax.org\/?p=152"},"modified":"2012-12-31T14:46:34","modified_gmt":"2012-12-31T13:46:34","slug":"installing-mediawiki-1-20-2-with-oracle-11g-express-edition","status":"publish","type":"post","link":"https:\/\/www.dolicapax.org\/?p=152","title":{"rendered":"Installing MediaWiki 1.20.2 with Oracle 11g Express Edition"},"content":{"rendered":"<p>I encountered and worked around a couple of issues when installing MediaWiki 1.20.2 with Oracle 11g Express Edition 11.2.0.2.0 as the database back-end. The solutions below can be also applied to MediaWiki 1.20.0 and 1.20.1.<\/p>\n<p>I did the installation on top of Zend Server Community Edition, saving me the trouble of tinkering too much with apache, php and oracle drivers.<\/p>\n<p>First out, the web installer did not accept the new Easy Connect string format, even though the help text encouraged such use. The Zend Server environment doesn&#8217;t play well with TNS based connect strings these days, so I worked around this by commenting out the validation code on line 90 and 91 <em>includes\/installer\/OracleInstaller.php<\/em>:<\/p>\n<pre>[roy@lonora02 installer]# diff OracleInstaller.php.orig OracleInstaller.php\r\n90,91c90,91\r\n&lt; } elseif ( !preg_match( '\/^[a-zA-Z0-9_\\.]+$\/', $newValues['wgDBserver'] ) ) {\r\n&lt; $status-&gt;fatal( 'config-invalid-db-server-oracle', $newValues['wgDBserver'] );\r\n---\r\n&gt; \/\/ } elseif ( !preg_match( '\/^[a-zA-Z0-9_\\.]+$\/', $newValues['wgDBserver'] ) ) {\r\n&gt; \/\/ $status-&gt;fatal( 'config-invalid-db-server-oracle', $newValues['wgDBserver'] );<\/pre>\n<p>The installer now accepted <em>localhost\/XE:POOLED\u00a0<\/em>quite nicely for my Oracle 11g XE database with Database Resident Connection Pooling (DRCP) enabled.<\/p>\n<p>After a couple of attempts, I found that the installer failed to create a database user, so I created a user manually, I suppose this is a good practice in any event, based on <em>maintenance\/oracle\/user.sql<\/em><\/p>\n<pre>[oracle@lonora02 ~]$ sqlplus \"\/as sysdba\"\r\n\r\ncreate user wikiuser identified by SECRET default tablespace users temporary tablespace temp quota unlimited on users;\r\n\r\ngrant connect,resource to wikiuser;\r\n\r\ngrant alter session to wikiuser;\r\n\r\ngrant ctxapp to wikiuser;\r\n\r\ngrant execute on ctx_ddl to wikiuser;\r\n\r\ngrant create view, create synonym, create table, create sequence, create trigger to wikiuser;<\/pre>\n<p>After installation successfuly completed, I found a bug that was introduced in MediaWiki 1.20.0, where an array would incorrectly translate to a variable thus breaking a lot of SQL queries and making the wiki all but unusable. Luckily, I was able to borrow an existing workaround from the Postgres database script and modified <em>includes\/db\/DatabaseOracle.php\u00a0<\/em>to implode the array to a comma\u00a0separated\u00a0list before passing it on to the variable. I found that this problem\u00a0occurred\u00a0two places, around line 1165 and 1168.<\/p>\n<pre>[roy@lonora02 db]# diff DatabaseOracle.php DatabaseOracle.php.orig\r\n1165,1168c1165\r\n&lt; $ob = is_array( $options['GROUP BY'] )\r\n&lt; ? implode( ',', $options['GROUP BY'] )\r\n&lt; : $options['GROUP BY'];\r\n&lt; $preLimitTail .= \" GROUP BY {$ob}\";\r\n---\r\n&gt; $preLimitTail .= \" GROUP BY {$options['GROUP BY']}\";\r\n1171,1174c1168\r\n&lt; $ob = is_array( $options['ORDER BY'] )\r\n&lt; ? implode( ',', $options['ORDER BY'] )\r\n&lt; : $options['ORDER BY'];\r\n&lt; $preLimitTail .= \" ORDER BY {$ob}\";\r\n---\r\n&gt; $preLimitTail .= \" ORDER BY {$options['ORDER BY']}\";<\/pre>\n<p>I really think it&#8217;s great that the MediaWiki team has taken the time to support Oracle database, not too many open source products like this do. The bugs I found have been reported and hopefully these issues will be all fixed by the next stable release.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I encountered and worked around a couple of issues when installing MediaWiki 1.20.2 with Oracle 11g Express Edition 11.2.0.2.0 as the database back-end. The solutions below can be also applied to MediaWiki 1.20.0 and 1.20.1. I did the installation on &hellip; <a href=\"https:\/\/www.dolicapax.org\/?p=152\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20,37,4],"tags":[],"_links":{"self":[{"href":"https:\/\/www.dolicapax.org\/index.php?rest_route=\/wp\/v2\/posts\/152"}],"collection":[{"href":"https:\/\/www.dolicapax.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dolicapax.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dolicapax.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dolicapax.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=152"}],"version-history":[{"count":4,"href":"https:\/\/www.dolicapax.org\/index.php?rest_route=\/wp\/v2\/posts\/152\/revisions"}],"predecessor-version":[{"id":156,"href":"https:\/\/www.dolicapax.org\/index.php?rest_route=\/wp\/v2\/posts\/152\/revisions\/156"}],"wp:attachment":[{"href":"https:\/\/www.dolicapax.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=152"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dolicapax.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=152"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dolicapax.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=152"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}