Jump to content
Wiki Home
EPrints Home
Bazaar
Files
Main menu
Main menu
move to sidebar
hide
Navigation
Front Page
EPrints 3 Manual
EPrints Training Course
EPrints Glossary
Installing EPrints
How-to Configure EPrints
EPrints 3.2+ API
EPrints 3 Reference
EPrints Plugins
Wiki
All categories
Recent changes
Main Page
Help
EPrints Documentation
Search
Search
Appearance
Log in
Request account
Personal tools
Log in
Request account
Pages for logged out editors
learn more
Contributions
Talk
Editing
API:EPrints/Repository
(section)
Page
Discussion
British English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==METHODS== <!-- Pod2Wiki=head_new --> ===new=== <source lang="perl">$repository = EPrints::Repository->new( %opts ) </source> Creates and returns a new repository object. This is a utility object only and will only have the basic system configuration available. <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_new --> ===new=== <source lang="perl">$repository = EPrints::Repository->new( $repository_id, %opts ) </source> Create a connection to an EPrints repository $repository_id which provides access to the database and to the repository configuration. Options: <pre> db_connect - 1 check_db - 1 noise - 0</pre> <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_create_from_data --> ===create_from_data=== <source lang="perl">$repo = EPrints::Repository->create_from_data( $epdata ) </source> Create a new repository instance using $epdata. <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_delete --> ===delete=== <source lang="perl">$repo->delete() </source> Destroy the repository and all its contents. To allow this method you must first set $EPrints::Repository::ALLOW_DELETE to 1. <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_query --> ===query=== <source lang="perl">$query = $repository->query </source> Return the {{API:PodLink|file=CGI|package_name=CGI|section=|text=CGI}} object describing the current HTTP query, or undefined if this isn't a CGI script. <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_url_param --> ===url_param=== <source lang="perl">$value or @values = $repository->url_param( $name ) </source> Retrieve the UTF-8 value(s) of the query parameter $name for the current request. This will not cause the POST data to be read. <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_param --> ===param=== <source lang="perl">$value or @values = $repository->param( $name ) </source> Passes through to CGI.pm param method. $value = $repository->param( $name ): returns the value of CGI parameter $name. @values = $repository->param: returns an array of the names of all the CGI parameters in the current request. <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_xml --> ===xml=== <source lang="perl">$xml = $repo->xml </source> Return an [[API:EPrints/XML|EPrints::XML]] object for working with XML. <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_xhtml --> ===xhtml=== <source lang="perl">$xhtml = $repo->xhtml </source> Return an [[API:EPrints/XHTML|EPrints::XHTML]] object for working with XHTML. <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_eprint --> ===eprint=== <source lang="perl">$eprint = $repository->eprint( $eprint_id ); </source> A convience method to return the [[API:EPrints/DataObj/EPrint|EPrints::DataObj::EPrint]] with the given ID, or undef. Equivent to $repository->dataset("eprint")->dataobj( $eprint_id ) <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_current_language --> ===current_language=== <source lang="perl">$lang = $repository->current_language </source> Returns the current language. <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_current_user --> ===current_user=== <source lang="perl">$user = $repository->current_user </source> Return the current logged in [[API:EPrints/DataObj/User|EPrints::DataObj::User]] for this session. Return undef if there isn't one. <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_user --> ===user=== <source lang="perl">$user = $repository->user( $user_id ); </source> A convience method to return the [[API:EPrints/DataObj/User|EPrints::DataObj::User]] with the given ID, or undef. Equivent to $repository->dataset("user")->dataobj( $user_id ) <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_user_by_username --> ===user_by_username=== <source lang="perl">$user = $repository->user_by_username( $username ); </source> Return the user with the given username, or undef. <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_user_by_email --> ===user_by_email=== <source lang="perl">$user = $repository->user_by_email( $email ); </source> Return the [[API:EPrints/DataObj/User|EPrints::DataObj::User]] with the given email, or undef. <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_template --> ===template=== <source lang="perl">$template = $repository->template( [ $id ] ) </source> <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_dataset --> ===dataset=== <source lang="perl">$dataset = $repository->dataset( $setname ) </source> Return a given [[API:EPrints/DataSet|EPrints::DataSet]] or undef if it doesn't exist. <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_config --> ===config=== <source lang="perl">$confitem = $repository->config( $key, [@subkeys] ) </source> Returns a named configuration setting including those defined in archvies/<archive_id>/cfg/cfg.d/ $repository->config( "stuff", "en", "foo" ) is equivalent to $repository->config( "stuff" )->{en}->{foo} <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_log --> ===log=== <source lang="perl">$repository->log( $msg [, $level ] ) </source> Log a plain text message $msg. If $level is given only logs if $level is greater than or equal to [[API:EPrints/Repository#noise|noise]]. To override where log messages are sent define the <code>log</code> callback: <pre> $c->{log} = sub { my( $repo, $msg, $level ) = @_; ... };</pre> <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_call --> ===call=== <source lang="perl">$result = $repository->call( $cmd, @params ) </source> Calls the subroutine named $cmd from the configuration perl modules for this repository with the given params and returns the result. <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_can_call --> ===can_call=== <source lang="perl">$boolean = $repository->can_call( @cmd_conf_path ) </source> Return true if the given subroutine exists in this repository's config package. <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_try_call --> ===try_call=== <source lang="perl">$result = $repository->try_call( $cmd, @params ) </source> Calls the subroutine named $cmd from the configuration perl modules for this repository with the given params and returns the result. If the subroutine does not exist then quietly returns undef. This is used to call deprecated callback subroutines. <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_template_dirs --> ===template_dirs=== <source lang="perl">@dirs = $repository->template_dirs( $langid ) </source> Returns a list of directories from which template files may be sourced, where the first matching template encountered is used. The directories searched are: <pre> archives/[archiveid]/cfg/lang/[langid]/templates/ archives/[archiveid]/cfg/templates/ archives/[archiveid]/cfg/themes/[themeid]/lang/[langid]/templates/ archives/[archiveid]/cfg/themes/[themeid]/templates/ lib/themes/[themeid]/templates/ lib/lang/[langid]/templates/ lib/templates/</pre> <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_get_static_dirs --> ===get_static_dirs=== <source lang="perl">@dirs = $repository->get_static_dirs( $langid ) </source> Returns a list of directories from which static files may be sourced. Directories are returned in order of importance, most important first: <pre> archives/[archiveid]/cfg/lang/[langid]/static archives/[archiveid]/cfg/static archives/[archiveid]/themes/[themeid]/static lib/themes/[themeid]/static lib/lang/[langid]/static lib/static</pre> <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_id --> ===id=== <source lang="perl">$id = $repository->id </source> Returns the id string of this repository. <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_exec --> ===exec=== <source lang="perl">$returncode = $repository->exec( $cmd_id, %map ) </source> Executes a system command. $cmd_id is the id of the command as set in SystemSettings and %map contains a list of things to "fill in the blanks" in the invocation line in SystemSettings. <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_test_config --> ===test_config=== <source lang="perl">( $returncode, $output) = $repository->test_config </source> This runs "epadmin test" as an external script to test if the current configuraion on disk loads OK. This can be used by the web interface to test if changes to config. files may be saved, or not. $returncode will be zero if everything seems OK. If not, then $output will contain the output of epadmin test <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_reload_config --> ===reload_config=== <source lang="perl">$ok = $repository->reload_config </source> Trigger a configuration reload on the next request/index. To reload the configuration right now just call [[API:EPrints/Repository#load_config|load_config]]. <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_html_phrase --> ===html_phrase=== <source lang="perl">$xhtml_phrase = $repository->html_phrase( $phraseid, %inserts ) </source> Return an XHTML DOM object describing a phrase from the phrase files. $phraseid is the id of the phrase to return. If the same ID appears in both the repository-specific phrases file and the system phrases file then the repository-specific one is used. If the phrase contains <ep:pin> elements, then each one should have an entry in %inserts where the key is the "ref" of the pin and the value is an XHTML DOM object describing what the pin should be replaced with. <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_phrase --> ===phrase=== <source lang="perl">$utf8_text = $repository->phrase( $phraseid, %inserts ) </source> Performs the same function as html_phrase, but returns plain text. All HTML elements will be removed, <br> and <p> will be converted into breaks in the text. <img> tags will be replaced with their "alt" values. <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_noise --> ===noise=== <source lang="perl">$noise_level = $repository->noise </source> Return the noise level for the current session. See the explaination under EPrints::Repository->new() <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_plugins --> ===plugins=== <source lang="perl">@plugins = $repository->plugins( [ $params, ] %restrictions ) </source> Returns a list of plugin objects that conform to %restrictions (may be empty). If $params is given uses that hash reference to initialise the plugins. Always passes this session to the plugin constructor method. <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_init_from_indexer --> ===init_from_indexer=== <source lang="perl">$repo->init_from_indexer( $daemon ) </source> (Re)initialise the repository object for use by the indexer. Calls [[API:EPrints/Repository#check_last_changed|check_last_changed]]. <!-- Pod2Wiki=head_copyright -->
Summary:
Please note that all contributions to EPrints Documentation may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
EPrints Documentation:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)