Commit Graph

97 Commits (4660d65679f4c5b073cf7babf4185e5903545d11)

Author SHA1 Message Date
Christian Boltz 29364b4734
ensure some fields are really latin1
The previous commit changed vacation_notificatoin.notified,
alias_domain.alias_domain and alias_domain.target_domain to latin1, but
did this only in their original upgrade function.

upgrade_1836_mysql() also applies this change to existing databases.
(It's unlikely that these fields are not latin1 - creating them as utf8
or utf8mb4 would break at the index length, but better safe than sorry ;-)
8 years ago
Christian Boltz ba94c3a75e
fix problems with utf8mb4 as default charset
When trying to create a new database with utf8mb4 as default charset,
upgrade.php fails at various places because of too long indexes.

- no longer run upgrade_1_mysql, upgrade_2_mysql and upgrade_3_mysql
  which all affect updates from pre-2.1 database layout
- add {LATIN1} to vacation_notificatoin.notified,
  alias_domain.alias_domain and alias_domain.target_domain

Thanks to martinx who reported this on IRC and helped to debug it.
8 years ago
Christian Boltz 516f1c68f4 upgrade_1835_mysql: fix defaults for both date fields at once
Doing it in two steps fails, see comment by Gabor 'Morc' KORMOS on
https://sourceforge.net/p/postfixadmin/bugs/5/

Note: This is an exception from the "never change an existing
upgrade_*() function" rule because
a) the result doesn't change for people where it worked and
b) it will continue here anyway for people who had upgrade problems


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1881 a1433add-5e2c-0410-b055-b7f2511e0802
8 years ago
Christian Boltz 13cdd50d0a Add checks to login.php and cli to ensure database layout is up to date
- add check_db_version() to functions.inc.php
- add $min_db_version (needs to be updated at least before the release)
- call check_db_version in login.php, users/login.php and CLI - they'll
  error out if the database layout is outdated
- change setup.php to use check_db_version()



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1853 a1433add-5e2c-0410-b055-b7f2511e0802
9 years ago
Christian Boltz 336d7a8e28 upgrade.php:
- change default date for 'created' and 'updated' columns from
  0000-00-00 (which causes problems with MySQL strict mode) to
  2000-01-01. This is done with a new {DATETIME} marker to reduce
  code duplication.
- add upgrade_1835_mysql() to apply the same change to existing
  databases

This fixes
  https://sourceforge.net/p/postfixadmin/bugs/5/ and
  https://sourceforge.net/p/postfixadmin/bugs/373/
(which are effectively duplicates)



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1835 a1433add-5e2c-0410-b055-b7f2511e0802
9 years ago
Christian Boltz b261db86c7 Merge pull request #9 from phyrog/master
Add sqlite backend option (thank you @phyrog for doing this)

(imported from github)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1824 a1433add-5e2c-0410-b055-b7f2511e0802
9 years ago
David Goodwin dbc8204ab1 try and support older versions of PHP (e.g 5.3) which do not support closures etc
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1798 a1433add-5e2c-0410-b055-b7f2511e0802
9 years ago
Christian Boltz 73ffaad7e8 upgrade.php:
- change fetchmail.date from DATECURRENT to date
  https://sourceforge.net/p/postfixadmin/bugs/351/


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1795 a1433add-5e2c-0410-b055-b7f2511e0802
9 years ago
Christian Boltz 7f87d130d7 upgrade.php:
- split upgrade_1763() into mysql and pgsql versions because pgsql
  doesn't support SUBSTRING_INDEX
  (reported by darix on IRC)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1786 a1433add-5e2c-0410-b055-b7f2511e0802
10 years ago
Christian Boltz 25356ede71 upgrade_1767: fetchmail.active field was just added. Make sure all
existing fetchmail jobs are active.


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1767 a1433add-5e2c-0410-b055-b7f2511e0802
10 years ago
Christian Boltz 9ca7ae050e Two upgrades for FetchmailHandler:
- upgrade_1762: add 'domain', 'active',  'created' and 'modified' fields
  to fetchmail table (used by FetchmailHandler)
