本文整理匯總了PHP中lxfile_exists函數的典型用法代碼示例。如果您正苦於以下問題:PHP lxfile_exists函數的具體用法?PHP lxfile_exists怎麽用?PHP lxfile_exists使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了lxfile_exists函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getServiceDetails
static function getServiceDetails($list)
{
$ps = lxshell_output("ps", "ax");
$run = Service__linux::getRunLevel();
$rclist = lscandir_without_dot("__path_real_etc_root/rc{$run}.d/");
foreach ($list as &$__l) {
$__l['install_state'] = 'dull';
$__l['state'] = 'off';
$__l['boot_state'] = 'off';
if (lxfile_exists("__path_real_etc_root/init.d/{$__l['servicename']}")) {
$__l['install_state'] = 'on';
} else {
continue;
}
if (self::checkServiceInRc($rclist, $__l['servicename'])) {
$__l['boot_state'] = 'on';
}
if ($__l['grepstring']) {
if (preg_match("/[\\/ ]{$__l['grepstring']}/i", $ps)) {
$__l['state'] = 'on';
}
} else {
$ret = lxshell_return("/etc/init.d/{$__l['servicename']}", "status");
if ($ret) {
$__l['state'] = 'off';
} else {
$__l['state'] = 'on';
}
}
}
return $list;
}
示例2: do_server_stuff
function do_server_stuff()
{
global $gbl, $sgbl, $login, $ghtml;
if (if_demo()) {
return;
}
try {
timed_execution();
if ($sgbl->is_this_master()) {
$schour = null;
$scminute = null;
$timefile = "../etc/conf/scavenge_time.conf";
if (lxfile_exists($timefile)) {
$readvalue = file_get_contents($timefile);
$readvalue = explode(" ", $readvalue);
$schour = $readvalue['0'];
$scminute = $readvalue['1'];
}
log_log("cron_exec", "Initialize Scavenge Cronjob");
if ($schour) {
cron_exec($schour, $scminute, "exec_scavenge");
} else {
cron_exec("03", "35", "exec_scavenge");
}
}
} catch (exception $e) {
print "Caught Exception: ";
print $e->getMessage();
print "\n";
}
}
示例3: updatecleanup_main
function updatecleanup_main()
{
global $argc, $argv;
global $gbl, $sgbl, $login, $ghtml;
$program = $sgbl->__var_program_name;
$opt = parse_opt($argv);
if ($opt['type'] === 'master') {
initProgram('admin');
$flg = "__path_program_start_vps_flag";
if (!lxfile_exists($flg)) {
set_login_skin_to_feather();
}
} else {
$login = new Client(null, null, 'update');
}
print "Executing UpdateCleanup. This can take a long time. Please be patient\n";
log_log("update", "Executing Updatecleanup");
//
// Cleanup old lxlabs.repo file
//
print "Fixing Repo's\n";
if (lxfile_exists("/etc/yum.repos.d/lxcenter.repo")) {
if (lxfile_exists("/etc/yum.repos.d/lxlabs.repo")) {
lxfile_mv("/etc/yum.repos.d/lxlabs.repo", "/etc/yum.repos.d/lxlabs.repo.lxsave");
system("rm -f /etc/yum.repos.d/lxlabs.repo");
}
}
if (lxfile_exists("CVS")) {
print "Found Development version, we just go on.\n";
// exit;
}
if ($opt['type'] === 'master') {
$sgbl->slave = false;
if (!is_secondary_master()) {
print "Update database\n";
updateDatabaseProperly();
print "Fix Extra database issues\n";
fixExtraDB();
print "Update extra issues\n";
doUpdateExtraStuff();
print "Get Driver info\n";
lxshell_return("__path_php_path", "../bin/common/driverload.php");
}
print "Starting Update all slaves\n";
update_all_slave();
print "Fix main {$program} databasefile\n";
cp_dbfile();
} else {
$sgbl->slave = true;
}
if (!is_secondary_master()) {
print "Starting update cleanups\n";
updatecleanup();
}
lxfile_touch("__path_program_start_vps_flag");
}
示例4: get
function get()
{
if (!lxfile_exists("__path_program_root/session/{$this->nname}")) {
$this->dbaction = 'add';
return;
}
$rmt = lfile_get_json_unserialize("__path_program_root/session/{$this->nname}");
$this->modify($rmt, 'clean');
$this->dbaction = 'clean';
}
示例5: change_lxadmin_to_kloxo_directory
function change_lxadmin_to_kloxo_directory($dir)
{
if (!lxfile_exists($dir)) {
return;
}
$list = lscandir_without_dot_or_underscore($dir);
foreach ($list as $l) {
change_lxadmin_to_kloxo("{$dir}/{$l}");
}
}
示例6: collectdata_main
function collectdata_main()
{
if (lxfile_exists("/proc/xen") && lxfile_exists("/usr/sbin/xm")) {
vps__xen::find_traffic();
vps__xen::find_cpuusage();
}
if (lxfile_exists("/proc/vz")) {
vps__openvz::find_traffic();
vps__openvz::find_cpuusage();
vps__openvz::find_memoryusage();
}
}
示例7: dbactionAdd
function dbactionAdd()
{
global $gbl, $sgbl, $login, $ghtml;
lxfile_mkdir("__path_client_root/{$this->main->nname}");
lxfile_mkdir("__path_client_root/{$this->main->nname}/__backup");
lxfile_generic_chown("__path_client_root/{$this->main->nname}", "lxlabs");
lxfile_generic_chown("__path_client_root/{$this->main->nname}/__backup", "lxlabs");
if (lxfile_exists("__path_customer_root/{$this->main->getPathFromName()}")) {
throw new lxException("directory_already_exists", '', '');
}
$ret = $this->createUser();
$this->setupDefaultDomain();
return $ret;
}
示例8: installapp_data_update
function installapp_data_update()
{
print fill_string("Fetch current InstallApp version", 50);
$string = file_get_contents("http://download.lxcenter.org/download/installapp/version.list");
$rmt = unserialize($string);
if (!$rmt) {
throw new lxexception(" could_not_get_application_version_list", '', "");
}
print " OK ";
$remver = $rmt->applist['installapp'];
print "version is {$remver}\n";
if (lxfile_exists("/home/kloxo/httpd/installappdata")) {
print fill_string("Fetch local InstallApp version", 50);
$loc = get_local_application_version_list();
$locver = $loc->applist['installapp'];
print " OK version is {$locver}\n";
if ($remver != $locver) {
print fill_string("New installapp found", 50);
print " OK\n";
}
}
print fill_string("Checking for old installappdata.zip", 50);
if (lxfile_exists("/tmp/installappdata.zip")) {
lxfile_rm("/tmp/installappdata.zip");
}
print " OK\n";
print fill_string("Downloading InstallApp data...", 50);
system("cd /tmp ; wget -q http://download.lxcenter.org/download/installapp/installappdata.zip");
if (!lxfile_exists("/tmp/installappdata.zip")) {
print " ERROR\n";
print "Could not download data from LxCenter.\nAborted.\n\n";
return;
}
print " OK\n";
print fill_string("Remove old InstallApp data", 50);
// lxfile_rm_rec("__path_kloxo_httpd_root/installappdata");
// lxfile_mkdir("__path_kloxo_httpd_root/installappdata");
lxfile_rm_rec("/home/kloxo/httpd/installappdata");
lxfile_mkdir("/home/kloxo/httpd/installapp");
lxfile_mkdir("/home/kloxo/httpd/installappdata");
print " OK\n";
print fill_string("Unpack new InstallApp data", 50);
// lxshell_unzip("lxlabs", "__path_kloxo_httpd_root/installappdata/", "/tmp/installappdata.zip");
system("cd /home/kloxo/httpd/installappdata ; unzip -qq /tmp/installappdata.zip");
print " OK\n";
print fill_string("Remove downloaded InstallApp data zip file", 50);
lxfile_rm("/tmp/installappdata.zip");
print " OK\n";
}
示例9: generateGraph
static function generateGraph($oldtime, $newtime)
{
global $global_dontlogshell;
$oldv = $global_dontlogshell;
$global_dontlogshell = true;
$list = lscandir_without_dot("__path_httpd_root");
foreach ($list as $l) {
if (!lxfile_exists("__path_httpd_root/{$l}/stats")) {
continue;
}
$total = webtraffic::getEachwebfilequota("__path_httpd_root/{$l}/stats/{$l}-custom_log", $oldtime, $newtime);
execRrdSingle("webtraffic", "ABSOLUTE", $l, $total * 1024 * 1024);
}
$global_dontlogshell = $oldv;
}
示例10: lxfile_rm_rec
function lxfile_rm_rec($file)
{
$obj = new COM("Scripting.FilesystemObject");
$file = expand_real_root($file);
$file = remove_extra_slash($file);
$list = explode("/", $file);
if (count($list) <= 2) {
throw new lxException('recursive_removal_low_level_directories_not_allowed', '');
}
if (lxfile_exists($file)) {
if (is_dir($file)) {
$obj->deleteFolder($file);
} else {
$obj->deleteFile($file);
}
}
}
示例11: scavenge_main
function scavenge_main()
{
global $gbl, $sgbl, $login, $ghtml;
log_scavenge("Fix log dir");
passthru("{$sgbl->__path_php_path} ../bin/common/fixlogdir.php");
log_scavenge("### Starting Scavenge");
initProgramlib('admin');
uploadStatsLxCenter();
if (lxfile_exists("../etc/conf/scavenge_time.conf")) {
log_scavenge("Found scavenge_time.conf");
}
log_scavenge("Collect Traffic");
passthru("{$sgbl->__path_php_path} ../bin/gettraffic.php");
log_scavenge("Collect Quota");
passthru("{$sgbl->__path_php_path} ../bin/collectquota.php");
log_scavenge("Schedule backups");
passthru("{$sgbl->__path_php_path} ../bin/common/schedulebackup.php");
log_scavenge("Clear Sessions");
passthru("{$sgbl->__path_php_path} ../bin/common/clearsession.php");
log_scavenge("Self backup");
passthru("{$sgbl->__path_php_path} ../bin/common/mebackup.php");
log_scavenge("Check Cluster Disk Quota");
checkClusterDiskQuota();
$driverapp = $gbl->getSyncClass(null, 'localhost', 'web');
if ($driverapp === 'lighttpd') {
log_scavenge("Restarting lighttpd");
system("service lighttpd restart");
}
log_scavenge("InstallApp update");
passthru("{$sgbl->__path_php_path} ../bin/installapp-update.phps");
log_scavenge("Watchdog checks");
$rs = get_all_pserver();
foreach ($rs as $r) {
watchdog::addDefaultWatchdog($r);
}
log_scavenge("Collect LxGuard info");
lxguard::collect_lxguard();
log_scavenge("Fix MySQL root password");
fix_all_mysql_root_password();
log_scavenge("Auto update Kloxo");
auto_update();
log_scavenge("### End Scavenge");
// Wait at least 60 seconds before ending the scavenge
sleep(60);
}
示例12: dbactionAdd
function dbactionAdd()
{
global $gbl, $sgbl, $login, $ghtml;
$dir = $this->main->__var_full_directory;
$dir = expand_real_root($dir);
$pass = $this->main->realpass;
if (!$pass) {
$pass = randomString(8);
}
lxshell_input("{$pass}\n{$pass}\n", "pure-pw", "useradd", $this->main->nname, "-u", $this->main->__var_username, "-d", $dir, "-m");
if (!lxfile_exists($dir)) {
lxfile_mkdir($dir);
lxfile_unix_chown($dir, $this->main->__var_username);
}
$this->setQuota();
// If the user is added is fully formed, this makes sure that all his properties are synced.
$this->toggleStatus();
}
示例13: createDiruserfile
function createDiruserfile()
{
$dir = '__path_httpd_root/' . $this->main->getParentName() . '/__dirprotect';
$dirfile = $dir . '/' . $this->main->getFileName();
$chownug = $this->main->__var_username . ':apache';
if (!lxfile_exists($dir)) {
lxuser_mkdir($chownug, $dir);
lxfile_generic_chmod($dir, '0750');
}
lxfile_rm($dirfile);
if ($this->main->status == 'on') {
$fstr = '';
foreach ($this->main->diruser_a as $v) {
$fstr .= $v->nname . ':' . crypt($v->param) . "\n";
}
lxuser_put_contents($chownug, $dirfile, $fstr);
lxfile_generic_chmod($dirfile, '0750');
}
}
示例14: updateform
function updateform($subaction, $param)
{
global $gbl, $sgbl, $login, $ghtml;
$list = array("client");
if ($sgbl->isHyperVm()) {
$list = lx_array_merge(array($list, array("vps")));
}
$vlist['class'] = array('s', $list);
$vlist['description'] = null;
$vlist['url'] = null;
$ipt = "img/custom/{$this->nname}.gif";
if (lxfile_exists($ipt)) {
$vlist['image'] = array('I', array('width' => 20, 'height' => 20, 'value' => $ipt));
} else {
$vlist['image'] = array('M', "No Image");
}
$vlist['upload'] = array('F', null);
return $vlist;
}
示例15: setFixUserlogoDomainPages
function setFixUserlogoDomainPages()
{
global $gbl, $sgbl, $login, $ghtml;
$login->loadAllObjects('client');
$list = $login->getList('client');
foreach ($list as $c) {
$clname = $c->getPathFromName('nname');
$cdir = "/home/{$clname}";
$dlist = $c->getList('domaina');
foreach ((array) $dlist as $l) {
$web = $l->nname;
// If there is no images directory so need to create that first
if (!lxfile_exists("{$cdir}/{$web}/images")) {
lxfile_mkdir("{$cdir}/{$web}/images");
}
system("cp -rf /home/kloxo/httpd/user-logo.png {$cdir}/{$web}/images/logo.png");
log_cleanup("- User logo for domain pages moved to -> {$cdir}/{$web}/images/logo.png");
}
}
}