Create directory –spam trash ……

Discussion in 'General' started by kristaps, Jul 18, 2007.

  1. kristaps

    kristaps New Member

    I am nub in coding Pleas help


    Where is error?
    (directories are not created)


    PHP:
    // User-Mail-Datei anlegen, sonst evtl. Fehler bei Autoresponder
      
    if(!$mod->system->server_conf["use_maildir"]){
        if(!
    is_file("/var/spool/mail/".$user_username) && $user_username != ''){
          
    $mod->log->phpcaselog(touch("/var/spool/mail/".$user_username), "create /var/spool/mail/".$user_username$this->FILE__LINE__);
          
    $mod->log->caselog("chown $user_username:mail /var/spool/mail/$user_username &> /dev/null"$this->FILE__LINE__);
          
    $mod->log->caselog("chmod 600 /var/spool/mail/$user_username"$this->FILE__LINE__);
        }
        } else {
        
    exec("maildirmake -f sent-mail $web_path/user/$user_username/Maildir");
        
    exec("maildirmake -f drafts $web_path/user/$user_username/Maildir");
        
    exec("maildirmake -f trash $web_path/user/$user_username/Maildir");
        
    exec("maildirmake -f Spam $web_path/user/$user_username/Maildir");
      }
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    This looks fine so far. Do you get any errors when you execute:

    rm -f /home/admispconfig/ispconfig/.run
    /root/ispconfig/php/php -q /root/ispconfig/scripts/writeconf.php
     
  3. kristaps

    kristaps New Member

    Hi,

    server1:/home/krcu # /root/ispconfig/php/php -q /root/ispconfig/scripts/writeconf.php
    ls: cannot access /etc/apache2/vhosts.d/*.conf: No such file or directory
    start
    ende
     
  4. falko

    falko Super Moderator Howtoforge Staff

    Any errors in /home/admispconfig/ispconfig/ispconfig.log?
     
  5. kristaps

    kristaps New Member

    Hi,

    24.07.2007 - 18:07:42 => INFO - Signalfile Set: insert
    24.07.2007 - 18:07:44 => INFO - USER:
    kristaps.cudars:x:10021:10002:Kristaps Cudars:/srv/www/web2/user/kristaps.cudars:/bin/bash
    24.07.2007 - 18:07:44 => INFO - /root/ispconfig/scripts/lib/config.lib.php, Line 661: cp -fr /root/ispconfig/isp/user_standard_index.html_en /srv/www/web2/user/kristaps.cudars/web/index.html
    24.07.2007 - 18:07:44 => INFO - /root/ispconfig/scripts/lib/config.lib.php, Line 722: setquota -u kristaps.cudars 3145728 3146752 0 0 -a &> /dev/null
    24.07.2007 - 18:07:44 => INFO - /root/ispconfig/scripts/lib/config.lib.php, Line 723: setquota -T -u kristaps.cudars 604800 604800 -a &> /dev/null
    24.07.2007 - 18:07:44 => INFO - /root/ispconfig/scripts/lib/classes/ispconfig_procmail.lib.php, Line 57: cp -f /root/ispconfig/isp/conf/forward.master /srv/www/web2/user/kristaps.cudars/.forward
    24.07.2007 - 18:07:44 => INFO - maildirmake /srv/www/web2/user/kristaps.cudars/Maildir &> /dev/null, Line 106: maildirmake /srv/www/web2/user/kristaps.cudars/Maildir &> /dev/null
    24.07.2007 - 18:07:44 => INFO - /root/ispconfig/scripts/lib/classes/ispconfig_postfix.lib.php, Line 137: cp -fr /etc/postfix/local-host-names /etc/postfix/local-host-names~
    24.07.2007 - 18:07:44 => INFO - /root/ispconfig/scripts/lib/classes/ispconfig_postfix.lib.php, Line 284: cp -fr /etc/postfix/virtusertable /etc/postfix/virtusertable~
    24.07.2007 - 18:07:44 => INFO - /root/ispconfig/scripts/lib/classes/ispconfig_postfix.lib.php, Line 289: postmap hash:/etc/postfix/virtusertable
    24.07.2007 - 18:07:44 => INFO - /root/ispconfig/scripts/lib/config.lib.php, Line 1236: cp -fr /etc/apache2/vhosts/Vhosts_ispconfig.conf /etc/apache2/vhosts/Vhosts_ispconfig.conf~
    24.07.2007 - 18:07:44 => INFO - HTTPD_SYNTAX_CHECK: suexec
    24.07.2007 - 18:07:45 => INFO - /root/ispconfig/scripts/lib/classes/ispconfig_system.lib.php, Line 728: /etc/init.d/postfix stop &> /dev/null
    24.07.2007 - 18:07:45 => INFO - /root/ispconfig/scripts/lib/classes/ispconfig_system.lib.php, Line 728: /etc/init.d/postfix start &> /dev/null
    24.07.2007 - 18:07:45 => INFO - /root/ispconfig/scripts/lib/config.lib.php, Line 1897: cp -fr /etc/proftpd_ispconfig.conf /etc/proftpd_ispconfig.conf~
    24.07.2007 - 18:07:52 => INFO - Signalfile Set: update
    24.07.2007 - 18:07:56 => INFO - /root/ispconfig/scripts/lib/config.lib.php, Line 257: setquota -g web2 0 0 0 0 -a &> /dev/null
    24.07.2007 - 18:07:56 => INFO - /root/ispconfig/scripts/lib/config.lib.php, Line 258: setquota -T -g web2 604800 604800 -a &> /dev/null
    24.07.2007 - 18:07:56 => INFO - /root/ispconfig/scripts/lib/config.lib.php, Line 277: Connected successfully
    24.07.2007 - 18:07:56 => INFO - USER:
    kristaps.cudars:x:10021:10002:Kristaps Cudars:/srv/www/web2/user/kristaps.cudars:/bin/bash
    24.07.2007 - 18:07:56 => INFO - /root/ispconfig/scripts/lib/config.lib.php, Line 896: setquota -u kristaps.cudars 3145728 3146752 0 0 -a &> /dev/null
    24.07.2007 - 18:07:56 => INFO - /root/ispconfig/scripts/lib/config.lib.php, Line 897: setquota -T -u kristaps.cudars 604800 604800 -a &> /dev/null
    24.07.2007 - 18:07:56 => INFO - /root/ispconfig/scripts/lib/classes/ispconfig_procmail.lib.php, Line 57: cp -f /root/ispconfig/isp/conf/forward.master /srv/www/web2/user/kristaps.cudars/.forward
    24.07.2007 - 18:07:56 => INFO - /root/ispconfig/scripts/lib/classes/ispconfig_postfix.lib.php, Line 137: cp -fr /etc/postfix/local-host-names /etc/postfix/local-host-names~
    24.07.2007 - 18:07:56 => INFO - /root/ispconfig/scripts/lib/classes/ispconfig_postfix.lib.php, Line 284: cp -fr /etc/postfix/virtusertable /etc/postfix/virtusertable~
    24.07.2007 - 18:07:56 => INFO - /root/ispconfig/scripts/lib/classes/ispconfig_postfix.lib.php, Line 289: postmap hash:/etc/postfix/virtusertable
    24.07.2007 - 18:07:56 => INFO - /root/ispconfig/scripts/lib/config.lib.php, Line 1236: cp -fr /etc/apache2/vhosts/Vhosts_ispconfig.conf /etc/apache2/vhosts/Vhosts_ispconfig.conf~
    24.07.2007 - 18:07:56 => INFO - Signalfile Set: update
    24.07.2007 - 18:07:56 => INFO - HTTPD_SYNTAX_CHECK: suexec
    24.07.2007 - 18:07:56 => INFO - /root/ispconfig/scripts/lib/config.lib.php, Line 1897: cp -fr /etc/proftpd_ispconfig.conf /etc/proftpd_ispconfig.conf~
     
  6. kristaps

    kristaps New Member

    Hi,


    I updated to the last version of ISPconfig and now I’m receiving error:

    server1:/srv/www/web2/user/kristaps.cudars/Maildir # rm -f /home/admispconfig/ispconfig/.run
    server1:/srv/www/web2/user/kristaps.cudars/Maildir # /root/ispconfig/php/php -q /root/ispconfig/scripts/writeconf.php

    Parse error: syntax error, unexpected ';', expecting T_FUNCTION in /root/ispconfig/scripts/lib/config.lib.php on line 2520

    Line 2520 is the end of file

    break;
    case 1014:
    //User-Verzeichnis lƶschen
    if(is_dir($item["pfad"])){
    $mod->log->caselog("rm -fr ".$item["pfad"], $this->FILE, __LINE__);
    }
    $mod->system->deluser($item["name"]);
    $mod->db->query("DELETE FROM del_status WHERE id = '".$item["id"]."'");
    break;
    }
    }
    }
    return true;
    }

    }

    ?> - Line 2520
     
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    which version do you mean? the last stable version is 2.2.15.
     
  8. kristaps

    kristaps New Member

    Yes: last stable version is 2.2.15.
     
  9. till

    till Super Moderator Staff Member ISPConfig Developer

    I'm sure that ISPConfig 2.2.15 has no syntax error in writeconf.php. Did you patch or modify any of the source code files?
     
  10. kristaps

    kristaps New Member

    Hi,

    I did not modified anything just those 4 lines for mail dir creation
    (when I’m removing them it works)

    I think that I have problems with syntax in that place and Im php lamer.

    Mea by I’m missing {} signs ?

    //Passwort in ISPConfig-DB lƶschen
    $mod->db->query("UPDATE isp_isp_user SET user_passwort = '' where doc_id = '$doc_id'");
    $mod->system->data["isp_isp_user"]["user_passwort"] = '';

    // User-Mail-Datei anlegen, sonst evtl. Fehler bei Autoresponder
    if(!$mod->system->server_conf["use_maildir"]){
    if(!is_file("/var/spool/mail/".$user_username) && $user_username != ''){
    $mod->log->phpcaselog(touch("/var/spool/mail/".$user_username), "create /var/spool/mail/".$user_username, $this->FILE, __LINE__);
    $mod->log->caselog("chown $user_username:mail /var/spool/mail/$user_username &> /dev/null", $this->FILE, __LINE__);
    $mod->log->caselog("chmod 600 /var/spool/mail/$user_username", $this->FILE, __LINE__);
    } else {
    exec("maildirmake -f sent-mail $web_path/user/$user_username/Maildir");
    exec("maildirmake -f drafts $web_path/user/$user_username/Maildir");
    exec("maildirmake -f trash $web_path/user/$user_username/Maildir");
    exec("maildirmake -f Spam $web_path/user/$user_username/Maildir");
    }

    // Diskquota setzen
     
    Last edited: Jul 25, 2007
  11. kristaps

    kristaps New Member

    When Im remowing those lines I get

    server1:/home/admkrcu # rm -f /home/admispconfig/ispconfig/.run
    server1:/home/admkrcu # /root/ispconfig/php/php -q /root/ispconfig/scripts/writeconf.php
    ls: cannot access /etc/apache2/vhosts.d/*.conf: No such file or directory
    start
    ende
    server1:/home/admkrcu #
     
  12. kristaps

    kristaps New Member

    Founded

    Line: 706~ Beganing of function 1
    (modify it to look like this)

    // User-Mail-Datei anlegen, sonst evtl. Fehler bei Autoresponder
    if(!$mod->system->server_conf["use_maildir"]){
    if(!is_file("/var/spool/mail/".$user_username) && $user_username != ''){
    $mod->log->phpcaselog(touch("/var/spool/mail/".$user_username), "create /var/spool/mail/".$user_username, $this->FILE, __LINE__);
    $mod->log->caselog("chown $user_username:mail /var/spool/mail/$user_username &> /dev/null", $this->FILE, __LINE__);
    $mod->log->caselog("chmod 600 /var/spool/mail/$user_username", $this->FILE, __LINE__);
    }
    } else {
    exec("maildirmake -f sent-mail $web_path/user/$user_username/Maildir");
    exec("maildirmake -f drafts $web_path/user/$user_username/Maildir");
    exec("maildirmake -f trash $web_path/user/$user_username/Maildir");
    exec("maildirmake -f Spam $web_path/user/$user_username/Maildir");
    }

    Modify next function to look like this

    // Diskquota setzen
    if(!strstr($mod->system->server_conf["dist"], "freebsd")){
    $mod->log->caselog("setquota -u $user_username $blocks_soft $blocks_hard 0 0 -a &> /dev/null", $this->FILE, __LINE__);
    $mod->log->caselog("setquota -T -u $user_username 604800 604800 -a &> /dev/null", $this->FILE, __LINE__);
    exec("maildirmake -f sent-mail $web_path/user/$user_username/Maildir");
    exec("maildirmake -f drafts $web_path/user/$user_username/Maildir");
    exec("maildirmake -f trash $web_path/user/$user_username/Maildir");
    exec("maildirmake -f Spam $web_path/user/$user_username/Maildir");
    } else {
    if($q_dirs = $mod->system->quota_dirs()){
    if(!empty($q_dirs)){
    foreach($q_dirs as $q_dir){
    $mod->log->caselog("setquota -u -f ".$q_dir." -bh".$blocks_hard." -bs".$blocks_soft." ".$user_username." &> /dev/null", $this->FILE, __LINE__);
    }
    }
    }
    }

    The Fined the same function as first one and modife to look like this:

    Line: 831 ~

    // User-Mail-Datei anlegen, sonst evtl. Fehler bei Autoresponder
    if(!$mod->system->server_conf["use_maildir"]){
    if(!is_file("/var/spool/mail/".$user_username)){
    $mod->log->phpcaselog(touch("/var/spool/mail/".$user_username), "create /var/spool/mail/".$user_username, $this->FILE, __LINE__);
    $mod->log->caselog("chown $user_username:mail /var/spool/mail/$user_username &> /dev/null", $this->FILE, __LINE__);
    $mod->log->caselog("chmod 600 /var/spool/mail/$user_username", $this->FILE, __LINE__);
    }
    } else {
    exec("maildirmake -f sent-mail $web_path/user/$user_username/Maildir");
    exec("maildirmake -f drafts $web_path/user/$user_username/Maildir");
    exec("maildirmake -f trash $web_path/user/$user_username/Maildir");
    exec("maildirmake -f Spam $web_path/user/$user_username/Maildir");
    }


    Then creation of directory starts working.
     

Share This Page