For some reason, I can not create a new system settings items. . I was able to create them in the past, but it was before I upgraded my site from version 2 to version 3. Did something change?.
Observed behavior
After hitting ‘Create’ button in the systems setting page and fill in the boxes and hit save, The dialog box simply says it could not create a setting.
I looked into error log and saw this.
Thanks for quick response. To make a long story short, you pointed me to the right direction. The editedon column was set to not null and default was set as “0000-00-00 00:00:00”. By setting this column to allow null and default as null, the error disappeared. I can now create systems setting as before.
Looking at the Systems’ settings, Untouched system properties’ editedon columns are all set to “0000-00-00 00:00:00” in the db. These initial settings are now showing “-0001-11-30, 12:00pm” in modx manager’s system settings page’s ‘Last Modified’ field.
I am not sure what has caused it. I have been using a2hosting’s shared linux hosting service for about 8 years and I am not sure if anything has changed on db setting although I suspect they kept server version up-to-date. Current system setting says it is mariaDB 10.5.
I should also mention that I upgraded PHP from 7.2 to 8.2 early this year. I observed increased amount of warning messages (which was discussed elsewhere in this forum by other people) but did not see any obvious errors otherwise so I thought all was good.
As for upgrade path, my tool of choice is your extension. I would like to say I upgraded to 3.0 from 2.8 before upgrading to newer versions as I usually take conservative approach, but I can not recall it for sure.
Yes, it does look similar. As I replied to Bob’s post, I was able to resolve it by changing db’s column setting to allow null.
However, I have also confirmed changing the default value to other than ‘0000-00-00 00:00:00’ such as ‘1970-01-02 00:00:00’ or set it simply to current_timestamp() also fix the problem. Modx has no problem adding the system settings with these settings.
At first look it appeared MariaDB’s default setting is not allowing zero date to be entered.
However, If I set the default value back to ‘0000-00-00 00:00:00’, I can use phpmyadmin console to execute the below query and it works, but not from modx manager page!
So Its still a mystery why there is a problem executing this from PHP script.
Thanks!
Post Edit: I checked my two other modx installs and in their database, these editedon columns default were set to null. At least one of them were upgraded from version 2.x so I dont know what causeed this difference. But it appears that correct setting for ‘editedon’ columns (for lexicon as well) should be default to null.
This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.