- upgrade_1763: fill fetchmail.domain based on mailbox



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1763 a1433add-5e2c-0410-b055-b7f2511e0802
10 years ago
David Goodwin feb2424188 stop relying on subversion keyword for database upgrades; just iterate over all user defined functions and find the largest numeric one
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1740 a1433add-5e2c-0410-b055-b7f2511e0802
10 years ago
Christian Boltz 6595a0a501 upgrade.php:
- upgrade_1685_mysql()/upgrade_1685_pgsql:
  Fix existing log entries broken by 
  https://sourceforge.net/p/postfixadmin/bugs/317/


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1685 a1433add-5e2c-0410-b055-b7f2511e0802
10 years ago
Christian Boltz f14d7d09a5 upgrade.php:
- change {BOOLEAN} to include "default false"
- revert the r1626 changes in upgrade_1283
  (BTW: "by default, every admin is a superadmin" is not a good idea ;-)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1632 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
David Goodwin fa984a5b5f upgrade.php : fix postgres complaining about addition of boolean not null field when existing data exists and no default is specified
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1626 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz 8c139c95d6 vacation:
restrict reply type to a list of options ($CONF[vacation_choice_of_reply]),
remove input field for custom interval


config.inc.php:
- change $CONF['vacation_choice_of_reply'] to [seconds] => [$PALANG label]
  (note: reply to every mail is commented by default because it can be
  annoying. Admins will have to explicitely add/enable it in their config.)
- remove $CONF[vacation_replytype_default]
- update comment about dovecot:* for $CONF[encrypt]

*.lang:
- add texts for reply types

VacationHandler.php:
- remove reply_type at various places
- set_away(): remove reply_type from list of function parameters

templates/vacation.tpl:
- update reply type dropdown for the changed $CONF['vacation_choice_of_reply']
- remove the input fields for custom reply delay

vacation.php:
- restrict reply type to a list of options ($CONF[vacation_choice_of_reply])
- if vacation is disabled, but old values are stored in the database,
  change the activeFrom and activeUntil date to today to avoid users
  have to scroll through the calendar a lot

xmlrpc.php:
- update set_away() call to match the removed parameter

upgrade.php:
- comment out upgrade_1345_mysql() which created the reply_type and 
  interval_time fields in the vacation table in mysql
