Difference between revisions of "API:EPrints/System"
(Created page with "<!-- Pod2Wiki=_preamble_ This page has been automatically generated from the EPrints 3.4 source. Any wiki changes made between the 'Pod2Wiki=*' and 'Edit below this comment'...") |
|||
Line 31: | Line 31: | ||
All file and directory names are absolute and joined by the UNIX separator character <tt>/</tt>. | All file and directory names are absolute and joined by the UNIX separator character <tt>/</tt>. | ||
+ | |||
+ | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <span style='display:none'>User Comments</span> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki= --> | ||
+ | </div> | ||
+ | <!-- Pod2Wiki=head_instance_variables --> | ||
+ | ==INSTANCE VARIABLES== | ||
+ | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <span style='display:none'>User Comments</span> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki= --> | ||
+ | </div> | ||
+ | <!-- Pod2Wiki=item_$self->{uid} --> | ||
+ | ===$self->{uid}=== | ||
+ | |||
+ | The user ID of this EPrints system. | ||
+ | |||
+ | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <span style='display:none'>User Comments</span> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki= --> | ||
+ | </div> | ||
+ | <!-- Pod2Wiki=item_$self->{gid} --> | ||
+ | ===$self->{gid}=== | ||
+ | |||
+ | The group ID of this EPrints system. | ||
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> |
Latest revision as of 10:02, 11 January 2022
EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects
Latest Source Code (3.4, 3.3) | Revision Log | Before editing this page please read Pod2Wiki
Contents
- 1 NAME
- 2 DESCRIPTION
- 3 INSTANCE VARIABLES
- 4 METHODS
- 4.1 Constructor Methods
- 4.2 Object Methods
- 4.2.1 init
- 4.2.2 chmod
- 4.2.3 chown
- 4.2.4 chown_for_eprints
- 4.2.5 getgrnam
- 4.2.6 getpwnam
- 4.2.7 current_uid
- 4.2.8 test_uid
- 4.2.9 mkdir
- 4.2.10 exec
- 4.2.11 read_exec
- 4.2.12 read_perl_script
- 4.2.13 free_space
- 4.2.14 proc_exists
- 4.2.15 get_hash_name
- 4.2.16 write_config_file
- 4.2.17 quotemeta
- 4.2.18 capture_stderr
- 4.2.19 restore_stderr
- 4.2.20 join_path
- 4.2.21 file_extension
- 4.2.22 sanitise
- 4.2.23 bin_paths
- 5 COPYRIGHT
NAME
EPrints::System - Wrappers for system calls.
DESCRIPTION
When you call a method in this class, it is sent to the appropriate EPrints::System sub-module:
EPrints::System::darwin EPrints::System::freebsd EPrints::System::linux EPrints::System::MSWin32 EPrints::System::openbsd EPrints::System::solaris
By default this will be EPrints::System::linux.
Which module is used is configured by the platform setting in EPrints::SystemSettings
All file and directory names are absolute and joined by the UNIX separator character /.
INSTANCE VARIABLES
$self->{uid}
The user ID of this EPrints system.
$self->{gid}
The group ID of this EPrints system.
METHODS
Constructor Methods
new
$sys = EPrints::System->new
Returns a new EPrints System object.
Object Methods
init
$sys->init
Perform any platform-specific initialisation.
chmod
$sys->chmod( $mode, @files )
Change the access control on @files listed to $mode.
chown
$sys->chown( $uid, $gid, @files )
Change the user and group on @files to $uid and $gid. $uid and $gid are as returned by getpwnam (usually numeric).
chown_for_eprints
$sys->chown_for_eprints( @files )
Change the user and group on @files to the current EPrints user and group.
getgrnam
$gid = $sys->getgrnam( $group )
Return the system group ID of the group $group.
getpwnam
($user, $crypt, $uid, $gid ) = $sys->getpwnam( $user )
Return the login name, password crypt, UID and GID for user $user.
current_uid
$sys->current_uid
Returns the current UID of the user running this process.
test_uid
$sys->test_uid
Test whether the current user is the same that is configured in EPrints::SystemSettings.
mkdir
$sys->mkdir( $full_path, $perms )
Create a directory $full_path (including parent directories as necessary) set permissions described by $perms. If $perms is undefined defaults to dir_perms in EPrints::SystemSettings.
exec
$sys->exec( $repository, $cmd_id, %map )
Executes certain named task $cmd_id on $repository, which were once (and may be) handled by external binaries. This allows a per-platform solution to each task. E.g. unpacking a .tar.gz file.
%map includes variable names and values that need to be mapped into the task command.
Returns the numerical return code from the executed command.
read_exec
$rc = $sys->read_exec( $repo, $tmp, $cmd_id, %map )
Same as </exec> but write STDOUT and STDERR to the filename specified by $tmp.
read_perl_script
$rc = $sys->read_perl_script( $repo, $tmp, @args )
Executes Perl with arguments from @args, including the current EPrints library path. Writes STDOUT and STDERR from the script to file with name $tmp.
Returns 0 on success.
free_space
$sys->free_space( $dir )
Return the amount of free space (in bytes) available at $dir. $dir may contain a drive (e.g. C:) on Windows platforms.
proc_exists
$bool = $sys->proc_exists( $pid )
Returns true if a process exists for ID with $pid.
Returns undef if process identification is unsupported.
get_hash_name
$filename = $sys->get_hash_name
Returns the last part of the filename of the hashfile for a document. (yes, it's a bad function name.)
write_config_file
$backup = write_config_file( $path, $content, [ %opts ] )
Write a config file containing $content to the file located at $path.
If $content is undefined no file will be written.
%opts not currently used but reserved for future use.
quotemeta
$quoted = $sys->quotemeta( $path )
Quote $path so it is safe to be used in a shell call.
capture_stderr
$tmpfile = $sys->capture_stderr
Captures STDERR output into a temporary file and return a file handle to it.
restore_stderr
$sys->restore_stderr( $tmpfile )
Restores STDERR after capturing.
If $tmpfile is set, reset seek and sysseek to the start of this file.
join_path
$path = $sys->join_path( @parts )
Returns @parts joined together using the current system's path separator.
file_extension
$ext = $sys->file_extension( $filename )
Returns the file extension of $filename including the leading . e.g. .tar.gz.
Returns empty string if there is no file extension.
sanitise
$filepath = $sys->sanitise( $filepath )
Replaces restricted file system characters and control characters in $filepath with _.
Removes path-walking elements (. and ..) from the front of any path components and removes the leading /.
bin_paths
@paths = $sys->bin_paths
Get the list of absolute directories to search for system tools (e.g. convert).
COPYRIGHT
© Copyright 2000-2024 University of Southampton.
EPrints 3.4 is supplied by EPrints Services.
http://www.eprints.org/eprints-3.4/
LICENSE
This file is part of EPrints 3.4 http://www.eprints.org/.
EPrints 3.4 and this file are released under the terms of the GNU Lesser General Public License version 3 as published by the Free Software Foundation unless otherwise stated.
EPrints 3.4 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 3.4. If not, see http://www.gnu.org/licenses/.