Пример #1
0
function vhosts_users()
{
    $ldap = new clladp();
    $pattern = "(&(objectclass=apacheConfig)(apacheServerName=*)(wwwservertype=WEBDAV))";
    $attr = array();
    $sr = @ldap_search($ldap->ldap_connection, $ldap->suffix, $pattern, $attr);
    $hash = ldap_get_entries($ldap->ldap_connection, $sr);
    for ($i = 0; $i < $hash["count"]; $i++) {
        $dn = $hash[$i]["dn"];
        if (preg_match("#ou=www,ou=(.+?),dc=organizations#", $dn, $re)) {
            $hash[$i]["OU"][0] = trim($re[1]);
            $ouexec = trim($re[1]);
        }
        $conf[] = vhosts_users_ou($hash[$i]);
    }
    $sock = new sockets();
    $unix = new unix();
    $ApacheGroupware = $sock->GET_INFO("ApacheGroupware");
    if ($ApacheGroupware == null) {
        $ApacheGroupware = 1;
    }
    $d_path = $unix->APACHE_DIR_SITES_ENABLED();
    if ($ApacheGroupware == 0) {
        echo "Starting......: Apache Groupware adding {$d_path}/webdav-artica-vhosts.conf\n";
        @file_put_contents("{$d_path}/groupware-artica-vhosts.conf", @implode("\n", $conf));
        $conf = null;
        $apache2ctl = $unix->LOCATE_APACHE_CTL();
        if (is_file($apache2ctl)) {
            shell_exec("{$apache2ctl} -k restart");
        }
    }
    @file_put_contents("/usr/local/apache-groupware/conf/webdav-vhosts.conf", @implode("\n", $conf));
}
Пример #2
0
function vhosts($noecho = false)
{
    $ldap = new clladp();
    $sock = new sockets();
    $unix = new unix();
    $ApacheGroupware = $sock->GET_INFO("ApacheGroupware");
    if ($ApacheGroupware == null) {
        $ApacheGroupware = 1;
    }
    echo "Starting......: " . date("H:i:s") . " Apache Groupware enabled ? -> {$ApacheGroupware}\n";
    $ApacheGroupwareListenIP = $sock->GET_INFO("ApacheGroupwareListenIP");
    $ApacheGroupWarePort = $sock->GET_INFO("ApacheGroupWarePort");
    $ApacheGroupWarePortSSL = $sock->GET_INFO("ApacheGroupWarePortSSL");
    $SSLStrictSNIVHostCheck = $sock->GET_INFO("SSLStrictSNIVHostCheck");
    $FreeWebsDisableSSLv2 = $sock->GET_INFO("FreeWebsDisableSSLv2");
    $d_path = $unix->APACHE_DIR_SITES_ENABLED();
    if ($ApacheGroupware == 0) {
        $ApacheGroupwareListenIP = $unix->APACHE_ListenDefaultAddress();
        $ApacheGroupWarePort = $sock->GET_INFO("FreeWebListenPort");
        $ApacheGroupWarePortSSL = $sock->GET_INFO("FreeWebListenSSLPort");
        echo "Starting......: " . date("H:i:s") . " Apache Groupware switch to Apache source\n";
        foreach (glob("{$d_path}/groupware-artica-*") as $filename) {
            echo "Starting......: " . date("H:i:s") . " Apache Groupware removing " . basename($filename) . "\n";
        }
    }
    if (!is_numeric($ApacheGroupWarePortSSL)) {
        $ApacheGroupWarePortSSL = 443;
    }
    if (!is_numeric($ApacheGroupWarePort)) {
        $ApacheGroupWarePort = 80;
    }
    if (!is_numeric($FreeWebsDisableSSLv2)) {
        $FreeWebsDisableSSLv2 = 0;
    }
    if ($ApacheGroupwareListenIP == null) {
        $ApacheGroupwareListenIP = "*";
    }
    echo "Starting......: " . date("H:i:s") . " Apache Port....: {$ApacheGroupwareListenIP}:{$ApacheGroupWarePort}\n";
    echo "Starting......: " . date("H:i:s") . " Apache SSL Port: {$ApacheGroupwareListenIP}:{$ApacheGroupWarePortSSL}\n";
    $pattern = "(&(objectclass=apacheConfig)(apacheServerName=*))";
    $attr = array();
    $sr = @ldap_search($ldap->ldap_connection, $ldap->suffix, $pattern, $attr);
    $hash = ldap_get_entries($ldap->ldap_connection, $sr);
    //print_r($hash);
    for ($i = 0; $i < $hash["count"]; $i++) {
        $ApacheGroupWarePort_WRITE = $ApacheGroupWarePort;
        $root = $hash[$i]["apachedocumentroot"][0];
        $apacheservername = trim($hash[$i]["apacheservername"][0]);
        $wwwservertype = trim($hash[$i]["wwwservertype"][0]);
        if ($wwwservertype == "WEBDAV") {
            continue;
        }
        if ($wwwservertype == "BACKUPPC") {
            continue;
        }
        $wwwsslmode = $hash[$i]["wwwsslmode"][0];
        $DirectoryIndex = "index.php";
        $magic_quotes_gpc = "off";
        $adds = null;
        $ssl = null;
        if ($wwwsslmode == "TRUE") {
            $ssl = "\tSSLEngine on\n";
            $ssl = $ssl . "\tSSLCertificateFile {$GLOBALS["SSLKEY_PATH"]}/{$apacheservername}.crt\n";
            $ssl = $ssl . "\tSSLCertificateKeyFile {$GLOBALS["SSLKEY_PATH"]}/{$apacheservername}.key\n";
            if ($FreeWebsDisableSSLv2 == 1) {
                $ssl = $ssl . "\tSSLProtocol -ALL +SSLv3 +TLSv1\n";
                $ssl = $ssl . "\tSSLCipherSuite ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:RC4+RSA:+HIGH:+MEDIUM\n";
            }
            vhosts_BuildCertificate($apacheservername);
            $ApacheGroupWarePort_WRITE = $ApacheGroupWarePortSSL;
            $SSLMODE = true;
            $conf = $conf . "\n<VirtualHost *:{$ApacheGroupWarePort}>\n";
            $conf = $conf . "\tServerName {$apacheservername}\n";
            $conf = $conf . "\tRedirect / https://{$apacheservername}\n";
            $conf = $conf . "</VirtualHost>\n\n";
        }
        $open_basedir = $root;
        if ($wwwservertype == "OBM2") {
            $adds = $adds . "\tSetEnv OBM_INCLUDE_VAR obminclude\n";
            $adds = $adds . "\tAddDefaultCharset ISO-8859-15\n";
            $adds = $adds . "\tphp_value  include_path \".:/usr/share/php:/usr/share/php5:{$root}\"\n";
            $magic_quotes_gpc = "On";
            $DirectoryIndex = "obm.php";
            $alias = "\tAlias /images {$root}/resources\n";
            $root = "{$root}/php";
        }
        if ($wwwservertype == "DRUPAL") {
            $DirectoryIndex = "index.php";
            $adds = null;
            $adds = $adds . "\tAddDefaultCharset ISO-8859-15\n";
            $adds = $adds . "\tAccessFileName .htaccess\n";
            $rewrite[] = "\t\t\t<IfModule mod_rewrite.c>";
            $rewrite[] = "\t\t\t\tRewriteEngine on";
            $rewrite[] = "\t\t\t\tRewriteBase /";
            $rewrite[] = "\t\t\t\tRewriteCond %{REQUEST_FILENAME} !-f";
            $rewrite[] = "\t\t\t\tRewriteCond %{REQUEST_FILENAME} !-d";
            $rewrite[] = "\t\t\t\tRewriteRule ^(.*)\$ index.php?q=\$1 [L,QSA]";
            $rewrite[] = "\t\t\t</IfModule>";
            $rewrite[] = "\t\t\t<FilesMatch \"\\.(engine|inc|info|install|module|profile|po|sh|.*sql|theme|tpl(\\.php)?|xtmpl)\$|^(code-style\\.pl|Entries.*|Repository|Root|Tag|Template)\$\">";
            $rewrite[] = "\t\t\t\tOrder allow,deny";
            $rewrite[] = "\t\t\t\tdeny from all";
            $rewrite[] = "\t\t\t</FilesMatch>";
            $dirplus[] = "\t\t\t<Location /cron.php>";
            $dirplus[] = "\t\t\t\tOrder deny,allow";
            $dirplus[] = "\t\t\t\tdeny from all";
            $dirplus[] = "\t\t\t\tallow from 127.0.0.1";
            $dirplus[] = "\t\t\t\tallow from IP";
            $dirplus[] = "\t\t\t</Location>";
            $root = "/usr/share/drupal";
            @mkdir("/usr/share/drupal/sites/{$apacheservername}/files", 0755, true);
            @chmod("/usr/share/drupal/sites/{$apacheservername}/files", 0777);
        }
        if ($wwwservertype == "SQUID_STATS") {
            $DirectoryIndex = "squid.logon.php";
            $open_basedir = "/usr/share/artica-postfix/ressources:/usr/share/artica-postfix:/usr/share/artica-postfix/framework:{$root}:{$root}/resources:{$root}/ressources/logs";
        }
        if ($wwwservertype == "GROUPOFFICE") {
            $open_basedir = null;
        }
        if ($wwwservertype == "ARTICA_USR") {
            $open_basedir = "/usr/share/artica-postfix/ressources:/usr/share/artica-postfix:/usr/share/artica-postfix/framework:{$root}:{$root}/resources:{$root}/ressources/logs";
        }
        if ($GLOBALS["VERBOSE"]) {
            echo " *** OPENBASE DIR: {$wwwservertype} *** \n";
        }
        if ($GLOBALS["VERBOSE"]) {
            echo " *** OPENBASE DIR: {$open_basedir} *** \n";
        }
        @mkdir("{$root}/php_logs/{$apacheservername}", 0755, true);
        $conf = $conf . "\n\n<VirtualHost {$ApacheGroupwareListenIP}:{$ApacheGroupWarePort_WRITE}>\n";
        $conf = $conf . "\tServerName {$apacheservername}\n";
        $conf = $conf . "\tServerAdmin webmaster@{$apacheservername}\n";
        $conf = $conf . "\tDocumentRoot {$root}\n";
        $conf = $conf . $ssl;
        $conf = $conf . $alias;
        $conf = $conf . $adds;
        $conf = $conf . "\tphp_value  error_log  \"{$root}/php_logs/{$apacheservername}/php.log\"\n";
        if ($open_basedir == null) {
            $conf = $conf . "\tphp_value open_basedir \"{$root}\"\n";
        }
        $conf = $conf . "\tphp_value magic_quotes_gpc {$magic_quotes_gpc}\n";
        $conf = $conf . "\t<Directory \"{$root}\">\n";
        if (is_array($rewrite)) {
            $conf = $conf . @implode("\n", $rewrite) . "\n";
        }
        $conf = $conf . "\t\t\tDirectoryIndex {$DirectoryIndex}\n";
        $conf = $conf . "\t\t\tOptions Indexes FollowSymLinks MultiViews\n";
        $conf = $conf . "\t\t\tAllowOverride all\n";
        $conf = $conf . "\t\t\tOrder allow,deny\n";
        $conf = $conf . "\t\t\tAllow from all\n";
        $conf = $conf . "\t</Directory>\n";
        if (is_array($dirplus)) {
            $conf = $conf . @implode("\n", $dirplus) . "\n";
        }
        $conf = $conf . "\tCustomLog /usr/local/apache-groupware/logs/{$apacheservername}_access.log \"%h %l %u %t \\\"%r\\\" %>s %b \\\"%{Referer}i\\\" \\\"%{User-Agent}i\\\" %V\"\n";
        $conf = $conf . "\tErrorLog /usr/local/apache-groupware/logs/{$apacheservername}_err.log\n";
        $conf = $conf . "</VirtualHost>\n";
        if ($ApacheGroupware == 0) {
            $a2ensite = $unix->find_program("a2ensite");
            @mkdir($d_path, 0755, true);
            echo "Starting......: " . date("H:i:s") . " Apache Groupware adding {$d_path}/groupware-artica-{$apacheservername}.conf\n";
            @file_put_contents("{$d_path}/groupware-artica-{$apacheservername}.conf", $conf);
            if (is_file($a2ensite)) {
                shell_exec("{$a2ensite} {$d_path}/groupware-artica-{$apacheservername}.conf");
            }
            $conf = null;
        }
    }
    if ($SSLMODE) {
        if ($SSLStrictSNIVHostCheck == 1) {
            $SSLStrictSNIVHostCheck = "\nSSLStrictSNIVHostCheck off";
        }
        $conf = "Listen {$ApacheGroupWarePortSSL}{$SSLStrictSNIVHostCheck}\nNameVirtualHost *:{$ApacheGroupWarePortSSL}\n" . $conf;
    }
    $mailmanhosts = mailmanhosts();
    if ($ApacheGroupware == 0) {
        echo "Starting......: " . date("H:i:s") . " Apache Groupware adding {$d_path}/groupware-artica-mailmanhosts.conf\n";
        @file_put_contents("{$d_path}/groupware-artica-mailmanhosts.conf", $mailmanhosts);
        $apache2ctl = $unix->LOCATE_APACHE_CTL();
        if (is_file($apache2ctl)) {
            shell_exec("{$apache2ctl} -k restart");
        }
    }
    $conf = $conf . $mailmanhosts;
    if ($noecho) {
        return $conf;
    }
    echo $conf;
}
Пример #3
0
function stop($aspid = false)
{
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    if (!$aspid) {
        $pid = $unix->get_pid_from_file($pidfile);
        if ($unix->process_exists($pid, basename(__FILE__))) {
            $time = $unix->PROCCESS_TIME_MIN($pid);
            if ($GLOBALS["OUTPUT"]) {
                echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} Already task running PID {$pid} since {$time}mn\n";
            }
            return;
        }
    }
    @file_put_contents($pidfile, getmypid());
    $pid = PID_NUM();
    if (!$unix->process_exists($pid)) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} already stopped...\n";
        }
        return;
    }
    $apache2ctl = $unix->LOCATE_APACHE_CTL();
    $time = $unix->PROCCESS_TIME_MIN($pid);
    if ($GLOBALS["OUTPUT"]) {
        echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} with a ttl of {$time}mn\n";
    }
    $kill = $unix->find_program("kill");
    if ($GLOBALS["OUTPUT"]) {
        echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} killing smoothly PID {$pid} ( {$apache2ctl} )...\n";
    }
    $results = array();
    exec("{$apache2ctl} -f /etc/zarafa/httpd.conf -k stop 2>&1", $results);
    while (list($index, $dir) = each($results)) {
        if (preg_match("#[0-9]+.*?not running#", $dir)) {
            if ($GLOBALS["OUTPUT"]) {
                echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} killing \"forced\" PID {$pid}...\n";
            }
            unix_system_kill($pid);
            break;
        }
    }
    sleep(1);
    for ($i = 1; $i < 10; $i++) {
        $pid = PID_NUM();
        if (!$unix->process_exists($pid)) {
            if ($GLOBALS["OUTPUT"]) {
                echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} Successfully stopped ...\n";
            }
            break;
        }
        if ($GLOBALS["OUTPUT"]) {
            echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} wait pid {$pid} {$i}/60\n";
        }
        shell_exec("{$apache2ctl} -f /etc/zarafa/httpd.conf -k kill >/dev/null 2>&1");
        sleep(1);
    }
    $pid = PID_NUM();
    if ($unix->process_exists($pid)) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} killing \"forced\" PID {$pid}...\n";
        }
        unix_system_kill($pid);
        sleep(1);
        for ($i = 1; $i < 10; $i++) {
            $pid = PID_NUM();
            if (!$unix->process_exists($pid)) {
                if ($GLOBALS["OUTPUT"]) {
                    echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} Successfully stopped ...\n";
                }
                break;
            }
            if ($GLOBALS["OUTPUT"]) {
                echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} wait {$i}/60\n";
            }
            sleep(1);
        }
    }
    if (!$unix->process_exists($pid)) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} daemon success...\n";
        }
        return;
    }
    if ($GLOBALS["OUTPUT"]) {
        echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} daemon failed...\n";
    }
}
Пример #4
0
function stop($aspid = false)
{
    $unix = new unix();
    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 "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} service Already Artica task running PID {$pid} since {$time}mn\n";
            }
            return;
        }
        @file_put_contents($pidfile, getmypid());
    }
    $pid = PID_NUM();
    if (!$unix->process_exists($pid)) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} service already stopped...\n";
        }
        return;
    }
    $pid = PID_NUM();
    $nohup = $unix->find_program("nohup");
    $php5 = $unix->LOCATE_PHP5_BIN();
    $apache2ctl = $unix->LOCATE_APACHE_CTL();
    shell_exec("{$apache2ctl} -f {$GLOBALS["APACHE_CONFIG_PATH"]} -k stop");
    if ($GLOBALS["OUTPUT"]) {
        echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} service Shutdown pid {$pid}...\n";
    }
    unix_system_kill($pid);
    for ($i = 0; $i < 5; $i++) {
        $pid = PID_NUM();
        if (!$unix->process_exists($pid)) {
            break;
        }
        if ($GLOBALS["OUTPUT"]) {
            echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} service waiting pid:{$pid} {$i}/5...\n";
        }
        sleep(1);
    }
    $pid = PID_NUM();
    if (!$unix->process_exists($pid)) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} service success...\n";
        }
        return;
    }
    if ($GLOBALS["OUTPUT"]) {
        echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} service shutdown - force - pid {$pid}...\n";
    }
    unix_system_kill_force($pid);
    for ($i = 0; $i < 5; $i++) {
        $pid = PID_NUM();
        if (!$unix->process_exists($pid)) {
            break;
        }
        if ($GLOBALS["OUTPUT"]) {
            echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} service waiting pid:{$pid} {$i}/5...\n";
        }
        sleep(1);
    }
    if ($unix->process_exists($pid)) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} service failed...\n";
        }
        return;
    }
}
Пример #5
0
function apache_pid()
{
    $unix = new unix();
    $pid = $unix->get_pid_from_file('/var/run/artica-apache/hotspot-apache.pid');
    if ($unix->process_exists($pid)) {
        return $pid;
    }
    $apache2ctl = $unix->LOCATE_APACHE_CTL();
    return $unix->PIDOF_PATTERN($apache2ctl . " -f /etc/artica-postfix/hotspot-httpd.conf");
}
Пример #6
0
function apache_start()
{
    $unix = new unix();
    $GLOBALS["SERVICE_NAME"] = "Artica Apache service";
    $apachebin = $unix->LOCATE_APACHE_BIN_PATH();
    $pid = apache_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();
    $rm = $unix->find_program("rm");
    $apache2ctl = $unix->LOCATE_APACHE_CTL();
    apache_config();
    $cmd = "{$nohup} {$php5} /usr/share/artica-postfix/exec.web-community-filter.php --register-lic >/dev/null 2>&1 &";
    if ($GLOBALS["VERBOSE"]) {
        echo "{$cmd}\n";
    }
    shell_exec($cmd);
    $cmd = "{$apache2ctl} -f /etc/artica-postfix/httpd.conf -k start";
    shell_exec($cmd);
    for ($i = 0; $i < 6; $i++) {
        $pid = apache_pid();
        if ($unix->process_exists($pid)) {
            break;
        }
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} waiting {$i}/6...\n";
        }
        sleep(1);
    }
    $pid = apache_pid();
    if ($unix->process_exists($pid)) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} Success service started pid:{$pid}...\n";
        }
        shell_exec("{$php5} /usr/share/artica-postfix/exec.apc.compile.php");
        if (!is_file('/etc/init.d/artica-memcache')) {
            shell_exec("{$php5} /usr/share/artica-postfix/exec.initslapd.php --memcache");
        }
        shell_exec("{$nohup} {$php5} /usr/share/artica-postfix/exec.shm.php --SessionMem >/dev/null 2>&1 &");
        shell_exec("{$nohup} {$php5} /usr/share/artica-postfix/exec.shm.php --service-up >/dev/null 2>&1 &");
        shell_exec("{$nohup} {$php5} /usr/share/artica-postfix/exec.initslapd.php --phppfm-restart-back >/dev/null 2>&1 &");
        shell_exec("{$nohup} /etc/init.d/artica-memcached start >/dev/null 2>&1 &");
        shell_exec("{$nohup} /etc/init.d/monit restart >/dev/null 2>&1 &");
    } else {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} failed...\n";
        }
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$cmd}\n";
        }
        apache_troubleshoot();
    }
    $APACHE_SRC_ACCOUNT = $unix->APACHE_SRC_ACCOUNT();
    $APACHE_SRC_GROUP = $unix->APACHE_SRC_GROUP();
    $unix->chown_func($APACHE_SRC_ACCOUNT, $APACHE_SRC_GROUP, "/var/lib/php5/*");
}
Пример #7
0
function apache_pid()
{
    $unix = new unix();
    $pid = $unix->get_pid_from_file('/var/run/squid/HyperCacheWeb.pid');
    if ($unix->process_exists($pid)) {
        return $pid;
    }
    $apache2ctl = $unix->LOCATE_APACHE_CTL();
    return $unix->PIDOF_PATTERN($apache2ctl . " -f /etc/artica-postfix/HyperCacheHTTPD.conf");
}
Пример #8
0
function LIGHTTPD_PID()
{
    $unix = new unix();
    $pid = $unix->get_pid_from_file('/var/run/roundcube-apache/apache.pid');
    if ($unix->process_exists($pid)) {
        return $pid;
    }
    $apache2ctl = $unix->LOCATE_APACHE_CTL();
    return $unix->PIDOF_PATTERN($apache2ctl . " -f.*?apache-roundcube.conf");
}
Пример #9
0
function install()
{
    $GLOBALS["PROGRESS_FILE"] = "/usr/share/artica-postfix/ressources/logs/phpmyadmin.progress";
    $GLOBALS["DOWNLOAD_PROGRESS_FILE"] = "/usr/share/artica-postfix/ressources/logs/phpmyadmin.download.progress";
    $uri = "http://articatech.net/download/phpMyAdmin-4.2.12.tar.gz";
    //$uri="http://artica.fr/download/phpMyAdmin-4.2.12.tar.gz";
    echo "Starting {$uri}\n";
    $unix = new unix();
    echo "Downloading phpMyAdmin-4.2.12.tar.gz...\n";
    build_progress("{downloading} phpMyAdmin-4.2.12.tar.gz...", 20);
    $TMP_FILE = $unix->TEMP_DIR() . "/phpMyAdmin-4.2.12.tar.gz";
    $curl = new ccurl($uri);
    $curl->Timeout = 2400;
    $curl->WriteProgress = true;
    $curl->ProgressFunction = "download_progress";
    if (!$curl->GetFile($TMP_FILE)) {
        @unlink($TMP_FILE);
        build_progress("{downloading} phpMyAdmin-4.2.12.tar.gz {failed}...", 110);
        return;
    }
    $tar = $unix->find_program("tar");
    $rm = $unix->find_program("rm");
    $nohup = $unix->find_program("nohup");
    $php = $unix->LOCATE_PHP5_BIN();
    $ln = $unix->find_program("ln");
    build_progress("{extracting} phpMyAdmin-4.2.12.tar.gz...", 50);
    $ERROR = false;
    echo "{$tar} xvf {$TMP_FILE} -C /usr/share/ 2>&1\n";
    exec("{$tar} xvf {$TMP_FILE} -C /usr/share/ 2>&1", $EXT);
    while (list($index, $ligne) = each($EXT)) {
        echo "{$ligne}\n";
        if (preg_match("#(Cannot|recoverable|Error|exiting)\\s+#", $ligne)) {
            echo "Error Found {$ligne}\n";
            $ERROR = true;
        }
    }
    if ($ERROR) {
        build_progress("{extraction_failed}...", 110);
        sleep(4);
        if (is_file($TMP_FILE)) {
            @unlink($TMP_FILE);
        }
        return;
    }
    if (is_file($TMP_FILE)) {
        @unlink($TMP_FILE);
    }
    if (!is_dir("/usr/share/phpMyAdmin-4.2.12-all-languages")) {
        build_progress("Destination failed...", 110);
        return;
    }
    build_progress("Creating symbolic link", 50);
    if (!is_link("/usr/share/phpmyadmin")) {
        @unlink("/usr/share/phpmyadmin");
    }
    if (is_dir("/usr/share/phpmyadmin")) {
        shell_exec("{$rm} -rf /usr/share/phpmyadmin");
    }
    shell_exec("{$ln} -sf /usr/share/phpMyAdmin-4.2.12-all-languages /usr/share/phpmyadmin");
    build_progress("{restart_services}: Artica Status...", 50);
    $php = $unix->LOCATE_PHP5_BIN();
    build_progress("{restart_services}: Artica Web interface...", 80);
    system("{$php} /usr/share/artica-postfix/exec.phpmyadmin.php --build");
    system("{$php} /usr/share/artica-postfix/exec.lighttpd.php --apache-build");
    $apache2ctl = $unix->LOCATE_APACHE_CTL();
    system("{$apache2ctl} -f /etc/artica-postfix/httpd.conf -k restart");
    build_progress("{success}...", 100);
}