App-WordPressTools
view release on metacpan or search on metacpan
script/wp-tools view on Meta::CPAN
my ($uid, $gid, $home_dir);
### determine who we are or should be running as
if ($< == 0) {
if (!$args->{'username'}) {
help(1, "You cannot $command a WordPress installation as a root user");
}
($uid, $gid, $home_dir) = (getpwnam $args->{'username'})[2, 3, 7];
}
else {
my $username;
($username, $uid, $gid, $home_dir) = (getpwuid $<)[0, 2, 3, 7];
$args->{'username'} = $username if !$args->{'username'};
}
### check space and average IO wait time of the home partition
if (my ($homeslash) = $home_dir =~ m{^(/home\d+)/} and !$args->{force}) {
#get available space on /home for the user in question in POSIX standard
my $df = `df -P $homeslash | tail -1`;
my ($device,undef,undef,$available) = split(/\s+/, $df);
#convert to MB
my $mbavail = $available / 1024;
( run in 0.252 second using v1.01-cache-2.11-cpan-8d75d55dd25 )