[vhffs-dev] [987] deleted useless fields in vhffs_mxdomain and vhffs_ml

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 987
Author:   gradator
Date:     2007-10-14 20:11:39 +0000 (Sun, 14 Oct 2007)

Log Message:
-----------
deleted useless fields in vhffs_mxdomain and vhffs_ml

Modified Paths:
--------------
    trunk/vhffs-api/src/Vhffs/Panel/MailingList.pm
    trunk/vhffs-api/src/Vhffs/Services/Mail.pm
    trunk/vhffs-api/src/Vhffs/Services/MailingList.pm
    trunk/vhffs-backend/src/mirror/mx1-mirror.pl
    trunk/vhffs-backend/src/mirror/mx1-mirror.sql
    trunk/vhffs-backend/src/pgsql/initdb.sql.in
    trunk/vhffs-compat/4.0.sql.in
    trunk/vhffs-doc/src/dbdiag.dia


Modified: trunk/vhffs-api/src/Vhffs/Panel/MailingList.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/MailingList.pm	2007-10-14 16:56:33 UTC (rev 986)
+++ trunk/vhffs-api/src/Vhffs/Panel/MailingList.pm	2007-10-14 20:11:39 UTC (rev 987)
@@ -127,7 +127,7 @@
     return undef unless( defined $user );
     return undef unless( defined $group ); 
     
-    my $list = Vhffs::Services::MailingList::create( $main , $lpart , $domain, $user->get_mail, $description, $user, $group );
+    my $list = Vhffs::Services::MailingList::create( $main , $lpart , $domain, $description, $user, $group );
     return undef unless( defined $list );
     
     return undef if ( Vhffs::Acl::add_acl( $user , $list , Vhffs::Constants::ACL_DELETE , $main ) < 0 );

Modified: trunk/vhffs-api/src/Vhffs/Services/Mail.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Mail.pm	2007-10-14 16:56:33 UTC (rev 986)
+++ trunk/vhffs-api/src/Vhffs/Services/Mail.pm	2007-10-14 20:11:39 UTC (rev 987)
@@ -105,7 +105,7 @@
 
         die('Unable to create parent object') unless(defined $parent);
 
-        my $sql = 'INSERT INTO vhffs_mxdomain(domain, unix_user, boxes_path, max_popbox, catchall, object_id) VALUES(?, \'exim\', ?, 0, \'\', ?)';
+        my $sql = 'INSERT INTO vhffs_mxdomain(domain, boxes_path, catchall, object_id) VALUES(?, ?, \'\', ?)';
         my $domain_hash = Vhffs::Functions::hash_mxdomain($domain);
         my $sth = $dbh->prepare($sql);
         $sth->execute($domain, $domain_hash, $parent->get_oid);
@@ -496,12 +496,6 @@
 	}
 }
 
