Gargaj / wuhu

Lightweight Party Management System

Home Page:http://wuhu.function.hu/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Timetable plugin is broken

sesse opened this issue · comments

Hi,

When trying to activate the timetable plugin on a fresh install, I get a 500 Internal Server Error. The log says:

[Thu May 18 22:35:00.290093 2017] [:error] [pid 23888] [client 2001:67c:a4:1:5e51:4fff:fe2f:86ef:47510] PHP Fatal error: Uncaught exception 'Exception' with message '<pre>\nMySQL ERROR:\nError: Invalid default value for 'date'\nQuery: CREATE TABLE `timetable` ( `id` int(11) NOT NULL auto_increment, `day` smallint(6) NOT NULL, `date` datetime NOT NULL default '00:00:00', `type` enum('mainevent','event','deadline','compo','seminar') collate utf8_unicode_ci NOT NULL, `event` text collate utf8_unicode_ci NOT NULL, `link` text collate utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; ' in /srv/wuhu/www_admin/sqllib.inc.php:57\nStack trace:\n#0 /srv/wuhu/www_admin/plugins/timetable/plugin.php(167): SQLLib::Query(' CREATE TABLE `...')\n#1 /srv/wuhu/www_admin/hooks.inc.php(17): timetable_activation(NULL)\n#2 /srv/wuhu/www_admin/plugins.php(30): run_hook('timetable_activ...')\n#3 {main}\n thrown in /srv/wuhu/www_admin/sqllib.inc.php on line 57, referer: https://admin.party.solskogen.no/plugins.php

Evidently '00:00:00' isn't valid for MySQL's DATETIME type; you will also need a date (https://dev.mysql.com/doc/refman/5.7/en/date-and-time-literals.html).

Does removing the default value work?

It creates the table just fine. Whether the functionality itself works or not, I honestly don't know; I haven't gotten to actually using the plugin yet.

The rows never get inserted without human-supplied value so the question is only about creation.

Fixed in d9320f6

Somehow it doesn't work; I get just a blank page when adding something, and the PHP error log says:

[Fri May 19 01:04:26.739375 2017] [:error] [pid 18432] [client 2001:67c:a4:1:5e51:4fff:fe2f:86ef:50292] PHP Fatal error:  Uncaught exception 'Exception' with message '<pre>\nMySQL ERROR:\nError: Field 'day' doesn't have a default value\nQuery: insert timetable (`date`, `type`, `event`, `link`) values ('2017-07-13 01:04:22', 'mainevent', 'event', 'http://dev.null')' in /srv/wuhu/www_admin/sqllib.inc.php:57\nStack trace:\n#0 /srv/wuhu/www_admin/sqllib.inc.php(105): SQLLib::Query('insert timetabl...')\n#1 /srv/wuhu/www_admin/cmsgen.inc.php(93): SQLLib::InsertRow('timetable', Array)\n#2 /srv/wuhu/www_admin/plugins/timetable/options.php(58): cmsProcessPost(Array)\n#3 /srv/wuhu/www_admin/pluginoptions.php(8): include('/srv/wuhu/www_a...')\n#4 {main}\n  thrown in /srv/wuhu/www_admin/sqllib.inc.php on line 57, referer: https://admin.party.solskogen.no/pluginoptions.php?plugin=timetable&new=add

Yeah that column isn't even used I think, let me check

Fixed in 72676bc - you might need to kill the day column manually from the db

Yes, that seems to do it :-) (I just nuked the entire table and reinstalled the plugin.)