本文整理汇总了PHP中unix::chmod_func方法的典型用法代码示例。如果您正苦于以下问题:PHP unix::chmod_func方法的具体用法?PHP unix::chmod_func怎么用?PHP unix::chmod_func使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unix
的用法示例。
在下文中一共展示了unix::chmod_func方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: start_prepare
function start_prepare()
{
if ($GLOBALS["CRASHED"]) {
return;
}
buil_init_squid_cache_log();
initd_squid();
$reconfigure = false;
$unix = new unix();
$sock = new sockets();
$NtpdateAD = $sock->GET_INFO("NtpdateAD");
$php = $unix->LOCATE_PHP5_BIN();
$nohup = $unix->find_program("nohup");
if (!is_file("/etc/squid3/malwares.acl")) {
@file_put_contents("/etc/squid3/malwares.acl", "\n");
}
if (!is_file("/etc/squid3/squid-block.acl")) {
@file_put_contents("/etc/squid3/squid-block.acl", "\n");
}
$EXPLODED = explode("\n", @file_get_contents("/etc/squid3/squid.conf"));
while (list($index, $val) = each($EXPLODED)) {
if (preg_match("#INSERT YOUR OWN RULE#", $val)) {
if ($GLOBALS["OUTPUT"]) {
echo "Preparing.....: " . date("H:i:s") . " squid must be reconfigured...\n";
}
$reconfigure = true;
}
}
if ($reconfigure) {
if ($GLOBALS["OUTPUT"]) {
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " Rebuild configuration\n";
}
system("{$php} /usr/share/artica-postfix/exec.squid.php --build --withoutloading");
} else {
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " Rebuild configuration\n";
}
exec("{$php} /usr/share/artica-postfix/exec.squid.php --build --withoutloading 2>&1", $GLOBALS["LOGS"]);
}
}
if ($NtpdateAD == 1) {
shell_exec("{$nohup} {$php} /usr/share/artica-postfix/exec.kerbauth.php --ntpdate >/dev/null 2>&1 &");
}
$unix->CreateUnixUser("squid", "squid");
if (!is_file("/etc/squid3/squid.conf")) {
if ($GLOBALS["OUTPUT"]) {
echo "Preparing.....: " . date("H:i:s") . " Warning /etc/squid3/squid.conf no such file\n";
}
if ($GLOBALS["OUTPUT"]) {
echo "Preparing.....: " . date("H:i:s") . " Ask to build it and die\n";
}
shell_exec("{$php} /usr/share/artica-postfix/exec.squid.php --build --force --withoutloading");
die;
}
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " initd-squid\n";
}
shell_exec("{$php} /usr/share/artica-postfix/exec.initd-squid.php >/dev/null 2>&1");
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " Watchdog config\n";
}
shell_exec("{$php} /usr/share/artica-postfix/exec.squid.php --watchdog-config >/dev/null 2>&1");
exec("{$php} /usr/share/artica-postfix/exec.squid.transparent.php", $GLOBALS["LOGS"]);
if (!is_file("/etc/init.d/tproxy start")) {
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " Building transparent method\n";
}
exec("{$php} /usr/share/artica-postfix/exec.squid.transparent.php", $GLOBALS["LOGS"]);
} else {
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " Starting transparent method\n";
}
exec("/etc/init.d/tproxy start", $GLOBALS["LOGS"]);
}
$directories_squid[] = "/var/squid";
$directories_squid[] = "/var/squid/cache";
$directories_squid[] = "/usr/share/squid3/icons";
$directories_squid[] = "/var/log/squid";
$directories_squid[] = "/etc/squid3";
$directories_squid[] = "/var/lib/squidguard";
$directories_squid[] = "/var/run/squid";
$directories_squid[] = "/lib/squid3";
$directories_chmod[] = "/var/logs";
$directories_chmod[] = "/var/log";
$directories_chmod[] = "/var";
$directories_chmod_owned[] = "/home/squid";
$filesOblig[] = "/etc/squid3/url_rewrite_program.deny.db";
$filesOblig[] = "/var/run/squid/squid.pid";
while (list($num, $directory) = each($directories_squid)) {
if ($GLOBALS["OUTPUT"]) {
echo "Preparing.....: " . date("H:i:s") . " {$directory}\n";
}
if (!is_dir($directory)) {
@mkdir($directory, 0755, true);
}
@chmod($directory, 0755);
$unix->chmod_func(0755, "{$directory}/*");
$unix->chown_func("squid", "squid", "{$directory}/*");
}
//.........这里部分代码省略.........
示例2: start
function start($aspid = false)
{
$unix = new unix();
$sock = new sockets();
if (!$aspid) {
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$pid = $unix->get_pid_from_file($pidfile);
if ($unix->process_exists($pid, basename(__FILE__))) {
$time = $unix->PROCCESS_TIME_MIN($pid);
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} Already Artica task running PID {$pid} since {$time}mn\n";
}
return;
}
@file_put_contents($pidfile, getmypid());
}
$spawn_fcgi = $unix->find_program("spawn-fcgi");
if (!is_file($spawn_fcgi)) {
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} not installed\n";
}
return;
}
$pid = DEFAULT_PID();
if ($unix->process_exists($pid)) {
$timepid = $unix->PROCCESS_TIME_MIN($pid);
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} already started {$pid} since {$timepid}Mn...\n";
}
return;
}
$nohup = $unix->find_program("nohup");
$php5 = $unix->LOCATE_PHP5_BIN();
$phpcgi = $unix->LIGHTTPD_PHP5_CGI_BIN_PATH();
$EnablePHPFPM = intval($sock->GET_INFO("EnablePHPFPM"));
$EnablePHPFPMFrameWork = $sock->GET_INFO("EnablePHPFPMFrameWork");
$EnableArticaApachePHPFPM = $sock->GET_INFO("EnableArticaApachePHPFPM");
$EnablePHPFPMFreeWeb = $sock->GET_INFO("EnablePHPFPMFreeWeb");
$EnableFreeWeb = $sock->GET_INFO("EnableFreeWeb");
if (!is_numeric($EnablePHPFPMFrameWork)) {
$EnablePHPFPMFrameWork = 0;
}
if (!is_numeric($EnableArticaApachePHPFPM)) {
$EnableArticaApachePHPFPM = 0;
}
if (!is_numeric($EnablePHPFPMFreeWeb)) {
$EnablePHPFPMFreeWeb = 0;
}
if (!is_numeric($EnableFreeWeb)) {
$EnableFreeWeb = 0;
}
if ($EnableFreeWeb == 0) {
$EnablePHPFPMFreeWeb = 1;
}
$enabled = 1;
if ($EnablePHPFPM == 1) {
if ($EnablePHPFPMFrameWork == 1) {
if ($EnableArticaApachePHPFPM == 1) {
if ($EnablePHPFPMFreeWeb == 1) {
$enabled = 0;
}
}
}
}
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} EnablePHPFPM............: {$EnablePHPFPM}\n";
}
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} EnablePHPFPMFrameWork...: {$EnablePHPFPMFrameWork}\n";
}
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} EnableArticaApachePHPFPM: {$EnableArticaApachePHPFPM}\n";
}
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} EnablePHPFPMFreeWeb.....: {$EnablePHPFPMFreeWeb}\n";
}
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} Enabled.................: {$enabled}\n";
}
if ($enabled == 0) {
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} is disabled...\n";
}
stop();
}
if (!is_file($phpcgi)) {
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} FATAL no php-cgi can be enabled !\n";
}
return false;
}
$unix->chmod_func(0777, "/var/run");
if ($unix->is_socket("/var/run/php-fcgi.sock")) {
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} remove old socket /var/run/php-fcgi.sock\n";
}
@unlink("/var/run/php-fcgi.sock");
}
$params = LOAD_CMDLINES();
if ($GLOBALS["OUTPUT"]) {
//.........这里部分代码省略.........
示例3: start_ldap
//.........这里部分代码省略.........
$suffix = @trim(@file_get_contents("/etc/artica-postfix/ldap_settings/suffix"));
shell_exec("{$nohup} /usr/share/artica-postfix/exec.virtuals-ip.php --resolvconf >/dev/null 2>&1 &");
echo "slapd: [INFO] slapd `{$slapd}`\n";
echo "slapd: [INFO] db_recover `{$DB_RECOVER_BIN}`\n";
echo "slapd: [INFO] db_archive `{$DB_ARCHIVE_BIN}`\n";
echo "slapd: [INFO] config `{$SLAPD_CONF}`\n";
echo "slapd: [INFO] pid `{$SLAPD_PID_FILE}`\n";
echo "slapd: [INFO] services `{$SLAPD_SERVICES}`\n";
echo "slapd: [INFO] pidof `{$pidofbin}`\n";
if ($EnableipV6 == 0) {
echo "slapd: [INFO] ipv4 only...\n";
$v4 = " -4";
}
if ($GLOBALS["VERBOSE"]) {
echo "-> ARRAY;\n";
}
$shemas[] = "core.schema";
$shemas[] = "cosine.schema";
$shemas[] = "mod_vhost_ldap.schema";
$shemas[] = "nis.schema";
$shemas[] = "inetorgperson.schema";
$shemas[] = "evolutionperson.schema";
$shemas[] = "postfix.schema";
$shemas[] = "dhcp.schema";
$shemas[] = "samba.schema";
$shemas[] = "ISPEnv.schema";
$shemas[] = "mozilla-thunderbird.schema";
$shemas[] = "officeperson.schema";
$shemas[] = "pureftpd.schema";
$shemas[] = "joomla.schema";
$shemas[] = "autofs.schema";
$shemas[] = "dnsdomain2.schema";
$shemas[] = "zarafa.schema";
restart_ldap_progress("{starting_service}", 50);
while (list($num, $file) = each($shemas)) {
if (is_file("/usr/share/artica-postfix/bin/install/{$file}")) {
if (is_file("{$LDAP_SCHEMA_PATH}/{$file}")) {
@unlink("{$LDAP_SCHEMA_PATH}/{$file}");
}
@copy("/usr/share/artica-postfix/bin/install/{$file}", "{$LDAP_SCHEMA_PATH}/{$file}");
echo "slapd: [INFO] installing `{$file}` schema\n";
$unix->chmod_func(0777, "{$LDAP_SCHEMA_PATH}/{$file}");
}
}
if (file_exists($ulimit)) {
shell_exec("{$ulimit} -HSd unlimited");
}
restart_ldap_progress("{starting_service}", 60);
if (is_dir("/usr/share/phpldapadmin/config")) {
$phpldapadmin = "{$php5} " . dirname(__FILE__) . "/exec.phpldapadmin.php --build >/dev/null 2>&1";
echo "slapd: [INFO] please wait, configuring PHPLdapAdminservice... \n";
shell_exec($phpldapadmin);
}
echo "slapd: [INFO] please wait, configuring the daemon...\n";
if ($unix->MEM_TOTAL_INSTALLEE() < 624288) {
$sock = new sockets();
$sock->SET_INFO("SlapdThreads", 2);
}
restart_ldap_progress("{starting_service}", 70);
@chmod("/usr/share/artica-postfix/bin/artica-install", 0755);
shell_exec("/usr/share/artica-postfix/bin/artica-install --slapdconf");
echo "slapd: [INFO] please wait, building the start script...\n";
buildscript();
$unix->ToSyslog("Launching the OpenLDAP daemon ", false, basename(__FILE__));
echo "slapd: [INFO] please wait, Launching the daemon...\n";
if (!$unix->NETWORK_INTERFACE_OK("lo")) {
$ifconfig = $unix->find_program("ifconfig");
shell_exec("{$ifconfig} lo 127.0.0.1 netmask 255.255.255.0 up >/dev/null 2>&1");
}
restart_ldap_progress("{starting_service}", 80);
$cdmline = "{$nohup} {$slapd}{$v4} -h \"{$SLAPD_SERVICES}\" -f {$SLAPD_CONF} -u root -g root -l local4{$OpenLDAPLogLevelCmdline} >/dev/null 2>&1 &";
shell_exec($cdmline);
sleep(1);
for ($i = 0; $i < 5; $i++) {
$pid = $unix->get_pid_from_file($SLAPD_PID_FILE);
if ($unix->process_exists($pid)) {
$pidtime = $unix->PROCCESS_TIME_MIN($pid);
echo "slapd: [INFO] slapd success Running pid {$pid}\n";
restart_ldap_progress("{success}", 100);
if ($users->ZARAFA_INSTALLED) {
start_zarafa();
}
return;
}
$pid = $unix->PIDOF($slapd);
if ($unix->process_exists($pid)) {
$pidtime = $unix->PROCCESS_TIME_MIN($pid);
echo "slapd: [INFO] slapd success Running pid {$pid}\n";
if ($users->ZARAFA_INSTALLED) {
start_zarafa();
}
restart_ldap_progress("{success}", 100);
return;
}
echo "slapd: [INFO] please wait, waiting service to start...\n";
sleep(1);
}
restart_ldap_progress("{failed}", 110);
echo "slapd: [ERR ] Failed to start the service with `{$cdmline}`\n";
}
示例4: monit
function monit()
{
$monit = new monit_unix();
$monit->WAKEUP();
$unix = new unix();
$unix->chmod_func(0755, "/etc/artica-postfix/settings/Daemons/*");
}
示例5: CheckPermissions
function CheckPermissions()
{
$unix = new unix();
$unix->SystemCreateUser("mail", "mail");
$unix->SystemCreateUser("postfix", "mail");
$unix->SystemCreateUser("cyrus", "cyrus");
$POSTFIX_QUEUE_DIRECTORY = $unix->POSTCONF_GET("queue_directory");
$dirs[] = "/var/lib/cyrus";
$dirs[] = "/var/lib/cyrus/db";
$dirs[] = "/var/lib/cyrus/socket";
$dirs[] = "/var/lib/cyrus/proc";
$dirs[] = "/var/run/cyrus/socket";
$dirs[] = "/var/spool/postfix/var/run/cyrus/socket";
$ln = $unix->find_program("ln");
$dirs[] = "{$POSTFIX_QUEUE_DIRECTORY}/var/run/cyrus";
while (list($num, $directory) = each($dirs)) {
if (!is_dir($directory)) {
@mkdir($directory, 0755, true);
}
$unix->chmod_func(0755, "{$directory}");
$unix->chown_func("cyrus", "mail", "{$directory}");
}
$unix->chown_func("cyrus", "cyrus", "/var/lib/cyrus");
if (!is_file("/var/lib/cyrus/user_deny.db")) {
@touch("/var/lib/cyrus/user_deny.db");
$unix->chown_func("cyrus", "mail", "/var/lib/cyrus/user_deny.db");
}
}
示例6: copytocache
function copytocache()
{
$unix = new unix();
$path = $_GET["copytocache"];
if (!is_file($path)) {
echo "<articadatascgi>No such file</articadatascgi>";
writelogs("{$path} -> No such file");
return;
}
$basename = basename($path);
writelogs("COPY {$path} -> /usr/share/artica-postfix/ressources/logs/{$basename}");
if (is_file("/usr/share/artica-postfix/ressources/logs/{$basename}")) {
@unlink("/usr/share/artica-postfix/ressources/logs/{$basename}");
}
if (!copy($path, "/usr/share/artica-postfix/ressources/logs/{$basename}")) {
echo "<articadatascgi>Copy failed</articadatascgi>";
return;
}
$APACHE = $unix->APACHE_SRC_ACCOUNT();
$APACHE_GROUP = $unix->APACHE_SRC_GROUP();
$unix->chown_func($APACHE, $APACHE_GROUP, "/usr/share/artica-postfix/ressources/logs/{$basename}");
$unix->chmod_func(0755, "/usr/share/artica-postfix/ressources/logs/{$basename}");
}
示例7: CheckFilesAndSecurity
function CheckFilesAndSecurity()
{
if (isset($GLOBALS[__FUNCTION__ . "_EXECUTED"])) {
return;
}
$GLOBALS[__FUNCTION__ . "_EXECUTED"] = true;
$squid_user = SquidUser();
$unix = new unix();
$chown = $unix->find_program("chown");
$chmod = $unix->find_program("chmod");
$squid_user = SquidUser();
$ln = $unix->find_program("ln");
$rm = $unix->find_program("rm");
if (!is_dir("/var/logs")) {
@mkdir("/var/logs", 0755, true);
}
$squidlogdir = "/var/log/squid";
if (is_link($squidlogdir)) {
$squidlogdir = @readlink($squidlogdir);
}
$baselogdir = dirname($squidlogdir);
@chmod($baselogdir, 0755);
@mkdir("/var/lib/squid/session", 0755, true);
@mkdir("/usr/local/share/artica", 0755, true);
@mkdir("/var/squid/cache", 0755, true);
@mkdir("/var/lib/ssl_db", 0755, true);
@mkdir("/var/log/squid/nudity", 0755, true);
if (!is_dir("/var/run/squid")) {
@mkdir("/var/run/squid", 0755, true);
}
@mkdir("/var/log/squid/squid", 0755, true);
if (!is_file("/var/logs/cache.log")) {
@file_put_contents("/var/logs/cache.log", "\n");
}
if (!is_dir("/usr/share/squid-langpack/templates/lb-lu")) {
shell_exec("{$ln} -sf /usr/share/squid-langpack/templates/en-us /usr/share/squid-langpack/templates/lb-lu");
}
if (!is_file("/etc/squid3/squid-block.acl")) {
@touch("/etc/squid3/squid-block.acl", "");
}
if (!is_file("/etc/squid3/clients_ftp.acl")) {
@touch("/etc/squid3/clients_ftp.acl", "");
}
if (!is_file("/etc/squid3/allowed-user-agents.acl")) {
@touch("/etc/squid3/allowed-user-agents.acl", "");
}
$unix->chmod_func(0755, "/etc/artica-postfix/settings/Daemons");
$unix->chmod_func(0755, "/etc/artica-postfix/settings/Daemons/*");
//helpers
@chmod("/usr/share/artica-postfix/ufdbgclient.php", 0755);
@chown("/usr/share/artica-postfix/ufdbgclient.php", "squid");
@chgrp("/usr/share/artica-postfix/ufdbgclient.php", "squid");
$GLOBALS["LogFileDeamonLogDir"] = @file_get_contents("/etc/artica-postfix/settings/Daemons/LogFileDeamonLogDir");
if ($GLOBALS["LogFileDeamonLogDir"] == null) {
$GLOBALS["LogFileDeamonLogDir"] = "/home/artica/squid/realtime-events";
}
@mkdir($GLOBALS["LogFileDeamonLogDir"], 0755, true);
@chmod($GLOBALS["LogFileDeamonLogDir"], 0755);
@chown($GLOBALS["LogFileDeamonLogDir"], "squid");
@chgrp($GLOBALS["LogFileDeamonLogDir"], "squid");
$items[] = "/etc/squid3/SquidNudityScanParams";
$items[] = "/var/squid/cache";
$items[] = "/var/lib/squid/session";
$items[] = "/etc/squid3/*";
$items[] = "{$squidlogdir}";
$items[] = "{$squidlogdir}/*";
$items[] = "{$squidlogdir}/nudity";
$items[] = "/var/logs";
$items[] = "/var/lib/ssl_db";
$items[] = "/var/logs/cache.log";
$items[] = "/home/squid/cache";
$items[] = "/home/squid";
$items[] = "/var/run/squid/*";
$items[] = "/usr/local/share/artica";
while (list($none, $path) = each($items)) {
echo "Starting......: " . date("H:i:s") . " [SYS]: permissions on \"{$path}\"\n";
$unix->chown_func($squid_user, $squid_user, $path);
$unix->chmod_func(0755, $path);
}
$squid_locate_pinger = $unix->squid_locate_pinger();
$setcap = $unix->find_program("setcap");
if (is_file($squid_locate_pinger)) {
shell_exec("{$chmod} 0755 {$squid_locate_pinger}");
@chown($squid_locate_pinger, "squid");
@chgrp($squid_locate_pinger, "squid");
if (is_file("{$setcap}")) {
shell_exec("{$setcap} cap_net_raw=pe {$squid_locate_pinger}");
} else {
$unix->DEBIAN_INSTALL_PACKAGE("libcap2-bin");
}
}
$unix->THREAD_COMMAND_SET("{$chown} -R squid:squid /var/lib/squid/session");
$GetCachesInsquidConf = $unix->SQUID_CACHE_FROM_SQUIDCONF();
while (list($CacheDirectory, $type) = each($GetCachesInsquidConf)) {
if (trim($CacheDirectory) == null) {
continue;
}
if (!is_dir($CacheDirectory)) {
continue;
}
//.........这里部分代码省略.........
示例8: BuildDHCP
function BuildDHCP($nopid = false)
{
$LOGBIN = "DHCP Server";
$timefile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
$unix = new unix();
if (!$nopid) {
if (!$GLOBALS["FORCE"]) {
if ($unix->file_time_min($timefile) < 2) {
if ($GLOBALS["VERBOSE"]) {
echo "{$timefile} -> is less than 2mn\n";
}
return;
}
}
}
build_progress("{starting_service}", 65);
$dhcpd = new dhcpd();
$conf = $dhcpd->BuildConf();
$confpath = dhcp3Config();
$unix = new unix();
@mkdir(dirname($confpath), null, true);
@file_put_contents($confpath, $conf);
echo "Starting......: " . date("H:i:s") . " [INIT]: {$LOGBIN} saving \"{$confpath}\" (" . strlen($conf) . " bytes) done\n";
if (!$unix->UnixUserExists("dhcpd")) {
$unix->CreateUnixUser("dhcpd", "dhcpd");
}
if (!is_dir("/var/lib/dhcp3")) {
@mkdir("/var/lib/dhcp3", 0755, true);
}
$unix->chown_func("dhcpd", "dhcpd", "/var/lib/dhcp3/*");
$unix->chmod_func(0755, "/var/lib/dhcp3");
$complain = $unix->find_program("aa-complain");
if (is_file($complain)) {
$dhcpd3 = $unix->DHCPD_BIN_PATH();
if (is_file($dhcpd3)) {
shell_exec("{$complain} {$dhcpd3} >/dev/null 2>&1");
}
}
@unlink($timefile);
@file_put_contents($timefile, time());
if ($GLOBALS["PROGRESS"]) {
build_progress("{starting_service}", 70);
$sock = new sockets();
$sock->getFrameWork("dnsmasq.php?restart=yes");
$sock->getFrameWork("services.php?restart-monit=yes");
$sock->getFrameWork("cmd.php?restart-artica-status=yes");
}
}
示例9: apache_config
//.........这里部分代码省略.........
$f[] = "{$MyDirectory}";
$mknod = $unix->find_program("mknod");
shell_exec("{$mknod} /dev/random c 1 9 >/dev/null 2>&1");
$f[] = "SSLEngine on";
$f[] = "</VirtualHost>";
$f[] = "";
}
if (!is_file("/etc/ssl/certs/apache/server.crt")) {
shell_exec("/usr/share/artica-postfix/bin/artica-install --apache-ssl-cert");
}
if ($EnableArticaApachePHPFPM == 1) {
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} Activate PHP5-FPM\n";
}
shell_exec("{$php} /usr/share/artica-postfix/exec.initslapd.php --phppfm");
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} Restarting PHP5-FPM\n";
}
shell_exec("/etc/init.d/php5-fpm restart");
$f[] = "\tAlias /php5.fastcgi /var/run/artica-roundcube/php5.fastcgi";
$f[] = "\tAddHandler php-script .php";
$f[] = "\tFastCGIExternalServer /var/run/artica-roundcube/php5.fastcgi -socket /var/run/php-fpm.sock -idle-timeout 610";
$f[] = "\tAction php-script /php5.fastcgi virtual";
$f[] = "\t<Directory /var/run/artica-roundcube>";
$f[] = "\t\t<Files php5.fastcgi>";
//$f[]="\t\tOrder deny,allow";
//$f[]="\t\tAllow from all";
$f[] = "\t\t</Files>";
$f[] = "\t</Directory>";
} else {
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} PHP5-FPM is disabled\n";
}
}
$f[] = "Loglevel info";
$f[] = "ErrorLog /var/log/apache2/roundcube-error.log";
$f[] = "LogFormat \"%h %l %u %t \\\"%r\\\" %<s %b\" common";
$f[] = "CustomLog /var/log/apache2/roundcube-access.log common";
if ($EnableArticaApachePHPFPM == 0) {
$array["php5_module"] = "libphp5.so";
}
$array["actions_module"] = "mod_actions.so";
$array["expires_module"] = "mod_expires.so";
$array["rewrite_module"] = "mod_rewrite.so";
$array["dir_module"] = "mod_dir.so";
$array["mime_module"] = "mod_mime.so";
$array["alias_module"] = "mod_alias.so";
$array["auth_basic_module"] = "mod_auth_basic.so";
$array["authn_file_module"] = "mod_authn_file.so";
//$array["authz_host_module"]="mod_authz_host.so";
$array["autoindex_module"] = "mod_autoindex.so";
$array["negotiation_module"] = "mod_negotiation.so";
$array["ssl_module"] = "mod_ssl.so";
$array["headers_module"] = "mod_headers.so";
$array["ldap_module"] = "mod_ldap.so";
if ($EnableArticaApachePHPFPM == 1) {
$array["fastcgi_module"] = "mod_fastcgi.so";
}
if (is_dir("/etc/apache2")) {
if (!is_file("/etc/apache2/mime.types")) {
if ($apache_LOCATE_MIME_TYPES != "/etc/apache2/mime.types") {
@copy($apache_LOCATE_MIME_TYPES, "/etc/apache2/mime.types");
}
}
}
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} Mime types path.......: {$apache_LOCATE_MIME_TYPES}\n";
}
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} Modules path..........: {$APACHE_MODULES_PATH}\n";
}
while (list($module, $lib) = each($array)) {
if (is_file("{$APACHE_MODULES_PATH}/{$lib}")) {
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} include module \"{$module}\"\n";
}
$f[] = "LoadModule {$module} {$APACHE_MODULES_PATH}/{$lib}";
} else {
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} skip module \"{$module}\"\n";
}
}
}
$f[] = "\n\n";
@file_put_contents("/etc/artica-postfix/apache-roundcube.conf", @implode("\n", $f));
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} /etc/artica-postfix/apache-roundcube.conf done\n";
}
$apachename = $unix->APACHE_SRC_ACCOUNT();
$apachegroup = $unix->APACHE_SRC_GROUP();
@mkdir("/usr/share/roundcube/uploads", 0755, true);
$dirs = $unix->dirdir("/usr/share/roundcube");
while (list($dirname, $lib) = each($dirs)) {
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} Privileges on {$dirname}\n";
}
$unix->chown_func($APACHE_SRC_ACCOUNT, $APACHE_SRC_GROUP, $dirname);
$unix->chmod_func(0755, $dirname);
}
}
示例10: compile
function compile()
{
$unix = new unix();
$MAIN_CACHE = unserialize(@file_get_contents("/root/UFDB_COMPILE_DATABASES"));
$q = new mysql_squid_builder();
$DB_LISTES = TransArray();
$ufdbGenTable = $unix->find_program("ufdbGenTable");
$WORKDIR = "/home/artica/ufdbv10";
$OUTPUTDIR = "/home/artica/ufdbv10Export";
@mkdir($OUTPUTDIR, 0755, true);
$UPDATED = 0;
while (list($category_table, $category) = each($DB_LISTES)) {
echo "Starting Cleaning {$category_table}\n";
Clean_table($category_table);
$CountCategoryTableRows = $q->COUNT_ROWS("{$category_table}");
echo "{$category_table}: {$CountCategoryTableRows} rows\n";
if ($CountCategoryTableRows == 0) {
sendEmail("ALERT! {$category_table} NO ROW!");
continue;
}
if (intval($MAIN_CACHE[$category_table]["ROWS"]) == $CountCategoryTableRows) {
ToSyslog($category_table . " [SKIPPED] {$MAIN_CACHE[$category_table]["ROWS"]} == {$CountCategoryTableRows}");
echo "{$category_table}: SKIPPED\n";
continue;
}
$workingtempdir = "{$WORKDIR}/{$category_table}";
$workingtempFile = "{$workingtempdir}/domains";
@mkdir($workingtempdir, 0777, true);
$unix->chmod_func(0777, $workingtempdir);
if (is_file($workingtempFile)) {
@unlink($workingtempFile);
}
$sql = "SELECT pattern FROM {$category_table} ORDER BY pattern INTO OUTFILE '{$workingtempFile}' LINES TERMINATED BY '\n';";
$q = new mysql_squid_builder();
$q->QUERY_SQL($sql);
if (!$q->ok) {
sendEmail("ALERT! {$category_table} MySQL error", $q->mysql_error);
die;
}
@file_put_contents("{$workingtempdir}/urls", "\n");
@file_put_contents("{$workingtempdir}/expressions", "\n");
@unlink("{$workingtempdir}/domains.ufdb");
$categoryKey = compile_databases_categoryKey($category);
$u = " -u {$workingtempdir}/urls";
$d = " -d {$workingtempdir}/domains";
$cmd = "{$ufdbGenTable} -n -q -W -t {$categoryKey}{$d}{$u} >/dev/null 2>&1";
echo "[{$category_table}]::{$category} {$cmd}\n";
$UPDATED++;
$t = time();
$resultsCMD[] = $cmd;
ToSyslog("[FINISH]:: Compiling {$category_table}...");
exec($cmd, $resultsCMD);
if (!is_file("{$workingtempdir}/domains.ufdb")) {
sendEmail("ALERT! {$category_table} domains.ufdb no such file!");
continue;
}
@mkdir("/home/artica/backuped_categories", 0755);
$unix->compress($workingtempFile, "/home/artica/backuped_categories/{$category_table}.gz");
echo "[{$category_table}]::{$category} Compressing to {$OUTPUTDIR}/{$category_table}.gz\n";
if (!$unix->compress("{$workingtempdir}/domains.ufdb", "{$OUTPUTDIR}/{$category_table}.gz")) {
sendEmail("ALERT! unable to compress {$workingtempdir}/domains.ufdb");
die;
}
@unlink("/home/ufdbcat/{$category_table}/domains.ufdb");
@copy("{$workingtempdir}/domains.ufdb", "/var/lib/ufdbartica/{$category_table}/domains.ufdb");
echo "[{$category_table}]::{$category} Indexing....\n";
$md5file = md5_file("{$workingtempdir}/domains.ufdb");
$md5zip = md5_file("{$OUTPUTDIR}/{$category_table}.gz");
ToSyslog("{$OUTPUTDIR}/{$category_table}.gz [UPDATED]");
$UPDATED_DBS[] = "{$category_table} ({$CountCategoryTableRows})";
$MAIN_CACHE[$category_table]["ROWS"] = $CountCategoryTableRows;
$MAIN_CACHE[$category_table]["TIME"] = time();
$MAIN_CACHE[$category_table]["MD5SRC"] = $md5file;
$MAIN_CACHE[$category_table]["MD5GZ"] = $md5zip;
}
ToSyslog("[FINISH]:: Building indexes {$UPDATED} updated...");
@file_put_contents("/root/UFDB_COMPILE_DATABASES", serialize($MAIN_CACHE));
@file_put_contents("{$OUTPUTDIR}/index.txt", base64_encode(serialize($MAIN_CACHE)));
if ($UPDATED > 0) {
ToSyslog("[FINISH]:: PushToRepo_alls()");
PushToRepo_alls();
sendEmail("{$UPDATED} Official Webfiltering databases updated", @implode("\n", $UPDATED_DBS));
}
}
示例11: unix
$unix = new unix();
$php5 = $unix->LOCATE_PHP5_BIN();
if ($GLOBALS["VERBOSE"]) {
echo "lighttpd user: {$username}:{$groupname}\n";
}
if (is_dir("/etc/resolvconf")) {
shell_exec("{$php5} " . basename(__FILE__) . "/exec.virtuals-ip.php --resolvconf >/dev/null 2>&1 &");
if (!is_dir("/etc/resolvconf/run/interface")) {
@mkdir("/etc/resolvconf/run/interface", 0755, true);
}
}
if (!is_dir("/var/log/btmp")) {
@mkdir("/var/log/btmp", 0755, true);
}
@chmod("/etc/artica-postfix/settings/Daemons", 0755);
$unix->chmod_func(0755, "/etc/artica-postfix/settings/Daemons/*");
writeprogress(5, "/etc/artica-postfix/settings/Daemons");
$sock = new sockets();
$f[] = 'ressources';
$f[] = 'ressources/sessions';
$f[] = 'ressources/web';
$f[] = 'ressources/web/logs';
$f[] = 'ressources/logs/web/queue/sessions';
$f[] = 'framework';
$f[] = 'ressources/userdb';
$f[] = 'ressources/conf';
$f[] = 'ressources/conf/kasDatas';
$f[] = 'ressources/logs';
$f[] = 'ressources/profiles';
$f[] = 'ressources/profiles/icons';
$f[] = 'ressources/sessions/SessionData';
示例12: start
function start()
{
$unix = new unix();
$pidfile = "/var/run/squid-stats-central.pid";
$timefile = $GLOBALS["TIMEFILE"];
$sock = new sockets();
if (!$unix->is_socket("/var/run/mysqld/squid-db.sock")) {
stats_admin_events(0, "MySQL server not ready, delay task...", null, __FILE__, __LINE__);
$unix->THREAD_COMMAND_SET($unix->LOCATE_PHP5_BIN() . " " . __FILE__);
die;
}
$WizardStatsApplianceDisconnected = intval($sock->GET_INFO("WizardStatsApplianceDisconnected"));
if ($WizardStatsApplianceDisconnected == 1) {
$export_stamp = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".EXPORT.time";
$export_time = $unix->file_time_min($export_stamp);
if ($export_time > 60) {
start_export();
export_push();
@unlink($export_stamp);
@file_put_contents($export_stamp, time());
}
die;
}
if (!$GLOBALS["NOTIME"]) {
@unlink($timefile);
@file_put_contents($timefile, time());
}
stats_admin_events(2, " **** STARTING Statistics Engine ****", null, __FILE__, __LINE__);
percentage("**** STARTING Statistics Engine ****", 0);
percentage("**** Importing tables ****", 2);
start_import(true);
$sock->SQUID_DISABLE_STATS_DIE();
$pid = @file_get_contents($pidfile);
if (!$GLOBALS["FORCE"]) {
if ($pid < 100) {
$pid = null;
}
$unix = new unix();
if ($unix->process_exists($pid, basename(__FILE__))) {
if ($GLOBALS["VERBOSE"]) {
echo "Already executed pid {$pid}\n";
}
return;
}
$mypid = getmypid();
@file_put_contents($pidfile, $mypid);
}
$DisableArticaProxyStatistics = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/DisableArticaProxyStatistics"));
if ($DisableArticaProxyStatistics == 1) {
percentage("{disabled}", 100);
stats_admin_events(1, "100%) Statistics are disabled");
StampDone(1000, "Statistics are disabled");
return;
}
@unlink("/var/run/squid-stats-central.stop");
if (!$GLOBALS["NOTIME"]) {
@unlink($timefile);
@file_put_contents($timefile, time());
}
$tSource = time();
$php5 = $unix->LOCATE_PHP5_BIN();
$nohup = $unix->find_program("nohup");
$EXEC_NICE = $unix->EXEC_NICE();
$Prefix = "/usr/share/artica-postfix";
$q = new mysql_squid_builder();
$GLOBALS["Q"] = $q;
@mkdir("/home/artica/categories_databases", 0755, true);
$unix->chmod_func(0755, "/home/artica/categories_databases/*");
$unix->chmod_func(0755, "/home/artica/categories_perso/*");
if (!StampOK(5)) {
percentage("Reloading categories Daemon...", 2);
shell_exec("/etc/init.d/ufdbcat reload");
}
$t = time();
if (!StampOK(10)) {
percentage("Purge old days", 1);
shell_exec(trim("{$EXEC_NICE} {$php5} {$Prefix}/exec.squidlogs.purge.php"));
stats_admin_events(2, "1%) Purge days took:" . $unix->distanceOfTimeInWords($t, time()), null, __FILE__, __LINE__);
StampDone(10, "Purge old days");
}
if (!StampOK(20)) {
percentage("Compile personal tables...", 2);
shell_exec(trim("{$EXEC_NICE} {$php5} {$Prefix}/exec.squid.compile_category_perso.php"));
Step2();
StampDone(20, "Compile personal tables");
}
$t = time();
if (!StampOK(30)) {
percentage("Running Quota day", 2);
shell_exec(trim("{$EXEC_NICE} {$php5} {$Prefix}/exec.squid.stats.quotaday.php"));
stats_admin_events(2, "2%) Quota day executed took:" . $unix->distanceOfTimeInWords($t, time()), null, __FILE__, __LINE__);
StampDone(30, "Running Quota day");
}
if (SquidStatisticsTasksOverTime()) {
stats_admin_events(1, "Statistics overtime... Aborting", null, __FILE__, __LINE__);
return;
}
if (!StampOK(40)) {
percentage("Running Youtube Hours", 2);
shell_exec(trim("{$EXEC_NICE} {$php5} {$Prefix}/exec.squid.stats.youtube.days.php --schedule-id={$GLOBALS["SCHEDULE_ID"]}"));
//.........这里部分代码省略.........
示例13: squidlogs_status
function squidlogs_status($nopid = false)
{
$sock = new sockets();
$unix = new unix();
$cachefile = "/usr/share/artica-postfix/ressources/logs/web/squidlogs.stats";
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$q = new mysql_squid_builder();
if (!$nopid) {
$pid = @file_get_contents($pidfile);
if ($unix->process_exists($pid)) {
echo "Starting......: " . date("H:i:s") . " cache manager, " . __FUNCTION__ . "() already running PID:{$pid}\n";
return;
}
@file_put_contents($pidfile, getmypid());
}
if ($GLOBALS["FORCE"]) {
@unlink($cachefile);
}
if (is_file($cachefile)) {
$time = $unix->file_time_min($cachefile);
if ($time < 20) {
if ($GLOBALS["VERBOSE"]) {
echo "{$time}mn require 20mn\n";
}
return;
}
}
$df = $unix->find_program("df");
$sock = new sockets();
$MYSQL_DATA_DIR = $q->MYSQL_DATA_DIR;
if (is_dir("/opt/squidsql")) {
$MYSQL_DATA_DIR = "/opt/squidsql";
}
if ($GLOBALS["VERBOSE"]) {
echo "MYSQL_DATA_DIR = {$MYSQL_DATA_DIR}\n";
}
if (!is_link("{$MYSQL_DATA_DIR}/{$q->database}")) {
$realFolder = "{$MYSQL_DATA_DIR}";
} else {
$realFolder = readlink("{$MYSQL_DATA_DIR}");
}
$EXEC_NICE = $unix->EXEC_NICE();
$cmdline = "{$EXEC_NICE}{$df} -h {$realFolder} 2>&1";
if ($GLOBALS["VERBOSE"]) {
echo __LINE__ . " {$cmdline}\n";
}
exec("{$df} -h {$realFolder} 2>&1", $results);
$foldersize = $unix->DIRSIZE_BYTES($realFolder);
while (list($num, $line) = each($results)) {
if (!preg_match("#(.+?)\\s+([0-9A-Z\\.]+)\\s+([0-9A-Z\\.]+)\\s+([0-9A-Z\\.]+)\\s+([0-9\\.]+)%#", $line, $re)) {
if ($GLOBALS["VERBOSE"]) {
echo "{$line}, no match\n";
}
continue;
}
$array["squidlogs"]["DEV"] = $re[1];
$array["squidlogs"]["SIZE"] = $re[2];
$array["squidlogs"]["OC"] = $re[3];
$array["squidlogs"]["DISP"] = $re[4];
$array["squidlogs"]["POURC"] = $re[5];
$array["squidlogs"]["REALPATH"] = $realFolder;
$array["squidlogs"]["PATHSIZE"] = $foldersize;
$array["squidlogs"]["TIME"] = time();
}
$TuningParameters = unserialize(base64_decode($sock->GET_INFO("MySQLSyslogParams")));
$MySQLSyslogWorkDir = $sock->GET_INFO("MySQLSyslogWorkDir");
if ($MySQLSyslogWorkDir == null) {
$MySQLSyslogWorkDir = "/home/syslogsdb";
}
$q = new mysql_storelogs();
$MYSQL_DATA_DIR = $MySQLSyslogWorkDir;
if (!is_link("{$MYSQL_DATA_DIR}")) {
$realFolder = "{$MYSQL_DATA_DIR}";
} else {
$realFolder = readlink("{$MYSQL_DATA_DIR}");
}
exec("{$df} -h {$realFolder} 2>&1", $results);
if ($GLOBALS["VERBOSE"]) {
echo __LINE__ . " {$cmdline}\n";
}
$foldersize = $unix->DIRSIZE_BYTES($realFolder);
while (list($num, $line) = each($results)) {
if (!preg_match("#(.+?)\\s+([0-9A-Z\\.]+)\\s+([0-9A-Z\\.]+)\\s+([0-9A-Z\\.]+)\\s+([0-9\\.]+)%#", $line, $re)) {
continue;
}
$array["syslogstore"]["DEV"] = $re[1];
$array["syslogstore"]["SIZE"] = $re[2];
$array["syslogstore"]["OC"] = $re[3];
$array["syslogstore"]["DISP"] = $re[4];
$array["syslogstore"]["POURC"] = $re[5];
$array["syslogstore"]["REALPATH"] = $realFolder;
$array["syslogstore"]["PATHSIZE"] = $foldersize;
$array["syslogstore"]["TIME"] = time();
}
print_r($array);
@unlink($cachefile);
@file_put_contents($cachefile, serialize($array));
$unix->chmod_func(0777, $cachefile);
if ($GLOBALS["VERBOSE"]) {
echo __LINE__ . " " . __FUNCTION__ . " finish OK\n";
//.........这里部分代码省略.........
示例14: 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;
//.........这里部分代码省略.........
示例15: TestingApacheConfigurationFile
function TestingApacheConfigurationFile()
{
CheckLibraries();
$unix = new unix();
$prefixOutput = "Starting......: " . date("H:i:s") . " [INIT]: Apache Check";
$httpdconf = $GLOBALS["CLASS_UNIX"]->LOCATE_APACHE_CONF_PATH();
$apache2ctl = $GLOBALS["CLASS_UNIX"]->LOCATE_APACHE_CTL();
$unix->chmod_func(0755, "/etc/apache2/sites-enabled/*");
if (!is_file($apache2ctl)) {
return true;
}
exec("{$apache2ctl} -f {$httpdconf} -S 2>&1", $results);
echo "{$prefixOutput} [" . __LINE__ . "] verify configuration...\n";
while (list($index, $line) = each($results)) {
echo "{$prefixOutput} [" . __LINE__ . "] `{$line}`\n";
if (preg_match("#Syntax error on line ([0-9]+) of (.+?):#", $line, $re)) {
@copy($re[2], "/root/" . basename($re[2]));
echo "{$prefixOutput} [" . __LINE__ . "] `" . basename($re[2]) . "` as been copied in /root...\n";
}
if (preg_match("#Syntax OK#i", $line)) {
echo "{$prefixOutput} [" . __LINE__ . "] Syntax OK...\n";
return true;
}
}
echo "{$prefixOutput} [" . __LINE__ . "] Syntax Failed !!!...\n";
@file_put_contents("/etc/artica-postfix/settings/Daemons/ApacheLastError", @implode("\n", $results));
}