Changeset 1528

Show
Ignore:
Timestamp:
04/26/06 16:26:21 (3 years ago)
Author:
benjamin
Message:

Adding spoolsize to cache the size of web / mail / db contents, Closes 569

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • alternc/trunk/bureau/class/m_bro.php

    r953 r1528  
    127127      while (($file = readdir($dir)) !== false) { 
    128128        if ($file!="." && $file!="..") { 
    129           $c[]=array("name"=>$file, "size"=>$size, "date"=>filemtime($absolute."/".$file), "type"=> (!is_dir($absolute."/".$file)) ); 
     129          $c[]=array("name"=>$file, "size"=>$this->fsize($absolute."/".$file), "date"=>filemtime($absolute."/".$file), "type"=> (!is_dir($absolute."/".$file)) ); 
    130130        } 
    131131      } 
  • alternc/trunk/bureau/class/m_mail.php

    r947 r1528  
    110110    while ($db->next_record()) { 
    111111      if ($db->f("pop")) {  
    112         /* 
    113         $size=exec("/usr/lib/alternc/du.pl /var/alternc/mail/".substr($info[$i]["mail"][0],0,1)."/".str_replace("@","_",$info[$i]["mail"][0])); 
    114         $size=$size*1024; 
    115         */ 
    116112        $size=0; 
     113        $r=mysql_query("SELECT size FROM size_mail WHERE alias='".str_replace("@","_",$db->f("mail"))."';"); 
     114        list($size)=@mysql_fetch_array($r); 
     115        $size=$size*1024; 
    117116      } else $size=0; 
    118117      if ($db->f("pop")) { 
  • alternc/trunk/debian/alternc.cron.d

    r939 r1528  
    1111# Every hour, check for slave_dns refreshes 
    12125 * * * *       root            /usr/lib/alternc/slave_dns 
     13 
     14# Every day at 2am, compute web, mail and db space usage per account. 
     15# You may put this computing every week only or on your filer on busy services. 
     160 2 * * *       www-data        /usr/lib/alternc/spoolsize.php 
  • alternc/trunk/install/upgrades/0.9.5.sql

    r1025 r1528  
    1010-- Force le bureau https si voulu :  
    1111INSERT INTO variable SET name='force_https', value='0', comment='Shall we force the users to access the managment desktop through HTTPS only ? If this value is true, HTTPS access will be forced. '; 
     12 
     13-- -------------------------------------------------------- 
     14-- TABLES de mémorisation de la taille des dossiers web/mail/db 
     15 
     16CREATE TABLE IF NOT EXISTS `size_db` ( 
     17  `db` varchar(255) NOT NULL default '', 
     18  `size` int(10) unsigned NOT NULL default '0', 
     19  `ts` timestamp(14) NOT NULL, 
     20  PRIMARY KEY  (`db`), 
     21  KEY `ts` (`ts`) 
     22) TYPE=MyISAM COMMENT='MySQL Database used space'; 
     23 
     24 
     25-- -------------------------------------------------------- 
     26CREATE TABLE IF NOT EXISTS `size_mail` ( 
     27  `alias` varchar(255) NOT NULL default '', 
     28  `size` int(10) unsigned NOT NULL default '0', 
     29  `ts` timestamp(14) NOT NULL, 
     30  PRIMARY KEY  (`alias`), 
     31  KEY `ts` (`ts`) 
     32) TYPE=MyISAM COMMENT='Mail space used by pop accounts.'; 
     33 
     34-- -------------------------------------------------------- 
     35CREATE TABLE IF NOT EXISTS `size_web` ( 
     36  `uid` int(10) unsigned NOT NULL default '0', 
     37  `size` int(10) unsigned NOT NULL default '0', 
     38  `ts` timestamp(14) NOT NULL, 
     39  PRIMARY KEY  (`uid`), 
     40  KEY `ts` (`ts`) 
     41) TYPE=MyISAM COMMENT='Web space used by accounts.'; 
     42 
  • alternc/trunk/src/Makefile

    r913 r1528  
    2929CC+=$(CFLAGS) 
    3030PROGS=mail_add mail_del quota_edit quota_get mem_add mem_del db_create  
    31 SCRIPTS=quota_edit.sh quota_get.sh basedir_prot.sh sqlbackup.sh rawstat.daily quota_init quota_delete update_domains.sh slave_dns sendmail 
     31SCRIPTS=quota_edit.sh quota_get.sh basedir_prot.sh sqlbackup.sh rawstat.daily quota_init quota_delete update_domains.sh slave_dns sendmail spoolsize.php 
    3232BIN=$(DESTDIR)/usr/lib/alternc/ 
    3333