本文整理汇总了PHP中unix::LINUX_CODE_NAME方法的典型用法代码示例。如果您正苦于以下问题:PHP unix::LINUX_CODE_NAME方法的具体用法?PHP unix::LINUX_CODE_NAME怎么用?PHP unix::LINUX_CODE_NAME使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unix
的用法示例。
在下文中一共展示了unix::LINUX_CODE_NAME方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: install
function install($filename)
{
$GLOBALS["PROGRESS_FILE"] = "/usr/share/artica-postfix/ressources/logs/squid.install.progress";
$GLOBALS["LOG_FILE"] = "/usr/share/artica-postfix/ressources/logs/web/squid.install.progress.txt";
$unix = new unix();
$LINUX_CODE_NAME = $unix->LINUX_CODE_NAME();
$LINUX_DISTRIBUTION = $unix->LINUX_DISTRIBUTION();
$LINUX_VERS = $unix->LINUX_VERS();
$LINUX_ARCHITECTURE = $unix->LINUX_ARCHITECTURE();
$APACHEUSER = $unix->APACHE_SRC_ACCOUNT();
$DebianVer = "debian{$LINUX_VERS[0]}";
$TMP_DIR = $unix->TEMP_DIR();
$ORGV = @file_get_contents("/usr/share/artica-postfix/VERSION");
$PATCH_VER = null;
$tarballs_file = "/usr/share/artica-postfix/ressources/conf/upload/{$filename}";
echo "Package {$tarballs_file}\n";
$size = filesize($tarballs_file);
echo "Size....................: " . FormatBytes($size / 1024) . "\n";
build_progress("Analyze...", 10);
echo "Current system..........: {$LINUX_CODE_NAME} {$LINUX_DISTRIBUTION} {$LINUX_VERS[0]}/{$LINUX_VERS[1]} {$LINUX_ARCHITECTURE}\n";
echo "Package.................: {$filename}\n";
echo "Temp dir................: {$TMP_DIR}\n";
if (!is_file($tarballs_file)) {
echo "{$tarballs_file} no such file...\n";
build_progress("No such file...", 110);
return;
}
echo "Uncompressing {$tarballs_file}...\n";
build_progress("{extracting} {$filename}...", 20);
$chown = $unix->find_program("chown");
$chmod = $unix->find_program("chmod");
$tar = $unix->find_program("tar");
$rm = $unix->find_program("rm");
$nohup = $unix->find_program("nohup");
$php = $unix->LOCATE_PHP5_BIN();
$squid = $unix->LOCATE_SQUID_BIN();
build_progress("{extracting} {$filename}...", 50);
system("{$tar} xf {$tarballs_file} -C /");
echo "Removing {$tarballs_file}...\n";
@unlink($tarballs_file);
shell_exec("{$rm} -rf /usr/share/artica-postfix/ressources/conf/upload/*");
@unlink(dirname(__FILE__) . "/ressources/logs/squid.compilation.params");
build_progress("{restarting} Squid-cache...", 60);
system("/etc/init.d/squid restart --force");
build_progress("{reconfiguring} Squid-cache...", 65);
system("{$php} /usr/share/artica-postfix/exec.squid.php --build --force");
build_progress("{reconfiguring} {APP_UFDBGUARD}...", 70);
system("{$php} /usr/share/artica-postfix/exec.squidguard.php --build --force");
build_progress("{restarting} {APP_C_ICAP}...", 80);
system("/etc/init.d/c-icap restart");
build_progress("Refresh local versions...", 90);
system('/usr/share/artica-postfix/bin/process1 --force --verbose --' . time());
$squid_version = x_squid_version();
build_progress("{success} v.{$squid_version}...", 100);
echo "Starting......: " . date("H:i:s") . " Done you can close the screen....\n";
}
示例2: install
function install()
{
$unix = new unix();
$DISTRICODE = $unix->LINUX_CODE_NAME();
$arch = $unix->LINUX_ARCHITECTURE();
$VERS = $unix->LINUX_VERS();
$dpkg = $unix->find_program("dpkg");
echo "DISTRICODE:{$DISTRICODE} \n";
if (!python_verify_modules("MySQLdb")) {
$unix->DEBIAN_INSTALL_PACKAGE("python-mysqldb");
}
if (!python_verify_modules("ldap")) {
echo "Installing python-ldap\n";
if ($DISTRICODE == "DEBIAN") {
if ($arch == 64) {
if ($VERS[0] == 6) {
if (is_file("/usr/share/artica-postfix/bin/install/postfix/python-6-ldap-amd64.deb")) {
shell_exec("{$dpkg} -i --force-all /usr/share/artica-postfix/bin/install/postfix/python-6-ldap-amd64.deb");
}
}
if ($VERS[0] == 7) {
if (is_file("/usr/share/artica-postfix/bin/install/postfix/python-7-ldap-amd64.deb")) {
shell_exec("{$dpkg} -i --force-all /usr/share/artica-postfix/bin/install/postfix/python-7-ldap-amd64.deb");
}
}
}
}
}
if (!python_verify_modules("ldap")) {
$unix->DEBIAN_INSTALL_PACKAGE("python-ldap");
}
if (!python_verify_modules("ldap")) {
echo "Warning, ldap/python-ldap not installed...\n";
return;
}
if (!python_verify_modules("MySQLdb")) {
echo "Warning, MySQLdb/python-mysqldb not installed...\n";
return;
}
echo "MySQLdb / python-mysqldb OK\n";
echo "LDAP / python-ldap OK\n";
$tmpdir = $unix->TEMP_DIR() . "/iredmail";
$tar = $unix->find_program("tar");
$rm = $unix->find_program("rm");
if (!is_file("/usr/share/artica-postfix/bin/install/postfix/iredapd.tar.gz")) {
return;
}
@mkdir($tmpdir, 0755, true);
shell_exec("{$tar} xf /usr/share/artica-postfix/bin/install/postfix/iredapd.tar.gz -C /");
if (!is_file("/opt/iRedAPD/iredapd.py")) {
return;
}
@chmod("/opt/iRedAPD/iredapd.py", 0755);
}
示例3: install
function install($filename)
{
$GLOBALS["PROGRESS_FILE"] = "/usr/share/artica-postfix/ressources/logs/artica.install.progress";
$GLOBALS["LOG_FILE"] = "/usr/share/artica-postfix/ressources/logs/web/artica.install.progress.txt";
$unix = new unix();
$LINUX_CODE_NAME = $unix->LINUX_CODE_NAME();
$LINUX_DISTRIBUTION = $unix->LINUX_DISTRIBUTION();
$LINUX_VERS = $unix->LINUX_VERS();
$LINUX_ARCHITECTURE = $unix->LINUX_ARCHITECTURE();
$APACHEUSER = $unix->APACHE_SRC_ACCOUNT();
$DebianVer = "debian{$LINUX_VERS[0]}";
$TMP_DIR = $unix->TEMP_DIR();
$ORGV = @file_get_contents("/usr/share/artica-postfix/VERSION");
$PATCH_VER = null;
$tarballs_file = "/usr/share/artica-postfix/ressources/conf/upload/{$filename}";
echo "Package {$tarballs_file}\n";
$size = filesize($tarballs_file);
ArticaMeta_release($tarballs_file);
if (preg_match('#([0-9\\.]+)_([0-9\\.]+)-([0-9]+).tgz$#i', $filename, $r)) {
$CUR_BRANCH = @file_get_contents("/usr/share/artica-postfix/MAIN_RELEASE");
$CUR_BRANCH = trim($CUR_BRANCH);
echo "Patch....................: {$r[3]}\n";
echo "From.....................: {$r[1]}\n";
echo "To.......................: {$r[2]}\n";
echo "Current Branch..........: {$CUR_BRANCH}\n";
if ($CUR_BRANCH != $r[1]) {
echo "{$CUR_BRANCH} != {$r[1]}\n";
build_progress("{not_for_current_branch} {requested} {$r[1]}", 110);
return;
}
$PATCH_VER = $r[2] . " :";
$ASPATCH = true;
}
echo "Size....................: " . FormatBytes($size / 1024) . "\n";
echo "Current version.........: {$ORGV}\n";
build_progress("{analyze}...", 10);
echo "Current system..........: {$LINUX_CODE_NAME} {$LINUX_DISTRIBUTION} {$LINUX_VERS[0]}/{$LINUX_VERS[1]} {$LINUX_ARCHITECTURE}\n";
echo "Package.................: {$filename}\n";
echo "Temp dir................: {$TMP_DIR}\n";
echo "Apache User.............: {$APACHEUSER}\n";
if (!is_file($tarballs_file)) {
echo "{$tarballs_file} no such file...\n";
build_progress("No such file...", 110);
return;
}
echo "Uncompressing {$tarballs_file}...\n";
build_progress("{extracting} {$filename}...", 20);
$chown = $unix->find_program("chown");
$chmod = $unix->find_program("chmod");
$tar = $unix->find_program("tar");
$rm = $unix->find_program("rm");
$nohup = $unix->find_program("nohup");
$php = $unix->LOCATE_PHP5_BIN();
$squid = $unix->LOCATE_SQUID_BIN();
build_progress("{extracting} {$filename}...", 50);
system("{$tar} xpf {$tarballs_file} -C /usr/share/");
echo "Removing {$tarballs_file}...\n";
@unlink($tarballs_file);
shell_exec("{$rm} -rf /usr/share/artica-postfix/ressources/conf/upload/*");
build_progress("{apply_permissions}...", 55);
echo "{$APACHEUSER} -> /usr/share/artica-postfix\n";
shell_exec("{$chown} -R {$APACHEUSER} /usr/share/artica-postfix");
echo "0755 -> /usr/share/artica-postfix\n";
shell_exec("{$chmod} -R 0755 /usr/share/artica-postfix");
$ORGD = @file_get_contents("/usr/share/artica-postfix/VERSION");
echo "Old version.............: {$ORGV}\n";
if ($ASPATCH) {
$patched = " (patched)";
}
echo "Current version.........: {$ORGD}{$patched}\n";
sleep(2);
if ($ORGV == $ORGD) {
build_progress("{operation_failed} Same version {$PATCH_VER}{$filename}...", 110);
return;
}
build_progress("{restarting} Artica...", 60);
$unix->THREAD_COMMAND_SET("{$php} /usr/share/artica-postfix/exec.web-community-filter.php --register");
build_progress("{restarting} Artica...", 65);
build_progress("{building_init_scripts}...", 70);
system("{$php} /usr/share/artica-postfix/exec.initslapd.php");
build_progress("{updating_network}...", 75);
system("{$php} /usr/share/artica-postfix/exec.virtuals-ip.php");
system("{$php} /usr/share/artica-postfix/exec.monit.php --build");
echo "Starting......: " . date("H:i:s") . " Purge and clean....\n";
build_progress("{restarting} Artica...", 80);
if (is_file("/etc/init.d/nginx")) {
shell_exec("{$nohup} /etc/init.d/nginx reload >/dev/null 2>&1 &");
}
build_progress("{restarting} Artica...", 81);
shell_exec("{$nohup} /etc/init.d/auth-tail restart");
build_progress("{restarting} Artica...", 82);
shell_exec("{$nohup} /etc/init.d/artica-framework");
build_progress("{restarting} Artica...", 83);
shell_exec("{$nohup} /usr/share/artica-postfix/bin/process1 --force --verbose " . time() . "");
build_progress("{restarting} Artica...", 84);
shell_exec("{$nohup} /usr/share/artica-postfix/bin/artica-make --empty-cache >/dev/null 2>&1 &");
build_progress("{restarting} Artica...", 85);
shell_exec("{$nohup} /etc/init.d/monit restart >/dev/null 2>&1 &");
build_progress("{restarting} Artica...", 86);
shell_exec("{$nohup} /etc/init.d/artica-status restart --force >/dev/null 2>&1 &");
//.........这里部分代码省略.........
示例4: wsgate_debian
function wsgate_debian()
{
if ($GLOBALS["VERBOSE"]) {
echo "Load unix class...\n";
}
$unix = new unix();
if ($GLOBALS["VERBOSE"]) {
echo "Load unix class done..\n";
}
if (!is_dir("/etc/apt/sources.list.d")) {
if ($GLOBALS["VERBOSE"]) {
echo "/etc/apt/sources.list.d, no such directory\n";
}
return;
}
if (is_file("/etc/apt/sources.list.d/freerdp.list")) {
@unlink("/etc/apt/sources.list.d/freerdp.list");
}
if (is_file("/etc/apt/sources.list.d/freerdp1.list")) {
if ($GLOBALS["VERBOSE"]) {
echo "/etc/apt/sources.list.d/freerdp1.list already set\n";
}
return;
}
$sourcelist = null;
$LINUX_CODE_NAME = $unix->LINUX_CODE_NAME();
$LINUXVER = $unix->LINUX_VERS();
if ($GLOBALS["VERBOSE"]) {
echo "{$LINUX_CODE_NAME} {$LINUXVER[0]}.{$LINUXVER[1]}\n";
}
if ($LINUX_CODE_NAME == "DEBIAN") {
if ($LINUXVER[0] > 5) {
$sourcelist = "deb http://download.opensuse.org/repositories/home:/felfert/Debian_6.0 ./";
}
}
if ($LINUX_CODE_NAME == "UBUNTU") {
if ($LINUXVER[0] > 9) {
if ($LINUXVER[1] > 9) {
$sourcelist = "deb http://download.opensuse.org/repositories/home:/felfert/xUbuntu_10.10 ./";
}
}
if ($LINUXVER[0] > 10) {
if ($LINUXVER[1] > 9) {
$sourcelist = "deb http://download.opensuse.org/repositories/home:/felfert/xUbuntu_11.10 ./";
}
}
if ($LINUXVER[0] > 11) {
if ($LINUXVER[1] > 3) {
$sourcelist = "deb http://download.opensuse.org/repositories/home:/felfert/xUbuntu_12.04 ./";
}
}
}
if ($sourcelist == null) {
if ($GLOBALS["VERBOSE"]) {
echo "sourcelist is null\n";
}
return;
}
$wget = $unix->find_program("wget");
$aptkey = $unix->find_program("apt-key");
$aptget = $unix->find_program("apt-get");
$cmd = "{$wget} -O - http://download.opensuse.org/repositories/home:/felfert/Debian_6.0/Release.key | {$aptkey} add -";
shell_exec($cmd);
@file_put_contents("/etc/apt/sources.list.d/freerdp1.list", $sourcelist);
$cmd = "DEBIAN_FRONTEND=noninteractive {$aptget} -o Dpkg::Options::=\"--force-confnew\" --force-yes -y update 2>&1";
exec($cmd, $results);
system_admin_events($cmd . "\n" . @implode("\n", $results), __FUNCTION__, __FILE__, __LINE__, "system-update");
shell_exec($cmd);
$cmd = "DEBIAN_FRONTEND=noninteractive {$aptget} -o Dpkg::Options::=\"--force-confnew\" --force-yes -y install wsgate 2>&1";
exec($cmd, $results);
system_admin_events($cmd . "\n" . @implode("\n", $results), __FUNCTION__, __FILE__, __LINE__, "system-update");
shell_exec($cmd);
}
示例5: CleanUbuntu
function CleanUbuntu()
{
$unix = new unix();
if (is_file("/etc/default/whoopsie")) {
echo "Ubuntu: [INFO] Disabling whoopsie\n";
@file_put_contents("/etc/default/whoopsie", "[General]\nreport_crashes=false\n");
shell_exec("/usr/bin/killall whoopsie");
shell_exec("/etc/init.d/whoopsie stop");
if (is_file('/usr/sbin/update-rc.d')) {
shell_exec("/usr/sbin/update-rc.d -f whoopsie remove >/dev/null 2>&1");
}
}
if (is_file("/usr/sbin/console-kit-daemon")) {
echo "Ubuntu: [INFO] Disabling console-kit-daemon\n";
shell_exec("/bin/mv /usr/sbin/console-kit-daemon /usr/sbin/console-kit-daemon.bkup");
shell_exec("/bin/cp /bin/true /usr/sbin/console-kit-daemon");
}
if (is_file("/usr/sbin/bluetoothd")) {
echo "Ubuntu: [INFO] Disabling bluetoothd\n";
shell_exec("/usr/bin/killall bluetoothd");
shell_exec("/etc/init.d/bluetooth stop");
if (is_file('/usr/sbin/update-rc.d')) {
shell_exec("/usr/sbin/update-rc.d -f bluetooth remove >/dev/null 2>&1");
}
}
if (is_file("/etc/default/avahi-daemon")) {
echo "Ubuntu: [INFO] Disabling avahi dameon\n";
if ($unix->LINUX_CODE_NAME() == "UBUNTU") {
@file_put_contents("/etc/default/avahi-daemon", "AVAHI_DAEMON_START = 0\nAVAHI_DAEMON_DETECT_LOCAL=1\n");
}
if (is_file("/etc/init.d/avahi-daemon")) {
shell_exec("/etc/init.d/avahi-daemon stop");
if (is_file('/usr/sbin/update-rc.d')) {
shell_exec("/usr/sbin/update-rc.d -f avahi-daemon remove >/dev/null 2>&1");
shell_exec("kill -9 `pidof avahi-daemon` >/dev/null 2>&1");
}
}
}
}
示例6: mylinux
function mylinux()
{
$unix = new unix();
$ARRAY["LINUX_CODE_NAME"] = trim($unix->LINUX_CODE_NAME());
$ARRAY["LINUX_DISTRIBUTION"] = trim($unix->LINUX_DISTRIBUTION());
$ARRAY["LINUX_VERS"] = trim($unix->LINUX_VERS());
$ARRAY["LINUX_ARCHITECTURE"] = trim($unix->LINUX_ARCHITECTURE());
echo "<articadatascgi>" . base64_encode(serialize($ARRAY)) . "</articadatascgi>";
}
示例7: install
function install($filename)
{
$AS_POSTFIX = false;
$GLOBALS["PROGRESS_FILE"] = "/usr/share/artica-postfix/ressources/logs/{$filename}.progress";
$GLOBALS["DOWNLOAD_PROGRESS_FILE"] = "/usr/share/artica-postfix/ressources/logs/{$filename}.download.progress";
echo "Starting {$filename}\n";
$unix = new unix();
$LINUX_CODE_NAME = $unix->LINUX_CODE_NAME();
$LINUX_DISTRIBUTION = $unix->LINUX_DISTRIBUTION();
$LINUX_VERS = $unix->LINUX_VERS();
$LINUX_ARCHITECTURE = $unix->LINUX_ARCHITECTURE();
$DebianVer = "debian{$LINUX_VERS[0]}";
$TMP_DIR = $unix->TEMP_DIR();
$UPLOADED_DIR = dirname(__FILE__) . "/ressources/conf/upload";
$UPLOADED_FILE = "{$UPLOADED_DIR}/{$filename}";
$t = time();
build_progress("Analyze...{$filename}", 10);
echo "Operating system........: {$DebianVer}\n";
if (!is_file($UPLOADED_FILE)) {
echo "{$UPLOADED_FILE} no such file\n";
$tarballs_file = "/usr/share/artica-postfix/ressources/logs/web/tarballs.cache";
$Content = @file_get_contents($tarballs_file);
$strlen = strlen($Content);
if (preg_match("#<PACKAGES>(.*?)</PACKAGES>#", $Content, $re)) {
$MAIN = unserialize(base64_decode($re[1]));
}
$ligne = $MAIN[$filename];
$ARCH = $ligne["ARCH"];
if (preg_match("#([0-9]+)#", $ARCH, $re)) {
$ARCHBIN = $re[1];
}
$SIZE = $ligne["SIZE"];
$VERSION = $ligne["VERSION"];
$distri = $ligne["distri"];
$uri = $ligne["uri"];
$TMP_FILE = "{$TMP_DIR}/{$filename}";
}
if (is_file($UPLOADED_FILE)) {
echo "Uploaded {$UPLOADED_FILE}\n";
$EXTRACT = parsefilename($filename);
if (count($EXTRACT) < 2) {
echo "{$filename} did not match defined pattern...\n";
build_progress("{failed}...{$filename} Not supported", 110);
@unlink($UPLOADED_FILE);
sleep(5);
return;
}
$ARCHBIN = $EXTRACT["ARCHBIN"];
$VERSION = $EXTRACT["VERSION"];
$distri = $EXTRACT["DISTRI"];
//$DebianVer=$re[3];
$TMP_FILE = $UPLOADED_FILE;
$SIZE = @filesize($TMP_FILE);
}
echo "Current system..........: {$LINUX_CODE_NAME} {$LINUX_DISTRIBUTION} {$LINUX_VERS[0]}/{$LINUX_VERS[1]} {$LINUX_ARCHITECTURE}\n";
echo "Package.................: {$filename}\n";
echo "Architecture............: x{$ARCHBIN}\n";
echo "Version.................: {$VERSION}\n";
echo "Operating system........: {$distri}/{$DebianVer}\n";
echo "Temp dir................: {$TMP_DIR}\n";
echo "Size....................: {$SIZE} bytes\n";
$comp = true;
if ($LINUX_ARCHITECTURE != $ARCHBIN) {
$comp = false;
$log[] = "{$LINUX_ARCHITECTURE} !== {$ARCHBIN}";
}
if ($LINUX_CODE_NAME != "DEBIAN") {
$log[] = "{$LINUX_CODE_NAME} !== DEBIAN";
$comp = false;
}
if ($DebianVer != $distri) {
$comp = false;
$log[] = "{$DebianVer} !== {$distri}";
$comp = false;
}
if (!$comp) {
echo @implode("\n", $log);
build_progress("{not_compatible}...", 110);
if (is_file($TMP_FILE)) {
@unlink($TMP_FILE);
}
return;
}
if (!is_file($UPLOADED_FILE)) {
echo "Downloading {$filename}...\n";
build_progress("{downloading} {$filename}...", 20);
$curl = new ccurl($uri);
$curl->Timeout = 2400;
$curl->WriteProgress = true;
$curl->ProgressFunction = "download_progress";
if (!$curl->GetFile($TMP_FILE)) {
build_progress("{downloading} {$filename} {failed}...", 110);
return;
}
if (@filesize($TMP_FILE) != $SIZE) {
build_progress("{corrupted} {$filename} {failed}...", 110);
if (is_file($TMP_FILE)) {
@unlink($TMP_FILE);
}
return;
//.........这里部分代码省略.........