当前位置: 首页>>代码示例>>PHP>>正文


PHP unix::chown_func方法代码示例

本文整理汇总了PHP中unix::chown_func方法的典型用法代码示例。如果您正苦于以下问题:PHP unix::chown_func方法的具体用法?PHP unix::chown_func怎么用?PHP unix::chown_func使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在unix的用法示例。


在下文中一共展示了unix::chown_func方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: apache_permissions

function apache_permissions()
{
    $unix = new unix();
    $APACHE_SRC_ACCOUNT = $unix->APACHE_SRC_ACCOUNT();
    $APACHE_SRC_GROUP = $unix->APACHE_SRC_GROUP();
    $f[] = "/var/log/apache2";
    $f[] = "/var/cache/apache2";
    $f[] = "/var/cache/apache2/mod_pagespeed";
    $f[] = "/etc/apache2/logs";
    $f[] = "/var/lib/apache2/fastcgi";
    $f[] = "/var/run/apache2";
    $f[] = "/var/www";
    while (list($index, $dir) = each($f)) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: apache2 apply permissions on `{$dir}`\n";
        if (!is_dir($dir)) {
            @mkdir($dir, 0755, true);
        }
        @chown($dir, $APACHE_SRC_ACCOUNT);
        @chgrp($dir, $APACHE_SRC_GROUP);
        $unix->chown_func($APACHE_SRC_ACCOUNT, $APACHE_SRC_GROUP, "{$dir}/*");
        $unix->chmod_func(0755, $dir);
    }
}
开发者ID:articatech,项目名称:artica,代码行数:23,代码来源:exec.freeweb.php

示例2: lighttpd_chowndir

function lighttpd_chowndir()
{
    $f = explode("\n", @file_get_contents("/etc/lighttpd/lighttpd.conf"));
    while (list($num, $line) = each($f)) {
        if (preg_match("#server\\.username.*?\"(.+?)\"#", $line, $re)) {
            $username = $re[1];
            continue;
        }
        if (preg_match("#server\\.groupname.*?\"(.+?)\"#", $line, $re)) {
            $groupname = $re[1];
            continue;
        }
        if ($groupname != null) {
            if ($username != null) {
                break;
            }
        }
    }
    if (is_file($_GET["chowndir"])) {
        @chown($_GET["chowndir"], $username);
        @chgrp($_GET["chowndir"], $groupname);
        return;
    }
    $unix = new unix();
    $unix->chown_func($username, $groupname, base64_decode($_GET["chowndir"]));
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:26,代码来源:services.php

示例3: 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);
        }
    }
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:50,代码来源:exec.clean.logs.php

示例4: SERVICE_START

