本文整理汇总了PHP中unix::Process1方法的典型用法代码示例。如果您正苦于以下问题:PHP unix::Process1方法的具体用法?PHP unix::Process1怎么用?PHP unix::Process1使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unix
的用法示例。
在下文中一共展示了unix::Process1方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Get_owncloud
function Get_owncloud()
{
$unix = new unix();
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".pid";
$pidtime = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".time";
$pid = @file_get_contents($pidfile);
$unix = new unix();
if ($unix->process_exists($pid, basename(__FILE__))) {
$time = $unix->PROCCESS_TIME_MIN($pid);
if ($GLOBALS["VERBOSE"]) {
echo "Already executed pid {$pid} since {$time}mn\n";
}
die;
}
$uri = download();
if ($uri == null) {
return;
}
$curl = new ccurl($uri);
$curl->NoHTTP_POST = true;
$cp = $unix->find_program("cp");
$rm = $unix->find_program("rm");
progress("Downloading Owncloud package...", 25);
if (!$curl->GetFile("/root/owncloud.tar.gz")) {
progress("Failed download owncloud package", 110);
return;
}
if (is_dir("/usr/share/owncloud")) {
shell_exec("{$rm} -rf /usr/share/owncloud");
}
@mkdir("/usr/share/owncloud", 0755, true);
if (!is_dir("/usr/share/owncloud")) {
progress("/usr/share/owncloud permission denied", 110);
@unlink("/root/owncloud.tar.gz");
return;
}
$tar = $unix->find_program("tar");
progress("Extracting package...", 35);
shell_exec("{$tar} xf /root/owncloud.tar.gz -C /usr/share/owncloud/");
@unlink("/root/owncloud.tar.gz");
if (is_dir("/usr/share/owncloud/owncloud")) {
shell_exec("{$cp} -rf /usr/share/owncloud/owncloud/* /usr/share/owncloud/");
shell_exec("{$rm} -rf /usr/share/owncloud/owncloud");
}
if (is_file("/usr/share/owncloud/settings/settings.php")) {
progress("Success...", 100);
$unix->Process1(true);
return;
}
progress("Failed...", 110);
}
示例2: process1
function process1()
{
$unix = new unix();
$unix->Process1(true);
}
示例3: ArticaSettingsrestore
function ArticaSettingsrestore()
{
$unix = new unix();
$tmp = $unix->FILE_TEMP();
events("restore Artica settings operations");
events("restore Artica settings operations");
$size = $unix->DIRSIZE_KO("{$_GET["PATH_RESTORE"]}/etc-artica-postfix");
events("restore Artica settingssize={$size} Ko");
if ($size == 0) {
events("restore Artica settings failed, directory {$_GET["PATH_RESTORE"]}/etc-artica-postfix...");
return null;
}
shell_exec("/bin/cp -rf {$_GET["PATH_RESTORE"]}/etc-artica-postfix/artica-postfix/* /etc/artica-postfix/");
$unix->Process1(true);
@unlink("/etc/artica-postfix/artica-postfix.pid");
@unlink("/etc/artica-postfix/mon.pid");
shell_exec("/etc/init.d/artica-postfix restart daemon");
@unlink("/etc/artica-postfix/settings/Daemons/SystemCpuNumber");
events("restore Artica settings done...");
}
示例4: SYNC_PACKAGES
function SYNC_PACKAGES()
{
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$unix = new unix();
$aptget = $unix->find_program("apt-get");
$pid = @file_get_contents($pidfile);
if ($unix->process_exists($pid)) {
echo "Already exists PID {$pid}\n";
return;
}
@file_put_contents($pidfile, getmypid());
$time = time();
exec("/usr/share/artica-postfix/bin/setup-ubuntu --check-base-system 2>&1", $results);
while (list($key, $line) = each($results)) {
if (preg_match("#Use.+?apt-get autoremove.+?to remove them#")) {
exec("{$aptget} autoremove -y -q 2>&1", $autoremove);
}
}
$message_text = @implode("\n", $results);
if (count($autoremove) > 0) {
$message_text = $message_text . " Auto-remove task:\n" . @implode("\n", $autoremove);
}
$time_text = $unix->distanceOfTimeInWords($time, time(), true);
$unix->send_email_events("Synchronize paquages done ({$time_text})", @implode("\n", $message_text), "system");
shell_exec('/bin/rm -f /usr/share/artica-postfix/ressources/logs/cache/*');
shell_exec('/bin/rm -f /usr/share/artica-postfix/ressources/logs/jGrowl-new-versions.txt');
shell_exec('/bin/rm -f /etc/artica-postfix/versions.cache');
shell_exec('/bin/rm -f /usr/share/artica-postfix/ressources/logs/global.versions.conf');
shell_exec('/usr/share/artica-postfix/bin/artica-install --write-versions');
$unix->Process1(true);
shell_exec('/etc/init.d/artica-status reload &');
shell_exec('/etc/init.d/artica-postfix restart artica-exec &');
shell_exec('rm -rf /usr/share/artica-postfix/ressources/web/logs/*.cache');
}
示例5: APPLY_SOFT
function APPLY_SOFT()
{
$filename = "/usr/share/artica-postfix/ressources/conf/upload/{$_GET["apply-soft"]}";
if (!is_file($filename)) {
echo "<articadatascgi>" . base64_encode(serialize(array("{$filename} no such file"))) . "</articadatascgi>";
return;
}
$unix = new unix();
$nohup = $unix->find_program("nohup");
$tar = $unix->find_program("tar");
$results[] = "Copy to {$filename} to /root ";
@copy($filename, "/root/" . basename($filename));
@unlink($filename);
chdir("/root");
exec("{$tar} -xvf /root/" . basename($filename) . " -C / 2>&1", $results);
$results[] = "Done...";
if (preg_match("#^nginx-#", $filename)) {
$results[] = "Ask to restarting nginx";
shell_exec("{$nohup} /etc/init.d/nginx restart >/dev/null 2>&1 &");
}
@unlink($filename);
echo "<articadatascgi>" . base64_encode(serialize($results)) . "</articadatascgi>";
shell_exec("{$nohup} /etc/init.d/artica-status reload >/dev/null 2>&1 &");
shell_exec("{$nohup} /etc/init.d/monit restart >/dev/null 2>&1 &");
$unix->Process1(true);
}
示例6: CheckSettingsInc
function CheckSettingsInc()
{
$unix = new unix();
$unix->Process1();
}
示例7: register_lic
//.........这里部分代码省略.........
squid_admin_mysql(0, $textGhost, null, $function_ghost, $line_ghost);
shell_exec("/usr/share/artica-postfix/bin/process1 --force --verbose");
if (is_file($squidbin)) {
shell_exec("{$php} /usr/share/artica-postfix/exec.squid.php --build");
shell_exec("{$php} /usr/share/artica-postfix/exec.kerbauth.php --disconnect");
shell_exec("/etc/init.d/squid restart {$GLOBALS["SCRIPT_SUFFIX"]}");
}
$sock->SaveConfigFile(base64_encode(serialize($array1)), "LicenseInfos");
}
return;
}
}
if (preg_match("#<BADMAIL>(0|1)</BADMAIL>#s", $curl->data, $re)) {
echo "***** EMAIL *****\n";
$sock->SET_INFO("RegisterCloudBadEmail", $re[1]);
}
if (preg_match("#REGISTRATION_OK:\\[(.+?)\\]#s", $curl->data, $re)) {
build_progress("{waiting_approval} {success}", 100);
$LicenseInfos["license_status"] = "{waiting_approval}";
$LicenseInfos["license_number"] = $re[1];
$LicenseInfos["TIME"] = time();
if ($finaltime > 0) {
$LicenseInfos["FINAL_TIME"] = $finaltime;
}
$sock->SaveConfigFile(base64_encode(serialize($LicenseInfos)), "LicenseInfos");
@unlink($WORKPATH);
if ($cmdADD != null) {
shell_exec($cmdADD);
}
shell_exec("/usr/share/artica-postfix/bin/process1 --force --verbose " . time() . " >/dev/null 2>&1");
return;
}
if (preg_match("#LICENSE_OK:\\[(.+?)\\]#s", $curl->data, $re)) {
echo "***** LICENSE_OK ****\n";
@file_put_contents($WORKPATH, "TRUE");
if ($finaltime > 0) {
$LicenseInfos["FINAL_TIME"] = $finaltime;
}
$LicenseInfos["license_status"] = "{license_active}";
$LicenseInfos["TIME"] = time();
$sock->SaveConfigFile(base64_encode(serialize($LicenseInfos)), "LicenseInfos");
if ($cmdADD != null) {
shell_exec($cmdADD);
}
build_progress("{license_active} {refresh}", 100);
system("/usr/share/artica-postfix/bin/process1 --force --verbose --" . time());
build_progress("{license_active} {success}", 100);
return;
}
if (preg_match("#REGISTRATION_INVALID#s", $curl->data, $re)) {
@unlink($WORKPATH);
echo "***** REGISTRATION_INVALID ****\n";
$LicenseInfos["license_status"] = "{community_license}";
$LicenseInfos["license_number"] = null;
$LicenseInfos["UNLOCKLIC"] = null;
$LicenseInfos["TIME"] = time();
if ($finaltime > 0) {
$LicenseInfos["FINAL_TIME"] = $finaltime;
}
build_progress("Community Edition - limited...", 100);
$sock->SaveConfigFile(base64_encode(serialize($LicenseInfos)), "LicenseInfos");
if ($cmdADD != null) {
shell_exec($cmdADD);
}
$unix->Process1(true);
return;
}
if (preg_match("#REGISTRATION_DELETE_NOW#s", $curl->data, $re)) {
echo "***** REGISTRATION_DELETE_NOW ****\n";
@unlink($WORKPATH);
$LicenseInfos["license_status"] = "Community Edition - limited";
$LicenseInfos["license_number"] = null;
$LicenseInfos["UNLOCKLIC"] = null;
$LicenseInfos["TIME"] = time();
if ($finaltime > 0) {
$LicenseInfos["FINAL_TIME"] = $finaltime;
}
$unix->Process1(true);
$sock->SaveConfigFile(base64_encode(serialize($LicenseInfos)), "LicenseInfos");
shell_exec("/usr/share/artica-postfix/bin/process1 --force --verbose " . time() . " >/dev/null 2>&1");
build_progress("Community Edition - limited", 110);
return;
}
if ($curl->error != null) {
system_admin_events("License registration failed with error {$curl->error}", "GetLicense", "license", 0, "license");
}
build_progress("Unknown registration?", 110);
if (!is_file($WORKPATH)) {
build_progress("{waiting_order}", 110);
echo "***** Registration_failed ****\n";
$LicenseInfos["TIME"] = time();
if ($LicenseInfos["license_number"] == null) {
$LicenseInfos["license_status"] = "{registration_failed} {$curl->error}";
}
$sock->SaveConfigFile(base64_encode(serialize($LicenseInfos)), "LicenseInfos");
}
if ($cmdADD != null) {
shell_exec($cmdADD);
}
}
示例8: register_lic
//.........这里部分代码省略.........
$URIBASE = $unix->MAIN_URI();
$URIBASE = str_replace("articatech.net", "artica.fr", $URIBASE);
$verbosed = "?VERBOSE=yes&time=" . time();
build_progress("Checking license on the cloud server...", 40);
echo "Contacting {$URIBASE}\n";
$curl = new ccurl("{$URIBASE}/shalla-orders.php", false, null, true);
echo "Set to not use Local proxy\n";
$curl->NoLocalProxy();
if ($GLOBALS["VERBOSE"]) {
$curl->parms["VERBOSE"] = yes;
}
$curl->parms["REGISTER-LIC"] = base64_encode(serialize($LicenseInfos));
$curl->parms["REGISTER-OLD"] = base64_encode(serialize($WizardSavedSettings));
echo "Send request... please wait...\n";
if (!$curl->get()) {
build_progress("Failed to contact cloud server", 110);
echo "Error: " . $curl->error . "\n";
echo @implode("\n", $curl->errors);
$LicenseInfos["TIME"] = time();
$LicenseInfos["license_status"] = "{registration_failed} {$curl->error}";
$sock->SaveConfigFile(base64_encode(serialize($LicenseInfos)), "LicenseInfos");
return;
}
echo "Request passed\n";
build_progress("Cheking license on the cloud server done.", 50);
if ($GLOBALS["VERBOSE"]) {
echo "***** {$curl->data} ****\n";
}
if (preg_match("#REGISTRATION_OK:\\[(.+?)\\]#s", $curl->data, $re)) {
build_progress("{waiting_approval} {success}", 100);
$LicenseInfos["license_status"] = "{waiting_approval}";
$LicenseInfos["license_number"] = $re[1];
$LicenseInfos["TIME"] = time();
$sock->SaveConfigFile(base64_encode(serialize($LicenseInfos)), "LicenseInfos");
@unlink($WORKPATH);
if ($cmdADD != null) {
shell_exec($cmdADD);
}
shell_exec("/usr/share/artica-postfix/bin/process1 --force --verbose " . time() . " >/dev/null 2>&1");
return;
}
if (preg_match("#LICENSE_OK:\\[(.+?)\\]#s", $curl->data, $re)) {
echo "***** LICENSE_OK ****\n";
@file_put_contents($WORKPATH, "TRUE");
$LicenseInfos["license_status"] = "{license_active}";
$LicenseInfos["TIME"] = time();
$sock->SaveConfigFile(base64_encode(serialize($LicenseInfos)), "LicenseInfos");
if ($cmdADD != null) {
shell_exec($cmdADD);
}
build_progress("{license_active} {refresh}", 100);
system("/usr/share/artica-postfix/bin/process1 --force --verbose --" . time());
build_progress("{license_active} {success}", 100);
return;
}
if (preg_match("#REGISTRATION_INVALID#s", $curl->data, $re)) {
@unlink($WORKPATH);
echo "***** REGISTRATION_INVALID ****\n";
$LicenseInfos["license_status"] = "{community_license}";
$LicenseInfos["license_number"] = null;
$LicenseInfos["UNLOCKLIC"] = null;
$LicenseInfos["TIME"] = time();
build_progress("Community Edition - limited...", 100);
$sock->SaveConfigFile(base64_encode(serialize($LicenseInfos)), "LicenseInfos");
if ($cmdADD != null) {
shell_exec($cmdADD);
}
$unix->Process1(true);
return;
}
if (preg_match("#REGISTRATION_DELETE_NOW#s", $curl->data, $re)) {
echo "***** REGISTRATION_DELETE_NOW ****\n";
@unlink($WORKPATH);
$LicenseInfos["license_status"] = "Community Edition - limited";
$LicenseInfos["license_number"] = null;
$LicenseInfos["UNLOCKLIC"] = null;
$LicenseInfos["TIME"] = time();
$unix->Process1(true);
$sock->SaveConfigFile(base64_encode(serialize($LicenseInfos)), "LicenseInfos");
shell_exec("/usr/share/artica-postfix/bin/process1 --force --verbose " . time() . " >/dev/null 2>&1");
build_progress("Community Edition - limited", 110);
return;
}
if ($curl->error != null) {
system_admin_events("License registration failed with error {$curl->error}", "GetLicense", "license", 0, "license");
}
build_progress("Unknown registration?", 110);
if (!is_file($WORKPATH)) {
build_progress("{registration_failed} {failed}", 110);
echo "***** Registration_failed ****\n";
$LicenseInfos["TIME"] = time();
if ($LicenseInfos["license_number"] == null) {
$LicenseInfos["license_status"] = "{registration_failed} {$curl->error}";
}
$sock->SaveConfigFile(base64_encode(serialize($LicenseInfos)), "LicenseInfos");
}
if ($cmdADD != null) {
shell_exec($cmdADD);
}
}