cPanel::SyncUtil

cPanel::SyncUtil is a Perl extension for creating utilities that work with cpanelsync aware directories.
Download

cPanel::SyncUtil Ranking & Summary

Advertisement

  • Rating:
  • License:
  • GPL
  • Price:
  • FREE
  • Publisher Name:
  • Daniel Muey
  • Publisher web site:
  • http://search.cpan.org/~dmuey/

cPanel::SyncUtil Tags


cPanel::SyncUtil Description

cPanel::SyncUtil is a Perl extension for creating utilities that work with cpanelsync aware directories. cPanel::SyncUtil is a Perl extension for creating utilities that work with cpanelsync aware directories.SYNOPSIS use cPanel::SyncUtil;These utility functions can be used to in scripts that create and work with cpanelsync environments.EXAMPLESee scripts/cpanelsync_build for a working example that can be used to build cPanel's cPAddon Vendor cpanelsync directory for your website.EXPORTNone by default, all functions are exportable if you wish: use cPanel::SyncUtil qw(_raw_dir); use cPanel::SyncUtil qw(:all);FUNCTIONS_chown_pwd_recursivelyTakes as its first argument a user that matches ^w+$ (and optionally a group as its second argument, also matching ^w+$) and recursively chown's the current working directory to the given user (and group if given).Currently the return value is from a system() call to chown._safe_cpsync_dirReturns true if the given argument is a directory that it is safe to be cpanelsync'ified.See the simple, scripts/cpanelsync_build_dir script for example useage while recursing directories._raw_dirThis function makes the .tar and .bz2 version of the file system.Its arguments are the following: _raw_dir($base, $archive, $verbose, @files);$base and $archive are the only required arguments.$archive is a directory in $base.It will chdir in $base and the process the directory $archiveIf $verbose is true, output will be verbose.If @files is specified each item in it is also processed.Each item in @files must be a file (-f) in $base/$archive.If it returns false the error is in $! _raw_dir($base, $archive, $verbose, @files) or die "_raw_dir($base, $archive, $verbose, @files) failed: $!";Its very important to check the return value because if its failed its possible you will not be in the directory you think and then subsequent file operations will either fail or not work like you expect. Plus if its returned false then there is either a file system problem or the input to the function is not valid. In other words, if it fails you need to resolve the problem before continuing so die()ing is a good idea generally._sync_touchlock_pwd is then run on $base/$archive so that its now a cpanelsync directory_get_opts_hashShortcut to get a hash (in array context) or hash ref (in scalar context) of the script using this module's command line options.Takes the same exact input as Getopt::Std getopts()_sync_touchlock_pwdCreates the .cpanelsync file (and its .bz2 version) and .cpanelsync.lock for the current working directory_read_dirShortcut to File::Slurp's read_dir_write_fileShortcut to File::Slurp's write_file_lockLocks the given directories._unlockUnlocks the given directories. _unlock(qw(foo bar baz));Requirements:· Perl Requirements: · Perl


cPanel::SyncUtil Related Software