function SERVICE_START($nochecks = false, $nopid = false)
{
    $unix = new unix();
    $sock = new sockets();
    $kill = $unix->find_program("kill");
    if (!$nopid) {
        $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
        $pid = @file_get_contents($pidfile);
        if ($unix->process_exists($pid, basename(__FILE__))) {
            $time = $unix->PROCCESS_TIME_MIN($pid);
            echo "Starting......: " . date("H:i:s") . " MySQL this script is already executed PID: {$pid} since {$time}Mn\n";
            if ($time < 5) {
                if (!$GLOBALS["FORCE"]) {
                    return;
                }
            }
            unix_system_kill_force($pid);
        }
        @file_put_contents($pidfile, getmypid());
    }
    if (is_file("/etc/artica-postfix/mysql.stop")) {
        echo "Starting......: " . date("H:i:s") . " MySQL locked, exiting\n";
        return;
    }
    $PID_NUM = PID_NUM();
    if ($unix->process_exists($PID_NUM)) {
        $timemin = $unix->PROCCESS_TIME_MIN($PID_NUM);
        echo "Starting......: " . date("H:i:s") . " MySQL already running PID \"{$PID_NUM}\" since {$timemin}Mn\n";
        return;
    }
    $mysql_install_db = $unix->find_program('mysql_install_db');
    $mysqlbin = $unix->LOCATE_mysqld_bin();
    $php5 = $unix->LOCATE_PHP5_BIN();
    $nohup = $unix->find_program("nohup");
    if (!is_file($mysqlbin)) {
        echo "Starting......: " . date("H:i:s") . " MySQL is not installed, abort\n";
        return;
    }
    $EnableMysqlFeatures = $sock->GET_INFO('EnableMysqlFeatures');
    $MysqlBinAllAdresses = $sock->GET_INFO('MysqlBinAllAdresses');
    $MySQLTMPMEMSIZE = $sock->GET_INFO('MySQLTMPMEMSIZE');
    $MysqlTooManyConnections = $sock->GET_INFO("MysqlTooManyConnections");
    $MysqlRemoveidbLogs = $sock->GET_INFO("MysqlRemoveidbLogs");
    $innodb_force_recovery = $sock->GET_INFO("innodb_force_recovery");
    if (!is_numeric($innodb_force_recovery)) {
        $innodb_force_recovery = 0;
    }
    if (!is_numeric($MysqlRemoveidbLogs)) {
        $MysqlRemoveidbLogs = 0;
    }
    if (!is_numeric($MysqlBinAllAdresses)) {
        $MysqlBinAllAdresses = 0;
    }
    if (!is_numeric($MySQLTMPMEMSIZE)) {
        $MySQLTMPMEMSIZE = 0;
    }
    if (!is_numeric($MysqlTooManyConnections)) {
        $MysqlTooManyConnections = 0;
    }
    if (!is_numeric($EnableMysqlFeatures)) {
        $EnableMysqlFeatures = 1;
    }
    $MySqlTmpDir = $sock->GET_INFO('MySQLTMPDIR');
    $MySQLLOgErrorPath = $sock->GET_INFO('MySQLLOgErrorPath');
    $datadir = $unix->MYSQL_DATA_DIR();
    $EnableMysqlLog = $sock->GET_INFO("EnableMysqlLog");
    if (!is_numeric($EnableMysqlLog)) {
        $EnableMysqlLog = 0;
    }
    if ($datadir == null) {
        $datadir = '/var/lib/mysql';
    }
    if ($MySqlTmpDir == '/tmp') {
        $MySqlTmpDir = null;
    }
    if ($MySQLLOgErrorPath == null) {
        $MySQLLOgErrorPath = $datadir . '/mysqld.err';
    }
    if ($MysqlTooManyConnections == 1) {
        echo "Starting......: " . date("H:i:s") . " MySQL MysqlTooManyConnections=1, abort\n";
        return;
    }
    if (isset($GLOBALS["RECOVERY"])) {
        $innodb_force_recovery = $GLOBALS["RECOVERY"];
    }
    if (strlen($MySqlTmpDir) > 3) {
        echo "Starting......: " . date("H:i:s") . " MySQL tempdir : {$MySqlTmpDir}\n";
        shell_exec("{$php5} /usr/share/artica-postfix/exec.mysql.build.php --tmpfs");
        $MySqlTmpDir = str_replace("//", "/", $MySqlTmpDir);
        if (!is_dir($MySqlTmpDir)) {
            @mkdir($MySqlTmpDir, 0755, true);
            $unix->chown_func("mysql", "mysql", $MySqlTmpDir);
        }
        $MySqlTmpDirCMD = " --tmpdir={$MySqlTmpDir}";
    }
    if ($EnableMysqlFeatures == 0) {
        echo "Starting......: " . date("H:i:s") . " MySQL is disabled by \"EnableMysqlFeatures\"...\n";
        return;
    }
    $pid_file = "/var/run/mysqld/mysqld.pid";
//.........这里部分代码省略.........
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:101,代码来源:exec.mysql.start.php

示例5: build

function build()
{
    $unix = new unix();
    $sock = new sockets();
    $ClamavStreamMaxLength = $sock->GET_INFO("ClamavStreamMaxLength");
    $ClamavMaxRecursion = $sock->GET_INFO("ClamavMaxRecursion");
    $ClamavMaxFiles = $sock->GET_INFO("ClamavMaxFiles");
    $PhishingScanURLs = $sock->GET_INFO("PhishingScanURLs");
    $ClamavMaxScanSize = $sock->GET_INFO("ClamavMaxScanSize");
    $ClamavMaxFileSize = $sock->GET_INFO("ClamavMaxFileSize");
    $ClamavTemporaryDirectory = $sock->GET_INFO("ClamavTemporaryDirectory");
    if ($ClamavTemporaryDirectory == null) {
        $ClamavTemporaryDirectory = "/home/clamav";
    }
    if (!is_numeric($ClamavStreamMaxLength)) {
        $ClamavStreamMaxLength = 12;
    }
    if (!is_numeric($ClamavMaxRecursion)) {
        $ClamavMaxRecursion = 5;
    }
    if (!is_numeric($ClamavMaxFiles)) {
        $ClamavMaxFiles = 10000;
    }
    if (!is_numeric($PhishingScanURLs)) {
        $PhishingScanURLs = 1;
    }
    if (!is_numeric($ClamavMaxScanSize)) {
        $ClamavMaxScanSize = 15;
    }
    if (!is_numeric($ClamavMaxFileSize)) {
        $ClamavMaxFileSize = 20;
    }
    if ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} MaxFileSize: {$ClamavMaxFileSize}M\n";
    }
    $dirs[] = "/var/clamav";
    $dirs[] = "/var/run/clamav";
    $dirs[] = "/var/lib/clamav";
    $dirs[] = "/var/log/clamav";
    $dirs[] = $ClamavTemporaryDirectory;
    while (list($i, $directory) = each($dirs)) {
        @mkdir($directory, 0755, true);
        @chmod($directory, 0755);
        @chown($directory, "clamav");
        @chgrp($directory, "clamav");
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Permissions on {$directory}\n";
        }
        $unix->chown_func("clamav", "clamav", $directory . "/*");
    }
    $PhishingScanURLs_text = "no";
    if ($PhishingScanURLs == 1) {
        $PhishingScanURLs_text = "yes";
    }
    $unix->SystemCreateUser("clamav", "clamav");
    $f[] = "LocalSocket /var/run/clamav/clamav.sock";
    $f[] = "FixStaleSocket true";
    $f[] = "User clamav";
    $f[] = "AllowSupplementaryGroups true";
    $f[] = "ScanMail true";
    $f[] = "ScanArchive true";
    $f[] = "#ArchiveLimitMemoryUsage false (depreciated)";
    $f[] = "ArchiveBlockEncrypted false";
    $f[] = "MaxDirectoryRecursion 15";
    $f[] = "FollowDirectorySymlinks false";
    $f[] = "FollowFileSymlinks false";
    $f[] = "ReadTimeout 180";
    $f[] = "MaxThreads 12";
    $f[] = "MaxConnectionQueueLength 15";
    $f[] = "StreamMaxLength {$ClamavStreamMaxLength}M";
    $f[] = "MaxFileSize {$ClamavMaxFileSize}M";
    $f[] = "MaxScanSize {$ClamavMaxFileSize}M";
    $f[] = "MaxFiles 10000";
    $f[] = "MaxRecursion {$ClamavMaxRecursion}";
    $f[] = "LogSyslog true";
    $f[] = "LogFacility LOG_LOCAL6";
    $f[] = "LogClean false";
    $f[] = "LogVerbose false";
    $f[] = "PidFile /var/run/clamav/clamd.pid";
    $f[] = "TemporaryDirectory {$ClamavTemporaryDirectory}";
    $f[] = "DatabaseDirectory /var/lib/clamav";
    $f[] = "SelfCheck 3600";
    $f[] = "Foreground false";
    $f[] = "Debug false";
    $f[] = "ScanPE true";
    $f[] = "ScanOLE2 true";
    $f[] = "ScanHTML true";
    $f[] = "DetectBrokenExecutables false";
    $f[] = "#MailFollowURLs false (depreciated)";
    $f[] = "ExitOnOOM false";
    $f[] = "LeaveTemporaryFiles false";
    $f[] = "AlgorithmicDetection true";
    $f[] = "ScanELF true";
    $f[] = "IdleTimeout 30";
    $f[] = "PhishingSignatures true";
    $f[] = "PhishingScanURLs {$PhishingScanURLs_text}";
    $f[] = "PhishingAlwaysBlockSSLMismatch false";
    $f[] = "PhishingAlwaysBlockCloak false";
    $f[] = "DetectPUA false";
    $f[] = "ScanPartialMessages false";
