本文整理汇总了PHP中unix::APACHE_SRC_ACCOUNT方法的典型用法代码示例。如果您正苦于以下问题:PHP unix::APACHE_SRC_ACCOUNT方法的具体用法?PHP unix::APACHE_SRC_ACCOUNT怎么用?PHP unix::APACHE_SRC_ACCOUNT使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unix
的用法示例。
在下文中一共展示了unix::APACHE_SRC_ACCOUNT方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: apache_config
function apache_config()
{
$sock = new sockets();
$unix = new unix();
$EnablePHPFPM = 0;
$APACHE_SRC_ACCOUNT = $unix->APACHE_SRC_ACCOUNT();
$APACHE_SRC_GROUP = $unix->APACHE_SRC_GROUP();
if (preg_match("#APACHE_RUN_GROUP#", $APACHE_SRC_GROUP)) {
$APACHE_SRC_GROUP = "www-data";
}
$LogFilePath = "/var/log/artica-wifidog/access.log";
$directories[] = "/var/run/apache2";
$directories[] = "/var/run/artica-apache";
$directories[] = "/var/log/artica-wifidog";
$directories[] = "/home/artica/hotspot/sessions";
$directories[] = "/home/artica/hotspot/caches";
while (list($index, $maindir) = each($directories)) {
@mkdir($maindir, 0755, true);
@chown($maindir, $APACHE_SRC_ACCOUNT);
@chgrp($maindir, $APACHE_SRC_GROUP);
}
$ErrorLog = dirname($LogFilePath) . "/error.log";
if (!is_file($LogFilePath)) {
@touch($LogFilePath);
}
@chown($LogFilePath, $APACHE_SRC_ACCOUNT);
@chgrp($LogFilePath, $APACHE_SRC_GROUP);
if (!is_file($ErrorLog)) {
@touch($ErrorLog);
}
@chown($ErrorLog, $APACHE_SRC_ACCOUNT);
@chgrp($ErrorLog, $APACHE_SRC_GROUP);
$APACHE_MODULES_PATH = $unix->APACHE_MODULES_PATH();
$HotSpotMaxClients = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/HotSpotMaxClients"));
$HotSpotStartServers = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/HotSpotStartServers"));
$HotSpotForceDDOSDisable = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/HotSpotForceDDOSDisable"));
if ($HotSpotMaxClients == 0) {
$HotSpotMaxClients = 20;
}
if ($HotSpotStartServers == 0) {
$HotSpotStartServers = 5;
}
$EnableArticaHotSpot = $sock->GET_INFO("EnableArticaHotSpot");
$SquidHotSpotPort = $sock->GET_INFO("SquidHotSpotPort");
$ArticaHotSpotPort = $sock->GET_INFO("ArticaHotSpotPort");
$ArticaSSLHotSpotPort = $sock->GET_INFO("ArticaSSLHotSpotPort");
$ArticaSplashHotSpotPort = $sock->GET_INFO("ArticaSplashHotSpotPort");
$ArticaSplashHotSpotPortSSL = $sock->GET_INFO("ArticaSplashHotSpotPortSSL");
if (!is_numeric($ArticaHotSpotPort)) {
$ArticaHotSpotPort = 0;
}
if (!is_numeric($ArticaSplashHotSpotPort)) {
$ArticaSplashHotSpotPort = 16080;
}
if (!is_numeric($ArticaSplashHotSpotPortSSL)) {
$ArticaSplashHotSpotPortSSL = 16443;
}
$ArticaHotSpotInterface = $sock->GET_INFO("ArticaHotSpotInterface");
$HospotHTTPServerName = trim($sock->GET_INFO("HospotHTTPServerName"));
$HotSpotErrorRedirect = $sock->GET_INFO("HotSpotErrorRedirect");
if ($HotSpotErrorRedirect == null) {
$HotSpotErrorRedirect = "http://www.msftncsi.com";
}
$Params = unserialize($sock->GET_INFO("HotSpotEvasive"));
$ApacheEvasiveInstalled = intval($sock->GET_INFO("ApacheEvasiveInstalled"));
if (!is_numeric($Params["DOSEnable"])) {
$Params["DOSEnable"] = 1;
}
if (!is_numeric($Params["DOSHashTableSize"])) {
$Params["DOSHashTableSize"] = 1024;
}
if (!is_numeric($Params["DOSPageCount"])) {
$Params["DOSPageCount"] = 3;
}
if (!is_numeric($Params["DOSSiteCount"])) {
$Params["DOSSiteCount"] = 20;
}
if (!is_numeric($Params["DOSPageInterval"])) {
$Params["DOSPageInterval"] = 1;
}
if (!is_numeric($Params["DOSSiteInterval"])) {
$Params["DOSSiteInterval"] = 10;
}
if (!is_numeric($Params["DOSBlockingPeriod"])) {
$Params["DOSBlockingPeriod"] = 5;
}
$unix = new unix();
$NETWORK_ALL_INTERFACES = $unix->NETWORK_ALL_INTERFACES();
$ipaddr = $NETWORK_ALL_INTERFACES[$ArticaHotSpotInterface]["IPADDR"];
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} HotSpot run as {$ArticaHotSpotInterface} ( {$ipaddr} )\n";
}
if ($ipaddr == "0.0.0.0") {
$ipaddr = "*";
}
if ($ipaddr == null) {
$ipaddr = "*";
}
$GLOBALS["HOSTPOT_WEB_INTERFACE"] = $ipaddr;
$phpfpm = $unix->APACHE_LOCATE_PHP_FPM();
//.........这里部分代码省略.........
示例3: sessions_clean
function sessions_clean()
{
$unix = new unix();
$sock = new sockets();
$TimeFile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
if ($unix->file_time_min($TimeFile) < 60) {
return;
}
@unlink($TimeFile);
@file_put_contents($TimeFile, time());
$APACHE_SRC_ACCOUNT = $unix->APACHE_SRC_ACCOUNT();
$APACHE_SRC_GROUP = $unix->APACHE_SRC_GROUP();
$CleanPHPSessionTime = $sock->GET_INFO("CleanPHPSessionTime");
if (!is_numeric($CleanPHPSessionTime)) {
$CleanPHPSessionTime = 1440;
}
sessions_clean_parse("/var/lib/php5", $CleanPHPSessionTime, $APACHE_SRC_ACCOUNT, $APACHE_SRC_GROUP);
sessions_clean_parse("/var/lib/php5-zarafa", $CleanPHPSessionTime, $APACHE_SRC_ACCOUNT, $APACHE_SRC_GROUP);
sessions_clean_parse("/home/squid/error_page_sessions", $CleanPHPSessionTime, $APACHE_SRC_ACCOUNT, $APACHE_SRC_GROUP);
sessions_clean_parse("/usr/share/artica-postfix/ressources/logs/jGrowl", 360, $APACHE_SRC_ACCOUNT, $APACHE_SRC_GROUP);
sessions_clean_parse("/usr/share/artica-postfix/ressources/conf", 360, $APACHE_SRC_ACCOUNT, $APACHE_SRC_GROUP);
sessions_clean_parse("/home/squid/error_page_cache", 60);
}
示例4: sessions_clean
function sessions_clean()
{
$unix = new unix();
$sock = new sockets();
$TimeFile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
$APACHE_SRC_ACCOUNT = $unix->APACHE_SRC_ACCOUNT();
$APACHE_SRC_GROUP = $unix->APACHE_SRC_GROUP();
$CleanPHPSessionTime = $sock->GET_INFO("CleanPHPSessionTime");
if (!is_numeric($CleanPHPSessionTime)) {
$CleanPHPSessionTime = 2880;
}
if ($unix->file_time_min($TimeFile) < 60) {
return;
}
@unlink($TimeFile);
@file_put_contents($TimeFile, time());
if ($CleanPHPSessionTime > 5) {
if (is_dir("/var/lib/php5")) {
foreach (glob("/var/lib/php5/*") as $filename) {
$unix->chown_func($APACHE_SRC_ACCOUNT, $APACHE_SRC_GROUP, $filename);
$time = $unix->file_time_min($filename);
if ($time > 2880) {
$unix->_syslog("Clean: Remove PHP Session file " . basename($filename) . " {$time}Mn", basename(__FILE__));
@unlink($filename);
}
}
}
if (is_dir("/var/lib/php5-zarafa")) {
foreach (glob("/var/lib/php5-zarafa/*") as $filename) {
$time = $unix->file_time_min($filename);
if ($time > 2880) {
$unix->_syslog("Clean: Remove PHP Zarafa Session file " . basename($filename) . " {$time}Mn", basename(__FILE__));
@unlink($filename);
}
}
}
}
foreach (glob("/usr/share/artica-postfix/ressources/logs/jGrowl/*") as $filename) {
$time = $unix->file_time_min($filename);
if ($time > 360) {
@unlink($filename);
}
}
foreach (glob("/usr/share/artica-postfix/ressources/conf/*") as $filename) {
$time = $unix->file_time_min($filename);
if ($time > 360) {
@unlink($filename);
}
}
}
示例5: build
function build()
{
$unix = new unix();
$sock = new sockets();
$apache = $unix->APACHE_SRC_ACCOUNT();
$apachegrp = $unix->APACHE_SRC_GROUP();
$VSFTPDPort = intval($sock->GET_INFO("VSFTPDPort"));
if ($VSFTPDPort == 0) {
$VSFTPDPort = 21;
}
$VsFTPDPassive = $sock->GET_INFO("VsFTPDPassive");
$VsFTPDFileOpenMode = $sock->GET_INFO("VsFTPDFileOpenMode");
$VsFTPDLocalUmask = $sock->GET_INFO("VsFTPDLocalUmask");
$ProFTPDRootLogin = intval($sock->GET_INFO("ProFTPDRootLogin"));
if (!is_numeric($VsFTPDPassive)) {
$VsFTPDPassive = 1;
}
if ($VsFTPDFileOpenMode == null) {
$VsFTPDFileOpenMode = "0666";
}
if ($VsFTPDLocalUmask == null) {
$VsFTPDLocalUmask = "077";
}
if ($VsFTPDFileOpenMode == null) {
$VsFTPDFileOpenMode = "0666";
}
$VsFTPDLocalMaxRate = intval($sock->GET_INFO("VsFTPDLocalMaxRate"));
$f[] = "ServerName\t\t\"FTP server {$unix->hostname_g}()\"";
$f[] = "ServerType\t\tstandalone";
$f[] = "DefaultServer\t\ton";
$f[] = "Port\t\t\t\t{$VSFTPDPort}";
$f[] = "UseIPv6\t\t\toff";
$f[] = "Umask\t\t\t\t{$VsFTPDFileOpenMode} {$VsFTPDLocalUmask}";
$f[] = "PidFile\t\t\t/var/run/proftpd.pid";
$f[] = "MaxInstances\t\t30";
$f[] = "User\t\t\t\t{$apache}";
$f[] = "Group\t\t\t\t{$apachegrp}";
if ($ProFTPDRootLogin == 1) {
$f[] = "RootLogin\ton";
} else {
$f[] = "RootLogin\toff";
}
$f[] = "RequireValidShell\toff";
$f[] = "DefaultRoot \t\t~";
$f[] = "AllowOverwrite\ton";
$f[] = "IdentLookups \toff";
$f[] = "UseReverseDNS \toff";
$f[] = "LogFormat default \"%h %l %u %t \\\"%r\\\" %s %b\"";
$f[] = "LogFormat\t\t\tauth \"%v [%P] %h %t \\\"%r\\\" %s\"";
$f[] = "LogFormat\t\t\twrite \"%h %l %u %t \\\"%r\\\" %s %b\"";
$f[] = "SystemLog \t\t/var/log/proftpd.log";
$f[] = "TransferLog \t\t/var/log/xferlog";
$f[] = "LoadModule \t\tmod_quotatab.c";
$f[] = "LoadModule \t\tmod_quotatab_sql.c";
$f[] = "";
$f[] = "LoadModule \t\tmod_sql.c";
$f[] = "LoadModule \t\tmod_sql_mysql.c";
$f[] = "";
$f[] = "LoadModule \t\tmod_ldap.c";
$f[] = "";
$f[] = "AuthOrder\t\t\tAuthOrder mod_sql.c mod_ldap.c";
$f[] = "";
if ($VsFTPDPassive == 1) {
$pasv_min_port = intval($sock->GET_INFO("VsFTPDPassiveMinPort"));
$pasv_max_port = intval($sock->GET_INFO("VsFTPDPassiveMaxPort"));
if ($pasv_min_port == 0) {
$pasv_min_port = 40000;
}
if ($pasv_max_port == 0) {
$pasv_max_port = 40200;
}
$f[] = "PassivePorts {$pasv_min_port} {$pasv_max_port}";
$VsFTPDPassiveAddr = $sock->GET_INFO("VsFTPDPassiveAddr");
if ($VsFTPDPassiveAddr != null) {
$f[] = "MasqueradeAddress {$VsFTPDPassiveAddr}";
}
}
if ($VsFTPDLocalMaxRate > 0) {
if (strpos($VsFTPDLocalMaxRate, ".") == 0) {
$VsFTPDLocalMaxRate = "{$VsFTPDLocalMaxRate}.0";
}
$f[] = "TransferRate RETR {$VsFTPDLocalMaxRate}";
$f[] = "TransferRate STOR {$VsFTPDLocalMaxRate}";
}
$f[] = "";
$f[] = "# Bar use of SITE CHMOD by default";
$f[] = "<Limit SITE_CHMOD>";
$f[] = " DenyAll";
$f[] = "</Limit>";
$f[] = "";
$f[] = "# A basic anonymous configuration, no upload directories. If you do not";
$f[] = "# want anonymous users, simply delete this entire <Anonymous> section.";
$f[] = "<Anonymous ~ftp>";
$f[] = " User\t\t\t\tftp";
$f[] = " Group\t\t\t\tftp";
$f[] = "";
$f[] = " # We want clients to be able to login with \"anonymous\" as well as \"ftp\"";
$f[] = " UserAlias\t\t\tanonymous ftp";
$f[] = "";
$f[] = " # Limit the maximum number of anonymous logins";
//.........这里部分代码省略.........
示例6: 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 &");
//.........这里部分代码省略.........
示例7: build
function build()
{
$unix = new unix();
$sock = new sockets();
$users = new usersMenus();
$APACHE_MODULES_PATH = $users->APACHE_MODULES_PATH;
if ($GLOBALS["OUTPUT"]) {
echo "Configuring...: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} Apache modules in \"{$APACHE_MODULES_PATH}\"\n";
}
$ZarafaApachePort = $sock->GET_INFO("ZarafaApachePort");
$ZarafaApacheSSL = $sock->GET_INFO("ZarafaApacheSSL");
$LighttpdArticaDisableSSLv2 = $sock->GET_INFO("LighttpdArticaDisableSSLv2");
$ZarafaWebNTLM = $sock->GET_INFO("ZarafaWebNTLM");
$ZarafaApacheServerName = $sock->GET_INFO("ZarafaApacheServerName");
if (!is_numeric($ZarafaWebNTLM)) {
$ZarafaWebNTLM = 0;
}
if (!is_numeric($LighttpdArticaDisableSSLv2)) {
$LighttpdArticaDisableSSLv2 = 0;
}
if (!is_numeric($ZarafaApacheSSL)) {
$ZarafaApacheSSL = 0;
}
if (!is_numeric($ZarafaApachePort)) {
$ZarafaApachePort = 9010;
}
$ZarafaApachePHPFPMEnable = $sock->GET_INFO("ZarafaApachePHPFPMEnable");
if (!is_numeric($ZarafaApachePHPFPMEnable)) {
$ZarafaApachePHPFPMEnable = 0;
}
if ($ZarafaApacheServerName == null) {
$ZarafaApacheServerName = $unix->hostname_g();
}
if (!is_dir('/usr/share/php/mapi')) {
if (is_dir('/usr/local/share/php/mapi')) {
@mkdir("/usr/share/php", 0755, true);
shell_exec('/bin/ln -s /usr/local/share/php/mapi /usr/share/php/mapi');
}
}
$username = $unix->APACHE_SRC_ACCOUNT();
$group = $unix->APACHE_SRC_GROUP();
if ($GLOBALS["OUTPUT"]) {
echo "Configuring...: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} logs access: /var/log/apache-zarafa/access.log\n";
}
if ($GLOBALS["OUTPUT"]) {
echo "Configuring...: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} logs error : /var/log/apache-zarafa/error.log\n";
}
@unlink("/var/log/apache-zarafa/access.log");
@unlink("/var/log/apache-zarafa/error.log");
@touch("/var/log/apache-zarafa/access.log");
@touch("/var/log/apache-zarafa/access.log");
@mkdir("/var/run/apache2", 0755, true);
@mkdir("/var/run/artica-apache", 0755, true);
@mkdir('/var/run/zarafa-web', 0755, true);
@mkdir('/var/log/apache-zarafa', 0755, true);
@mkdir('/var/lib/zarafa-webaccess/tmp', 0755, true);
$unix->chown_func($username, $group, "/var/log/apache-zarafa/access.log");
$unix->chown_func($username, $group, "/var/log/apache-zarafa/error.log");
$unix->chown_func($username, $group, "/var/run/apache2");
$unix->chown_func($username, $group, "/var/run/artica-apache");
$unix->chown_func($username, $group, "/var/run/zarafa-web");
$unix->chown_func($username, $group, "/var/log/apache-zarafa");
$unix->chown_func($username, $group, "/var/lib/zarafa-webaccess");
$unix->chmod_func(0777, "/var/lib/zarafa-webaccess/tmp");
$unix->chown_func($username, $group, "/usr/share/zarafa-webaccess/plugins/*");
if ($ZarafaApacheSSL == 1) {
if (is_file("{$APACHE_MODULES_PATH}/mod_ssl.so")) {
if (!is_file("/etc/ssl/certs/zarafa/apache.crt.nopass.cert")) {
shell_exec("/usr/share/artica-postfix/bin/artica-install --zarafa-apache-certificates");
}
$f[] = "LoadModule ssl_module /usr/lib/apache2/modules/mod_ssl.so";
$f[] = "SSLEngine on";
$f[] = "SSLCertificateFile /etc/ssl/certs/zarafa/apache.crt.nopass.cert";
$f[] = "SSLCertificateKeyFile /etc/ssl/certs/zarafa/apache-ca.key.nopass.key";
if ($LighttpdArticaDisableSSLv2 == 1) {
$f[] = "SSLProtocol -ALL +SSLv3 +TLSv1";
$f[] = "SSLCipherSuite ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:RC4+RSA:+HIGH:+MEDIUM";
}
$f[] = "SSLRandomSeed connect builtin";
$f[] = "SSLRandomSeed startup file:/dev/urandom 256";
$f[] = "SSLRandomSeed connect file:/dev/urandom 256";
$f[] = "AddType application/x-x509-ca-cert .crt";
$f[] = "AddType application/x-pkcs7-crl .crl";
$f[] = "SSLPassPhraseDialog builtin";
$f[] = "SSLSessionCache shmcb:/var/run/apache2/ssl_scache-zarafa(512000)";
$f[] = "SSLSessionCacheTimeout 300";
$f[] = "SSLVerifyClient none";
$f[] = "ServerSignature Off";
}
}
$SET_MODULES = SET_MODULES();
$FreeWebPerformances = unserialize(base64_decode($sock->GET_INFO("ZarafaApachePerformances")));
if (!is_numeric($FreeWebPerformances["Timeout"])) {
$FreeWebPerformances["Timeout"] = 300;
}
if (!is_numeric($FreeWebPerformances["KeepAlive"])) {
$FreeWebPerformances["KeepAlive"] = 0;
}
if (!is_numeric($FreeWebPerformances["MaxKeepAliveRequests"])) {
$FreeWebPerformances["MaxKeepAliveRequests"] = 100;
//.........这里部分代码省略.........
示例8: squid_conf_copy
function squid_conf_copy()
{
if (is_file("/usr/share/artica-postfix/ressources/logs/web/squid.conf")) {
@unlink("/usr/share/artica-postfix/ressources/logs/web/squid.conf");
}
@copy("/etc/squid3/squid.conf", "/usr/share/artica-postfix/ressources/logs/web/squid.conf");
@chmod("/usr/share/artica-postfix/ressources/logs/web/squid.conf", 0755);
$unix = new unix();
@chown("/usr/share/artica-postfix/ressources/logs/web/squid.conf", $unix->APACHE_SRC_ACCOUNT());
}
示例9: install_PIWIK
function install_PIWIK($servername)
{
$sources = "/usr/share/piwik";
$unix = new unix();
$cp = $unix->find_program("cp");
$freeweb = new freeweb($servername);
if (!is_dir($sources)) {
writelogs("[{$servername}] {$sources} no such directory", __FUNCTION__, __FILE__, __LINE__);
return;
}
if (!is_dir($freeweb->WORKING_DIRECTORY)) {
writelogs("[{$servername}] {$freeweb->WORKING_DIRECTORY} no such directory", __FUNCTION__, __FILE__, __LINE__);
return;
}
include_once dirname(__FILE__) . "/ressources/class.piwik.inc";
$piwik = new piwik();
if ($piwik->checkWebsite($freeweb->WORKING_DIRECTORY)) {
return;
}
writelogs("[{$servername}] copy sources...", __FUNCTION__, __FILE__, __LINE__);
shell_exec("{$cp} -rf {$sources}/* {$freeweb->WORKING_DIRECTORY}/");
@unlink("{$freeweb->WORKING_DIRECTORY}/config/config.ini.php");
@mkdir('/usr/share/piwik/tmp/assets', 0777, true);
@mkdir('/usr/share/piwik/tmp/templates_c', 0777, true);
@mkdir('/usr/share/piwik/tmp/cache', 0777, true);
@mkdir('/usr/share/piwik/tmp/assets', 0777, true);
shell_exec('/bin/chmod 0777 /usr/share/piwik/tmp');
shell_exec('/bin/chmod 0777 /usr/share/piwik/tmp/templates_c/');
shell_exec('/bin/chmod 0777 /usr/share/piwik/tmp/cache/');
shell_exec('/bin/chmod 0777 /usr/share/piwik/tmp/assets/');
shell_exec('/bin/chmod a+w /usr/share/piwik/config');
$apacheusername = $unix->APACHE_SRC_ACCOUNT();
$apachegroup = $unix->APACHE_SRC_GROUP();
$freeweb->chown($freeweb->WORKING_DIRECTORY);
}
示例10: execute_mysql
function execute_mysql($OnlyID = 0)
{
$GLOBALS["INDEXED"] = 0;
$GLOBALS["SKIPPED"] = 0;
$GLOBALS["DIRS"] = array();
$unix = new unix();
$httrack = $unix->find_program("httrack");
if (!is_file($httrack)) {
apache_admin_mysql(0, "httrack no such binary", null, __FILE__, __LINE__, "webcopy");
return;
}
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$pid = $unix->get_pid_from_file($pidfile);
if ($unix->process_exists($pid, basename(__FILE__))) {
apache_admin_mysql(1, "Already instance executed", null, __FILE__, __LINE__, "webcopy");
return;
}
$ini = new Bs_IniHandler();
$sock = new sockets();
$datas = $sock->GET_INFO("ArticaProxySettings");
if (trim($datas) != null) {
$ini->loadString($datas);
if (!isset($ini->_params["PROXY"]["ArticaProxyServerEnabled"])) {
$ini->_params["PROXY"]["ArticaProxyServerEnabled"] = "no";
}
$ArticaProxyServerEnabled = $ini->_params["PROXY"]["ArticaProxyServerEnabled"];
$ArticaProxyServerName = $ini->_params["PROXY"]["ArticaProxyServerName"];
$ArticaProxyServerPort = $ini->_params["PROXY"]["ArticaProxyServerPort"];
$ArticaProxyServerUsername = trim($ini->_params["PROXY"]["ArticaProxyServerUsername"]);
$ArticaProxyServerUserPassword = $ini->_params["PROXY"]["ArticaProxyServerUserPassword"];
if ($ArticaProxyServerEnabled == 1) {
$ArticaProxyServerEnabled = "yes";
}
}
$PPRoxy = null;
$userPP = null;
if ($ArticaProxyServerEnabled == "yes") {
if ($ArticaProxyServerUsername != null) {
$userPP = "{$ArticaProxyServerUsername}:{$ArticaProxyServerUserPassword}@";
}
$PPRoxy = " --proxy {$userPP}@{$ArticaProxyServerName}:{$ArticaProxyServerPort}";
} else {
$squidbin = $unix->LOCATE_SQUID_BIN();
if (is_file($squidbin)) {
$SQUIDEnable = $sock->GET_INFO("SQUIDEnable");
if (!is_numeric($SQUIDEnable)) {
$SQUIDEnable = 1;
}
$SquidMgrListenPort = intval($sock->GET_INFO("SquidMgrListenPort"));
$PPRoxy = " --proxy 127.0.0.1:{$SquidMgrListenPort}";
}
}
$getmypid = getmypid();
@file_put_contents($pidfile, $getmypid);
$php = $unix->LOCATE_PHP5_BIN();
$APACHE_USERNAME = $unix->APACHE_SRC_ACCOUNT();
$APACHE_SRC_GROUP = $unix->APACHE_SRC_GROUP();
$q = new mysql();
$nice = EXEC_NICE();
$sql = "SELECT * FROM httrack_sites WHERE enabled=1";
$results = $q->QUERY_SQL($sql, "artica_backup");
if (!$q->ok) {
apache_admin_mysql(0, "Fatal: {$q->mysql_error}", null, __FILE__, __LINE__, "webcopy");
return;
}
$t1 = time();
$count = 0;
if ($OnlyID > 0) {
$ligne2 = mysql_fetch_array($q->QUERY_SQL("SELECT sitename FROM httrack_sites WHERE ID={$OnlyID}", "artica_backup"));
$log_exp = " only for [{$ligne2["sitename"]}] ";
}
apache_admin_mysql(2, "Starting executing WebCopy task {$log_exp} pid:{$getmypid}", null, __FILE__, __LINE__, "webcopy");
$dirsizeG = 0;
while ($ligne = mysql_fetch_assoc($results)) {
if ($OnlyID > 0) {
if ($ligne["ID"] != $OnlyID) {
continue;
}
}
$t = time();
$count++;
$workingdir = $ligne["workingdir"];
$sitename = $ligne["sitename"];
$minrate = $ligne["minrate"];
$maxfilesize = $ligne["maxfilesize"];
$maxsitesize = $ligne["maxsitesize"];
$size = $ligne["size"];
$sizeKB = $size / 1024;
$sizeMB = round($sizeKB / 1024, 2);
$maxworkingdir = intval($ligne["maxworkingdir"]);
if ($maxworkingdir == 0) {
$maxworkingdir = 20;
}
$maxsitesizeMB = $maxsitesize / 1000;
if ($maxsitesizeMB > $maxworkingdir) {
$maxsitesize = $maxworkingdir * 1000;
}
if ($sizeMB > $maxworkingdir) {
apache_admin_mysql(1, "Skip downloading content of {$sitename} Directory: {$sizeMB}MB reach limit of {$maxworkingdir}MB", null, __FILE__, __LINE__, "webcopy");
continue;
//.........这里部分代码省略.........
示例11: coova_web
function coova_web()
{
$ldap = new clladp();
$sock = new sockets();
$ChilliConf = unserialize(base64_decode($sock->GET_INFO("ChilliConf")));
if (!isset($ChilliConf["HS_UAMFREEWEB"])) {
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: FreeWeb Login page is not set...\n";
}
}
$f[] = "<?";
$f[] = "\t\$msecret = '{$ldap->ldap_password}'; //Change this to be the same as your chilli's configuration";
$f[] = "\t\$username = \$_POST['username'];";
$f[] = "\t\$password = \$_POST['password'];";
$f[] = "\t\$challenge = \$_POST['challenge'];";
$f[] = "\t\$redir\t = \$_POST['userurl'];";
$f[] = "\t\$server_ip = \$_POST['uamip'];";
$f[] = "\t\$port = \$_POST['uamport'];";
$f[] = "";
$f[] = " //--Add a remember me cookie---";
$f[] = " if( array_key_exists('remember',\$_POST)){";
$f[] = " \$Year = (2592000*12) + time();";
$f[] = " setcookie(\"hs[username]\", \$username, \$Year);";
$f[] = " setcookie('hs[password]', \$password, \$Year);";
$f[] = " }";
$f[] = "";
$f[] = " //--There is a bug that keeps the logout in a loop if userurl is http%3a%2f%2f1.0.0.0 ---/";
$f[] = " //--We need to remove this and replace it with something we want";
$f[] = " if (preg_match(\"/1\\.0\\.0\\.0/i\", \$redir)) {";
$f[] = "";
$f[] = " \$default_site = 'google.com';";
$f[] = " \$pattern = \"/1\\.0\\.0\\.0/i\";";
$f[] = " \$redir = preg_replace(\$pattern, \$default_site, \$redir);";
$f[] = " }";
$f[] = "";
$f[] = "\t\$enc_pwd = return_new_pwd(\$password,\$challenge,\$uamsecret);";
$f[] = "\t//\$dir\t\t= '/json/logon';";
$f[] = "\t\$dir\t\t= '/logon';";
$f[] = " \$target = \"http://\$server_ip\".':'.\$port.\$dir.\"?username=\$username&password=\$enc_pwd&userurl=\$redir\";";
$f[] = " // print(\$target);";
$f[] = "";
$f[] = "\theader(\"Location: \$target\");";
$f[] = "";
$f[] = "\t//Function to do the encryption thing of the password";
$f[] = "\tfunction return_new_pwd(\$pwd,\$challenge,\$uamsecret){";
$f[] = "\t \$hex_chal = pack('H32', \$challenge); //Hex the challenge";
$f[] = "\t \$newchal = pack('H*', md5(\$hex_chal.\$uamsecret)); //Add it to with \$uamsecret (shared between chilli an this script)";
$f[] = "\t \$response = md5(\"\" . \$pwd . \$newchal); //md5 the lot";
$f[] = "\t \$newpwd = pack('a32', \$pwd); //pack again";
$f[] = "\t \$password = implode ('', unpack('H32', (\$newpwd ^ \$newchal))); //unpack again";
$f[] = "\t return \$password;";
$f[] = " \t}";
$f[] = "";
$f[] = "?>";
$unix = new unix();
$cp = $unix->find_program("cp");
@mkdir("/var/www/coova_json", 0755, true);
if (!is_file("/var/www/coova_json/login.php")) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Installing Coova JSON...\n";
shell_exec("{$cp} -rf /var/www/c2/yfi_cake/setup/coova_json/* /var/www/coova_json/");
}
@file_put_contents("/var/www/coova_json/login.php", @implode("\n", $f));
@chmod("var/www/coova_json/login.php", 0755);
$unix->chown_func($unix->APACHE_SRC_ACCOUNT(), $unix->APACHE_SRC_GROUP(), "/var/www/coova_json/*");
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} `coova_json/login.php` done\n";
$f = explode("\n", @file_get_contents("/var/www/coova_json/js/custom.js"));
while (list($key, $line) = each($f)) {
if (preg_match("#\\s+p_url_use:.*?'#", $line)) {
echo "Starting......: " . date("H:i:s") . " [INIT]: Chilli: L.{$key} FreeWeb: {$ChilliConf["HS_UAMFREEWEB"]}\n";
$f[$key] = "\tp_url_use: 'http://{$ChilliConf["HS_UAMFREEWEB"]}/c2/yfi_cake/third_parties/json_usage_check?key=12345&username=', //This is the YFi Web service which will show the user's usage";
continue;
}
if (preg_match("#\\s+p_url_uam:.*?'#", $line)) {
echo "Starting......: " . date("H:i:s") . " [INIT]: Chilli: L.{$key} FreeWeb: {$ChilliConf["HS_UAMFREEWEB"]}\n";
$f[$key] = "\tp_url_uam: 'http://{$ChilliConf["HS_UAMFREEWEB"]}/mobile/uam.php?challenge=', //This us the web service which will return a uam encrypted hash using the challenge, password and UAM shared secret";
continue;
}
if (preg_match("#\\s+p_url_voucher_name:.*?'#", $line)) {
echo "Starting......: " . date("H:i:s") . " [INIT]: Chilli: L.{$key} FreeWeb: {$ChilliConf["HS_UAMFREEWEB"]}\n";
$f[$key] = "\tp_url_voucher_name: 'http://{$ChilliConf["HS_UAMFREEWEB"]}/c2/yfi_cake/third_parties/json_voucher_name?key=12345&password=',";
continue;
}
}
@file_put_contents("/var/www/coova_json/js/custom.js", @implode("\n", $f));
echo "Starting......: " . date("H:i:s") . " [INIT]: Chilli: `/custom.js` done\n";
$f = explode("\n", @file_get_contents("/var/www/coova_json/uam.php"));
while (list($key, $line) = each($f)) {
if (preg_match("#uamsecret.*?=#", $line)) {
$f[$key] = "\t\$uamsecret = '{$ldap->ldap_password}';";
continue;
}
}
@file_put_contents("/var/www/coova_json/uam.php", @implode("\n", $f));
echo "Starting......: " . date("H:i:s") . " [INIT]: Chilli: `/uam.php` done\n";
DefaultSplash($ChilliConf);
}
示例12: LoagRotateApache
function LoagRotateApache()
{
$sock = new sockets();
$unix = new unix();
$ApacheLogRotate = $sock->GET_INFO("ApacheLogRotate");
if (!is_numeric($ApacheLogRotate)) {
$ApacheLogRotate = 1;
}
if ($ApacheLogRotate == 0) {
return;
}
$gzip = $unix->find_program("gzip");
$ligneC = unserialize(base64_decode($sock->GET_INFO("ApacheLogRotateParams")));
if (!is_numeric($ligneC["RotateType"])) {
$ligneC["RotateType"] = 0;
}
if (!is_numeric($ligneC["MaxSize"])) {
$ligneC["MaxSize"] = 100;
}
if (!is_numeric($ligneC["RotateCount"])) {
$ligneC["RotateCount"] = 5;
}
$php5 = $unix->LOCATE_PHP5_BIN();
$q = new mysql();
$sql = "SELECT servername FROM freeweb";
$results = $q->QUERY_SQL($sql, 'artica_backup');
if (mysql_num_rows($results) == 0) {
return;
}
while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
$servername = $ligne["servername"];
$f = array();
$f[] = "/var/log/apache2/{$servername}/*.log {";
$f[] = "\t{$ligneC["RotateFreq"]}";
$f[] = "\tsu " . $unix->APACHE_SRC_ACCOUNT() . " " . $unix->APACHE_SRC_GROUP();
$f[] = "\tmissingok";
if ($ligneC["MaxSize"] > 0) {
$f[] = "\tsize {$ligneC["MaxSize"]}M";
}
if ($ligneC["RotateCount"] > 0) {
$f[] = "\trotate {$ligneC["RotateCount"]}";
}
$f[] = "\tcompress";
$f[] = "\tsharedscripts";
$f[] = "\tcreate 640 root";
$f[] = "\tdateext";
$f[] = "\tcompressext .gz";
$f[] = "\tcompresscmd {$gzip}";
$f[] = "\tcompressoptions -9";
$f[] = "\textension -TASK-99999";
$f[] = "\tpostrotate";
$f[] = "{$php5} /usr/share/artica-postfix/exec.freeweb.php --reload";
$f[] = "endscript";
$f[] = "}\n";
@file_put_contents("/etc/logrotate.d/rotate-{$servername}", @implode("\n", $f));
}
}
示例13: start
function start()
{
$unix = new unix();
$sock = new sockets();
$EnableArticaMirror = intval($sock->GET_INFO("EnableArticaMirror"));
if ($EnableArticaMirror == 0) {
die;
}
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$cachetime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
if ($GLOBALS["VERBOSE"]) {
echo "Time: {$cachetime}\n";
}
$pid = @file_get_contents($pidfile);
if ($unix->process_exists($pid)) {
WriteMyLogs("Already executed PID:{$pid}, die()", __FUNCTION__, __FILE__, __LINE__);
die;
}
@file_put_contents($pidfile, getmypid());
$cachetimeEx = $unix->file_time_min($cachetime);
if (!$GLOBALS["FORCE"]) {
if ($cachetimeEx < 25) {
return;
}
}
@unlink($cachetime);
@file_put_contents($cachetime, time());
$APACHE_USER = $unix->APACHE_SRC_ACCOUNT();
$MyRepo = "/home/www.artica.fr/web/tmpf/auto.update.ini";
$MIRROR = "http://articatech.net";
$REMOTE_URI = "{$MIRROR}/auto.update.php";
$OFFICIAL_DEST = "/home/www.artica.fr/web/download";
$NIGHTLY_DEST = "/home/www.artica.fr/web/nightbuilds";
$TEMP_DIR = $unix->TEMP_DIR();
$MyRepo = "/home/www.artica.fr/web/tmpf/auto.update.ini";
if (!is_file($MyRepo)) {
if ($GLOBALS["VERBOSE"]) {
echo "{$MyRepo} no such file\n";
}
}
$ini = new Bs_IniHandler($MyRepo);
$LOCAL_OFFICIAL = $ini->_params["NEXT"]["artica"];
$LOCAL_NIGHTLY = $ini->_params["NEXT"]["artica-nightly"];
$tmpfile = $unix->FILE_TEMP();
$curl = new ccurl($REMOTE_URI);
if (!$curl->GetFile($tmpfile)) {
return;
}
$ini = new Bs_IniHandler($tmpfile);
$REMOTE_OFFICIAL = $ini->_params["NEXT"]["artica"];
$REMOTE_NIGHTLY = $ini->_params["NEXT"]["artica-nightly"];
@unlink($tmpfile);
echo "Official {$LOCAL_OFFICIAL}/{$REMOTE_OFFICIAL}\n";
echo "Nightly {$LOCAL_NIGHTLY}/{$REMOTE_NIGHTLY}\n";
if ($LOCAL_OFFICIAL != $REMOTE_OFFICIAL) {
$uri = "{$MIRROR}/download/artica-{$REMOTE_OFFICIAL}.tgz";
$ArticaFileTemp = "{$TEMP_DIR}/{$REMOTE_OFFICIAL}.tgz";
echo "Downloading {$uri}\n";
$curl1 = new ccurl($uri);
if (!$curl1->GetFile($ArticaFileTemp)) {
echo "Failed\n";
return;
}
@copy($ArticaFileTemp, "{$OFFICIAL_DEST}/artica-{$REMOTE_OFFICIAL}.tgz");
@chown("{$OFFICIAL_DEST}/artica-{$REMOTE_OFFICIAL}.tgz", "{$APACHE_USER}");
@unlink($ArticaFileTemp);
@unlink($MyRepo);
}
if ($LOCAL_NIGHTLY != $REMOTE_NIGHTLY) {
$uri = "{$MIRROR}/nightbuilds/artica-{$REMOTE_NIGHTLY}.tgz";
$ArticaFileTemp = "{$TEMP_DIR}/{$REMOTE_NIGHTLY}.tgz";
echo "*******************************************\n";
echo "Downloading {$uri} to {$ArticaFileTemp}\n";
echo "Local: {$NIGHTLY_DEST}/{$REMOTE_NIGHTLY}.tgz\n";
echo "*******************************************\n\n";
$curl2 = new ccurl($uri);
if (!$curl2->GetFile($ArticaFileTemp)) {
echo "Failed\n";
return;
}
@copy($ArticaFileTemp, "{$NIGHTLY_DEST}/artica-{$REMOTE_NIGHTLY}.tgz");
@chown("{$NIGHTLY_DEST}/artica-{$REMOTE_NIGHTLY}.tgz", "{$APACHE_USER}");
@unlink($ArticaFileTemp);
@unlink($MyRepo);
}
}
示例14: extract_tgz
function extract_tgz($uuid)
{
$unix = new unix();
$workingdir = "/usr/share/artica-postfix/ressources/conf/meta/hosts/uploaded/{$uuid}";
if (is_file("{$workingdir}/status.tgz")) {
$tar = $unix->find_program("tar");
shell_exec("{$tar} -xf {$workingdir}/status.tgz -C {$workingdir}/");
@unlink("{$workingdir}/status.tgz");
}
$unix->chown_func($unix->APACHE_SRC_ACCOUNT(), $unix->APACHE_SRC_GROUP(), "{$workingdir}/*");
if (is_file("{$workingdir}/squid_admin_mysql.db")) {
$q = new mysql_meta();
if (!$q->TABLE_EXISTS("squid_admin_mysql")) {
$q->CheckTables();
}
$data = trim(@file_get_contents("{$workingdir}/squid_admin_mysql.db"));
if ($data != null) {
$q->QUERY_SQL(@file_get_contents("{$workingdir}/squid_admin_mysql.db"));
if (!$q->ok) {
meta_admin_mysql(0, "Failed to import {$workingdir}/squid_admin_mysql.db", $q->mysql_error, __FILE__, __LINE__);
} else {
@unlink("{$workingdir}/squid_admin_mysql.db");
}
} else {
@unlink("{$workingdir}/squid_admin_mysql.db");
}
} else {
if ($GLOBALS["VERBOSE"]) {
echo "{$workingdir}/squid_admin_mysql.db ( no such file )\n";
}
}
if (is_file("{$workingdir}/network_hosts.db")) {
__network_hosts($uuid, "{$workingdir}/network_hosts.db");
} else {
if ($GLOBALS["VERBOSE"]) {
echo "{$workingdir}/network_hosts.db ( no such file )\n";
}
}
global_status_ini($uuid);
}
示例15: apache_config
function apache_config()
{
$sock = new sockets();
$unix = new unix();
$EnablePHPFPM = 0;
$ipaddr = null;
@mkdir("/var/run/apache2", 0755, true);
@mkdir("/var/run/sarg-apache", 0755, true);
@mkdir("/var/log/apache2", 0755, true);
@mkdir(dirname($GLOBALS["APACHE_PID_PATH"]), 0755, true);
$APACHE_SRC_ACCOUNT = $unix->APACHE_SRC_ACCOUNT();
$APACHE_SRC_GROUP = $unix->APACHE_SRC_GROUP();
$APACHE_MODULES_PATH = $unix->APACHE_MODULES_PATH();
$SargOutputDir = $sock->GET_INFO("SargOutputDir");
if ($SargOutputDir == null) {
$SargOutputDir = "/var/www/html/squid-reports";
}
$SargWebPort = intval($sock->GET_INFO("SargWebPort"));
if ($SargWebPort == 0) {
$SargWebPort = rand(55600, 59000);
$sock->SET_INFO("SargWebPort", $SargWebPort);
}
if (is_link($SargOutputDir)) {
$SargOutputDir = @readlink($SargOutputDir);
}
@mkdir($SargOutputDir, 0755, true);
if (!is_file("{$SargOutputDir}/index.html")) {
$php = $unix->LOCATE_PHP5_BIN();
shell_exec("{$php} /usr/share/artica-postfix/exec.sarg.php --exec --force >/dev/null 2>&1 &");
}
if ($ipaddr == null) {
$ipaddr = "*";
}
$phpfpm = $unix->APACHE_LOCATE_PHP_FPM();
$php = $unix->LOCATE_PHP5_BIN();
$EnableArticaApachePHPFPM = $sock->GET_INFO("EnableArticaApachePHPFPM");
if (!is_numeric($EnableArticaApachePHPFPM)) {
$EnableArticaApachePHPFPM = 0;
}
if (!is_file($phpfpm)) {
$EnableArticaApachePHPFPM = 0;
}
$logfile = "/var/log/apache2/apache-sarg-access.log";
$ErrorLog = "/var/log/apache2/apache-sarg-error.log";
$unix->chown_func($APACHE_SRC_ACCOUNT, $APACHE_SRC_GROUP, "/var/run/sarg-apache");
$apache_LOCATE_MIME_TYPES = $unix->apache_LOCATE_MIME_TYPES();
if ($EnableArticaApachePHPFPM == 1) {
if (!is_file("{$APACHE_MODULES_PATH}/mod_fastcgi.so")) {
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} mod_fastcgi.so is required to use PHP5-FPM\n";
}
$EnableArticaApachePHPFPM = 0;
}
}
if ($APACHE_SRC_ACCOUNT == null) {
$APACHE_SRC_ACCOUNT = "www-data";
$APACHE_SRC_GROUP = "www-data";
$unix->CreateUnixUser($APACHE_SRC_ACCOUNT, $APACHE_SRC_GROUP, "Apache username");
}
@unlink($ErrorLog);
@unlink($logfile);
if (!is_file("{$logfile}")) {
@touch("{$logfile}");
}
if (!is_file("{$ErrorLog}")) {
@touch("{$ErrorLog}");
}
$unix->chown_func($APACHE_SRC_ACCOUNT, $APACHE_SRC_GROUP, $ErrorLog);
$unix->chown_func($APACHE_SRC_ACCOUNT, $APACHE_SRC_GROUP, $logfile);
$unix->chown_func($APACHE_SRC_ACCOUNT, $APACHE_SRC_GROUP, "/var/run/sarg-apache");
$unix->chown_func($APACHE_SRC_ACCOUNT, $APACHE_SRC_GROUP, "/var/log/apache2");
$unix->chown_func($APACHE_SRC_ACCOUNT, $APACHE_SRC_GROUP, dirname($GLOBALS["APACHE_PID_PATH"]));
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} Run as {$APACHE_SRC_ACCOUNT}:{$APACHE_SRC_GROUP}\n";
}
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} HTTP Port: {$ArticaSplashHotSpotPort} SSL Port: {$ArticaSplashHotSpotPortSSL}\n";
}
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} PHP-FPM: {$EnablePHPFPM}\n";
}
$f[] = "LockFile /var/run/apache2/sarg-artica-accept.lock";
$f[] = "PidFile {$GLOBALS["APACHE_PID_PATH"]}";
$f[] = "AcceptMutex flock";
$f[] = "DocumentRoot {$SargOutputDir}";
$f[] = "DirectoryIndex index.html";
$f[] = "ErrorDocument 400 /index.html";
$f[] = "ErrorDocument 401 /index.html";
$f[] = "ErrorDocument 403 /index.html";
$f[] = "ErrorDocument 404 /index.html";
$f[] = "ErrorDocument 500 /index.html";
$f[] = "NameVirtualHost {$ipaddr}:{$SargWebPort}";
$f[] = "Listen {$ipaddr}:{$SargWebPort}";
$f[] = "<VirtualHost {$ipaddr}:{$SargWebPort}>";
$f[] = "\tServerName {$ipaddr}";
$f[] = "\tDocumentRoot {$SargOutputDir}";
$f[] = "</VirtualHost>";
$f[] = "<IfModule mpm_prefork_module>";
$f[] = "</IfModule>";
$f[] = "<IfModule mpm_worker_module>";
//.........这里部分代码省略.........