Difference between revisions of "API:EPrints/Config"

From EPrints Documentation
Jump to: navigation, search
(New page: <!-- Pod2Wiki=_preamble_ This page has been automatically generated from the EPrints source. Any wiki changes made between the 'Pod2Wiki=*' and 'End of Pod2Wiki' comments will be lost. -...)
 
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
<!-- Pod2Wiki=_preamble_  
 
<!-- Pod2Wiki=_preamble_  
This page has been automatically generated from the EPrints source. Any wiki changes made between the 'Pod2Wiki=*' and 'End of Pod2Wiki' comments will be lost.
+
This page has been automatically generated from the EPrints 3.2 source. Any wiki changes made between the 'Pod2Wiki=*' and 'Edit below this comment' comments will be lost.
  -->{{Pod2Wiki}}{{API:Source|file=EPrints/Config.pm|package_name=EPrints::Config}}[[Category:API|Config]]<!-- End of Pod2Wiki -->
+
  -->{{API}}{{Pod2Wiki}}{{API:Source|file=perl_lib/EPrints/Config.pm|package_name=EPrints::Config}}[[Category:API|CONFIG]][[Category:API:EPrints/Config|CONFIG]]<div><!-- Edit below this comment -->
<!-- Pod2Wiki=head_name -->=NAME=
+
 
 +
 
 +
<!-- Pod2Wiki=_private_ --><!-- Pod2Wiki=head_name -->
 +
==NAME==
 
'''EPrints::Config''' - software configuration handler
 
'''EPrints::Config''' - software configuration handler
  
<!-- End of Pod2Wiki -->
+
<!-- Edit below this comment -->
<!-- Pod2Wiki=head_description -->=DESCRIPTION=
+
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
<!-- Pod2Wiki=head_description -->
 +
==DESCRIPTION==
 
This module handles loading the main configuration for an instance of the eprints software - such as the list of language id's and  the top level configurations for repositories - the XML files in /archives/
 
This module handles loading the main configuration for an instance of the eprints software - such as the list of language id's and  the top level configurations for repositories - the XML files in /archives/
  
<!-- End of Pod2Wiki -->
+
You should need to use this module, instead load repositories using [[API:EPrints|EPrints]].
<!-- Pod2Wiki=head_methods -->=METHODS=
+
<!-- End of Pod2Wiki -->
+
<!-- Pod2Wiki=head_deprecated_methods -->==Deprecated Methods==
+
<!-- End of Pod2Wiki -->
+
<!-- Pod2Wiki=item_eprints_config_abort -->===eprints_config_abort===
+
  
  EPrints::Config::abort
+
<!-- Edit below this comment -->
  
Deprecated, use [[API:EPrints|EPrints]]::abort.
 
  
<!-- End of Pod2Wiki -->
+
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=item_eprints_config_get_archive_config_item_eprints_config_get_archive_ids_item_eprints_config_load_archive_config_module -->===eprints_config_get_archive_config_item_eprints_config_get_archive_ids_item_eprints_config_load_archive_config_module===
+
<!-- Pod2Wiki=head_deprecated_methods -->
 +
===Deprecated Methods===
 +
* EPrints::Config::abort
 +