//.........这里部分代码省略.........
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:101,代码来源:exec.clamd.php

示例6: start

function start($aspid = false, $nochecksquid = false)
{
    $unix = new unix();
    $sock = new sockets();
    $Masterbin = $unix->find_program("ufdbguardd");
    if (!is_file($Masterbin)) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, ufdbguardd not installed\n";
        }
        return;
    }
    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["TITLENAME"]} Already Artica task running PID {$pid} since {$time}mn\n";
            }
            return;
        }
        @file_put_contents($pidfile, getmypid());
    }
    $pid = PID_NUM();
    if ($unix->process_exists($pid)) {
        $timepid = $unix->PROCCESS_TIME_MIN($pid);
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Service already started {$pid} since {$timepid}Mn...\n";
        }
        if ($GLOBALS["MONIT"]) {
            @file_put_contents($GLOBALS["PID_PATH"], $pid);
        }
        return;
    }
    $EnableUfdbGuard = intval($sock->EnableUfdbGuard());
    $UseRemoteUfdbguardService = intval($sock->GET_INFO("UseRemoteUfdbguardService"));
    if ($UseRemoteUfdbguardService == 1) {
        $EnableUfdbGuard = 0;
    }
    $SquidUFDBUrgency = intval($sock->GET_INFO("SquidUFDBUrgency"));
    if ($SquidUFDBUrgency == 1) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} * * * * Your Web filtering is on Emergency mode ! * * * *\n";
        }
        stop();
        return;
    }
    if ($EnableUfdbGuard == 0) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} service disabled (see EnableUfdbGuard)\n";
        }
        stop();
        return;
    }
    $php5 = $unix->LOCATE_PHP5_BIN();
    $sysctl = $unix->find_program("sysctl");
    $echo = $unix->find_program("echo");
    $nohup = $unix->find_program("nohup");
    $kill = $unix->find_program("kill");
    $PossibleDirs[] = "/var/lib/ftpunivtlse1fr";
    $PossibleDirs[] = "/var/lib/ufdbartica";
    $PossibleDirs[] = "/var/lib/squidguard";
    while (list($index, $Directory) = each($PossibleDirs)) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} permissions on `{$Directory}`\n";
        }
        if (is_link($Directory)) {
            $Directory = readlink($Directory);
        }
        $f = explode("/", $Directory);
        while (list($index, $subdir) = each($f)) {
            if ($subdir == null) {
                continue;
            }
            $dir = $dir . "/{$subdir}";
            @chmod($dir, 0755);
        }
        @chmod("{$Directory}", 0755);
        $unix->chown_func("squid", "squid", "{$Directory}");
    }
    @mkdir(dirname($GLOBALS["PID_PATH"]), 0755, true);
    @mkdir("/var/lib/squidguard/security", 0755, true);
    $unix->chown_func("squid", "squid", dirname($GLOBALS["PID_PATH"]));
    $chmod = $unix->find_program("chmod");
    $chown = $unix->find_program("chown");
    $php = $unix->LOCATE_PHP5_BIN();
    @chmod($GLOBALS["PID_PATH"], 0755);
    $unix->chown_func("squid", "squid", "/var/lib/squidguard/security/cacerts");
    @chmod("/var/lib/squidguard/security/cacerts", 0755);
    if (!is_file("/etc/squid3/ufdbGuard.conf")) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} building settings\n";
        }
        shell_exec("{$php5} /usr/share/artica-postfix/exec.squidguard.php --build >/dev/null 2>&1");
    }
    $datas = unserialize(base64_decode($sock->GET_INFO("ufdbguardConfig")));
    if (!isset($datas["listen_port"])) {
        $datas["listen_port"] = 3977;
    }
    if (!isset($datas["tcpsockets"])) {
//.........这里部分代码省略.........
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:101,代码来源:exec.ufdb.php

示例7: start

function start($aspid = false)
{
    $unix = new unix();
    $sock = new sockets();
    $LOGBIN = "DHCP Server";
    $binpath = $unix->DHCPD_BIN_PATH();
    if (!is_file($binpath)) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$LOGBIN}, not installed\n";
        }
        return;
    }
    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]: {$LOGBIN}, [START] Already Artica task running PID {$pid} since {$time}mn\n";
            }
            return false;
        }
        @file_put_contents($pidfile, getmypid());
    }
    $pid = PID_NUM();
    if ($unix->process_exists($pid)) {
        $timepid = $unix->PROCCESS_TIME_MIN($pid);
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$LOGBIN} Service already started {$pid} since {$timepid}Mn...\n";
        }
        return true;
    }
    $EnableDHCPServer = $sock->GET_INFO("EnableDHCPServer");
    if (!is_numeric($EnableDHCPServer)) {
        $EnableDHCPServer = 0;
    }
    $EnableChilli = $sock->GET_INFO("EnableChilli");
    if (!is_numeric($EnableChilli)) {
        $EnableChilli = 0;
    }
    if ($EnableChilli == 1) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$LOGBIN} replaced by HotSpot feature...\n";
        }
        $EnableDHCPServer = 0;
    }
    if ($EnableDHCPServer == 0) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$LOGBIN} service disabled\n";
        }
        build_progress("{starting_service} {failed}", 110);
        return false;
    }
    build_progress("{starting_service}", 60);
    @mkdir("/var/run/dhcp3-server", 0755, true);
    @mkdir("/var/lib/dhcp3", 0755, true);
    if (!is_file("/var/lib/dhcp3/dhcpd.other")) {
        @file_put_contents("/var/lib/dhcp3/dhcpd.other", "#");
    }
    if (!is_file("/var/lib/dhcp3/dhcpd.leases")) {
        @file_put_contents("/var/lib/dhcp3/dhcpd.leases", "#");
    }
    $unix->SystemCreateUser("dhcpd", "dhcpd");
    $unix->chown_func("dhcpd", "dhcpd", "/var/run/dhcp3-server");
    $unix->chown_func("dhcpd", "dhcpd", "/var/lib/dhcp3/dhcpd.leases");
    $unix->chown_func("dhcpd", "dhcpd", "/var/lib/dhcp3/dhcpd.leases~");
    $DHCP3ListenNIC = $sock->GET_INFO('DHCP3ListenNIC');
    if ($DHCP3ListenNIC == null) {
        $DHCP3ListenNIC = "eth0";
    }
    echo "Starting......: " . date("H:i:s") . " [INIT]: {$LOGBIN} Listen {$DHCP3ListenNIC}\n";
    echo "Starting......: " . date("H:i:s") . " [INIT]: {$LOGBIN} building settings...\n";
    BuildDHCP(true);
    build_progress("{starting_service}", 75);
    $CMD[] = "{$binpath} -q -pf " . PID_PATH();
    $CMD[] = "-cf " . dhcp3Config();
    $CMD[] = "-lf /var/lib/dhcp3/dhcpd.leases";
    $cmd = @implode(" ", $CMD);
    echo "Starting......: " . date("H:i:s") . " [INIT]: {$LOGBIN} service..\n";
    if ($GLOBALS["VERBOSE"]) {
        echo "{$cmd}\n";
    }
    shell_exec($cmd);
    build_progress("{starting_service}", 80);
    for ($i = 0; $i < 6; $i++) {
        $pid = PID_NUM();
        if ($unix->process_exists($pid)) {
            break;
        }
        build_progress("{starting_service}  waiting {$i}/6", 80);
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$LOGBIN} service waiting {$i}/6...\n";
        }
        sleep(1);
    }
    $pid = PID_NUM();
    if ($unix->process_exists($pid)) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$LOGBIN} service Success service started pid:{$pid}...\n";
        }
