#!/usr/bin/perl
##LICENSE##
package RVL::Task::SetupConstantsStart;
use base qw(RVL::Task);
use RVL::File;
use Class::Std::Utils;
{
sub run {
my ($this, $conf) = @_;
use define RVL_ETC_DIR => __CONSTANT__::RVL_PATH . '/etc';
use define RVL_APP_ROOT => __CONSTANT__::RVL_PATH;
use define RVL_LOG_DIR => __CONSTANT__::RVL_VAR_DIR . '/log';
if($ENV{REMOTE_USER} ne 'root'){
my $homePath = (getpwnam($ENV{REMOTE_USER}))[7];
$cachePath = $homePath . '/.rvglobalsoft/tmp/cache';
if(!-d $cachePath){
RVL::File::mkdirp($cachePath,'0755');
}
my $cmd = "chown $ENV{REMOTE_USER}:$ENV{REMOTE_USER} $homePath/.rvglobalsoft";
system($cmd);
$cmd = "chown $ENV{REMOTE_USER}:$ENV{REMOTE_USER} $homePath/.rvglobalsoft/tmp";
system($cmd);
$cmd = "chown $ENV{REMOTE_USER}:$ENV{REMOTE_USER} $homePath/.rvglobalsoft/tmp/cache";
system($cmd);
}else{
$cachePath = __CONSTANT__::RVL_VAR_DIR . '/cache';
}
use define RVL_CACHE_DIR => $cachePath;
use define RVL_LIB_DIR => __CONSTANT__::RVL_APP_ROOT . '/lib';
use define RVL_ENT_DIR => __CONSTANT__::RVL_CACHE_DIR . '/entities';
use define RVL_DAT_DIR => __CONSTANT__::RVL_APP_ROOT . '/lib/data';
use define RVL_CORE_DIR => __CONSTANT__::RVL_APP_ROOT . '/lib/RVL';
}
}
package RVL::Task::SetupConstant;
use base qw(RVL::Task);
use Class::Std::Utils;
{
sub getBaseUrl {
my ($conf) = RVL::Config::singleton()->getAll();
return defined($conf->{'site'}->{'baseUrl'}) ? $conf->{'site'}->{'baseUrl'} : '.';
}
sub getWebRoot {
my ($conf) = RVL::Config::singleton()->getAll();
return (defined($conf->{'path'}->{'webRoot'})) ? $conf->{'path'}->{'webRoot'} : __CONSTANT__::RVL_PATH . '/public_html';
}
}
package RVL::Task::SetupConstantsFinish;
use base qw(RVL::Task);
use Class::Std::Utils;
{
sub run {
my ($this, $conf) = @_;
use define RVL_BASE_URL => RVL::Task::SetupConstant::getBaseUrl();
use define RVL_WEB_ROOT => RVL::Task::SetupConstant::getWebRoot();
use define RVL_THEME_DIR => __CONSTANT__::RVL_WEB_ROOT . '/themes';
}
}
package RVL::Task::LoadPlatform;
use base qw(RVL::Task);
use Class::Std::Utils;
{
sub run {
my ($package) = "RVL/";
if ($^O =~ /MSWin/i) {
$package = "RVL/Platform/MSWin/";
}
my @aListFiles = (
"Archive.pm",
"File.pm",
"Net.pm"
);
foreach my $file (@aListFiles) {
if (-f __CONSTANT__::RVL_LIB_DIR . "/" . $package . $file) {
require $package . $file;
}
}
}
}
1;
Copyright 2K16 - 2K18 Indonesian Hacker Rulez