: Deprecated, use [[API:EPrints#abort|EPrints/abort]].
  
  EPrints::Config::get_archive_config=item EPrints::Config::get_archive_ids=item EPrints::Config::load_archive_config_module
+
* EPrints::Config::get_archive_config
 +
* EPrints::Config::get_archive_ids
 +
* EPrints::Config::load_archive_config_module
 +
: Deprecated, use *_repository_*.
  
Deprecated, use *_repository_*.
+
<!-- Edit below this comment -->
  
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=head_normal_methods -->==Normal Methods==
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_ensure_init -->===ensure_init===
 
  
  EPrints::Config::ensure_init()
+
<!-- Pod2Wiki= -->
 +
<!-- Pod2Wiki=head_methods -->
 +
==METHODS==
 +
<!-- Pod2Wiki=head_init -->
 +
===init===
  
If the init() method has not yet been called then call it, otherwise do nothing.
+
<source lang="perl">EPrints::Config::init()
  
<!-- End of Pod2Wiki -->
+
</source>
<!-- Pod2Wiki=item_init -->===init===
+
Load the EPrints configuration.
  
  EPrints::Config::init()
+
Do not use this method directly, it will be automatically called when using EPrints.
  
Load all the EPrints configuration files, first the general files such as SystemSettings and then the configurations for each repository.
+
Defines the following configuration properties:
  
<!-- End of Pod2Wiki -->
+
<pre> cgi_path /cgi
<!-- Pod2Wiki=item_get_repository_config -->===get_repository_config===
+
  cfg_path /cfg
 +
  lib_path /lib
 +
  arc_path /archives
 +
  bin_path /bin
 +
  var_path /var</pre>
  
  $repository = EPrints::Config::get_repository_config( $id )
+
<!-- Edit below this comment -->
  
 +
 +
<!-- Pod2Wiki= -->
 +
<!-- Pod2Wiki=head_load_system_config -->
 +
===load_system_config===
 +
 +
<source lang="perl">EPrints::Config::load_system_config()
 +
 +
</source>
 +
Load the system configuration files.
 +
 +
Configuration files are loaded in order from (later files with the same name will be ignored):
 +
 +
<pre>  /cfg/cfg.d
 +
  /lib/syscfg.d</pre>
 +
 +
<!-- Edit below this comment -->
 +
 +
 +
<!-- Pod2Wiki= -->
 +
<!-- Pod2Wiki=head_system_config -->
 +
===system_config===
 +
 +
<source lang="perl">$conf = EPrints::Config::system_config()
 +
 +
</source>
 +
Returns the system configuration variable. To access a specific configuration option use [[API:EPrints/Config#get|get]].
 +
 +
<!-- Edit below this comment -->
 +
 +
 +
<!-- Pod2Wiki= -->
 +
<!-- Pod2Wiki=head_get_repository_config -->
 +
===get_repository_config===
 +
 +
<source lang="perl">$repository = EPrints::Config::get_repository_config( $id )
 +
 +
</source>
 
Returns a hash of the basic configuration for the repository with the given id. This hash will include the properties from SystemSettings.
 
Returns a hash of the basic configuration for the repository with the given id. This hash will include the properties from SystemSettings.
  
<!-- End of Pod2Wiki -->
+
<!-- Edit below this comment -->
<!-- Pod2Wiki=item_get_repository_ids -->===get_repository_ids===
+
  
  @ids = EPrints::Config::get_repository_ids()
 
  
 +
<!-- Pod2Wiki= -->
 +
<!-- Pod2Wiki=head_get_repository_ids -->
 +
===get_repository_ids===
 +
 +
<source lang="perl">@ids = EPrints::Config::get_repository_ids()
 +
 +
</source>
 
Return a list of ids of all repositories belonging to this instance of the eprints software.
 
Return a list of ids of all repositories belonging to this instance of the eprints software.
  
<!-- End of Pod2Wiki -->
+
<!-- Edit below this comment -->
<!-- Pod2Wiki=item_load_repository_config_module -->===load_repository_config_module===
+
  
  $arc_conf = EPrints::Config::load_repository_config_module( $id )
 
  
Load the full configuration for the specified repository unless the  it has already been loaded.
+
<!-- Pod2Wiki= -->
 +
<!-- Pod2Wiki=head_load_repository_config_module -->
 +
===load_repository_config_module===
  
Return a reference to a hash containing the full repository configuration.
+
<source lang="perl">$arc_conf = EPrints::Config::load_repository_config_module( $id )
  
<!-- End of Pod2Wiki -->
+
</source>
<!-- Pod2Wiki=item_get -->===get===
+
Load the full configuration for the specified repository.
  
  $value = EPrints::Config::get( $confitem )
+
Returns a reference to a hash containing the full repository configuration.
  
 +
Configuration files are loaded in order from (later files with the same name will be ignored):
 +
 +
<pre>  archives/[archiveid]/cfg/cfg.d
 +
  site_lib/cfg.d
 +
  lib/cfg.d</pre>
 +
 +
Defines the following configuration properties:
 +
 +
<pre>  archiveroot    archives/[archiveid]
 +
  documents_path archives/[archiveid]/documents
 +
  config_path    archives/[archiveid]/cfg
 +
  htdocs_path    archives/[archiveid]/html
 +
  cgi_path      archives/[archiveid]/cgi</pre>
 +
 +
<!-- Edit below this comment -->
 +
 +
 +
<!-- Pod2Wiki= -->
 +
<!-- Pod2Wiki=head_get -->
 +
===get===
 +
 +
<source lang="perl">$value = EPrints::Config::get( $confitem )
 +
 +
</source>
 
Return the value of a given eprints configuration item. These values are obtained from SystemSettings plus a few extras for paths.
 
Return the value of a given eprints configuration item. These values are obtained from SystemSettings plus a few extras for paths.
  
<!-- End of Pod2Wiki -->
+
<!-- Edit below this comment -->
<!-- Pod2Wiki=_postamble_ --><!-- End of Pod2Wiki -->
+
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
<!-- Pod2Wiki=head_write_config -->
 +
===write_config===
 +
 
 +
<source lang="perl">$ok = EPrints::Config::write_config( $dest, $names, $values )
 +
 
 +
</source>
 +
Write name-value pairs to a configuration file $dest (overwriting any existing data). This uses [[API:EPrints/Dumper|EPrints::Dumper]] to serialise the passed Perl structures.
 +
 
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
<!-- Pod2Wiki=head_copyright -->
 +
==COPYRIGHT==
 +
Copyright 2000-2011 University of Southampton.
 +
 
 +
This file is part of EPrints http://www.eprints.org/.
 +
 
 +
EPrints is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
 +
 
 +
EPrints is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
 +
 
 +
You should have received a copy of the GNU Lesser General Public License along with EPrints.  If not, see http://www.gnu.org/licenses/.
 +
 
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
<!-- Pod2Wiki=_postamble_ -->
 +
<!-- Edit below this comment -->

Latest revision as of 14:59, 30 July 2013

EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects


API: Core API

Latest Source Code (3.3, 3.2) | Revision Log | Before editing this page please read Pod2Wiki


NAME

EPrints::Config - software configuration handler


DESCRIPTION

This module handles loading the main configuration for an instance of the eprints software - such as the list of language id's and the top level configurations for repositories - the XML files in /archives/

You should need to use this module, instead load repositories using EPrints.


Deprecated Methods

  • EPrints::Config::abort
Deprecated, use EPrints/abort.
  • EPrints::Config::get_archive_config
  • EPrints::Config::get_archive_ids
  • EPrints::Config::load_archive_config_module
Deprecated, use *_repository_*.


METHODS

init

EPrints::Config::init()

Load the EPrints configuration.

Do not use this method directly, it will be automatically called when using EPrints.

Defines the following configuration properties:

  cgi_path /cgi
  cfg_path /cfg
  lib_path /lib
  arc_path /archives
  bin_path /bin
  var_path /var


load_system_config

EPrints::Config::load_system_config()

Load the system configuration files.

Configuration files are loaded in order from (later files with the same name will be ignored):

  /cfg/cfg.d
  /lib/syscfg.d


system_config

$conf = EPrints::Config::system_config()

Returns the system configuration variable. To access a specific configuration option use get.


get_repository_config

$repository = EPrints::Config::get_repository_config( $id )

Returns a hash of the basic configuration for the repository with the given id. This hash will include the properties from SystemSettings.


get_repository_ids

@ids = EPrints::Config::get_repository_ids()

Return a list of ids of all repositories belonging to this instance of the eprints software.


load_repository_config_module

$arc_conf = EPrints::Config::load_repository_config_module( $id )

Load the full configuration for the specified repository.

Returns a reference to a hash containing the full repository configuration.

Configuration files are loaded in order from (later files with the same name will be ignored):

  archives/[archiveid]/cfg/cfg.d
  site_lib/cfg.d
  lib/cfg.d

Defines the following configuration properties:

  archiveroot    archives/[archiveid]
  documents_path archives/[archiveid]/documents
  config_path    archives/[archiveid]/cfg
  htdocs_path    archives/[archiveid]/html
  cgi_path       archives/[archiveid]/cgi


get

$value = EPrints::Config::get( $confitem )

Return the value of a given eprints configuration item. These values are obtained from SystemSettings plus a few extras for paths.


write_config

$ok = EPrints::Config::write_config( $dest, $names, $values )

Write name-value pairs to a configuration file $dest (overwriting any existing data). This uses EPrints::Dumper to serialise the passed Perl structures.


COPYRIGHT

Copyright 2000-2011 University of Southampton.

This file is part of EPrints http://www.eprints.org/.

EPrints is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

EPrints is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with EPrints. If not, see http://www.gnu.org/licenses/.