//.........这里部分代码省略.........
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:101,代码来源:exec.dhcpd.compile.php

示例8: sessions_clean_parse

function sessions_clean_parse($directory, $CleanPHPSessionTime, $APACHE_SRC_ACCOUNT = null, $APACHE_SRC_GROUP = null)
{
    $CleanPHPSessionTime = $CleanPHPSessionTime - 1;
    if (!is_dir($directory)) {
        return;
    }
    if (!($handle = opendir($directory))) {
        return;
    }
    $unix = new unix();
    while (false !== ($fileZ = readdir($handle))) {
        if ($fileZ == ".") {
            continue;
        }
        if ($fileZ == "..") {
            continue;
        }
        $filename = "{$directory}/{$fileZ}";
        if (is_dir($filename)) {
            continue;
        }
        $time = $unix->file_time_min($filename);
        if ($time > $CleanPHPSessionTime) {
            @unlink($filename);
            continue;
        }
        if ($APACHE_SRC_ACCOUNT != null) {
            $unix->chown_func($APACHE_SRC_ACCOUNT, $APACHE_SRC_GROUP, $filename);
        }
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:31,代码来源:exec.clean.logs.php

示例9: build

function build()
{
    $unix = new unix();
    $DIRS[] = "/var/run/kav4proxy";
    $DIRS[] = "/etc/opt/kaspersky";
    $DIRS[] = "/tmp/Kav4proxy";
    $DIRS[] = "/var/log/kaspersky/kav4proxy";
    $DIRS[] = "/var/log/artica-postfix/ufdbguard-blocks";
    $DIRS[] = "/opt/kaspersky/kav4proxy/share/notify";
    while (list($none, $path) = each($DIRS)) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Permissions on {$path}\n";
        }
        @mkdir("{$path}", 0755, true);
        $unix->chown_func("kluser", "klusers", $path);
    }
    $kav = new Kav4Proxy();
    $conf = $kav->build_config();
    if ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Building /etc/opt/kaspersky/kav4proxy.conf done\n";
    }
    @file_put_contents("/etc/opt/kaspersky/kav4proxy.conf", $conf);
    $kav->LoadTemplates();
    if ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} " . count($kav->templates_data) . " templates\n";
    }
    while (list($templateName, $val) = each($kav->templates_data)) {
        if (is_array($val)) {
            echo "Warning {$templateName}: val is array\n";
        }
        if (strlen($val) < 100) {
            echo "Warning {$templateName}: val lenght is not supported!\n";
        }
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} building \"{$templateName}\" template\n";
        }
        @file_put_contents("/opt/kaspersky/kav4proxy/share/notify/{$templateName}", $val);
        @chmod("/opt/kaspersky/kav4proxy/share/notify/{$templateName}", 0755);
        @chown("/opt/kaspersky/kav4proxy/share/notify/{$templateName}", "kluser");
    }
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:41,代码来源:exec.kav4proxy.service.php

