anvc / scalar

Born-digital, open source, media-rich scholarly publishing that’s as easy as blogging.
Other
231 stars 73 forks source link

MySQL 5.6 datetime issues #36

Closed burki closed 8 years ago

burki commented 8 years ago

Upon creating a new page, I get the error: Incorrect datetime value: '2016-03-03T14:45:21+01:00' for column 'created' for INSERT INTO scalar_db_content (book_id, slug, type, is_live, color, user , created, thumbnail, background, banner, custom_style, custom_scripts, audio) VALUES (1, 'index', 'composite', '1', '', 1, '2016-03-03T14:45:21+01:00', '', '', '', '', '', '')

The +01:00 comes from $data['created'] = date('c') in page_model.php (similar in reply_model).

In book_model.php / version_model.php you use 'created'=>$mysqldate = date('Y-m-d H:i:s')

It probably makes sense to add a constant or a method to use the same datetime-formatting (without the timezone-appendix) everywhere.

craigdietrich commented 8 years ago

Hi @burki,

Thanks for your reports! I haven't had a chance to use MySQL 5.6, but I'm assuming this and the other issues you've run in to are related to this version. Our testing and production environments are all 5.5.

For example, I could see 5.6 not allowing a date('c') formatted string, while 5.5 does.

Is it possible to revert your MySQL to version 5.5? We haven't heard other reports of this nature from installs there, so this would be a quick fix.

In the meantime, @paulshannon has prompted us to start looking into 5.6 (and 5.7) in an earnest way. I'm hoping to start this effort soon. Maybe you'd like to be involved? For example, a pull request from you with updates to the issues you've noticed would be most appreciated!

burki commented 8 years ago

Hi @craigdietrich See https://github.com/anvc/scalar/pull/38 for a pull-request to fix the issues I encountered so far with MySQL 5.6.