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
- 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
EPrints::System - Wrappers for system calls.
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 /.
The user ID of this EPrints system.
The group ID of this EPrints system.
$sys = EPrints::System->new
Returns a new EPrints System object.
Perform any platform-specific initialisation.
$sys->chmod( $mode, @files )
Change the access control on @files listed to $mode.
$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).
$sys->chown_for_eprints( @files )
Change the user and group on @files to the current EPrints user and group.
$gid = $sys->getgrnam( $group )
Return the system group ID of the group $group.
($user, $crypt, $uid, $gid ) = $sys->getpwnam( $user )
Return the login name, password crypt, UID and GID for user $user.
Returns the current UID of the user running this process.
Test whether the current user is the same that is configured in EPrints::SystemSettings.
$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.
$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.
$rc = $sys->read_exec( $repo, $tmp, $cmd_id, %map )
Same as </exec> but write STDOUT and STDERR to the filename specified by $tmp.
$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.
$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.
$bool = $sys->proc_exists( $pid )
Returns true if a process exists for ID with $pid.
Returns undef if process identification is unsupported.
$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.)
$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.
$quoted = $sys->quotemeta( $path )
Quote $path so it is safe to be used in a shell call.
$tmpfile = $sys->capture_stderr
Captures STDERR output into a temporary file and return a file handle to it.
$sys->restore_stderr( $tmpfile )
Restores STDERR after capturing.
If $tmpfile is set, reset seek and sysseek to the start of this file.
$path = $sys->join_path( @parts )
Returns @parts joined together using the current system's path separator.
$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.
$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 /.
@paths = $sys->bin_paths
Get the list of absolute directories to search for system tools (e.g. convert).
© Copyright 2022 University of Southampton.
EPrints 3.4 is supplied by EPrints Services.
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/.