示例10: CheckFilesAndSecurity

function CheckFilesAndSecurity()
{
    $unix = new unix();
    $sock = new sockets();
    $StreamCacheCache = $sock->GET_INFO("StreamCacheCache");
    if ($StreamCacheCache == null) {
        $StreamCacheCache = "/home/squid/videocache";
    }
    $StreamCacheMainCache = $sock->GET_INFO("StreamCacheMainCache");
    if ($StreamCacheMainCache == null) {
        $StreamCacheMainCache = "/home/squid/streamcache";
    }
    $f[] = "/var/log/videocache";
    $f[] = $StreamCacheCache;
    $f[] = "/etc/streamsquidcache";
    $f[] = "/var/spool/streamsquidcache";
    $f[] = $StreamCacheMainCache;
    $f[] = "/var/run/squid";
    $f[] = "/usr/share/streamsquidcache";
    while (list($num, $val) = each($f)) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} checking \"{$val}\"\n";
        }
        if (!is_dir($val)) {
            @mkdir($val, 0755, true);
        }
        $unix->chown_func("squid", "squid", "{$val}/*");
    }
    $MAINDIR = true;
    for ($i = 0; $i < 10; $i++) {
        $dir = "{$StreamCacheMainCache}/0{$i}";
        if (!is_dir($dir)) {
            if ($GLOBALS["OUTPUT"]) {
                echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} {$dir} no such directory\n";
            }
            $MAINDIR = false;
            break;
        }
    }
    if (!$MAINDIR) {
        $masterbin = $unix->find_program("streamsquidcache");
        shell_exec("{$masterbin} -f /etc/streamsquidcache/squid.conf -z");
    }
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:44,代码来源:exec.squidstream.php

