本文整理汇总了PHP中unix::LOCATE_PHP5_BIN方法的典型用法代码示例。如果您正苦于以下问题:PHP unix::LOCATE_PHP5_BIN方法的具体用法?PHP unix::LOCATE_PHP5_BIN怎么用?PHP unix::LOCATE_PHP5_BIN使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unix
的用法示例。
在下文中一共展示了unix::LOCATE_PHP5_BIN方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: xstart
function xstart()
{
$sock = new sockets();
$unix = new unix();
$php = $unix->LOCATE_PHP5_BIN();
$SquidAllow80Port = intval($sock->GET_INFO("SquidAllow80Port"));
build_progress("{starting} {allow_80443_port}", 15);
if ($SquidAllow80Port == 1) {
build_progress("{stopping} {web_service}", 20);
system("/etc/init.d/apache2 stop");
build_progress("{stopping} Reverse Proxy", 30);
system("/etc/init.d/nginx stop");
} else {
build_progress("{remove} 80/443 ports", 20);
$q = new mysql_squid_builder();
$q->QUERY_SQL("DELETE FROM proxy_ports WHERE `port`='80'");
build_progress("{remove} 80/443 ports", 25);
$q->QUERY_SQL("DELETE FROM proxy_ports WHERE `port`='443'");
build_progress("{reconfigure_proxy_service}", 30);
$php = $unix->LOCATE_PHP5_BIN();
shell_exec("{$php} /usr/share/artica-postfix/exec.squid.php --build --force");
}
build_progress("{restarting_artica_status}", 80);
system("/etc/init.d/artica-status restart --force");
build_progress("{done}", 100);
}
示例2: xstart
function xstart()
{
$unix = new unix();
$php = $unix->LOCATE_PHP5_BIN();
$tar = $unix->find_program("tar");
build_progress("{downloading} roundcubeemail-1.1.2.tar.gz", 20);
$tmpfile = $unix->FILE_TEMP();
$curl = new ccurl("http://articatech.net/download/postfix-debian7/roundcubeemail-1.1.2.tar.gz");
if (!$curl->GetFile($tmpfile)) {
echo "Failed: " . $curl->error . "\n";
@unlink($tmpfile);
build_progress("{failed} roundcubeemail-1.1.2.tar.gz", 110);
return;
}
build_progress("{uncompressing} roundcubeemail-1.1.2.tar.gz", 50);
system("{$tar} xf {$tmpfile} -C /");
@unlink($tmpfile);
if (!is_file("/usr/share/roundcube/index.php")) {
build_progress("{uncompressing} roundcubeemail-1.1.2.tar.gz {failed}", 110);
return;
}
build_progress("{verify_database}", 60);
system("{$php} /usr/share/artica-postfix/exec.roundcube.php --database");
build_progress("{restarting_service}", 70);
system("{$php} /usr/share/artica-postfix/exec.roundcube.php --restart");
system("/etc/init.d/artica-status restart");
build_progress("{installing} roundcubeemail-1.1.2.tar.gz {success}", 100);
}
示例3: optimize
function optimize()
{
$unix = new unix();
$GLOBALS["PROGRESS"] = true;
$GLOBALS["UPDATE_GRUB"] = true;
$sock = new sockets();
$php = $unix->LOCATE_PHP5_BIN();
$EnableSystemOptimize = intval($sock->GET_INFO("EnableSystemOptimize"));
if ($EnableSystemOptimize == 1) {
build_progress("{enable_system_optimization}: ON", 10);
EnableScheduler();
$ARRAY = unserialize(base64_decode($sock->GET_INFO("kernel_values")));
$ARRAY["swappiness"] = 0;
@file_put_contents("/etc/artica-postfix/settings/Daemons/kernel_values", serialize($ARRAY));
build_progress("Build Kernel values....", 35);
system("{$php} /usr/share/artica-postfix/exec.sysctl.php --restart");
build_progress("Optimize system disk partitions", 50);
system("{$php} /usr/share/artica-postfix/exec.patch.fstab.php");
build_progress("{done}", 100);
} else {
build_progress("{enable_system_optimization}: OFF", 10);
DisableScheduler();
$ARRAY = unserialize(base64_decode($sock->GET_INFO("kernel_values")));
$ARRAY["swappiness"] = 60;
@file_put_contents("/etc/artica-postfix/settings/Daemons/kernel_values", serialize($ARRAY));
build_progress("Build Kernel values....", 35);
system("{$php} /usr/share/artica-postfix/exec.sysctl.php --restart");
build_progress("Optimize system disk partitions", 50);
system("{$php} /usr/share/artica-postfix/exec.patch.fstab.php");
build_progress("{done}", 100);
}
}
示例4: pattern
function pattern()
{
$unix = new unix();
$nohup = $unix->find_program("nohup");
$php5 = $unix->LOCATE_PHP5_BIN();
shell_exec("{$nohup} {$php5} /usr/share/artica-postfix/exec.haarp.php --squid-pattern >/dev/null 2>&1");
}
示例5: schedules
function schedules(){
$unix=new unix();
$files=$unix->DirFiles("/etc/cron.d");
$cron=new cron_macros();
$php5=$unix->LOCATE_PHP5_BIN();
while (list ($index, $line) = each ($files) ){
if($index==null){continue;}
if(preg_match("#^LdapImport-#",$index)){
@unlink("/etc/cron.d/$index");
}
}
$sql="SELECT * FROM ldap_ou_import WHERE enabled=1";
$q=new mysql();
$results=$q->QUERY_SQL($sql,"artica_backup");
while($ligne=@mysql_fetch_array($results,MYSQL_ASSOC)){
if(trim($ligne["ScheduleMin"]==null)){continue;}
$schedule=$cron->cron_defined_macros[$ligne["ScheduleMin"]];
$f[]="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin:/usr/share/artica-postfix/bin";
$f[]="MAILTO=\"\"";
$f[]="$schedule root $php5 ".__FILE__." --import {$ligne["ID"]}";
$f[]="";
@file_put_contents("/etc/cron.d/LdapImport-{$ligne["ID"]}",implode("\n",$f));
@chmod("/etc/cron.d/LdapImport-{$ligne["ID"]}",600);
unset($f);
}
}
示例6: xstart
function xstart()
{
$unix = new unix();
$php = $unix->LOCATE_PHP5_BIN();
build_progress("{starting} {ssl_rules}", 15);
if (!checkIntegrated()) {
build_progress("{starting} {ssl_rules}", 30);
$squid_ssl = new squid_ssl();
$squid_ssl->build();
build_progress("{starting} {reconfigure_proxy_service}", 50);
system("{$php} /usr/share/artica-postfix/exec.squid.php --build --force");
if (!checkIntegrated()) {
build_progress("{failed}", 110);
return;
}
build_progress("{done} {ssl_rules}", 100);
return;
}
build_progress("{starting} {ssl_rules}", 30);
$squid_ssl = new squid_ssl();
$squid_ssl->build();
if (!Test_config()) {
build_progress("{failed}", 90);
@file_put_contents("/etc/squid3/GlobalAccessManager_auth.conf", "\n");
@file_put_contents("/etc/squid3/GlobalAccessManager_url_rewrite.conf", "\n");
@file_put_contents("/etc/squid3/GlobalAccessManager_deny_cache.conf", "\n");
@file_put_contents("/etc/squid3/icap.conf", "\n");
build_progress("{failed}", 110);
return;
}
build_progress("{done} {reloading_proxy_service}", 100);
$squidbin = $unix->find_program("squid");
system("{$squidbin} -f /etc/squid3/squid.conf -k reconfigure");
}
示例7: EnablePolicyd
function EnablePolicyd()
{
$unix = new unix();
$php = $unix->LOCATE_PHP5_BIN();
system("{$php} " . dirname(__FILE__) . "/exec.postfix.maincf.php--smtpd-client-restrictions");
$q = new mysql();
$sql = "SELECT * FROM postfix_whitelist_con";
$results = $q->QUERY_SQL($sql, "artica_backup");
if (!$q->ok) {
echo "{$q->mysql_error}\n";
}
while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
$finalwhitelist[] = $ligne["ipaddr"] . "\tOK";
if (strpos($ligne["hostname"], "*") == 0) {
$finalwhitelist[] = $ligne["hostname"] . "\tOK";
}
}
if (is_array($finalwhitelist)) {
$conf = implode("\n", $finalwhitelist);
}
events("saving " . strlen($conf) . " bytes length in /etc/postfix/wbl_connections");
@file_put_contents("/etc/postfix/wbl_connections", $conf);
system("postmap hash:/etc/postfix/wbl_connections");
events("adding policyd-weight done...");
}
示例8: xstart
function xstart()
{
$unix = new unix();
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".pid";
$pidtime = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".time";
$pid = $unix->get_pid_from_file($pidfile);
if ($unix->process_exists($pid, basename(__FILE__))) {
return;
}
$TimeExec = $unix->file_time_min($pidtime);
if ($TimeExec < 360) {
return;
}
@unlink($pidtime);
@file_put_contents($pidtime, time());
@file_put_contents($pidfile, getmypid());
$php5 = $unix->LOCATE_PHP5_BIN();
$q = new mysql_squid_builder();
$q->CreateCategoryUrisTable("malware");
$COUNT1 = $q->COUNT_ROWS("categoryuris_malware");
vxvault();
malwareurls_joxeankoret();
clean_mx_de();
$COUNT2 = $q->COUNT_ROWS("categoryuris_malware");
$URLS_ADDED = $COUNT2 - $COUNT1;
if ($URLS_ADDED > 0) {
system("{$php5} /usr/share/artica-postfix/exec.squidguard.php --compile-category malware");
squid_admin_mysql(2, "{$URLS_ADDED} malware URLs added", null, __FILE__, __LINE__);
}
}
示例9: startx
function startx()
{
$unix = new unix();
$php = $unix->LOCATE_PHP5_BIN();
$tar = $unix->find_program("tar");
build_progress("{backup_parameters}....", 5);
chdir("/etc/squid3");
system("cd /etc/squid3");
system("{$tar} -czf /root/backup.squid.tar.gz *");
build_progress("{reconfiguring}....", 10);
system("{$php} /usr/share/artica-postfix/exec.squid.php --build --force");
build_progress("{stopping_service}....", 50);
system("/etc/init.d/squid stop");
build_progress("{starting_service}....", 80);
system("/etc/init.d/squid start");
$cachefile = "/usr/share/artica-postfix/ressources/logs/web/squid.start.progress";
if (is_file($cachefile)) {
$textAR = unserialize(@file_get_contents($cachefile));
if ($textAR["POURC"] > 100) {
build_progress("{restore_parameters}....", 90);
shell_exec("{$tar} -xf /root/backup.squid.tar.gz -C /etc/squid3/");
build_progress("{starting_service}....", 90);
system("/etc/init.d/squid start");
}
}
@unlink("/root/backup.squid.tar.gz");
build_progress("{starting_service} {success}", 100);
chdir("/root");
}
示例10: mailboxes_schedules
function mailboxes_schedules()
{
$unix = new unix();
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$cachetime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
$unix = new unix();
$myFile = basename(__FILE__);
$pid = @file_get_contents($pidfile);
if ($unix->process_exists($pid, $myFile)) {
system_admin_events("Already executed PID:{$pid}, die()", __FUNCTION__, __FILE__, __LINE__, "mbximport");
die;
}
@file_put_contents($pidfile, getmypid());
$sql = "SELECT zmd5 FROM mbx_migr_users WHERE scheduled=1";
$q = new mysql();
$results = $q->QUERY_SQL($sql, "artica_backup");
$nohup = $unix->find_program("nohup");
$php5 = $unix->LOCATE_PHP5_BIN();
$myscript = __FILE__;
while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
$c++;
if ($ligne["zmd5"] == null) {
continue;
}
$cmd = "{$nohup} {$php5} {$myscript} --member {$ligne["zmd5"]} --schedule-id={$GLOBALS["SCHEDULE_ID"]} >/dev/null 2>&1 &";
shell_exec($cmd);
}
if ($c > 0) {
system_admin_events("{$c} launched tasks", __FUNCTION__, __FILE__, __LINE__, "mbximport");
}
}
示例11: startx
function startx()
{
$unix = new unix();
build_progress(50, "{refresh} CPUS");
@unlink("/etc/artica-postfix/CPU_NUMBER");
build_progress(55, "{refresh} CPUS");
@unlink("/usr/share/artica-postfix/ressources/interface-cache/CPU_NUMBER");
build_progress(60, "{rescan-disk-system}");
$dirs = $unix->dirdir("/sys/class/scsi_host");
$echo = $unix->find_program("echo");
$udevadm = $unix->find_program("udevadm");
$php = $unix->LOCATE_PHP5_BIN();
while (list($dirpath, $line) = each($dirs)) {
$basename = basename($dirpath);
if (!preg_match("#host[0-9]+#", $basename)) {
continue;
}
$cmd = "{$echo} \"- - -\" >{$dirpath}/scan";
build_progress(65, "{rescan-disk-system}" . dirname($dirpath));
shell_exec($cmd);
}
build_progress(70, "{rescan-disk-system}");
$cmdline = "{$php} /usr/share/artica-postfix/exec.usb.scan.write.php --verbose";
system($cmd);
build_progress(80, "{rescan-network-system}");
system("{$udevadm} control --reload-rules");
system("{$udevadm} trigger --attr-match=subsystem=net");
sleep(3);
system("/usr/share/artica-postfix/bin/process1 --force --verbose --" . time());
build_progress(100, "{refresh} {done}");
}
示例12: export_to_zarafa
function export_to_zarafa($uid)
{
$f[] = "First Name,Middle Name,Last Name,Title,Suffix,Initials,Web Page,Gender,Birthday,Anniversary,Location,Language,Internet Free Busy,Notes,E-mail Address,E-mail 2 Address,E-mail 3 Address,Primary Phone,Home Phone,Home Phone 2,Mobile Phone,Pager,Home Fax,Home Address,Home Street,Home Street 2,Home Street 3,Home Address PO Box,Home City,Home State,Home Postal Code,Home Country,Spouse,Children,Manager's Name,Assistant's Name,Referred By,Company Main Phone,Business Phone,Business Phone 2,Business Fax,Assistant's Phone,Company,Job Title,Department,Office Location,Organizational ID Number,Profession,Account,Business Address,Business Street,Business Street 2,Business Street 3,Business Address PO Box,Business City,Business State,Business Postal Code,Business Country,Other Phone,Other Fax,Other Address,Other Street,Other Street 2,Other Street 3,Other Address PO Box,Other City,Other State,Other Postal Code,Other Country,Callback,Car Phone,ISDN,Radio Phone,TTY/TDD Phone,Telex,User 1,User 2,User 3,User 4,Keywords,Mileage,Hobby,Billing Information,Directory Server,Sensitivity,Priority,Private,Categories";
$ldap = new clladp();
$ct = new user($uid);
$dn = "ou={$uid},ou=People,dc={$ct->ou},dc=NAB,{$ldap->suffix}";
$filter = "(objectClass=inetOrgPerson)";
$attrs = array();
$hash = $ldap->Ldap_search($dn, $filter, array("employeeNumber"));
if ($GLOBALS["VERBOSE"]) {
echo "[{$uid}]: Exporting {$hash["count"]} user(s)\n";
}
for ($i = 0; $i < $hash["count"]; $i++) {
$emp = new contacts(null, $hash[$i]["employeenumber"][0]);
$f[] = @implode(",", $emp->ContactTocsvArray());
}
$tmpfile = "/tmp/{$uid}." . time() . ".csv";
@file_put_contents("{$tmpfile}", @implode("\n", $f));
$unix = new unix();
$php = $unix->LOCATE_PHP5_BIN();
$basename = basename($tmpfile);
$cmd = $php . " " . dirname(__FILE__) . "/exec.zarafa.csv2contacts.php {$uid} \"{$ct->password}\" {$basename} 2>&1";
if ($GLOBALS["VERBOSE"]) {
echo "[{$uid}]: {$cmd}\n";
}
exec($cmd, $results);
if ($GLOBALS["VERBOSE"]) {
while (list($num, $line) = each($results)) {
echo "[{$uid}]: {$line}\n";
}
}
}
示例13: build
function build()
{
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$unix = new unix();
$sock = new sockets();
$pid = $unix->get_pid_from_file($pidfile);
if ($unix->process_exists($pid, basename(__FILE__))) {
die;
}
$php = $unix->LOCATE_PHP5_BIN();
@file_put_contents($pidfile, getmypid());
progress("{get_system_informations}", 30);
support_step1();
progress("{APP_UFDBGUARD}", 40);
$EnableUfdbGuard = intval($sock->EnableUfdbGuard());
if ($EnableUfdbGuard == 1) {
$ufdbguardd = $unix->find_program("ufdbguardd");
if (is_file($ufdbguardd)) {
shell_exec("{$php} /usr/share/artica-postfix/exec.squidguard.php --build --force --verbose >/usr/share/artica-postfix/ressources/support/build-ufdbguard.log 2>&1");
}
}
progress("{get_all_logs}", 50);
support_step2();
progress("{get_all_logs}", 70);
export_tables();
progress("{compressing_package}", 90);
support_step3();
progress("{success}", 100);
}
示例14: restore
function restore($filename)
{
$unix = new unix();
$sock = new sockets();
$TMP = $unix->FILE_TEMP();
$filenameBase = basename($filename);
if (!is_file($filename)) {
echo "{$filename} no such file\n";
build_progress("{failed}", 110);
}
$tmpf = $unix->FILE_TEMP();
build_progress("{uncompress} {$filenameBase}", 10);
if (!$unix->uncompress($filename, $tmpf)) {
@unlink($filename);
build_progress("{uncompress} {$filenameBase} {failed}", 110);
return;
}
@unlink($filename);
build_progress("{importing} {$tmpf}", 50);
$q = new mysql_squid_builder();
$nice = $unix->EXEC_NICE();
$mysql = $unix->find_program("mysql");
$gzip = $unix->find_program("gzip");
$nohup = $unix->find_program("nohup");
$echo = $unix->find_program("echo");
$rm = $unix->find_program("rm");
$php = $unix->LOCATE_PHP5_BIN();
$sh[] = "#!/bin/sh";
$sh[] = "{$echo} \"{$mysql} -> {$filenameBase}\"";
$sh[] = "{$nice} {$mysql} {$q->MYSQL_CMDLINES} -f squidlogs < {$tmpf}";
$sh[] = "{$rm} {$TMP}.sh";
$sh[] = "\n";
@file_put_contents("{$TMP}.sh", @implode("\n", $sh));
@chmod("{$TMP}.sh", 0755);
build_progress(10, "Starting restore {$filenameBase} - " . basename("{$TMP}.sh") . " ");
system("{$nohup} {$TMP}.sh >{$TMP}.txt 2>&1 &");
sleep(1);
$PID = $unix->PIDOF_PATTERN("{$TMP}.sh");
echo "Running PID {$PID}\n";
while ($unix->process_exists($PID)) {
build_progress(50, "Starting restoring {$filenameBase}");
sleep(3);
$PID = $unix->PIDOF_PATTERN("{$TMP}.sh");
echo "Running PID {$PID}\n";
}
echo @file_get_contents("{$TMP}.txt") . "\n";
@unlink("{$TMP}.sh");
@unlink("{$TMP}.txt");
build_progress(50, "{restore} {done} {$filenameBase}");
build_progress(50, "{restore} Analyze Hourly tables");
system("{$php} /usr/share/artica-postfix/exec.squid.stats.hours.php --force --verbose");
build_progress(60, "{restore} Repair Hourly tables");
system("{$php} /usr/share/artica-postfix/exec.squid.stats.hours.php --repair --force --verbose");
build_progress(70, "{restore} Repair Table days");
system("{$php} /usr/share/artica-postfix/exec.squid.stats.repair.php --tables-day --repair --force --verbose");
build_progress(80, "{restore} Repair sums");
system("{$php} /usr/share/artica-postfix/exec.squid.stats.totals.php --repair --force --verbose");
build_progress(100, "{restore} Done");
}
示例15: remove_dhcp_role
function remove_dhcp_role()
{
$eth = $_GET["eth"];
$unix = new unix();
$nohup = $unix->find_program("nohup");
$php = $unix->LOCATE_PHP5_BIN();
shell_exec("{$php} /usr/share/artica-postfix/exec.dnsmasq.php --remove-service {$eth}");
}