Modification to make the upgrade from 1.0 to 1.1 work

This commit is contained in:
Steven Mondji-Lerider 2012-09-26 09:41:41 +00:00
parent 3d36d8633e
commit 9fb6c3a1c1
5 changed files with 70 additions and 36 deletions

1
.gitattributes vendored
View File

@ -514,6 +514,7 @@ install/upgrades/1.0.1.php -text
install/upgrades/1.0.3.sql -text
install/upgrades/1.0.sql -text
install/upgrades/1.1.php -text
install/upgrades/1.1.sh -text
install/upgrades/1.1.sql -text
install/upgrades/README -text
lang/README -text

View File

@ -120,6 +120,7 @@ fi
# Prepare template expansions
#
chown :alterncpanel /etc/alternc/local.sh
. /etc/alternc/local.sh
# Check ACL

32
install/upgrades/1.1.sh Normal file
View File

@ -0,0 +1,32 @@
#!/bin/sh
CONFIG_FILE="/etc/alternc/local.sh"
PATH=/sbin:/bin:/usr/sbin:/usr/bin
umask 022
if [ ! -r "$CONFIG_FILE" ]; then
echo "Can't access $CONFIG_FILE."
exit 1
fi
if [ `id -u` -ne 0 ]; then
echo "fixperms.sh must be launched as root"
exit 1
fi
fix_mail() {
read LOGIN GID || true
while [ "$LOGIN" ]; do
INITIALE=`echo $LOGIN |cut -c1`
REP="$ALTERNC_LOC/mail/$INITIALE/$LOGIN/"
chown --recursive $GID:vmail "$REP"
}
query="select user,userdb_gid from dovecot_view"
mysql --defaults-file=/etc/alternc/my.cnf --skip-column-names -B -e "$query" |fix_mail

View File

@ -151,41 +151,6 @@ CREATE TABLE IF NOT EXISTS `cron` (
KEY `uid` (`uid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Structure de la vue `dovecot_view`
--
CREATE OR REPLACE VIEW `dovecot_view` AS
SELECT concat(`address`.`address`,'@',`domaines`.`domaine`) AS `user`,
concat('*:storage=',cast(`mailbox`.`quota` as char charset latin1),'M') AS `userdb_quota_rule`,
`address`.`password` AS `password`,
`mailbox`.`path` AS `userdb_home`,
`domaines`.`compte` AS `userdb_uid`,
`domaines`.`compte` AS `userdb_gid`,
`mailbox`.`bytes` AS `quota_dovecot`,
`mailbox`.`messages` AS `nb_messages`
from ((`mailbox`
join `address` on((`address`.`id` = `mailbox`.`address_id`)))
join `domaines` on((`domaines`.`id` = `address`.`domain_id`)))
where `address`.`enabled` = 1
;
--
-- Structure de la vue `alias_view`
--
CREATE OR REPLACE VIEW `alias_view` AS
select concat(`address`.`address`,'@',`domaines`.`domaine`) AS `mail`,
concat(if(isnull(`mailbox`.`id`),'',concat(concat(`address`.`address`,'@',`domaines`.`domaine`),'\n')),`recipient`.`recipients`) AS `alias`
from (((`recipient` join `address` on((`address`.`id` = `recipient`.`address_id`)))
left join `mailbox` on((`mailbox`.`address_id` = `address`.`id`)))
join `domaines` on((`domaines`.`id` = `address`.`domain_id`)))
where `address`.`enabled` = 1
union
select distinct concat(`m`.`login`,'@',`v`.`value`) AS `mail`,
`m`.`mail` AS `alias`
from ((`membres` `m` join `variable` `v`) join `domaines` `d`)
where (`v`.`name` = 'mailname_bounce');
--
@ -483,3 +448,38 @@ update mail_domain, domaines, mail_alias
-- End of insert data into new model from old model.
-- -------------------------------------------------
--
-- Structure de la vue `dovecot_view`
--
CREATE OR REPLACE VIEW `dovecot_view` AS
SELECT concat(`address`.`address`,'@',`domaines`.`domaine`) AS `user`,
concat('*:storage=',cast(`mailbox`.`quota` as char charset latin1),'M') AS `userdb_quota_rule`,
`address`.`password` AS `password`,
`mailbox`.`path` AS `userdb_home`,
`domaines`.`compte` AS `userdb_uid`,
`domaines`.`compte` AS `userdb_gid`,
`mailbox`.`bytes` AS `quota_dovecot`,
`mailbox`.`messages` AS `nb_messages`
from ((`mailbox`
join `address` on((`address`.`id` = `mailbox`.`address_id`)))
join `domaines` on((`domaines`.`id` = `address`.`domain_id`)))
where `address`.`enabled` = 1
;
--
-- Structure de la vue `alias_view`
--
CREATE OR REPLACE VIEW `alias_view` AS
select concat(`address`.`address`,'@',`domaines`.`domaine`) AS `mail`,
concat(if(isnull(`mailbox`.`id`),'',concat(concat(`address`.`address`,'@',`domaines`.`domaine`),'\n')),`recipient`.`recipients`) AS `alias`
from (((`recipient` join `address` on((`address`.`id` = `recipient`.`address_id`)))
left join `mailbox` on((`mailbox`.`address_id` = `address`.`id`)))
join `domaines` on((`domaines`.`id` = `address`.`domain_id`)))
where `address`.`enabled` = 1
union
select distinct concat(`m`.`login`,'@',`v`.`value`) AS `mail`,
`m`.`mail` AS `alias`
from ((`membres` `m` join `variable` `v`) join `domaines` `d`)
where (`v`.`name` = 'mailname_bounce');

View File

@ -5,7 +5,7 @@
DocumentRoot /usr/share/squirrelmail
<Directory /usr/share/squirrelmail>
php_value open_basedir /usr/share/squirrelmail:/etc/squirrelmail/:/var/lib/squirrelmail/data/:/var/spool/squirrelmail/
php_value open_basedir /usr/share/squirrelmail:/etc/squirrelmail/:/var/lib/squirrelmail/data/:/var/spool/squirrelmail/:/etc/mailname
php_admin_flag safe_mode off
Options Indexes FollowSymLinks
</Directory>