Koozali.org: home of the SME Server

SOGo update breaks web Calendar Events+Tasks, requires sql update patch

Offline Gary Douglas

  • *
  • 73
  • +1/-0
I found when Updating SOGo from 2.2.17a -> 2.3.1.1  Events and Tasks in the web Calendar could not be added or deleted
I found this thread which advises the update-sql script needs to be run;  http://www.sogo.nu/bugs/view.php?id=3230
I have run the below sql-update script on SME9 and SME8 and it resolves the problem.
I am not a coder so I would prefer if the maintainer of Sogo for SMEServer checked this before either updating the wiki or the packages.

my modified script for SME8 and SME9 is below the dotted lines, when asked for credentials I used root and the password from /root/.my.cnf
svr:~# ./sogo-update.sh

Username (root): root
Hostname (localhost): localhost
Database (root): sogo
This script will ask for the sql password twice

-----------------------
#!/bin/bash
set -e
# This script only works with MySQL
# updates c_partstates to mediumtext
# adds c_description to Calendar quick tables
# http://www.sogo.nu/bugs/view.php?id=3175
# the field length was actually changed in v2.2.18
defaultusername=$USER
defaulthostname=localhost
defaultdatabase=$USER
indextable=$(/usr/sbin/sogo-tool dump-defaults -f /etc/sogo/sogo.conf | awk -F\" '/ OCSFolderInfoURL =/ {print $2}' | awk -F/ '{print $NF}')
if [ -z "$indextable" ]; then
echo "Couldn't fetch OCSFolderInfoURL value, aborting" >&2
exit 1
fi
read -p "Username ($defaultusername): " username
read -p "Hostname ($defaulthostname): " hostname
read -p "Database ($defaultdatabase): " database
if [ -z "$username" ]
then
username=$defaultusername
fi
if [ -z "$hostname" ]
then
hostname=$defaulthostname
fi
if [ -z "$database" ]
then
database=$defaultdatabase
fi
sqlscript=""
function adjustSchema() {
oldIFS="$IFS"
IFS=" "
part1="`echo -e \"ALTER TABLE $table MODIFY c_partstates mediumtext;\\n\"`";
part2="`echo -e \"ALTER TABLE $table ADD COLUMN c_description mediumtext;\\n\"`";
sqlscript="$sqlscript$part1$part2"
IFS="$oldIFS"
}
echo "This script will ask for the sql password twice" >&2
echo "Converting c_partstates from VARCHAR(255) to mediumtext in calendar quick tables" >&2
echo "Adding c_description column as mediumtext in calendar quick tables" >&2
tables=`mysql -p -s -u $username -h $hostname $database -e "select SUBSTRING_INDEX(c_quick_location, '/', -1) from $indextable where c_path3 = 'Calendar';"`
for table in $tables;
do
adjustSchema
done
echo "$sqlscript" | mysql -p -s -u $username -h $hostname $database



guest22

Re: SOGo update breaks web Calendar Events+Tasks, requires sql update patch
« Reply #1 on: August 22, 2015, 12:38:49 PM »
Thanks, good catch.

guest22

Re: SOGo update breaks web Calendar Events+Tasks, requires sql update patch
« Reply #2 on: August 22, 2015, 12:45:15 PM »
my modified script for SME8 and SME9 is below the dotted lines, when asked for credentials I used root and the password from /root/.my.cnf


That should not be necessary on SME Server when the script is run as root. The sript should simply select the database without user and password. 

Offline stephdl

  • *
  • 1,519
  • +0/-0
    • Linux et Geekeries
Re: SOGo update breaks web Calendar Events+Tasks, requires sql update patch
« Reply #3 on: August 22, 2015, 02:14:01 PM »
normally I fixed the case https://github.com/stephdl/smeserver-sogo/commit/6497e7c6fb4e18d9f120440aa5c10fb47ccf2036 but what I missed is to integrate it to the post-event reconfiguration, maybe this is why you get the bug.
thank for reporting :)
See http://wiki.contribs.org/Koozali_Foundation
irc : Freenode #sme_server #sme-fr

!!! Please write your knowledge to the Wiki !!!

Offline stephdl

  • *
  • 1,519
  • +0/-0
    • Linux et Geekeries
Re: SOGo update breaks web Calendar Events+Tasks, requires sql update patch
« Reply #4 on: August 22, 2015, 02:57:29 PM »
smeserver-sogo updated and released to stephdl
See http://wiki.contribs.org/Koozali_Foundation
irc : Freenode #sme_server #sme-fr

!!! Please write your knowledge to the Wiki !!!

guest22

Re: SOGo update breaks web Calendar Events+Tasks, requires sql update patch
« Reply #5 on: August 22, 2015, 03:27:07 PM »
Thanks Stephane!

Offline Gary Douglas

  • *
  • 73
  • +1/-0
Re: SOGo update breaks web Calendar Events+Tasks, requires sql update patch
« Reply #6 on: August 23, 2015, 08:09:21 PM »
thank you Stephane, and for everything else you do for SME Server, without you I would give up!

Offline stephdl

  • *
  • 1,519
  • +0/-0
    • Linux et Geekeries
Re: SOGo update breaks web Calendar Events+Tasks, requires sql update patch
« Reply #7 on: August 23, 2015, 10:38:21 PM »
you are welcome and free to become a volunteer like me.

merci
See http://wiki.contribs.org/Koozali_Foundation
irc : Freenode #sme_server #sme-fr

!!! Please write your knowledge to the Wiki !!!