? ? Pending

User tests: Successful: Unsuccessful:

avatar csthomas
csthomas
28 Aug 2018

Pull Request for Issue # .

Summary of Changes

This PR changes only datetimes in the module table.
No more zero dates like "0000-00-00 00:00:00" in the module table.

Method checkIn() is only added (almost copy/paste) to set column check_out_time to NULL.
At method store() the default value has been changed to $updateNulls = true to be able to save NULL values.

TODO

  • missing changes for the install files (Mysql, PostgreSQL)
  • missing changes in the update files for Postgresql version

Changes for other tables should be made in the next PRs

Testing Instructions

First way:

  1. On existed 4.0-dev installation upload changes and then click on the database "Fix" button.
    The UPDATE ... query won't be applied by the FIX button. You can do it manually (in phpMyAdmin), but it is not required, the system will work anyway!
    • on Postgresql database Fix button does not work because PR #19707 has not yet been merged in 4.0.

Second way:

  1. Upload changes, then remove file configuration.php and install joomla 4.0 again (also you can test sample data).

In both cases:

  1. After changes will be applied you can create and save modules with real NULL dates.
    Test publish_up, publish_down and check_out_time columns. Everything work as before.

Expected result

You can create, edit and save modules.
Modules are loaded normally on backend and frontend.

How to revert changes in your test db

