From 51abae40513f70f110422303929d58005f9615d7 Mon Sep 17 00:00:00 2001 From: Benjamin Sonntag Date: Thu, 3 Jun 2010 08:55:26 +0000 Subject: [PATCH] removing old styles + integrating mailman lists size spooling --- .gitattributes | 2 - bureau/admin/login.php | 22 +-- bureau/admin/styles/base.css | 339 ----------------------------------- bureau/head.php | 46 ----- install/mysql.sql | 19 ++ install/upgrades/0.9.10.sql | 22 +++ src/du.pl | 6 + src/spoolsize.php | 33 +++- 8 files changed, 77 insertions(+), 412 deletions(-) delete mode 100644 bureau/admin/styles/base.css delete mode 100644 bureau/head.php diff --git a/.gitattributes b/.gitattributes index 5bcca827..eb48d4fa 100644 --- a/.gitattributes +++ b/.gitattributes @@ -260,7 +260,6 @@ bureau/admin/sta2_doedit_raw.php -text bureau/admin/sta2_edit_raw.php -text bureau/admin/sta2_list.php -text bureau/admin/stats_members.php -text -bureau/admin/styles/base.css -text bureau/admin/styles/style.css -text bureau/admin/template.php -text bureau/admin/web_list.php -text @@ -288,7 +287,6 @@ bureau/class/m_sta2.php -text bureau/class/mime.php -text bureau/class/reset_stats_conf.php -text bureau/class/variables.php -text -bureau/head.php -text bureau/index.php -text bureau/locales/Makefile -text bureau/locales/README -text diff --git a/bureau/admin/login.php b/bureau/admin/login.php index 3d87cc92..d9b2bcd6 100644 --- a/bureau/admin/login.php +++ b/bureau/admin/login.php @@ -39,24 +39,4 @@ if (!$mem->checkid()) include("main.php"); exit; -?> - - - -<?php __("AlternC Desktop"); ?> - - - - - - - -<body> -<p> - Votre navigateur doit supporter les cadres.<br /> - Your browser must support frames -</p> -</body> - - - \ No newline at end of file +?> \ No newline at end of file diff --git a/bureau/admin/styles/base.css b/bureau/admin/styles/base.css deleted file mode 100644 index e0ceddc2..00000000 --- a/bureau/admin/styles/base.css +++ /dev/null @@ -1,339 +0,0 @@ -body { - font-family: sans-serif; - font-size: 85%; -} - -.hlp { - color: #202020; -} - -td { - color: #000000; -} - -th { -/* color: #007799;*/ -} - -h3 { - color: #CB781A; -} - -h4 { - color: #007777; -} - -hr { - border: none; - border-top: 1px solid #000; -} - -.inp { - /* Should not be use anymore !!! */ - border-color: blue; - border-width: 5px; - background-color: #500000; - color: white; -} - -.inc, .inl { - border-style: none; - color: black; -} - -.inb { - border: 1px solid #aaa; - color: black; -} - -.int { - border: 1px solid #aaa; - color: black; - -} - -.lst1 { - background-color: #FFFFFF; -} -.lst2 { - background-color: #EEEEEE; -} - -.dlogin { - text-align: center; -} - -.login { - margin-left: auto; - margin-right: auto; -} - -img { - border: 0px; - vertical-align: middle; -} - -.error { - color: red; - font-weight: bold; -} - -/* Over quota class */ -.over { - color: red; -} - -.code { - font-size: 16px; - font-family: Courier New, Fixed; - font-weight: bold; - text-align: center; -} - -a { - color:#333; - } -a:hover { - color:#CB781A; -} -a:visited { - color:#985B16; -} - -body#menu { - border-right:1px solid #000; - font-size: .9em; - padding-bottom: 2em; - margin:0; - } -body#menu img { - padding: 5px; - } -body#menu h3 { - padding-left: 5px; - margin: .5em 0; - } -#menu-list a { - display:block; - padding: 2px; - margin:0; - } -#menu-list a:hover { - color: #000; - background-color: #EBE0D0; - } -#menu dl { - margin: .5em 0; - } -#menu-list dt { - font-weight:bold; - color:#777; - font-size:.8em; - /*margin: 4px 0 2px 0;*/ - padding: 1px .1em 0 5px; - /*background-color: #ccc;*/ - /*border-bottom: 2px solid #ccc;*/ - background-color:#bbb; - color:white; - } -#menu-list dd { - padding:0; - margin:0; - font-size: .9em; - border-bottom: 1px solid #ccc; - } -#alternc-logo { - padding: .5em ; - text-align: center; - background-color: #CB781A; - } -#alternc-logo a { - color: #fff; - font-weight:bold; - } -#menu-list dd a { - padding: 0 0 0 15px; - text-decoration: none; -} - - - -/**** Login ****/ - -body.login { - text-align:center; - margin: 2em 10em; -} -#wrapper { - margin: 0 auto; -} -body.login form { - -} -.login img { - padding: 3em 1em 1em;; -} -.login form table { - width: 100%; - border: 1px solid #CB781A; - border-collapse:collapse; -} -.login form table thead { - font-weight: bold; - font-size: 1.5em; - padding: 1em; - background-color:#CB781A; -} -.login form table thead td{ - color: white; -} -.login form table td.forminfo { - padding: 1em; - border-top: 1px solid #CB781A; - border-bottom: 1px solid #CB781A; - font-size: 110%; -} - -td.username, -td.pass { - text-align: right; - padding: 0 0 0 .5em; - width: 50%; - font-weight: bold; - font-size: 1.2em; - letter-spacing: 2px; -} -td.input_username, -td.input_pass { - text-align: left; - width: 50%; - padding: 0 1em; -} -td.input_username input, -td.input_pass input { -/* width: 100%;*/ - border-color:#CB781A; - font-family: Courrier New, fixed; - padding: 2px; - font-size: 110%; -} -td.input_username input:hover, -td.input_pass input:hover { - background-color:yellow; -} -td.username, -td.input_username { - padding-top: 1em; -} -td.pass, -td.input_pass { - padding-bottom: 1em; -} -.cookie_ack { - font-size: 85%; - padding-bottom: 1em; - font-weight: bold; -} -.login form table tfoot { - background-color:#F4D9B9; - border-top: 1px solid #CB781A; - margin-top: 2em; - font-size: 85%; -} -.login form table tfoot p { - margin: .3em; -} - -input.inb { - font-weight: bold; - font-size: 100%; - padding: 1px .1em; - background-color:#fff; -} -input.inb:hover { - background-color:yellow; -} -input.inb:active { - background-color:red; - color: #fff; -} - -/** menu param (intend to be the style of all the tables) **/ - -#mem_param table { - width: 70%; - border-collapse:collapse; - margin-bottom: 1em; - } -#mem_param table thead { - background-color:#CB781A; - } -#mem_param table thead td { - color: #fff; - font-weight: bold; - } -#mem_param table th { - width: 50%; - text-align: right; - } -#mem_param table input { - } -#mem_param table input.inb { - float: right; - } -#mem_param input.inb { - font-size: .8em - } - -/** ftp accounts list **/ -body#ftp-account-list input .inc { - clear:both; -} -body#ftp-account-list div.delete { - clear: both; - margin: 1em 0; - } -body#ftp-account-list label { - font-weight: bold; - color: #CB781A; - font-size: 120%; -} -body#ftp-account-list dt { - border-bottom: 1px solid #ddd; - padding: .2em 0 .3em; - margin: 0 0 .3em -} -body#ftp-account-list dd { - margin-left: .3em; - font-size: 120%; - float: left; -} -body#ftp-account-list dd code { - margin-left: .3em; - color: #CB781A; -} -dl.ftp-account { - border: 1px solid #eee; - display: block; - float: left; - margin: 0 1em 1em 0; - padding: .4em; - background-color: #fdfcfc; - width: 45%; - } -body#ftp-account-list .edit { - border: 1px solid #aaa; - color: black; - font-weight: bold; - font-size: 100%; - padding: 0 .2em; - background-color:#fff; - float: right; -} -body#ftp-account-list .edit:hover { - background-color:yellow; -} -body#ftp-account-list .edit:active { - background-color:red; - color: #fff; -} diff --git a/bureau/head.php b/bureau/head.php deleted file mode 100644 index 81f902a8..00000000 --- a/bureau/head.php +++ /dev/null @@ -1,46 +0,0 @@ - - - - -AlternC - - - - - - - - - diff --git a/install/mysql.sql b/install/mysql.sql index c740fafd..2c2f5978 100644 --- a/install/mysql.sql +++ b/install/mysql.sql @@ -464,3 +464,22 @@ CREATE TABLE IF NOT EXISTS `size_web` ( KEY `ts` (`ts`) ) TYPE=MyISAM COMMENT='Web space used by accounts.'; +-- -------------------------------------------------------- +CREATE TABLE IF NOT EXISTS `size_db` ( + `db` varchar(255) NOT NULL default '', + `size` int(10) unsigned NOT NULL default '0', + `ts` timestamp(14) NOT NULL, + PRIMARY KEY (`db`), + KEY `ts` (`ts`) +) TYPE=MyISAM COMMENT='MySQL Database used space'; + +-- -------------------------------------------------------- +CREATE TABLE IF NOT EXISTS `size_mailman` ( + `list` varchar(255) NOT NULL default '', + `uid` int(11) NOT NULL default '0', + `size` int(10) unsigned NOT NULL default '0', + `ts` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + PRIMARY KEY (`list`), + KEY `ts` (`ts`), + KEY `uid` (`uid`) +) ENGINE=MyISAM COMMENT='Mailman Lists used space'; diff --git a/install/upgrades/0.9.10.sql b/install/upgrades/0.9.10.sql index 1caff591..5515a02c 100644 --- a/install/upgrades/0.9.10.sql +++ b/install/upgrades/0.9.10.sql @@ -16,3 +16,25 @@ VALUES ( 'This variable set the way the account list works for accounts other than "admin" (2000). 0 (default) = admin other than admin/2000 can see their own account, but not the other one 1 = admin other than admin/2000 can see any account by clicking the ''show all accounts'' link. ' ); +-- -------------------------------------------------------- +-- TABLES de mémorisation de la taille des dossiers db/listes + +CREATE TABLE IF NOT EXISTS `size_db` ( + `db` varchar(255) NOT NULL default '', + `size` int(10) unsigned NOT NULL default '0', + `ts` timestamp(14) NOT NULL, + PRIMARY KEY (`db`), + KEY `ts` (`ts`) +) TYPE=MyISAM COMMENT='MySQL Database used space'; + + +CREATE TABLE IF NOT EXISTS `size_mailman` ( + `list` varchar(255) NOT NULL default '', + `uid` int(11) NOT NULL default '0', + `size` int(10) unsigned NOT NULL default '0', + `ts` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + PRIMARY KEY (`list`), + KEY `ts` (`ts`), + KEY `uid` (`uid`) +) ENGINE=MyISAM COMMENT='Mailman Lists used space'; + diff --git a/src/du.pl b/src/du.pl index d70d91c5..28422266 100644 --- a/src/du.pl +++ b/src/du.pl @@ -31,3 +31,9 @@ if ($A=~/^\/var\/alternc\/db\//) { $B=~/^([0-9]+).*/; printf "$1\n"; } +if ($A=~/^\/var\/lib\/mailman\//) { + open(SI,"/usr/bin/du -s '$A'|"); + $B=; + $B=~/^([0-9]+).*/; + printf "$1\n"; +} diff --git a/src/spoolsize.php b/src/spoolsize.php index e15f925b..3dc6eec6 100644 --- a/src/spoolsize.php +++ b/src/spoolsize.php @@ -5,9 +5,6 @@ require_once("/var/alternc/bureau/class/config_nochk.php"); // On déverrouile le bureau AlternC :) @alternc_shutdown(); -mysql_query("TRUNCATE TABLE size_mail;"); -mysql_query("TRUNCATE TABLE size_web;"); - echo "---------------------------\n Generating size-cache for mail accounts\n\n"; $r=mysql_query("SELECT * FROM mail_users WHERE alias NOT LIKE '%@%' AND alias LIKE '%\_%';"); while ($c=mysql_fetch_array($r)) { @@ -26,7 +23,35 @@ while ($c=mysql_fetch_array($r)) { echo " done ($size KB) \n"; flush(); } +echo "---------------------------\n Generating size-cache for MySQL databases\n\n"; +$r=mysql_query("SELECT uid,db FROM db;"); +while ($c=mysql_fetch_array($r)) { + echo $c["uid"]."/".$c["db"]; flush(); + $s=mysql_query('SHOW TABLE STATUS FROM `'.$c["db"].'`'); + $size=0; + while ($d=mysql_fetch_array($s)) { + $size+=$d["Data_length"]+$d["Index_length"]; + } + // $size/=1024; + mysql_query("REPLACE INTO size_db SET db='".$c["db"]."',size='$size';"); + echo " done ($size B) \n"; flush(); +} + +echo "---------------------------\n Generating size-cache for web accounts\n\n"; +$r=@mysql_query("SELECT uid, name FROM mailman;"); +if ($r) { + while ($c=mysql_fetch_array($r)) { + echo $c["uid"]."/".$c["name"]; flush(); + $size1=exec("/usr/lib/alternc/du.pl /var/lib/mailman/lists/".$c["name"]); + $size2=exec("/usr/lib/alternc/du.pl /var/lib/mailman/archives/private/".$c["name"]); + $size3=exec("/usr/lib/alternc/du.pl /var/lib/mailman/archives/private/".$c["name"].".mbox"); + $size=(intval($size1)+intval($size2)+intval($size3)); + mysql_query("REPLACE INTO size_mailman SET uid='".$c["uid"]."',list='".$c["name"]."', size='$size';"); + echo " done ($size KB) \n"; flush(); + } + } + // On relocke le bureau pour éviter un msg d'erreur. -sem_acquire( $alternc_sem ); +@sem_acquire( $alternc_sem ); ?>