craigk5n / webcalendar

WebCalendar is a PHP application used to maintain a calendar for a single user or an intranet group of users. It can also be configured as an event calendar.
http://www.k5n.us/webcalendar.php
GNU General Public License v2.0
148 stars 70 forks source link

Installer does not upgrade db properly after v1.3.0 #431

Closed z1atk0 closed 7 months ago

z1atk0 commented 8 months ago

Upgraded from 1.3.0 to 1.9.10 today, which basically went smooth and without errors, and the install script claimed it wouldn't need to update my DB. Turns out that this was not quite correct, though.

I found that I couldn't log in after the upgrade, and after some debugging it turned out that upon (the first?) login, WC wants to convert the stored password from the old scheme (MD5?) to the new scheme (Crypt?). However, my database still had cal_passwd VARCHAR(32) in the webcal_user table, while the new scheme requires cal_passwd VARCHAR(255), so the UPDATE cal_passwd ... statement resulted in a "Data too long for column" error.

Once I updated my DB scheme accordingly, I could log in again just fine. :sunglasses:

So for me this isn't actually an issue anymore, but I thought I'd still report it here in case someone else stumbles across the same thing. And of course it should be fixed in the installer as well. :wink:

z1atk0 commented 8 months ago

Diffing 1.3.0's install/sql/tables-mysql.sql against 1.9.10's showed another two differences in the MySQL scheme, which have not been updated by the install script. One in webcal_entry_categories, and another one in webcal_import:

@@ -127,8 +126,10 @@ CREATE TABLE webcal_entry_categories (
   /* order that user requests their categories appear. */
   /* Globals are always last */
   cat_order INT DEFAULT 0 NOT NULL,
-  /* user that owns this record. Global categories will be NULL */
-  cat_owner varchar(25) DEFAULT NULL
+  /* user that owns this record. Global categories will be empty string */
+  cat_owner varchar(25) DEFAULT '' NOT NULL,
+  PRIMARY KEY ( cal_id, cat_id, cat_order, cat_owner ),
+  INDEX webcal_entry_categories ( cat_id )
@@ -468,10 +469,14 @@ CREATE TABLE webcal_import (
   cal_name VARCHAR(50) NULL,
   /* date of import (YYYYMMDD format) */
   cal_date INT NOT NULL,
+  /* date of last check to see if remote calendar updated (YYYYMMDD format) */
+  cal_check_date INT NULL,
   /* type of import (ical, vcal, palm, outlookcsv) */
   cal_type VARCHAR(10) NOT NULL,
   /* user who performed the import */
   cal_login VARCHAR(25) NULL,
+  /* md5 of last import used to see if a new import changes anything */
+  cal_md5 VARCHAR(32) NULL DEFAULT NULL,
   PRIMARY KEY ( cal_import_id )
 );

I noticed that all of these changes (plus the cal_passwd VARCHAR(32) => cal_passwd VARCHAR(255) one) are actually present in 1.9.10's install/sql/upgrade-mysql.sql, but somehow that didn't get applied by the install script. :man_shrugging:

craigk5n commented 8 months ago

It seems the installer has not been doing db upgrades properly since 1.9.0. The installer code has become almost unmanageable, so I am working on a 80% rewrite of it that will address these issues.

grzchr15 commented 8 months ago

Some ISP provide Php 8.1 only. So what webcalender versions should as next webcalender Br Bretterhofer

Craig Knudsen @.***> schrieb am Fr., 20. Okt. 2023, 21:10:

It seems the installer has not been doing db upgrades properly since 1.9.0. The installer code has become almost unmanageable, so I am working on a 80% rewrite of it that will address these issues.

— Reply to this email directly, view it on GitHub https://github.com/craigk5n/webcalendar/issues/431#issuecomment-1773267943, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAKPGRNZVETGD7YSSZGUG3YALECRAVCNFSM6AAAAAA6HOM33SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONZTGI3DOOJUGM . You are receiving this because you are subscribed to this thread.Message ID: @.***>

craigk5n commented 8 months ago

You can use the latest release, but the installer won't complete successfully. So, you'd have to do some things by hand. Look at this comment for details on how to do that:

https://github.com/craigk5n/webcalendar/issues/430#issuecomment-1773273727

craigk5n commented 7 months ago

The code in master should have a working installer (for mysql). Or you can wait for the 0.9.12 release that will include it.