示例11: buildConfig


//.........这里部分代码省略.........
        $EnableArticaApachePHPFPM = 0;
    }
    $EnablePHPFPM = intval($sock->GET_INFO("EnablePHPFPM"));
    if (!is_numeric($EnablePHPFPM)) {
        $EnablePHPFPM = 0;
    }
    if ($EnablePHPFPM == 0) {
        $EnableArticaApachePHPFPM = 0;
    }
    if ($EnableArticaApachePHPFPM == 0) {
        $EnablePHPFPM = 0;
    }
    $PHP_STANDARD_MODE = true;
    $LighttpdArticaListenIP = $sock->GET_INFO('LighttpdArticaListenIP');
    $phpcgi_path = $unix->LIGHTTPD_PHP5_CGI_BIN_PATH();
    $LIGHTTPD_GET_USER = LIGHTTPD_GET_USER();
    $LIGHTTPD_CONF_PATH = LIGHTTPD_CONF_PATH();
    if (preg_match("#^(.+?):(.+)#", $LIGHTTPD_GET_USER, $re)) {
        $LIGHTTPD_USER = $re[1];
        $LIGHTTPD_GROUP = $re[1];
    }
    $PHP_FCGI_CHILDREN = 1;
    $max_procs = 2;
    @mkdir("/var/log/lighttpd", 0755, true);
    @mkdir("/usr/share/artica-postfix/ressources/logs", 0755, true);
    if (!is_file("/var/log/lighttpd/access.log")) {
        @touch("/var/log/lighttpd/access.log");
    }
    @chown("/var/log/lighttpd", $LIGHTTPD_USER);
    @chgrp("/var/log/lighttpd", $LIGHTTPD_GROUP);
    @chown("/var/log/lighttpd/access.log", $LIGHTTPD_USER);
    @chgrp("/var/log/lighttpd/access.log", $LIGHTTPD_GROUP);
    @chmod("/var/log/lighttpd/access.log", 0777);
    $unix->chown_func($LIGHTTPD_USER, $LIGHTTPD_GROUP, "/var/log/lighttpd/*");
    $unix->chown_func($LIGHTTPD_USER, $LIGHTTPD_GROUP, "/usr/share/artica-postfix/ressources/logs/*");
    if ($LighttpdArticaMaxProcs > 0) {
        $max_procs = $LighttpdArticaMaxProcs;
    }
    if ($LighttpdArticaMaxChildren > 0) {
        $HP_FCGI_CHILDREN = $LighttpdArticaMaxChildren;
    }
    if ($LighttpdRunAsminimal == 1) {
        $max_procs = 2;
        $PHP_FCGI_CHILDREN = 2;
    }
    $mod_auth = isModule('mod_auth');
    if (is_file('/proc/user_beancounters')) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} VPS mode enabled, swith to socket mode for PHP\n";
        }
        $LighttpdUseUnixSocket = 1;
    }
    if ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} MAX Procs............: {$max_procs}\n";
    }
    if ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} Php5 processes.......: {$PHP_FCGI_CHILDREN}\n";
    }
    if ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} Max cnx/processes....: {$PHP_FCGI_MAX_REQUESTS}\n";
    }
    if ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} php-cgi path.........: {$phpcgi_path}\n";
    }
    if ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} chown path...........: {$chown}\n";
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:67,代码来源:exec.lighttpd.php

