docker icon indicating copy to clipboard operation
docker copied to clipboard

fix version check without volume var/www/html

Open unteem opened this issue 6 years ago • 12 comments

it fixes https://github.com/nextcloud/docker/issues/489 At the moment the upgrade does not work if there is no volume for /var/www/html/ as it checks /var/www/html/version.php to compare versions. This PR make it so it checks for the version in var/www/html/config which must be persisted and everyone is happy :)

unteem avatar Dec 20 '18 18:12 unteem

This duplicates a lot of code from version_greater. Maybe a "greater or equal" function could cover both cases?

J0WI avatar Jan 05 '19 16:01 J0WI

@J0WI I agree that it looks like there are some duplicated code but the procedure is not the same if the version is equal or greater.

If version is equal I just rsync the php code and do nothing whereas if the version is greater I rsync the php code and upgrade.

What would you recommend to refactor it?

unteem avatar Jan 07 '19 15:01 unteem

You can move the duplicated part to a new function that can be called in both cases.

J0WI avatar Jan 21 '19 15:01 J0WI

Has there been any update on this, it is sorely needed when running in a kubernetes environment where I would like to avoid mounting the php codebase on a remote share.

weikinhuang avatar Mar 11 '19 22:03 weikinhuang

If @unteem is not responding you're welcome to continue here.

J0WI avatar Mar 13 '19 16:03 J0WI

Does this really work? If I I start the apache docker container with a NEXTCLOUD_CONFIG_DIR set, how does this check for the version then? As far as I can tell new script only checks for the config.php in the default config directory?

And my second problem ist: even if I change the script to check in the NEXTCLOUD_CONFIG_DIR, there is no version number set in my config.php

it looks like this:

<?php
$CONFIG = array (
  'passwordsalt' => 'xxxxx',
  'secret' => 'xxxx',
  'trusted_domains' => 
  array (
    0 => 'localhost',
  ),
  'datadirectory' => '/mnt/nextcloudFiles/data',
  'dbtype' => 'mysql',
  'version' => '16.0.1.1',
  'overwrite.cli.url' => 'http://localhost',
  'dbname' => 'nextcloud',
  'dbhost' => '127.0.0.1',
  'dbport' => '',
  'dbtableprefix' => '',
  'dbuser' => 'nextclouduser',
  'dbpassword' => 'xxxxx',
  'installed' => true,
  'instanceid' => 'ocyldeyn9lq3',
); 

timLoewel avatar Jun 26 '19 08:06 timLoewel

there is no version number set in my config.php

'version' => '16.0.1.1', :wink:

J0WI avatar Jun 26 '19 12:06 J0WI

:flushed: how blind I am. sorry..

but I stand by my first point. A custom config dir does not seem to be handled.

timLoewel avatar Jun 26 '19 14:06 timLoewel

Is it planned to fix this issue also for v16?

sebastiansterk avatar Jul 17 '19 17:07 sebastiansterk

Once this is ready we will apply it to all maintained versions.

J0WI avatar Jul 17 '19 22:07 J0WI

@unteem: Thank you very much for this patch. Saved me a lot of time

Is there any reason why this PR is not merged yet?

jgeerds avatar Jul 22 '19 18:07 jgeerds

Is there any reason why this PR is not merged yet?

The review comments above have not yet been resolved.

J0WI avatar Nov 03 '19 13:11 J0WI

closing stale PR

J0WI avatar Oct 08 '24 14:10 J0WI