Skip to content

Commit

Permalink
Merge branch 'master' of github.com:roundcube/roundcubemail
Browse files Browse the repository at this point in the history
  • Loading branch information
alecpl committed Dec 5, 2017
2 parents 895948f + 6b76b04 commit 608e23c
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 16 deletions.
13 changes: 7 additions & 6 deletions docker/README.md
Expand Up @@ -28,22 +28,23 @@ this option should not be used for production environments.

The recommended way to run Roundcube is connected to a MySQL database. Specify the following env variables to do so:

`MYSQL_ENV_MYSQL_HOST` - Host (or Docker instance) name of the MySQL service; defaults to `mysql`
`ROUNDCUBEMAIL_DB_TYPE` - Database provider; currently supported: `mysql`, `pgsql`, `sqlite`

`MYSQL_ENV_MYSQL_USER` - The database username for Roundcube; defaults to `root`
`ROUNDCUBEMAIL_DB_HOST` - Host (or Docker instance) name of the database service; defaults to `mysql` or `postgres` depending on linked containers.

`MYSQL_ENV_MYSQL_PASSWORD` - The password for the database connection or
`MYSQL_ENV_MYSQL_ROOT_PASSWORD` - if the database username is `root`
`ROUNDCUBEMAIL_DB_USER` - The database username for Roundcube; defaults to `root` on `mysql`

`MYSQL_ENV_MYSQL_DATABASE` - The database name for Roundcube to use; defaults to `roundcubemail`
`ROUNDCUBEMAIL_DB_PASSWORD` - The password for the database connection

`ROUNDCUBEMAIL_DB_NAME` - The database name for Roundcube to use; defaults to `roundcubemail`

Before starting the container, please make sure that the supplied database exists and the given database user
has privileges to create tables.

Run it with a link to the MySQL host and the username/password variables:

```
docker run -e MYSQL_ENV_MYSQL_ROOT_PASSWORD=my-secret-password --link=mysql:mysql -d roundcube/roundcubemail
docker run --link=mysql:mysql -d roundcube/roundcubemail
```

## Building a Docker image
Expand Down
17 changes: 13 additions & 4 deletions docker/docker-entrypoint.sh
Expand Up @@ -15,9 +15,16 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
echo >&2 "Complete! ROUNDCUBEMAIL has been successfully copied to $PWD"
fi

if [ ! -z "${!MYSQL_ENV_MYSQL_*}" ]; then
if [ ! -z "${!POSTGRES_ENV_POSTGRES_*}" ]; then
: "${ROUNDCUBEMAIL_DB_TYPE:=pgsql}"
: "${ROUNDCUBEMAIL_DB_HOST:=postgres}"
: "${ROUNDCUBEMAIL_DB_USER:=${POSTGRES_ENV_POSTGRES_USER}}"
: "${ROUNDCUBEMAIL_DB_PASSWORD:=${POSTGRES_ENV_POSTGRES_PASSWORD}}"
: "${ROUNDCUBEMAIL_DB_NAME:=${POSTGRES_ENV_POSTGRES_DB:-roundcubemail}}"
: "${ROUNDCUBEMAIL_DSNW:=${ROUNDCUBEMAIL_DB_TYPE}://${ROUNDCUBEMAIL_DB_USER}:${ROUNDCUBEMAIL_DB_PASSWORD}@${ROUNDCUBEMAIL_DB_HOST}/${ROUNDCUBEMAIL_DB_NAME}}"
elif [ ! -z "${!MYSQL_ENV_MYSQL_*}" ]; then
: "${ROUNDCUBEMAIL_DB_TYPE:=mysql}"
: "${ROUNDCUBEMAIL_DB_HOST:=${MYSQL_ENV_MYSQL_HOST:-mysql}}"
: "${ROUNDCUBEMAIL_DB_HOST:=mysql}"
: "${ROUNDCUBEMAIL_DB_USER:=${MYSQL_ENV_MYSQL_USER:-root}}"
if [ "$ROUNDCUBEMAIL_DB_USER" = 'root' ]; then
: "${ROUNDCUBEMAIL_DB_PASSWORD:=${MYSQL_ENV_MYSQL_ROOT_PASSWORD}}"
Expand All @@ -28,8 +35,10 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
: "${ROUNDCUBEMAIL_DSNW:=${ROUNDCUBEMAIL_DB_TYPE}://${ROUNDCUBEMAIL_DB_USER}:${ROUNDCUBEMAIL_DB_PASSWORD}@${ROUNDCUBEMAIL_DB_HOST}/${ROUNDCUBEMAIL_DB_NAME}}"
else
# use local SQLite DB in /var/www/html/db
: "${ROUNDCUBEMAIL_DB_TYPE:=sqlite}"
: "${ROUNDCUBEMAIL_DB_DIR:=$PWD/db}"
: "${ROUNDCUBEMAIL_DSNW:=sqlite:///$ROUNDCUBEMAIL_DB_DIR/sqlite.db?mode=0646}"
: "${ROUNDCUBEMAIL_DB_NAME:=sqlite}"
: "${ROUNDCUBEMAIL_DSNW:=${ROUNDCUBEMAIL_DB_TYPE}:///$ROUNDCUBEMAIL_DB_DIR/${ROUNDCUBEMAIL_DB_NAME}.db?mode=0646}"

mkdir -p $ROUNDCUBEMAIL_DB_DIR
chown www-data:www-data $ROUNDCUBEMAIL_DB_DIR
Expand Down Expand Up @@ -70,4 +79,4 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
fi
fi

exec "$@"
exec "$@"
4 changes: 2 additions & 2 deletions program/js/app.js
Expand Up @@ -7868,8 +7868,8 @@ function rcube_webmail()
width = popup.width(),
height = options.height || (popup[0].scrollHeight + 20),
dialog = popup.parent(),
titlebar_height = $('.ui-dialog-titlebar', dialog).outerHeight(),
buttonpane_height = $('.ui-dialog-buttonpane', dialog).outerHeight(),
titlebar_height = $('.ui-dialog-titlebar', dialog).outerHeight() || 0,
buttonpane_height = $('.ui-dialog-buttonpane', dialog).outerHeight() || 0,
padding = (parseInt(dialog.css('padding-top')) + parseInt(popup.css('padding-top'))) * 2;

popup.dialog('option', {
Expand Down
9 changes: 5 additions & 4 deletions program/lib/Roundcube/rcube.php
Expand Up @@ -547,7 +547,7 @@ public function gc()

/**
* Garbage collector function for temp files.
* Remove temp files older than two days
* Removes temporary files older than temp_dir_ttl.
*/
public function gc_temp()
{
Expand All @@ -556,8 +556,9 @@ public function gc_temp()
// expire in 48 hours by default
$temp_dir_ttl = $this->config->get('temp_dir_ttl', '48h');
$temp_dir_ttl = get_offset_sec($temp_dir_ttl);
if ($temp_dir_ttl < 6*3600)
if ($temp_dir_ttl < 6*3600) {
$temp_dir_ttl = 6*3600; // 6 hours sensible lower bound.
}

$expire = time() - $temp_dir_ttl;

Expand All @@ -567,8 +568,8 @@ public function gc_temp()
continue;
}

if (@filemtime($tmp.'/'.$fname) < $expire) {
@unlink($tmp.'/'.$fname);
if (@filemtime("$tmp/$fname") < $expire) {
@unlink("$tmp/$fname");
}
}

Expand Down

0 comments on commit 608e23c

Please sign in to comment.