/[drupal]/contributions/modules/oai2/oai2.install
ViewVC logotype

Contents of /contributions/modules/oai2/oai2.install

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.4 - (show annotations) (download) (as text)
Thu Jan 11 20:59:56 2007 UTC (2 years, 10 months ago) by rjerome
Branch: MAIN
CVS Tags: DRUPAL-5--1-1, DRUPAL-5--1-0, HEAD
Branch point for: DRUPAL-5
Changes since 1.3: +7 -6 lines
File MIME type: text/x-php
modified to work with Drupal 5.x
1 <?PHP
2 // $Id: oai2.install,v 1.3 2006/08/24 12:36:44 rjerome Exp $
3
4 function oai2_install(){
5 $result = array();
6
7 switch ($GLOBALS['db_type']) {
8 case 'mysql':
9 case 'mysqli':
10
11 $result[] = db_query ("CREATE TABLE {oai2_metadata_formats} (
12 `name` varchar(100) NOT NULL default '',
13 `metadata_prefix` varchar(100) NOT NULL default '',
14 `schema` varchar(255) NOT NULL default '',
15 `metadata_namespace` varchar(255) NOT NULL default '',
16 `record_prefix` varchar(100) NOT NULL default '',
17 `record_namespace` varchar(255) NOT NULL default '',
18 PRIMARY KEY (`name`)
19 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;");
20
21 $result[] = db_query("INSERT INTO {oai2_metadata_formats} (`name`,`metadata_prefix`,`schema`,`metadata_namespace`,`record_prefix`,`record_namespace`) VALUES
22 ('oai_dc','oai_dc','http://www.openarchives.org/OAI/2.0/oai_dc.xsd','http://www.openarchives.org/OAI/2.0/oai_dc/','dc','http://purl.org/dc/elements/1.1/');
23 ;");
24
25 $result[] = db_query("CREATE TABLE {oai2_tokens} (
26 `id` bigint(20) NOT NULL default '0',
27 `deliveredrecords` int(11) NOT NULL default '0',
28 `extquery` varchar(255) default '',
29 `queryargs` varchar(255) default '',
30 `metadata_prefix` varchar(255) default '',
31 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
32 PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8;");
33
34 break;
35
36 case 'pgsql':
37 break;
38 }
39
40 if (count($result) == count(array_filter($result))) {
41 drupal_set_message(t('The oai2 module has successfully added its tables to the database.'));
42 }
43 else {
44 drupal_set_message(t('Drupal was unable to install the database tables for the oai2 module.'), 'error');
45 }
46
47
48 }
49 function oai2_uninstall(){
50
51 db_query("DROP TABLE {oai2_metadata_formats} ");
52 db_query("DROP TABLE {oai2_tokens} ");
53
54 }

  ViewVC Help
Powered by ViewVC 1.1.2