simple-oai-pmh/oaidp-config.php

262 lines
11 KiB
PHP
Raw Normal View History

<?php
/**
* \file
* \brief Configuration file of current data provider.
*
* This is the configuration file for the PHP OAI Data Provider.
* 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.
2013-05-07 20:44:21 +02:00
*
*
* Some other used variables:
*
2013-05-07 20:44:21 +02:00
* - <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.
* 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.
2013-05-07 20:44:21 +02:00
*/
/**
* Whether to show error message for dubug.
* For installation, testing and debuging set SHOW_QUERY_ERROR to TRUE
* If set to TRUE, application will die and display query and database error message
* as soon as there is a problem. Do not set this to TRUE on a production site,
* since it will show error messages to everybody.
* If set FALSE, will create XML-output, no matter what happens.
*/
// If everything is running ok, you should use this
define('SHOW_QUERY_ERROR',FALSE);
2013-05-07 20:44:21 +02:00
/**
* \property CONTENT_TYPE
2013-05-07 20:44:21 +02:00
* The content-type the WWW-server delivers back. For debug-puposes, "text/plain"
* is easier to view. On a production site you should use "text/xml".
*/
#define('CONTENT_TYPE','Content-Type: text/plain');
// If everything is running ok, you should use this
define('CONTENT_TYPE', 'Content-Type: text/xml');
/**
* Identifier settings. It needs to have proper values to reflect the settings of the data provider.
*
* - $identifyResponse['repositoryName'] : compulsory. A human readable name for the repository;
* - $identifyResponse['baseURL'] : compulsory. The base URL of the repository;
* - $identifyResponse['protocolVersion'] : compulsory. The version of the OAI-PMH supported by the repository;
* - $identifyResponse['earliestDatestamp'] : compulsory. A UTCdatetime that is the guaranteed lower limit of all datestamps recording changes, modifications, or deletions in the repository. A repository must not use datestamps lower than the one specified by the content of the earliestDatestamp element. earliestDatestamp must be expressed at the finest granularity supported by the repository.
* - $identifyResponse['deletedRecord'] : the manner in which the repository supports the notion of deleted records. Legitimate values are no ; transient ; persistent with meanings defined in the section on deletion.
* - $identifyResponse['granularity'] : the finest harvesting granularity supported by the repository. The legitimate values are YYYY-MM-DD and YYYY-MM-DDThh:mm:ssZ with meanings as defined in ISO8601.
*
*/
$identifyResponse = array();
// MUST (only one)
// please adjust
2013-05-07 20:44:21 +02:00
$identifyResponse["repositoryName"] = 'Moodle Dev2';
// For ANDS to harvest of RIF-CS, originatingSource is plantaccelerator.org.au
// $dataSource = "plantaccelerator.org.au";
2013-05-07 20:44:21 +02:00
define('DATASOURCE','dev2.moodle.ufsc.br');
// do not change
define('MY_URI','http://'.$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']);
// You can use a static URI as well.
2013-05-07 20:44:21 +02:00
// $baseURL = "http://my.server.org/oai/oai2.php";
$identifyResponse["baseURL"] = MY_URI;
// do not change
$identifyResponse["protocolVersion"] = '2.0';
2013-05-07 20:44:21 +02:00
// must exist before earliestDatestamp
$identifyResponse['adminEmail'] = 'danielneis@gmail.com';
// MUST (only one)
// the earliest datestamp in your repository,
// please adjust
// Only date is needed even later it will be formatted according to the granularity.
2013-05-07 20:44:21 +02:00
$identifyResponse["earliestDatestamp"] = '2013-01-01T12:00:00Z';
// How your repository handles deletions
2013-05-07 20:44:21 +02:00
// no: The repository does not maintain status about deletions.
// It MUST NOT reveal a deleted status.
// persistent: The repository persistently keeps track about deletions
// with no time limit. It MUST consistently reveal the status
// of a deleted record over time.
// transient: The repository does not guarantee that a list of deletions is
// maintained. It MAY reveal a deleted status for records.
//
// If your database keeps track of deleted records change accordingly.
// Currently if $record['deleted'] is set to 'true', $status_deleted is set.
2013-05-07 20:44:21 +02:00
// Some lines in listidentifiers.php, listrecords.php, getrecords.php
// must be changed to fit the condition for your database.
2013-05-07 20:44:21 +02:00
$identifyResponse["deletedRecord"] = 'no';
$deletedRecord = $identifyResponse["deletedRecord"]; // a shorthand for checking the configuration of Deleted Records
// MAY (only one)
//granularity is days
//$granularity = 'YYYY-MM-DD';
// granularity is seconds
2013-05-07 22:01:22 +02:00
$identifyResponse["granularity"] = 'YYYY-MM-DDThh:mm:ssZ';
// this is appended if your granularity is seconds.
// do not change
if (strcmp($identifyResponse["granularity"],'YYYY-MM-DDThh:mm:ssZ')==0) {
2013-05-07 22:01:22 +02:00
// $identifyResponse["earliestDatestamp"] = $identifyResponse["earliestDatestamp"].'T00:00:00Z';
}
/** Compression methods supported. Optional (multiple). Default: null.
2013-05-07 20:44:21 +02:00
*
* Currently only gzip is supported (you need output buffering turned on,
* and php compiled with libgz).
* The client MUST send "Accept-Encoding: gzip" to actually receive
*/
// $compression = array('gzip');
$compression = null;
// MUST (only one)
2013-05-07 20:44:21 +02:00
// You may choose any name, but for repositories to comply with the oai
// format it has to be unique identifiers for items records.
// see: http://www.openarchives.org/OAI/2.0/guidelines-oai-identifier.htm
// Basically use domainname
// please adjust
2013-05-07 20:44:21 +02:00
$repositoryIdentifier = 'dev2.moodle.ufsc.br.';
// For RIF-CS, especially with ANDS, each registryObject much has a group for the ownership of data.
// For detail please see ANDS guide on its web site. Each data provider should have only one REG_OBJ_GROUP
// for this purpose.
define('REG_OBJ_GROUP','Something agreed on');
2013-05-07 20:44:21 +02:00
// If Identifier needs to show NODE description. It is defined in identify.php
// You may include details about your community and friends (other
// data-providers).
2013-05-07 20:44:21 +02:00
// 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
2013-05-07 20:44:21 +02:00
$delimiter = ':';
/** Maximum mumber of the records to deliver
* (verb is ListRecords)
* If there are more records to deliver
* a ResumptionToken will be generated.
*/
define('MAXRECORDS',10);
/** Maximum mumber of identifiers to deliver
* (verb is ListIdentifiers)
* If there are more identifiers to deliver
* a ResumptionToken will be generated.
*/
define('MAXIDS',40);
/** After 24 hours resumptionTokens become invalid. Unit is second. */
define('TOKEN_VALID',24*3600);
2013-05-07 20:44:21 +02:00
$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
2013-05-07 20:44:21 +02:00
$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
define('XMLSCHEMA', 'http://www.w3.org/2001/XMLSchema-instance');
2013-05-07 20:44:21 +02:00
//
// DATABASE SETUP
//
// change according to your local DB setup.
2013-05-07 20:44:21 +02:00
$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";
2013-05-07 20:44:21 +02:00
$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";
2013-05-07 20:44:21 +02:00
// 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;
2013-05-07 20:44:21 +02:00
// 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']
2013-05-07 20:44:21 +02:00
// $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
//
2013-05-07 20:44:21 +02:00
// 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';