diff --git a/config-database.php b/config-database.php new file mode 100644 index 0000000..fbf170b --- /dev/null +++ b/config-database.php @@ -0,0 +1,76 @@ +$SQL: Settings for database and queries from database + * + * - $DSN: DSN for connecting your database. Reference PDO for details. + * + */ + +// Data Source Name: This is the universal connection string +// if you use something other than mysql edit accordingly. +// Example for MySQL +// $DSN = "mysql://$DB_USER:$DB_PASSWD@$DB_HOST/$DB_NAME"; +// Example for Oracle +// $DSN = "oci8://$DB_USER:$DB_PASSWD@$DB_NAME"; + +$DSN = "mysql:host={$DB_HOST};dbname={$DB_NAME};port=3306;"; + +// the charset you store your metadata in your database +// currently only utf-8 and iso8859-1 are supported +$charset = "utf8"; + +// if entities such as < > ' " in your metadata has already been escaped +// then set this to true (e.g. you store < as < in your DB) +$xmlescaped = false; + +// We store multiple entries for one element in a single row +// in the database. SQL['split'] lists the delimiter for these entries. +// If you do not do this, do not define $SQL['split'] +// $SQL['split'] = ';'; + +// the name of the table where your store your metadata's header +$SQL['table'] = 'oai_headers'; + +// the name of the column where you store the unique identifiers +// pointing to your item. +// this is your internal identifier for the item +$SQL['identifier'] = 'oai_identifier'; + +$SQL['metadataPrefix'] = 'oai_metadataprefix'; + +// If you want to expand the internal identifier in some way +// use this (but not for OAI stuff, see next line) +$idPrefix = ''; + +// this is your external (OAI) identifier for the item +// this will be expanded to +// oai:$repositoryIdentifier:$idPrefix$SQL['identifier'] +// should not be changed +// +// Commented out 24/11/10 14:19:09 +// $oaiprefix = "oai".$delimiter.$repositoryIdentifier.$delimiter.$idPrefix; +$oaiprefix = ""; + +// adjust anIdentifier with sample contents an identifier +// $sampleIdentifier = $oaiprefix.'anIdentifier'; + +// the name of the column where you store your datestamps +$SQL['datestamp'] = 'datestamp'; + +// the name of the column where you store information whether +// a record has been deleted. Leave it as it is if you do not use +// this feature. +$SQL['deleted'] = 'deleted'; + +// to be able to quickly retrieve the sets to which one item belongs, +// the setnames are stored for each item +// the name of the column where you store sets +$SQL['set'] = 'oai_set'; diff --git a/config-sets.php b/config-sets.php new file mode 100644 index 0000000..7ae85a7 --- /dev/null +++ b/config-sets.php @@ -0,0 +1,28 @@ +$SETS: An array with key words . List of supported SETs. + * + */ + +// define all supported sets in your repository +$SETS = array ( + array('setSpec'=>'class:activity', 'setName'=>'Activities'), + array('setSpec'=>'class:collection', 'setName'=>'Collections'), + array('setSpec'=>'class:party', 'setName'=>'Parties'), + /* + array('setSpec'=>'math', 'setName'=>'Mathematics') , + array('setSpec'=>'phys', 'setName'=>'Physics'), + + array('setSpec'=>'phdthesis', + 'setName'=>'PHD Thesis', + 'setDescription'=>' + This set contains metadata describing + electronic music recordings made during the 1950ies + ') + */ +); diff --git a/listsets.php b/listsets.php index d05d857..53b0d27 100644 --- a/listsets.php +++ b/listsets.php @@ -4,6 +4,7 @@ * \brief Response to Verb ListSets * * Lists what sets are available to records in the system. + * This variable is filled in config-sets.php */ // Here the size of sets is small, no resumptionToken is taken care. diff --git a/oai2.php b/oai2.php index dc4b023..adf43d3 100644 --- a/oai2.php +++ b/oai2.php @@ -68,6 +68,8 @@ foreach($attribs as $val) { require_once('oaidp-config.php'); require_once('config-metadataformats.php'); +require_once('config-sets.php'); +require_once('config-database.php'); // Create a PDO object try { diff --git a/oaidp-config.php b/oaidp-config.php index 0b98392..0f75525 100644 --- a/oaidp-config.php +++ b/oaidp-config.php @@ -7,23 +7,15 @@ * Please read through the WHOLE file, there are several things, that * need to be adjusted. * - * * The response may may be compressed for better performace: * - Compression : a compression encoding supported by the repository. The recommended values are those defined for the Content-Encoding header in Section 14.11 of RFC 2616 describing HTTP 1.1. A compression element should not be included for the identity encoding, which is implied. * - * * Some other used variables: * * - $repositoryIdentifier : For a data provider there is only one. For repositories to comply with the oai * format it has to be unique identifiers for items records. Basically using domainname will be fine. * See: http://www.openarchives.org/OAI/2.0/guidelines-oai-identifier.htm. * - * - $SETS: An array with key words . List of supported SETs. - * - * - $SQL: Settings for database and queries from database - * - * - $DSN: DSN for connecting your database. Reference PDO for details. - * * The rest of settings will not normally need to be adjusted. Read source code for details. */ @@ -142,6 +134,7 @@ define('REG_OBJ_GROUP','Something agreed on'); // Please check identify.php for other possible containers // in the Identify response $show_identifier = false; + // MUST (only one) // should not be changed. Only useful when NODE description is included in the response to Identifier $delimiter = ':'; @@ -166,96 +159,5 @@ $expirationdatetime = gmstrftime('%Y-%m-%dT%TZ', time()+TOKEN_VALID); /** Where token is saved and path is included */ define('TOKEN_PREFIX','/tmp/ANDS_DBPD-'); -// define all supported sets in your repository -$SETS = array ( - array('setSpec'=>'class:activity', 'setName'=>'Activities'), - array('setSpec'=>'class:collection', 'setName'=>'Collections'), - array('setSpec'=>'class:party', 'setName'=>'Parties') - /*, - array('setSpec'=>'phdthesis', 'setName'=>'PHD Thesis', 'setDescription'=>' - This set contains metadata describing electronic music recordings made during the 1950ies - ') //, - // array('setSpec'=>'math', 'setName'=>'Mathematics') , - // array('setSpec'=>'phys', 'setName'=>'Physics') - */ -); - - // The shorthand of xml schema namespace, no need to change this define('XMLSCHEMA', 'http://www.w3.org/2001/XMLSchema-instance'); - -// -// DATABASE SETUP -// - -// change according to your local DB setup. -$DB_HOST = ''; -$DB_USER = ''; -$DB_PASSWD = ''; -$DB_NAME = ''; - -// Data Source Name: This is the universal connection string -// if you use something other than mysql edit accordingly. -// Example for MySQL -// $DSN = "mysql://$DB_USER:$DB_PASSWD@$DB_HOST/$DB_NAME"; -// Example for Oracle -// $DSN = "oci8://$DB_USER:$DB_PASSWD@$DB_NAME"; - -$DSN = "mysql:host={$DB_HOST};dbname={$DB_NAME};port=3306;"; - -// the charset you store your metadata in your database -// currently only utf-8 and iso8859-1 are supported -$charset = "iso8859-1"; - -// if entities such as < > ' " in your metadata has already been escaped -// then set this to true (e.g. you store < as < in your DB) -$xmlescaped = false; - -// We store multiple entries for one element in a single row -// in the database. SQL['split'] lists the delimiter for these entries. -// If you do not do this, do not define $SQL['split'] -// $SQL['split'] = ';'; - -// the name of the table where your store your metadata's header -$SQL['table'] = 'oai_headers'; - -// the name of the column where you store the unique identifiers -// pointing to your item. -// this is your internal identifier for the item -$SQL['identifier'] = 'oai_identifier'; - -$SQL['metadataPrefix'] = 'oai_metadataprefix'; - -// If you want to expand the internal identifier in some way -// use this (but not for OAI stuff, see next line) -$idPrefix = ''; - -// this is your external (OAI) identifier for the item -// this will be expanded to -// oai:$repositoryIdentifier:$idPrefix$SQL['identifier'] -// should not be changed -// -// Commented out 24/11/10 14:19:09 -// $oaiprefix = "oai".$delimiter.$repositoryIdentifier.$delimiter.$idPrefix; -$oaiprefix = ""; - -// adjust anIdentifier with sample contents an identifier -// $sampleIdentifier = $oaiprefix.'anIdentifier'; - -// the name of the column where you store your datestamps -$SQL['datestamp'] = 'datestamp'; - -// the name of the column where you store information whether -// a record has been deleted. Leave it as it is if you do not use -// this feature. -$SQL['deleted'] = 'deleted'; - -// to be able to quickly retrieve the sets to which one item belongs, -// the setnames are stored for each item -// the name of the column where you store sets -$SQL['set'] = 'oai_set';