-sub get_unixuser
-{
-	my $self = shift;
-	return $self->{'unix_user'};
-}
-
 sub set_catchall
 {
 	my( $self , $value ) = @_;
@@ -528,7 +522,7 @@
 sub get_by_mxdomain {
     my ($main, $domain) = @_;
 
-    my $sql = 'SELECT m.mxdomain_id, o.owner_gid, m.domain, m.unix_user, m.boxes_path, m.max_popbox, m.catchall, o.object_id, o.owner_uid, o.date_creation, o.state, o.description FROM vhffs_mxdomain m INNER JOIN vhffs_object o ON o.object_id = m.object_id WHERE domain = ?';
+    my $sql = 'SELECT m.mxdomain_id, o.owner_gid, m.domain, m.boxes_path, m.catchall, o.object_id, o.owner_uid, o.date_creation, o.state, o.description FROM vhffs_mxdomain m INNER JOIN vhffs_object o ON o.object_id = m.object_id WHERE domain = ?';
     my $dbh = $main->get_db_object();
     my @params;
     return undef unless(@params = $dbh->selectrow_array($sql, undef, $domain));
@@ -550,7 +544,7 @@
 
 sub fill_object {
     my ($class, $obj) = @_;
-    my $sql = q{SELECT mxdomain_id, domain, unix_user, boxes_path, max_popbox,
+    my $sql = q{SELECT mxdomain_id, domain, boxes_path,
     catchall FROM vhffs_mxdomain WHERE object_id = ?};
     $obj = $class->SUPER::_fill_object($obj, $sql);
     if($obj->isa('Vhffs::Services::Mail')) {
@@ -598,15 +592,13 @@
 }
 
 sub _new {
-    my ($class, $main, $mxdomain_id, $owner_gid, $domain, $unix_user, $boxes_path, $max_popbox, $catchall, $oid, $owner_uid, $date_creation, $state, $description, $boxes, $forwards) = @_;
+    my ($class, $main, $mxdomain_id, $owner_gid, $domain, $boxes_path, $catchall, $oid, $owner_uid, $date_creation, $state, $description, $boxes, $forwards) = @_;
     my $self = $class->SUPER::_new($main, $oid, $owner_uid, $owner_gid, $date_creation, $description, '', $state, Vhffs::Constants::TYPE_MAIL);
     return undef unless defined($self);
     
     $self->{mxdomain_id} = $mxdomain_id;
     $self->{domain} = $domain;
-    $self->{unix_user} = $unix_user;
     $self->{boxes_path} = $boxes_path;
-    $self->{max_popbox} = $max_popbox;
     $self->{catchall} = $catchall;
     $self->{boxes} = $boxes;
     $self->{forward} = $forwards;

Modified: trunk/vhffs-api/src/Vhffs/Services/MailingList.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/MailingList.pm	2007-10-14 16:56:33 UTC (rev 986)
+++ trunk/vhffs-api/src/Vhffs/Services/MailingList.pm	2007-10-14 20:11:39 UTC (rev 987)
@@ -57,7 +57,7 @@
 
 =head2 create
 
-    my $ml = Vhffs::Services::MailingList::create($local, $domain, $admin, $description, $user, $group);
+    my $ml = Vhffs::Services::MailingList::create($local, $domain, $description, $user, $group);
     die('Unable to create list') unless defined $ml;
 
 Creates a new mailing list in database and returns the corresponding fully functional object.
@@ -67,13 +67,12 @@
 =cut
 sub create
 {
-    my ($main, $local, $domain, $admin, $description, $user, $group) = @_;
+    my ($main, $local, $domain, $description, $user, $group) = @_;
     
     return undef unless(defined $user && defined $group);
     return undef unless($local =~ /^[a-z0-9\_\-]+$/);
     return undef unless(Vhffs::Functions::check_domain_name($domain));
     return undef if(Vhffs::Services::Mail::address_exists($main, $local, $domain));
-    $admin = $user->get_mail() unless(defined $admin);
 
     my $ml;
 
@@ -92,9 +91,9 @@
         die('Unable to create parent object') unless(defined $parent);
 
 	# open sub, post members only
-        $sql = 'INSERT INTO vhffs_ml(local_part, domain, prefix, object_id, admin, open_archive, reply_to, sub_ctrl, post_ctrl) VALUES(?, ?, ?, ?, ?, FALSE, TRUE, ?, ? )';
+        $sql = 'INSERT INTO vhffs_ml(local_part, domain, prefix, object_id, open_archive, reply_to, sub_ctrl, post_ctrl) VALUES(?, ?, ?, ?, FALSE, TRUE, ?, ? )';
         my $sth = $dbh->prepare($sql);
-        $sth->execute($local, $domain, $local, $parent->get_oid, $admin, Vhffs::Constants::ML_SUBSCRIBE_NO_APPROVAL_REQUIRED, Vhffs::Constants::ML_POSTING_MEMBERS_ONLY);
+        $sth->execute($local, $domain, $local, $parent->get_oid, Vhffs::Constants::ML_SUBSCRIBE_NO_APPROVAL_REQUIRED, Vhffs::Constants::ML_POSTING_MEMBERS_ONLY);
         $dbh->commit;
         $ml = get_by_mladdress($main, $local, $domain);
     };
@@ -123,7 +122,7 @@
     my ($main, $local, $domain) = @_;
     
     my $dbh = $main->get_db_object();
-    my $sql = 'SELECT ml.ml_id, ml.local_part, ml.domain, ml.prefix, o.owner_gid, ml.admin, ml.open_archive, ml.reply_to, ml.sub_ctrl, ml.post_ctrl, ml.signature, o.object_id, o.owner_uid, o.date_creation, o.state, o.description FROM vhffs_ml ml INNER JOIN vhffs_object o ON o.object_id = ml.object_id WHERE domain = ? and local_part = ?';
+    my $sql = 'SELECT ml.ml_id, ml.local_part, ml.domain, ml.prefix, o.owner_gid, ml.open_archive, ml.reply_to, ml.sub_ctrl, ml.post_ctrl, ml.signature, o.object_id, o.owner_uid, o.date_creation, o.state, o.description FROM vhffs_ml ml INNER JOIN vhffs_object o ON o.object_id = ml.object_id WHERE domain = ? and local_part = ?';
     my $sth = $dbh->prepare($sql);
     return undef unless ($sth->execute($domain, $local) > 0);
     my @params = $sth->fetchrow_array;
@@ -160,7 +159,7 @@
 
 sub fill_object {
     my ($class, $obj) = @_;
-    my $sql = q{SELECT ml_id, local_part, domain, prefix, admin, open_archive,
+    my $sql = q{SELECT ml_id, local_part, domain, prefix, open_archive,
         reply_to, sub_ctrl, post_ctrl, signature FROM vhffs_ml
         WHERE object_id = ?};
     $obj = $class->SUPER::_fill_object($obj, $sql);
@@ -171,7 +170,7 @@
 }
 
 sub _new {
-    my ($class, $main, $ml_id, $local_part, $domain, $prefix, $owner_gid, $admin, $open_archive, $reply_to, $sub_ctrl, $post_ctrl, $signature, $oid, $owner_uid, $date_creation, $state, $description, $subs) = @_;
+    my ($class, $main, $ml_id, $local_part, $domain, $prefix, $owner_gid, $open_archive, $reply_to, $sub_ctrl, $post_ctrl, $signature, $oid, $owner_uid, $date_creation, $state, $description, $subs) = @_;
 
     my $self = $class->SUPER::_new($main, $oid, $owner_uid, $owner_gid, $date_creation, $description, '', $state, Vhffs::Constants::TYPE_ML);
     return undef unless defined($self);
@@ -180,7 +179,6 @@
     $self->{local_part} = $local_part;
     $self->{domain} = $domain,
     $self->{prefix} = $prefix;
-    $self->{admin} = $admin;
     $self->{open_archive} = $open_archive;
     $self->{reply_to} = $reply_to;
     $self->{sub_ctrl} = $sub_ctrl;
@@ -196,9 +194,9 @@
 {
     my $self = shift;	
 
-    my $sql = 'UPDATE vhffs_ml SET prefix = ?, admin = ?, open_archive = ?, reply_to = ?, sub_ctrl = ?, post_ctrl = ?, signature = ? WHERE ml_id = ?';
+    my $sql = 'UPDATE vhffs_ml SET prefix = ?, open_archive = ?, reply_to = ?, sub_ctrl = ?, post_ctrl = ?, signature = ? WHERE ml_id = ?';
     my $dbh = $self->get_main->get_db_object();
-    $dbh->do($sql, undef, $self->{prefix}, $self->{admin}, $self->{open_archive}, $self->{reply_to}, $self->{sub_ctrl}, $self->{post_ctrl}, $self->{signature}, $self->{ml_id});
+    $dbh->do($sql, undef, $self->{prefix}, $self->{open_archive}, $self->{reply_to}, $self->{sub_ctrl}, $self->{post_ctrl}, $self->{signature}, $self->{ml_id});
 
     return -3 if( $self->SUPER::commit < 0 );
 
@@ -427,12 +425,6 @@
     return $self->{'reply_to'};
 }
 
-sub get_admin
-{
-    my $self = shift;
-    return $self->{'admin'};
-}
-
 sub get_domain
 {
     my $self = shift;
@@ -490,13 +482,6 @@
 	return 0;
 }
 
-sub set_admin
-{
-    my $self = shift;
-    my $value = shift;
-    $self->{'admin'} = $value;
-}
-
 sub set_prefix
 {
     my( $self , $value ) = @_;

Modified: trunk/vhffs-backend/src/mirror/mx1-mirror.pl
===================================================================
--- trunk/vhffs-backend/src/mirror/mx1-mirror.pl	2007-10-14 16:56:33 UTC (rev 986)
+++ trunk/vhffs-backend/src/mirror/mx1-mirror.pl	2007-10-14 20:11:39 UTC (rev 987)
@@ -113,14 +113,13 @@
 
 # Replicate vhffs_mxdomain table
 my $msth = $master_dbh->prepare(q{SELECT d.mxdomain_id, d.domain,
-    d.unix_user, d.boxes_path, d.max_popbox, d.catchall,
-    d.owner_uid, d.owner_gid, d.object_id
+    d.boxes_path, d.catchall, d.owner_uid, d.owner_gid, d.object_id
     FROM vhffs_mxdomain d 
     INNER JOIN vhffs_object o ON o.object_id = d.object_id
     WHERE o.state = 6})
     or die("Unable to prepare SELECT query for vhffs_mxdomain\n");
 my $ssth = $slave_dbh->prepare(q{INSERT INTO tmp_mxdomain(mxdomain_id,
-    domain, unix_user, boxes_path, max_popbox, catchall, owner_uid, owner_gid,
+    domain, boxes_path, catchall, owner_uid, owner_gid,
     object_id) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)}) 
     or die("Unable to prepare INSERT query for tmp_mxdomain\n");
 
@@ -128,8 +127,8 @@
     or die("Unable to execute SELECT query for vhffs_mxdomain\n");
 
 while(my $row = $msth->fetchrow_hashref()) {
-    $ssth->execute($row->{mxdomain_id}, $row->{domain}, $row->{unix_user},
-    $row->{boxes_path}, $row->{max_popbox}, $row->{catchall},
+    $ssth->execute($row->{mxdomain_id}, $row->{domain},
+    $row->{boxes_path}, $row->{catchall},
     $row->{owner_uid}, $row->{owner_gid}, $row->{object_id})
     or die('Unable to insert mxdomain #'.$row->{id}."\n");
 }
@@ -326,9 +325,9 @@
 
 # Insert new boxes/forward/ml/domains
 
-($count = $slave_dbh->do(q{INSERT INTO vhffs_mxdomain(mxdomain_id, domain, unix_user,
-    boxes_path, max_popbox, catchall, owner_uid, owner_gid, object_id)
-    SELECT mxdomain_id, domain, unix_user, boxes_path, max_popbox, catchall,
+($count = $slave_dbh->do(q{INSERT INTO vhffs_mxdomain(mxdomain_id, domain,
+    boxes_path, catchall, owner_uid, owner_gid, object_id)
+    SELECT mxdomain_id, domain, boxes_path, catchall,
     owner_uid, owner_gid, object_id FROM tmp_mxdomain 
     WHERE mxdomain_id NOT IN(SELECT mxdomain_id FROM vhffs_mxdomain)}))
     or die("Unable to insert new mail domains\n");

Modified: trunk/vhffs-backend/src/mirror/mx1-mirror.sql
===================================================================
--- trunk/vhffs-backend/src/mirror/mx1-mirror.sql	2007-10-14 16:56:33 UTC (rev 986)
+++ trunk/vhffs-backend/src/mirror/mx1-mirror.sql	2007-10-14 20:11:39 UTC (rev 987)
@@ -2,9 +2,7 @@
 (
     mxdomain_id integer,
     domain varchar,
-    unix_user varchar NOT NULL,
     boxes_path varchar NOT NULL,
-    max_popbox int4 NOT NULL,
     catchall varchar NOT NULL,
     owner_uid int4 NOT NULL,
     owner_gid int4 NOT NULL,

Modified: trunk/vhffs-backend/src/pgsql/initdb.sql.in
===================================================================
--- trunk/vhffs-backend/src/pgsql/initdb.sql.in	2007-10-14 16:56:33 UTC (rev 986)
+++ trunk/vhffs-backend/src/pgsql/initdb.sql.in	2007-10-14 20:11:39 UTC (rev 987)
@@ -183,9 +183,7 @@
 (
 	mxdomain_id serial,
 	domain varchar,
-	unix_user varchar NOT NULL,
 	boxes_path varchar NOT NULL,
-	max_popbox int4 NOT NULL,
 	catchall varchar NOT NULL,
 	object_id int4 NOT NULL,
 	CONSTRAINT vhffs_mxdomain_pkey PRIMARY KEY (mxdomain_id)
@@ -198,7 +196,6 @@
 	domain varchar(256) NOT NULL,
 	prefix varchar(32),
 	object_id int4 NOT NULL,
-	admin varchar(250) NOT NULL,
 	sub_ctrl int4 NOT NULL,
 	post_ctrl int4 NOT NULL,
 	reply_to boolean,

Modified: trunk/vhffs-compat/4.0.sql.in
===================================================================
--- trunk/vhffs-compat/4.0.sql.in	2007-10-14 16:56:33 UTC (rev 986)
+++ trunk/vhffs-compat/4.0.sql.in	2007-10-14 20:11:39 UTC (rev 987)
@@ -375,3 +375,10 @@
 
 -- add ACLs on group to group
 INSERT INTO vhffs_acl( granted_oid,target_oid,perm ) ( SELECT object_id,object_id,2 FROM vhffs_groups WHERE gid NOT IN (SELECT gid FROM vhffs_users) );
+
+-- drop useless columns on vhffs_mxdomain
+ALTER TABLE vhffs_mxdomain DROP COLUMN unix_user;
+ALTER TABLE vhffs_mxdomain DROP COLUMN max_popbox;
+
+-- drop useless columns on vhffs_ml
+ALTER TABLE vhffs_ml DROP COLUMN vhffs_ml;

Modified: trunk/vhffs-doc/src/dbdiag.dia
===================================================================
(Binary files differ)


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/