本文整理汇总了PHP中lunlink函数的典型用法代码示例。如果您正苦于以下问题:PHP lunlink函数的具体用法?PHP lunlink怎么用?PHP lunlink使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了lunlink函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process_main
function process_main()
{
global $gbl, $sgbl, $login, $ghtml;
global $argv;
$list = parse_opt($argv);
$exitchar = $sgbl->__var_exit_char;
$res = new Remote();
$res->exception = null;
$res->ddata = "hello";
$res->message = "hello";
$total = file_get_contents($list['temp-input-file']);
@lunlink($list['temp-input-file']);
$string = explode("\n", $total);
if (csb($total, "__file::")) {
ob_end_clean();
file_server(null, $total);
} else {
$reply = process_server_input($total);
//fprint(unserialize(base64_decode($reply)));
ob_end_clean();
print "{$reply}\n{$exitchar}\n";
flush();
}
exit;
}
示例2: fixlogdir_main
function fixlogdir_main()
{
global $gbl, $sgbl, $login, $ghtml;
$progname = $sgbl->__var_program_name;
$logl = lscandir_without_dot("../log");
lxfile_mkdir("../processed_log");
@lunlink("../log/access_log");
@lunlink("/usr/local/lxlabs/ext/php/error.log");
$dir = getNotexistingFile("../processed_log", "proccessed");
system("mv ../log ../processed_log/{$dir}");
mkdir("../log");
$list = lscandir_without_dot("../processed_log");
foreach ($list as $l) {
remove_directory_if_older_than_a_day("../processed_log/{$l}", 6);
}
foreach ($logl as $l) {
lxfile_touch("../log/{$l}");
}
lxfile_generic_chown_rec("../log", "lxlabs:lxlabs");
//
// Related to Issue #15
//
lxfile_generic_chmod_rec("../log", "0640");
lxfile_generic_chmod_rec("../processed_log", "0640");
lxfile_generic_chmod("../log", "0700");
lxfile_generic_chmod("../processed_log", "0700");
lxfile_generic_chmod("../log/lighttpd_error.log", "0644");
lxfile_generic_chmod("../log/access_log", "0644");
lxfile_generic_chown("../log/lighttpd_error.log", "lxlabs:root");
lxfile_generic_chown("../log/access_log", "lxlabs:root");
//
os_restart_program();
}
示例3: doUpdate
static function doUpdate($list)
{
$cmd = self::getYumCommand();
$file = fix_nname_to_be_variable($cmd);
$file = "__path_program_root/cache/{$file}";
lxshell_return("yum", "-y", "install", implode(" ", $list));
lunlink($file);
}
示例4: remove_lighttpd_error_log
function remove_lighttpd_error_log()
{
$f = "/home/kloxo/httpd/lighttpd/error.log";
$s = lxfile_size($f);
if ($s > 50 * 1024 * 1024) {
lunlink($f);
createRestartFile("lighttpd");
}
}
示例5: uninstallMe
static function uninstallMe()
{
global $gbl, $sgbl, $login, $ghtml;
lxshell_return("service", "httpd", "stop");
lxshell_return("rpm", "-e", "--nodeps", "httpd");
if (file_exists("/etc/init.d/httpd")) {
lunlink("/etc/init.d/httpd");
}
}
示例6: __xenimport_get_data
function __xenimport_get_data()
{
lxfile_mkdir("/home/oldxenconfig-hypervm");
$list = lscandir_without_dot("/etc/xen/oldxen");
foreach ($list as $l) {
$vm[] = __xenimport_parse_config("/etc/xen/oldxen/{$l}");
//lxfile_mv("/etc/xen/$l", "/home/oldxenconfig-hypervm");
lunlink("/etc/xen/auto/{$l}");
}
dprintr($vm);
return $vm;
}
示例7: doUpdate
static function doUpdate($list)
{
$cmd = self::getYumCommand();
$file = fix_nname_to_be_variable(implode(" ", $cmd));
$file = "__path_program_root/cache/{$file}";
$plist = implode(" ", $list);
while (true) {
system("up2date --nox --install --nosig {$plist}", $return_value);
if (!$return_value) {
break;
}
dprint("Got error from up2date...\n");
}
lunlink($file);
}
示例8: __xenimport_get_data
function __xenimport_get_data()
{
lxfile_mkdir("/home/oldxenconfig-hypervm");
$list = lscandir_without_dot("/etc/hypervm/");
foreach ($list as $l) {
if (!csb($l, "xm")) {
continue;
}
if (csb($l, "xmexample")) {
continue;
}
$vm[] = __xenimport_parse_config("/etc/xen/{$l}");
//lxfile_mv("/etc/xen/$l", "/home/oldxenconfig-hypervm");
lunlink("/etc/xen/auto/{$l}");
}
dprintr($vm);
return $vm;
}
示例9: readAuthorizedKey
static function readAuthorizedKey($username)
{
$p = os_get_home_dir($username);
if ($p === '/tmp' && $username) {
lxfile_mkdir("/home/{$username}");
lxshell_return("usermod", "-d", "/home/{$username}", $username);
lxfile_unix_chown_rec("/home/{$username}", "{$username}:{$username}");
$p = "/home/{$username}";
}
if (!$p) {
return;
}
$f = "{$p}/.ssh/authorized_keys";
if (lxfile_exists("{$f}2")) {
$s = lfile_get_contents("{$f}2");
$s = "\n{$s}\n";
lfile_put_contents($f, $s, FILE_APPEND);
lunlink("{$f}2");
}
return lfile_get_contents($f);
}
示例10: findTotalmailQuota
static function findTotalmailQuota($driver, $list, $oldtime, $newtime)
{
global $gbl, $sgbl, $login, $ghtml;
if (!isset($oldtime)) {
return null;
}
$file = '/var/log/kloxo/maillog';
$processedir = "/var/log/kloxo";
$convertedfile = self::convertfile($oldtime, $newtime);
if (!$convertedfile) {
self::rotateLog($processedir, $file);
return;
}
foreach ($list as $d) {
$tlist[$d] = self::getmail_usage($convertedfile, $d, $oldtime, $newtime);
}
lunlink($convertedfile);
self::rotateLog($processedir, $file);
self::rotateLog("/var/log/kloxo/", "/var/log/kloxo/courier");
self::rotateLog("/var/log/kloxo/", "/var/log/kloxo/smtp.log");
return $tlist;
}
示例11: initThisList
static function initThisList($parent, $class)
{
// Load entire Session
$result = null;
$list = lscandir_without_dot("__path_program_root/session");
foreach ($list as $l) {
$pp = lfile_get_json_unserialize("__path_program_root/session/{$l}");
if (!$pp) {
lunlink("__path_program_root/session/{$l}");
continue;
}
if (!$parent->isAdmin()) {
//$result = $db->getRowsWhere("parent_clname = '" . $parent->getClName() . "'");
if ($pp['parent_clname'] !== $parent->getClName()) {
continue;
}
}
$result[] = $pp;
}
if ($result) {
$parent->setListFromArray($parent->__masterserver, $parent->__readserver, 'ssessionlist', $result, true);
}
return null;
}
示例12: syncCreateConf
function syncCreateConf()
{
global $gbl, $sgbl, $login, $ghtml;
global $global_shell_error;
if_demo_throw_exception('cron');
$conf_file = "__path_cron_root/{$this->main->username}";
$list = array('minute', 'hour', 'weekday', 'ddate', 'month');
$tfile = lx_tmp_file($conf_file);
$cmd = null;
if ($this->main->__var_mailto) {
$cmd .= "MAILTO={$this->main->__var_mailto}\n";
}
$result = $this->main->__var_cron_list;
foreach ($result as &$__r) {
foreach ($list as $l) {
$__r[$l] = unserialize(base64_decode($__r["ser_{$l}"]));
}
}
$result = merge_array_object_not_deleted($result, $this->main);
//dprintr($result);
foreach ((array) $result as $v) {
if ($v['ttype'] === 'simple') {
$v['weekday'] = array('--all--');
$v['month'] = array('--all--');
$v['ddate'] = array('--all--');
if ($v['simple_cron'] === 'every-day') {
$v['hour'] = $v['cron_day_hour'];
$v['minute'] = 0;
}
if ($v['simple_cron'] === 'every-hour') {
$v['hour'] = array('--all--');
$v['minute'] = 0;
}
if ($v['simple_cron'] === 'every-minute') {
$v['hour'] = array('--all--');
$v['minute'] = array('--all--');
}
} else {
foreach ($v["weekday"] as &$___tq) {
if (is_numeric($___tq)) {
$___tq -= 1;
}
}
}
foreach ($list as $l) {
$v[$l] = $this->getCronString($v[$l]);
}
if (!$v['minute']) {
$v['minute'] = 0;
}
$cmd .= implode("\t", array($v['minute'], $v['hour'], $v['ddate'], $v['month'], $v['weekday'], $v['command']));
$cmd .= "\n";
}
lfile_put_contents($tfile, $cmd);
if (!posix_getpwnam($this->main->username)) {
lxfile_rm("/var/spool/cron/{$this->main->username}");
return;
}
$ret = lxshell_return("crontab", "-u", $this->main->username, $tfile);
if ($ret) {
// Why exactly was a throw removed? backup/restore?
//throw new lxException("adding_cron_failed", "", $global_shell_error);
$gbl->setWarning('adding_cron_failed', '', $global_shell_error);
$data = lfile_get_contents($tfile);
log_log("cron_error", $data);
}
lunlink($tfile);
}
示例13: setInternalParam
//.........这里部分代码省略.........
}
$iplist = get_namelist_from_objectlist($this->main->vmipaddress_a);
if ($this->main->mainipaddress) {
$main_ip = $this->main->mainipaddress;
$iplist = array_remove($iplist, $main_ip);
} else {
$main_ip = array_shift($iplist);
}
if ($this->main->networknetmask) {
$main_netmask = $this->main->networknetmask;
} else {
$main_netmask = "255.255.255.0";
}
$iplist = implode(" ", $iplist);
$ipadd = $result['ADD_IP'];
$sethostname = $result['SET_HOSTNAME'];
$setuserpass = $result['SET_USERPASS'];
$ipdel = $result['DEL_IP'];
if ($this->main->networkgateway) {
$gw = $this->main->networkgateway;
} else {
$gw = os_get_network_gateway();
}
$gwn = strtil($gw, '.') . '.0';
$hostname = $this->main->hostname;
if (!$hostname) {
$hostname = os_get_hostname();
}
if ($result['STARTUP_SCRIPT'] != 'systemd') {
$name = createTempDir("{$mountpoint}/tmp", 'xen-scripts');
lxfile_cp_rec("__path_program_root/bin/xen-dists/scripts/functions", $name);
lxfile_cp_rec("__path_program_root/bin/xen-dists/scripts/{$ipadd}", $name);
lxfile_cp_rec("__path_program_root/bin/xen-dists/scripts/{$sethostname}", $name);
lxfile_cp_rec("__path_program_root/bin/xen-dists/scripts/{$setuserpass}", $name);
lxfile_cp_rec("__path_program_root/bin/xen-dists/scripts/{$ipdel}", $name);
$basepath = strfrom($name, $mountpoint);
lfile_put_contents("{$name}/tmpfile.sh", "source /{$basepath}/functions\nsource /{$basepath}/{$ipdel}\n");
$delipstring = "IPDELALL=yes chroot {$mountpoint} bash /{$basepath}/tmpfile.sh";
log_shell($delipstring);
log_shell(system($delipstring, $ret1) . ":return {$ret1}");
putenv("VE_STATE=stopped");
lfile_put_contents("{$name}/tmpfile.sh", "source /{$basepath}/functions\n source /{$basepath}/{$ipadd}\n");
$string = "IPDELALL=yes MAIN_NETMASK={$main_netmask} MAIN_IP_ADDRESS={$main_ip} IP_ADDR=\"{$iplist}\" NETWORK_GATEWAY={$gw} NETWORK_GATEWAY_NET={$gwn} chroot {$mountpoint} bash /{$basepath}/tmpfile.sh";
log_shell($string);
log_shell(system($string, $ret1) . ":return {$ret1}");
lfile_put_contents("{$name}/tmpfile.sh", "source /{$basepath}/functions\n source /{$basepath}/{$sethostname}\n");
$string = "HOSTNM={$hostname} chroot {$mountpoint} bash /{$basepath}/tmpfile.sh";
log_shell($string);
log_shell(system($string, $ret1) . ":return {$ret1}");
if ($this->main->subaction === 'rebuild' || $this->main->dbaction === 'add' || $this->main->isOn('__var_rootpassword_changed') && $this->main->rootpassword) {
$rootpass = "root:{$this->main->rootpassword}";
lfile_put_contents("{$name}/tmpfile.sh", "source /{$basepath}/functions\n source /{$basepath}/{$setuserpass}\n");
$string = "USERPW={$rootpass} chroot {$mountpoint} bash /{$basepath}/tmpfile.sh";
log_shell($string);
log_shell(system($string));
}
lxfile_rm_rec($name);
} else {
if ($result['STARTUP_SCRIPT'] == 'systemd') {
$script_dir = createTempDir("{$mountpoint}", "hypervm-runonce");
lxfile_cp_rec("__path_program_root/bin/xen-dists/scripts/functions", $script_dir);
lxfile_cp_rec("__path_program_root/bin/xen-dists/scripts/{$ipadd}", $script_dir);
lxfile_cp_rec("__path_program_root/bin/xen-dists/scripts/{$sethostname}", $script_dir);
lxfile_cp_rec("__path_program_root/bin/xen-dists/scripts/{$setuserpass}", $script_dir);
lxfile_cp_rec("__path_program_root/bin/xen-dists/scripts/{$ipdel}", $script_dir);
$basepath = strfrom($script_dir, $mountpoint);
$startupdir = 'lib/systemd/system';
$startupscript = 'fedora-startup.service';
$setrootpass = '';
if ($this->main->subaction === 'rebuild' || $this->main->dbaction === 'add' || $this->main->isOn('__var_rootpassword_changed') && $this->main->rootpassword) {
$rootpass = "root:{$this->main->rootpassword}";
$setrootpass = " & USERPW={$rootpass} source {$basepath}/{$setuserpass}";
}
$run_once_script = "#!/bin/bash\n" . "source {$basepath}/functions\n" . '(' . "IPDELALL=yes source {$basepath}/{$ipdel}" . " & IPDELALL=yes VE_STATE=stopped MAIN_NETMASK={$main_netmask} MAIN_IP_ADDRESS={$main_ip} IP_ADDR=\"{$iplist}\" NETWORK_GATEWAY={$gw} NETWORK_GATEWAY_NET={$gwn} source {$basepath}/{$ipadd}" . " & HOSTNM={$hostname} source {$basepath}/{$sethostname}" . "{$setrootpass})\n" . "service fedora-startup disable\nrm -f /{$startupdir}/{$startupscript}\nrm -rf {$basepath}";
lfile_put_contents("{$script_dir}/hypervm-runonce.sh", $run_once_script);
lxfile_cp_rec("__path_program_root/bin/xen-dists/scripts/{$startupscript}", "{$mountpoint}/{$startupdir}");
lfile_put_contents("{$mountpoint}/{$startupdir}/{$startupscript}", lfile_get_contents("{$mountpoint}/{$startupdir}/{$startupscript}") . "ExecStart={$basepath}/hypervm-runonce.sh\n");
system("ln -s /lib/systemd/system/fedora-startup.service {$mountpoint}/etc/systemd/system/multi-user.target.wants/fedora-startup.service");
system("chmod 755 {$script_dir}/hypervm-runonce.sh");
}
}
if ($this->main->nameserver) {
$nlist = explode(" ", $this->main->nameserver);
$nstring = null;
foreach ($nlist as $l) {
$nstring .= "nameserver {$l}\n";
}
lfile_put_contents("{$mountpoint}/etc/resolv.conf", $nstring);
}
if ($this->main->timezone) {
lxfile_rm("{$mountpoint}/etc/localtime");
$cmdstring = "ln -sf ../usr/share/zoneinfo/{$this->main->timezone} {$mountpoint}/etc/localtime";
log_log("localtime", $cmdstring);
do_exec_system('__system__', "/", $cmdstring, $out, $err, $ret, null);
//lxfile_cp("/usr/share/zoneinfo/{$this->main->timezone}", "$mountpoint/etc/localtime");
}
lunlink("{$mountpoint}/etc/sysconfig/network-scripts/ifcfg-venet0");
lunlink("{$mountpoint}/etc/sysconfig/network-scripts/ifcfg-venet0:0");
$this->main->doKloxoInit($mountpoint);
}
示例14: lxfile_mkdir
lxfile_mkdir("{$cdir}/old");
lxfile_mkdir("{$cdir}/cgi-bin");
foreach ($dlist as $l) {
if (lxfile_exists("{$cdir}/{$l->nname}")) {
lxfile_mv_rec("{$cdir}/{$l->nname}", "{$cdir}/old/");
}
if (!is_link("{$cdir}/domain/{$l->nname}/www/")) {
lxfile_mv_rec("{$cdir}/domain/{$l->nname}/www/", "{$cdir}/{$l->nname}");
}
/*
foreach($l->subweb_a as $k => $v) {
lxfile_mv_rec("$cdir/domain/$l->nname/subdomains/$v->nname", "$cdir/$l->nname/$v->nname");
}
*/
if (!is_link("{$cdir}/domain/{$l->nname}/cgi-bin/")) {
lxfile_mv_rec("{$cdir}/domain/{$l->nname}/cgi-bin/", "{$cdir}/cgi-bin/{$l->nname}");
}
lunlink("{$cdir}/domain/{$l->nname}/www");
lxfile_symlink("{$cdir}/{$l->nname}", "{$cdir}/domain/{$l->nname}/www");
lxfile_symlink("{$cdir}/cgi-bin/{$l->nname}", "{$cdir}/domain/{$l->nname}/cgi-bin");
$web = $l->getObject('web');
$web->setUpdateSubaction('full_update');
$dirlist = $web->getList('dirprotect');
foreach ($dirlist as $dir) {
$dir->setUpdateSubaction('full_update');
$dir->was();
}
$web->was();
}
}
lxshell_return("__path_php_path", "../bin/misc/fixftpuserclient.phps");
示例15: setRemoveOldDirs
function setRemoveOldDirs()
{
log_cleanup("Remove Old dirs");
log_cleanup("- Remove process");
if (lxfile_exists("/home/admin/domain")) {
log_cleanup("- Remove dir /home/admin/domain/ if exists");
rmdir("/home/admin/domain/");
}
if (lxfile_exists("/home/admin/old")) {
log_cleanup("- Remove dir /home/admin/old/ if exists");
rmdir("/home/admin/old/");
}
if (lxfile_exists("/home/admin/cgi-bin")) {
log_cleanup("- Remove dir /home/admin/cgi-bin/ if exists");
rmdir("/home/admin/cgi-bin/");
}
if (lxfile_exists("/etc/skel/Maildir")) {
log_cleanup("- Remove dir /etc/skel/Maildir/ if exists");
rmdir("/etc/skel/Maildir/new");
rmdir("/etc/skel/Maildir/cur");
rmdir("/etc/skel/Maildir/tmp");
rmdir("/etc/skel/Maildir/");
}
if (lxfile_exists('kloxo.sql')) {
log_cleanup("- Remove file kloxo.sql");
lunlink('kloxo.sql');
}
}