- add upgrade_1610() to add the vacation.interval_time field


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1610 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz 77c0fbcb22 upgrade.php:
- upgrade_729 - add comment about r1605 changes


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1606 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz 975956b73e upgrade.php:
- change {BIGINT} to include "NOT NULL DEFAULT 0"
- add {INT} (not used anywhere yet)
- upgrade_729:
  - quota2 table: change "{BIGINT} NOT NULL DEFAULT 0" to "{BIGINT}" to 
    match the above change
  - note: quota table created with old versions of upgrade.php will not 
    have explicit "NOT NULL DEFAULT 0" for the "current" field 
    (shouldn't hurt)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1605 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz 7bffdc9907 upgrade.php:
- convert TODO to a note


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1591 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz b985816baa fetchmail: add sslcertck, sslcertpath, sslfingerprint
ADDITIONS/fetchmail.pl
- add sslcertck, sslcertpath and sslfingerprint to fetchmail config
- some whitespace fixes

fetchmail.php
- add sslcertck, sslcertpath, sslfingerprint fields
  (sslcertpath and sslfingerprint require $CONF[fetchmail_extra_options]
  because they don't have input validation)

languages/*.lang
- add new texts needed for the added fields

templates/fetchmail.tpl:
- add the new fields
- also add extra_options and mda fields - they were not displayed yet

upgrade.php
- fix _db_add_field() to call _db_field_exists() with correct table name
- upgrade_1519(): add sslcertck, sslcertpath, sslfingerprint fields to the
  fetchmail table


Most parts of this commit are based on the work of Lars Engelhard
(modified files sent on the mailinglist 2013-07-30)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1519 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz 47bc9bb2ad upgrade.php:
- _pgsql_field_exists(), _mysql_field_exists():
  Those functions are always called with the expanded table name - don't
  expand it twice. (The better solution would be to change all calling
  code to provide non-expanded tablenames, but that's more work.)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1391 a1433add-5e2c-0410-b055-b7f2511e0802
13 years ago
David Goodwin ef80736445 Merge jan-kruis's vacation interval reply behaviour - see SF patch 3508083 - https://sourceforge.net/tracker/?func=detail&aid=3508083&group_id=191583&atid=937966 ; Thank you
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1373 a1433add-5e2c-0410-b055-b7f2511e0802
13 years ago
Christian Boltz 060b101d69 upgrade.php:
- add \n after "Upgrading database" lines - that makes the output readable 
  if setup.php is called in a console instead a webbrowser


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1345 a1433add-5e2c-0410-b055-b7f2511e0802
13 years ago
Christian Boltz 41d8bcaf0a upgrade.php:
- upgrade_1284(): migrate the ALL domain to the superadmin column
  Note: The ALL domain is not (yet) deleted to stay backwards-compatible 
  for now (will be done in a later upgrade function)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1284 a1433add-5e2c-0410-b055-b7f2511e0802
13 years ago
Christian Boltz 48f2a0a94b upgrade.php
- upgrade_1283(): add a "superadmin" column to the admin table
  This is the first step to get rid of the "ALL" dummy domain.


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1283 a1433add-5e2c-0410-b055-b7f2511e0802
13 years ago
Christian Boltz b2d953071c upgrade.php:
- add hint about ?debug=1


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1130 a1433add-5e2c-0410-b055-b7f2511e0802
13 years ago
Christian Boltz 0247de425a upgrade_1050():
- add index on (domain,timestamp) in log table to make viewlog faster

_add_index():
- fix handling of multi-column aliases in MySQL


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1050 a1433add-5e2c-0410-b055-b7f2511e0802
14 years ago
Christian Boltz 0fa1614dad upgrade.php:
- fix syntax error


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1001 a1433add-5e2c-0410-b055-b7f2511e0802
14 years ago
Valkum 179f195bf1 *fixed db_insert - duplicate $timestamp
*fixed VacationHandler.php
*changed edit-vacation to us VacationHandler
*added todopoint to upgrade.php
*fixed problem in AliasHandler


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@981 a1433add-5e2c-0410-b055-b7f2511e0802
14 years ago
Christian Boltz acfc4e57f8 upgrade.php:
- PostgreSQL: change domain.quota, domain.maxquota and mailbox.quota to bigint

reported by oliver (n0d3 @SF), 
https://sourceforge.net/tracker/?func=detail&aid=3057081&group_id=191583&atid=937964

Note: MySQL has bigint field since r169.


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@968 a1433add-5e2c-0410-b055-b7f2511e0802
14 years ago
Christian Boltz 515fa83809 upgrade.php: add vacation.activefrom/activeuntil even for updates from 2.3.x
- MySQL only allows one column with DEFAULT CURRENT_TIMESTAMP per table
  -> introduce {DATE} with DEFAULT 2000-01-01 as workaround
  -> GingerDog, please check if the PostgreSQL variant of {DATE} is valid
- disable upgrade_727_mysql because
  - function number is too small for upgrades from 2.3.x
  - MySQL only
  - it creates some tables PostfixAdmin doesn't use
- new function upgrade_946 to add activefrom/activeuntil fields to the
  vacation table (previously done in upgrade_727_mysql)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@946 a1433add-5e2c-0410-b055-b7f2511e0802
14 years ago
Christian Boltz fc26618140 upgrade.php: add "modified" column to vacation table, various fixes and new helper functions
- fix _pgsql_field_exists and _mysql_field_exists to work with 
  non-default table names
- new function _db_field_exists as database-independent wrapper for 
  _*_field_exists
- new function _db_add_field to add a field to a table
- new function printdebug for debug output (grey text)
- define {DATECURRENT} for timestamp fields (avoids lots of duplication)
  -> @GingerDog: please check if the PostgreSQL statement is correct!
- upgrade_945: add a 'modified' column to the vacation table
- various small changes (whitespace, comments, TODO notes etc.


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@945 a1433add-5e2c-0410-b055-b7f2511e0802
14 years ago
Christian Boltz 2f259742f5 upgrade.php:
- replaced deprecated split() with explode()
- added SVN $Id header


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@894 a1433add-5e2c-0410-b055-b7f2511e0802
14 years ago
Christian Boltz 70d09e17ab upgrade.php:
- fix typo in _drop_index and _add_index ($tabe -> $table) that broke 
  changing table names via $CONF


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@794 a1433add-5e2c-0410-b055-b7f2511e0802
15 years ago
Christian Boltz 20d2aab24f upgrade.php
- function upgrade_1_mysql(): change default charset of vacation table to
  latin1. Otherwise table creation breaks with MySQL 6.
  Fields that need to be utf-8 are changed to utf-8 later anyways.
  (Found by mechno on #postfixadmin)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@790 a1433add-5e2c-0410-b055-b7f2511e0802
15 years ago
Christian Boltz a250b68988 upgrade.php:
- fix issues from smarty merge:
  - re-add {BIGINT} replacement for pgsql
  - convert DOS linebreaks to unix linebreaks


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@784 a1433add-5e2c-0410-b055-b7f2511e0802
15 years ago
Sebastian b1287d97e2 - big merge of Postfixadmin smarty into trunk
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@757 a1433add-5e2c-0410-b055-b7f2511e0802
15 years ago
Christian Boltz 0ec2c3aa41 upgrade.php
- upgrade_344_mysql(): fix MySQL 6.0 compatibility
  reported by ant77191 on					   
  https://sourceforge.net/projects/postfixadmin/forums/forum/676076/topic/3435180


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@745 a1433add-5e2c-0410-b055-b7f2511e0802
15 years ago
David Goodwin eb68607f56 create the plpgsql language if it is not already there; will error if already enabled, but we will just ignore this - this may cause issues if the db user does not have priviledges to create language ... if this is the case the next query will fail
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@738 a1433add-5e2c-0410-b055-b7f2511e0802
15 years ago
Christian Boltz 04b272472d support for displaying quota (dovecot 1.1 and 1.2 format)
upgrade.php
- create quota and quota2 table (upgrade_729)
- create the triggers required by dovecot (upgrade_730_pgsql)

list-virtual.php
- updated to work with both quota tables
  Patch by Varren Volz, https://sourceforge.net/tracker/?func=detail&aid=2867629&group_id=191583&atid=937966
- changed query for 1.1 quota table to 
      WHERE [...] AND  (  $table_quota.path='quota/storage' OR $table_quota.path IS NULL  )
  This fixes https://sourceforge.net/tracker/?func=detail&aid=2794247&group_id=191583&atid=937964
  (users not shown when initial email is not sent)

config.inc.php, functions.php
- new config option $CONF['new_quota_table'] (YES means dovecot 1.2 format)
- set variables for new quota2 table

DOCUMENTS/DOVECOT.txt
- added note that quota table is automatically created
- added note about different quota tables for dovecot 1.0/1.1 and >= 1.2


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@730 a1433add-5e2c-0410-b055-b7f2511e0802
15 years ago
Christian Boltz 246a793a7d upgrade.php:
- replaced TYPE=... in CREATE/ALTER TABLE statements with ENGINE= to fix
  compability with MySQL 6.x (TYPE= is no longer supported)
  https://sourceforge.net/projects/postfixadmin/forums/forum/676076/topic/3377035
- new placeholders {INNODB} and {MYISAM} - I don't hope that this needs to be
  changed again, but you never know ;-)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@723 a1433add-5e2c-0410-b055-b7f2511e0802
15 years ago
David Goodwin b8401e5b48 quotation fix; use double quotes with $ silly (thanks to ksb4ever - #2858717 )
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@719 a1433add-5e2c-0410-b055-b7f2511e0802
15 years ago
David Goodwin dadb8094da try and avoid naming conflicts so put _idx on the end of all postgres indexes
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@667 a1433add-5e2c-0410-b055-b7f2511e0802
16 years ago
Christian Boltz 84a5203fe1 list-domain.php:
- replace get_domain_properties() calls with two SQL queries that fetch
  the domain data and count the number of mailboxes and aliases per domain.
  This change speeds up list-domain extremely on setups with lots of domains,
  mailboxes and aliases. The old code took several minutes on my test data
  (that's about 55000 mailboxes and their aliases), the new code only needs
  some seconds.
- $domain_properties now uses the domain name as index key instead of a
  serial number

templates/admin_list-domain.php:
- replace usage of $list_domains with $domain_properties
- change main loop to use the domain name as $domain_properties array key 
  instead of a serial number

upgrade.php:
- upgrade_655(): add index on domain column in mailbox and alias table.
  This speeds up list-domain from 14s to about 1s on my test data in MySQL
  (the 14s were _after_ the changes in list_domain.php)
- added _add_index() function to hide the database specific details in 
  upgrade functions

This commit should fix the performance problems reported on
http://sourceforge.net/forum/forum.php?thread_id=2343349&forum_id=676076



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@655 a1433add-5e2c-0410-b055-b7f2511e0802
16 years ago
Christian Boltz 5ec73b7044 setup.php:
- added form to create setup password hash. It will be displayed if
  a) no setup password is defined yet
  b) the "lost password" link was clicked
- moved checks for empty and too short passwort into check_setup_password()
- added an optional $lostpw_mode parameter to check_setup_password() which
  causes slightly different behaviour (enforces generation of new hash, even
  if the password would match)
- changed check_password_setup() return value to array($error, $message)
- moved displaying $tMessage above the form - it is more useful there.
- removed "see config.inc.php" notice from password field in "create superadmin" 
  form - this hint doesn't help much with the hashed password ;-)
- TODO: The if statements to decide which form to display is quite difficult
  (and will become unreadable in case we need another form ;-)
  We should think about a better way to select the form to display...
  (maybe flash_error / flash_info + redirect?)

upgrade.php:
- added missing <p> tag


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@648 a1433add-5e2c-0410-b055-b7f2511e0802
16 years ago
David Goodwin 84cd5ddfcd upgrade.php: see tdiehl on irc.. perhaps this fixes his problem (i hate mysql)
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@514 a1433add-5e2c-0410-b055-b7f2511e0802
16 years ago
David Goodwin b6c2be4976 upgrade.php: fix mysql alter table add columns to only take place if hte field does not exist
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@511 a1433add-5e2c-0410-b055-b7f2511e0802
16 years ago
David Goodwin 926a774bbf upgrade.php: add _mysql_field_exists() so we do not add fields that are already there; fix bugs -hopefully fix errors seen by Tom me@tdiehl.org - see postfixadmin-devel mailing list etc
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@510 a1433add-5e2c-0410-b055-b7f2511e0802
16 years ago
David Goodwin 1c8d6e63e6 upgrade.php: this makes it work for me...
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@509 a1433add-5e2c-0410-b055-b7f2511e0802
16 years ago
David Goodwin 8bab8fa689 upgrade.php: Fixes from Thiago Silva - see https://sourceforge.net/forum/forum.php?thread_id=2789651&forum_id=676076
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@508 a1433add-5e2c-0410-b055-b7f2511e0802
16 years ago