示例12: start

function start($aspid = false)
{
    $unix = new unix();
    $sock = new sockets();
    $Masterbin = $unix->find_program("opendkim");
    if (!is_file($Masterbin)) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, opendkim not installed\n";
        }
        return;
    }
    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["TITLENAME"]} Already Artica task running PID {$pid} since {$time}mn\n";
            }
            return;
        }
        @file_put_contents($pidfile, getmypid());
    }
    $pid = PID_NUM();
    if ($unix->process_exists($pid)) {
        $timepid = $unix->PROCCESS_TIME_MIN($pid);
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Service already started {$pid} since {$timepid}Mn...\n";
        }
        return;
    }
    $EnableDKFilter = intval($sock->GET_INFO("EnableDKFilter"));
    if ($EnableDKFilter == 0) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} service disabled (see EnableDKFilter)\n";
        }
        stop();
        return;
    }
    $php5 = $unix->LOCATE_PHP5_BIN();
    $sysctl = $unix->find_program("sysctl");
    $echo = $unix->find_program("echo");
    $nohup = $unix->find_program("nohup");
    $kill = $unix->find_program("kill");
    $chown = $unix->find_program("chown");
    @unlink("/var/run/opendkim/opendkim.pid");
    $f[] = $Masterbin;
    $f[] = "-p //var/run/opendkim/opendkim.sock";
    $f[] = "-x /etc/opendkim.conf";
    $f[] = "-u postfix";
    $f[] = "-P {$GLOBALS["PID_FILE"]}";
    @unlink("/var/run/opendkim/opendkim.sock");
    @mkdir("/var/run/opendkim", 0755, true);
    $unix->chown_func("postfix", "postfix", "/var/run/opendkim");
    $cmd = @implode(" ", $f);
    if ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} service\n";
    }
    shell_exec($cmd);
    for ($i = 1; $i < 5; $i++) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} waiting {$i}/5\n";
        }
        sleep(1);
        $pid = PID_NUM();
        if ($unix->process_exists($pid)) {
            break;
        }
    }
    $pid = PID_NUM();
    if ($unix->process_exists($pid)) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Success PID {$pid}\n";
        }
        $unix->chown_func("postfix", "postfix", "/var/run/opendkim/opendkim.sock");
        shell_exec("{$chown} -R postfix:postfix /etc/mail/dkim >/dev/null 2>&1");
        shell_exec("{$chown} -R postfix:postfix /etc/mail/dkim/keys >/dev/null 2>&1");
        shell_exec("{$chown} -R postfix:postfix /var/run/opendkim >/dev/null 2>&1");
    } else {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Failed\n";
        }
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} {$cmd}\n";
        }
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:87,代码来源:exec.opendkim.php

示例13: apache_config