SET sql_mode = '';
ALTER TABLE `#__modules` MODIFY `publish_up` DATETIME NOT NULL DEFAULT '0000-00-00 0000:00:00';
ALTER TABLE `#__modules` MODIFY `publish_down` DATETIME NOT NULL DEFAULT '0000-00-00 0000:00:00';
ALTER TABLE `#__modules` MODIFY `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 0000:00:00';
avatar csthomas csthomas - open - 28 Aug 2018
avatar csthomas csthomas - change - 28 Aug 2018
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 28 Aug 2018
Category SQL Administration com_admin Libraries
avatar csthomas csthomas - change - 29 Aug 2018
Labels Added: ?
avatar csthomas csthomas - change - 29 Aug 2018
The description was changed
avatar csthomas csthomas - edited - 29 Aug 2018
avatar csthomas csthomas - change - 29 Aug 2018
The description was changed
avatar csthomas csthomas - edited - 29 Aug 2018
avatar laoneo
laoneo - comment - 30 Aug 2018

I like the change. I was always wondering why we bloat the rows with such 0 dates instead of null.

avatar alikon
alikon - comment - 30 Aug 2018

we should do this now in 4.0 or never more

avatar joomla-cms-bot joomla-cms-bot - change - 30 Aug 2018
Category SQL Administration com_admin Libraries SQL Administration com_admin Postgresql Installation Libraries
avatar csthomas csthomas - change - 30 Aug 2018
Title
[4.0][POC] Replace the zero datetime value '0000-00-00 00:00:00' by the real NULL value
[4.0] Replace the zero datetime value '0000-00-00 00:00:00' by the real NULL value
avatar csthomas csthomas - edited - 30 Aug 2018
avatar csthomas csthomas - change - 30 Aug 2018
The description was changed
avatar csthomas csthomas - edited - 30 Aug 2018
avatar csthomas
csthomas - comment - 30 Aug 2018

Ready for core review and test:)

avatar csthomas
csthomas - comment - 31 Aug 2018

By adding patch from curl https://patch-diff.githubusercontent.com/raw/joomla/joomla-cms/pull/19707.diff | git apply --reject you can test the update file for postgresql

avatar csthomas
csthomas - comment - 31 Aug 2018

In the "Files changed" tab it is probably not visible. I copy&paste checkIn() method from Table.php and pasted it into Module.php. Then I changed only the comment and two lines to change the sql zero date with NULL and empty string with null.

I will change the order of methods in the file, and the diff view should be more readable.

avatar csthomas
csthomas - comment - 31 Aug 2018

The diff between Table.php and Module.php for checkIn() method.

screenshot_20180831_113733

I did not want to add changes in Table.php because it breaks other tables.

avatar laoneo
laoneo - comment - 31 Aug 2018

Would be good if we can do it without copy paste. Can you not expand the query with an "or is null" in Table.php?

avatar csthomas
csthomas - comment - 31 Aug 2018

Can you not expand the query with an "or is null" in Table.php?

Read carefully, this is an update query (SET ....):

- ->set($this->_db->quoteName($checkedOutTimeField) . ' = ' . $this->_db->quote($this->_db->getNullDate()));
+ ->set($this->_db->quoteName($checkedOutTimeField) . ' = NULL');
avatar csthomas
csthomas - comment - 31 Aug 2018

I changed the code and now should be more readable, without overloading checkIn() method.

avatar csthomas
csthomas - comment - 4 Sep 2018

@alikon @tonypartridge @ggppdk @Bakual I am asking you for a test, at least for a part, I know people are very busy.

If this go then I can work on the rest of tables.

avatar ggppdk
ggppdk - comment - 4 Sep 2018

I have tested this item successfully on b3e640c

@csthomas thanks for making such PRs to improve / fix Database API and Database handling

I have tested with MySQL
frontend and backend modules,

also looked to see if there are more places to be updated with usage of isNullDatetime() by looking at files that have #__modules as
but did not find any more places


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/21901.

avatar ggppdk ggppdk - test_item - 4 Sep 2018 - Tested successfully
avatar alikon
alikon - comment - 10 Sep 2018

on my to do list

avatar laoneo
laoneo - comment - 26 Sep 2018

Can we get here some tests? Would be nice to get it in.

avatar alikon
alikon - comment - 14 Nov 2018

I have tested this item successfully on a692e02

sorry for the delay


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/21901.

avatar alikon alikon - test_item - 14 Nov 2018 - Tested successfully
avatar csthomas
csthomas - comment - 14 Nov 2018

There is some conflicts so I have to resolve it. @wilsonge do you have time to review the code?

avatar csthomas csthomas - change - 14 Nov 2018
Labels Added: ?
avatar csthomas
csthomas - comment - 14 Nov 2018

I rebased PR. There were conflicts in sql files. Now there is need one more test.

avatar laoneo
laoneo - comment - 3 Dec 2018

Would be good to get some more tests here and the conflicts fixed, so we can get it merged.

avatar csthomas
csthomas - comment - 3 Dec 2018

I did what I could. Your turn.

avatar ggppdk
ggppdk - comment - 19 Mar 2019

#24151

So what is the status with this PR ?
Furthermore after this gets merged , more similar PRs will be needed

avatar wilsonge
wilsonge - comment - 19 Mar 2019

Let's go for this. I think we still have other compatibility issues. But this seems like a positive starting point.

avatar wilsonge wilsonge - change - 19 Mar 2019
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2019-03-19 20:03:22
Closed_By wilsonge
avatar wilsonge wilsonge - close - 19 Mar 2019
avatar wilsonge wilsonge - merge - 19 Mar 2019
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 20 Mar 2019

@ggppdk can #24151 be closed or needs more Pull Requests?

avatar wilsonge
wilsonge - comment - 20 Mar 2019

@franz-wohlkoenig needs more. this rolls it out for modules. this will need rolling out everywhere that has a publish up/down column (com_content etc etc)

avatar hardik-codes
hardik-codes - comment - 20 Mar 2019

Members may I help with further PRs ?
@wilsonge @franz-wohlkoenig

avatar wilsonge
wilsonge - comment - 20 Mar 2019

Fine by me

avatar hardik-codes
hardik-codes - comment - 20 Mar 2019

Fine by me

Where in are the further changes to be made?

avatar sakiss
sakiss - comment - 14 Jun 2019

Tested that and works.
Fixes the error messages related with empty published_up, published_down and checked_out_time in the module saving as well.

Add a Comment

Login with GitHub to post a comment