isolating sets and database configs in files

This commit is contained in:
Usuario Moodle 2013-05-07 17:16:52 -03:00
parent f0bf8e6bf5
commit 56d7f33ca2
5 changed files with 108 additions and 99 deletions

76
config-database.php Normal file
View File

@ -0,0 +1,76 @@
<?php
//
// DATABASE SETUP
//
$DB_HOST = '';
$DB_USER = '';
$DB_PASSWD = '';
$DB_NAME = '';
/*
* - <b>$SQL</b>: Settings for database and queries from database
*
* - <b>$DSN</b>: 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 &lt; 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';

28
config-sets.php Normal file
View File

@ -0,0 +1,28 @@
<?php
/*
*
* - <b>$SETS</b>: 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'=>'<oai_dc:dc xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/
http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
<dc:description>This set contains metadata describing
electronic music recordings made during the 1950ies</dc:description>
</oai_dc:dc>')
*/
);

View File

@ -4,6 +4,7 @@
* \brief Response to Verb ListSets * \brief Response to Verb ListSets
* *
* Lists what sets are available to records in the system. * 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. // Here the size of sets is small, no resumptionToken is taken care.

View File

@ -68,6 +68,8 @@ foreach($attribs as $val) {
require_once('oaidp-config.php'); require_once('oaidp-config.php');
require_once('config-metadataformats.php'); require_once('config-metadataformats.php');
require_once('config-sets.php');
require_once('config-database.php');
// Create a PDO object // Create a PDO object
try { try {

View File

@ -7,23 +7,15 @@
* Please read through the WHOLE file, there are several things, that * Please read through the WHOLE file, there are several things, that
* need to be adjusted. * need to be adjusted.
* *
*
* The response may may be compressed for better performace: * 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. * - 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: * Some other used variables:
* *
* - <b>$repositoryIdentifier</b> : For a data provider there is only one. For repositories to comply with the oai * - <b>$repositoryIdentifier</b> : 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. * 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. * See: http://www.openarchives.org/OAI/2.0/guidelines-oai-identifier.htm.
* *
* - <b>$SETS</b>: An array with key words . List of supported SETs.
*
* - <b>$SQL</b>: Settings for database and queries from database
*
* - <b>$DSN</b>: 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. * 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 // Please check identify.php for other possible containers
// in the Identify response // in the Identify response
$show_identifier = false; $show_identifier = false;
// MUST (only one) // MUST (only one)
// should not be changed. Only useful when NODE description is included in the response to Identifier // should not be changed. Only useful when NODE description is included in the response to Identifier
$delimiter = ':'; $delimiter = ':';
@ -166,96 +159,5 @@ $expirationdatetime = gmstrftime('%Y-%m-%dT%TZ', time()+TOKEN_VALID);
/** Where token is saved and path is included */ /** Where token is saved and path is included */
define('TOKEN_PREFIX','/tmp/ANDS_DBPD-'); 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'=>'<oai_dc:dc
xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/
http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
<dc:description>This set contains metadata describing electronic music recordings made during the 1950ies</dc:description>
</oai_dc:dc>') //,
// array('setSpec'=>'math', 'setName'=>'Mathematics') ,
// array('setSpec'=>'phys', 'setName'=>'Physics')
*/
);
// The shorthand of xml schema namespace, no need to change this // The shorthand of xml schema namespace, no need to change this
define('XMLSCHEMA', 'http://www.w3.org/2001/XMLSchema-instance'); 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 &lt; 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';