function apache_config()
{
    $sock = new sockets();
    $unix = new unix();
    $EnablePHPFPM = 0;
    @mkdir("/var/run/squid", 0755, true);
    @mkdir("/var/run/squid", 0755, true);
    $APACHE_SRC_ACCOUNT = "squid";
    $APACHE_SRC_GROUP = "squid";
    $APACHE_MODULES_PATH = $unix->APACHE_MODULES_PATH();
    if (!isset($GLOBALS["HyperCacheStoragePath"])) {
        $sock = new sockets();
        $GLOBALS["HyperCacheStoragePath"] = $sock->GET_INFO("HyperCacheStoragePath");
        if ($GLOBALS["HyperCacheStoragePath"] == null) {
            $GLOBALS["HyperCacheStoragePath"] = "/home/artica/proxy-cache";
        }
    }
    $SquidEnforceRules = intval($sock->GET_INFO("SquidEnforceRules"));
    $HyperCacheHTTPListenPort = $sock->GET_INFO("HyperCacheHTTPListenPort");
    $HyperCacheHTTPListenPortSSL = $sock->GET_INFO("HyperCacheHTTPListenPortSSL");
    $HyperCacheHTTPListenPortSSLEnabled = intval($sock->GET_INFO("HyperCacheHTTPListenPortSSLEnabled"));
    if (!is_numeric($HyperCacheHTTPListenPort)) {
        $HyperCacheHTTPListenPort = 8700;
    }
    if (!is_numeric($HyperCacheHTTPListenPortSSL)) {
        $HyperCacheHTTPListenPortSSL = 8900;
    }
    $HyperCacheListenAddr = $sock->GET_INFO("HyperCacheListenAddr");
    $unix = new unix();
    $NETWORK_ALL_INTERFACES = $unix->NETWORK_ALL_INTERFACES();
    unset($NETWORK_ALL_INTERFACES["lo"]);
    if ($HyperCacheListenAddr == null) {
        $HyperCacheListenAddr = $unix->NETWORK_DEFAULT_LISTEN_ADDR();
        $sock->SET_INFO("HyperCacheListenAddr", $HyperCacheListenAddr);
    }
    if ($unix->NETWORK_IS_LISTEN_ADDR_EXISTS($HyperCacheListenAddr)) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} {$HyperCacheListenAddr} doesn't exists...\n";
        }
        $HyperCacheListenAddr = $unix->NETWORK_DEFAULT_LISTEN_ADDR();
        $sock->SET_INFO("HyperCacheListenAddr", $HyperCacheListenAddr);
    }
    $ipaddr = $HyperCacheListenAddr;
    $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;
    }
    $unix->chown_func($APACHE_SRC_ACCOUNT, $APACHE_SRC_GROUP, "/var/run/squid");
    $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 ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} Listen address: {$ipaddr}\n";
    }
    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: {$HyperCacheHTTPListenPort} SSL Port: {$HyperCacheHTTPListenPortSSL}\n";
    }
    if ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} PHP-FPM: {$EnablePHPFPM}\n";
    }
    $q = new mysql_squid_builder();
    $nice = EXEC_NICE();
    $sql = "SELECT * FROM artica_caches_mirror WHERE enabled=1 AND `ToDelete`=0";
    $results = $q->QUERY_SQL($sql);
    $HyperCache = new HyperCache();
    while ($ligne = mysql_fetch_assoc($results)) {
        $t = time();
        $sitename = $ligne["sitename"];
        $sitename_path = $HyperCache->HyperCacheUriToHostname($sitename);
        $workingdir = $GLOBALS["HyperCacheStoragePath"] . "/mirror/{$sitename_path}";
        if (!is_dir($workingdir)) {
            @mkdir($workingdir, 0755, true);
        }
        @chown("{$GLOBALS["HyperCacheStoragePath"]}/mirror", "squid");
        @chgrp("{$GLOBALS["HyperCacheStoragePath"]}/mirror", "squid");
        @chown("{$GLOBALS["HyperCacheStoragePath"]}/mirror/{$sitename_path}", "squid");
        @chgrp("{$GLOBALS["HyperCacheStoragePath"]}/mirror/{$sitename_path}", "squid");
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} build folder for mirrored {$sitename_path}\n";
        }
        $mirrors[] = "";
        $mirrors_aliases[] = "alias /{$sitename_path} {$workingdir}";
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: alias /{$sitename_path} {$workingdir}\n";
        }
        $mirrors[] = "";
//.........这里部分代码省略.........
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:101,代码来源:exec.HyperCacheWeb.php

示例14: 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}");
}
开发者ID:articatech,项目名称:artica,代码行数:23,代码来源:system.php

示例15: 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;
//.........这里部分代码省略.........
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:101,代码来源:exec.zarafa-apache.php


注:本文中的unix::chown_func方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。