News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Updating problem

Started by PD3, May 09, 2020, 08:00:41 AM

Previous topic - Next topic

Arantor


vbgamer45

So the old default above   eventDate date NOT NULL default '0001-01-01',
Won't work? And needs to be changed?
I just checked 2.1 and uses the same default date.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Arantor

The birthdate was changed in the members table to 1004-01-01, I assumed this had been changed too for similar reasons (but I stopped caring about the calendar a long time ago)

vbgamer45

Ah, you are right. I was doing a quick search on .sql files the code I was looking at was 1.1 upgrade part.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

PD3

Tried deleting again and running:

CREATE TABLE smf_calendar_holidays (
  ID_HOLIDAY smallint(5) unsigned NOT NULL auto_increment,
  eventDate date NOT NULL default '1004-01-01',
  title varchar(30) NOT NULL default '',
  PRIMARY KEY (ID_HOLIDAY),
  KEY eventDate (eventDate)
) ENGINE=MyISAM;


And that brings up this on the My Sql:

MySQL returned an empty result set (i.e. zero rows). (Query took 0.0020 seconds.)
CREATE TABLE smf_calendar_holidays ( ID_HOLIDAY smallint(5) unsigned NOT NULL auto_increment, eventDate date NOT NULL default '1004-01-01', title varchar(30) NOT NULL default '', PRIMARY KEY (ID_HOLIDAY), KEY eventDate (eventDate) ) ENGINE=MyISAM


and this on the update.php:

Executing database changes
Please be patient - this may take some time on large forums. The time elapsed increments from the server to show progress is being made!
Executing upgrade script 1 of 3.
Executing: "Updating holidays and calendar..." (5 of 19 - of this script)
Error!
Incorrect date value: '0000-00-00' for column 'eventDate' at row 1

shawnb61

Turning strict mode off resolves this issue.

You should leave the original logic, the only change needed is to disable strict mode.
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

PD3

Quote from: shawnb61 on May 11, 2020, 11:05:02 AM
Turning strict mode off resolves this issue.

You should leave the original logic, the only change needed is to disable strict mode.

Thanks for the reply, but the server admins say strict mode is not enabled

Arantor

Ask them to turn off NO_ZERO_DATE mode.

PD3

Quote from: Arantor on May 11, 2020, 11:16:47 AM
Ask them to turn off NO_ZERO_DATE mode.

They tell me because it's a shared environment they're not prepared to mod the PHP

shawnb61

I would set it globally to '' at the server level.

smf1.1 provided the capability to address this by adding
$mysql_set_mode = true;
to Settings.php.  That works, too. 
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

shawnb61

Quote from: PD3 on May 11, 2020, 11:48:06 AM
They tell me because it's a shared environment they're not prepared to mod the PHP

It's not a php setting, it's a mysql setting.

But then try the $mysql_set_mode suggestion from above.
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Shambles

I'd edit the update/upgrade script and remove the restriction from the mysql SESSION variable.

https://github.com/ShamblesX/SMF-Tools/blob/master/RemoveModeFromMysqlSession.php

RemoveModeFromMysqlSession ( 'NO_ZERO_DATE' );

or

RemoveModeFromMysqlSession ( 'STRICT_TRANS_TABLES' );

PD3

Quote from: Shambles on May 11, 2020, 12:16:03 PM
I'd edit the update/upgrade script and remove the restriction from the mysql SESSION variable.

https://github.com/ShamblesX/SMF-Tools/blob/master/RemoveModeFromMysqlSession.php

RemoveModeFromMysqlSession ( 'NO_ZERO_DATE' );

or

RemoveModeFromMysqlSession ( 'STRICT_TRANS_TABLES' );

Thanks for the reply. Where do I run that query, on the root_smf structure? I'm a real noob at this, sorry.

PD3

Quote from: shawnb61 on May 11, 2020, 11:50:58 AM
Quote from: PD3 on May 11, 2020, 11:48:06 AM
They tell me because it's a shared environment they're not prepared to mod the PHP

It's not a php setting, it's a mysql setting.

But then try the $mysql_set_mode suggestion from above.

Error
Static analysis:

4 errors were found during analysis.

Unexpected character. (near "$" at position 0)
Unexpected beginning of statement. (near "$" at position 0)
Unexpected beginning of statement. (near "mysql_set_mode" at position 1)
Unexpected beginning of statement. (near "true" at position 18)
SQL query:

$mysql_set_mode = true

MySQL said: Documentation

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '$mysql_set_mode = true' at line 1

Doug Heffernan

Quote from: PD3 on May 11, 2020, 12:34:25 PM
Quote from: Shambles on May 11, 2020, 12:16:03 PM
I'd edit the update/upgrade script and remove the restriction from the mysql SESSION variable.

https://github.com/ShamblesX/SMF-Tools/blob/master/RemoveModeFromMysqlSession.php

RemoveModeFromMysqlSession ( 'NO_ZERO_DATE' );

or

RemoveModeFromMysqlSession ( 'STRICT_TRANS_TABLES' );

Thanks for the reply. Where do I run that query, on the root_smf structure? I'm a real noob at this, sorry.

It is not a query. It is an edit to the upgrade.php file.

Quote from: PD3 on May 11, 2020, 12:37:49 PM
Quote from: shawnb61 on May 11, 2020, 11:50:58 AM
Quote from: PD3 on May 11, 2020, 11:48:06 AM
They tell me because it's a shared environment they're not prepared to mod the PHP

It's not a php setting, it's a mysql setting.

But then try the $mysql_set_mode suggestion from above.

Error
Static analysis:

4 errors were found during analysis.

Unexpected character. (near "$" at position 0)
Unexpected beginning of statement. (near "$" at position 0)
Unexpected beginning of statement. (near "mysql_set_mode" at position 1)
Unexpected beginning of statement. (near "true" at position 18)
SQL query:

$mysql_set_mode = true

MySQL said: Documentation

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '$mysql_set_mode = true' at line 1

Did you enter the code posted by shawnb61 at your Settings.php file correctly?

shawnb61

Sorry, forgot the semicolon:
$mysql_set_mode = true;

::)
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

PD3

Quote from: doug_ips on May 11, 2020, 12:47:23 PM
Quote from: PD3 on May 11, 2020, 12:34:25 PM
Quote from: Shambles on May 11, 2020, 12:16:03 PM
I'd edit the update/upgrade script and remove the restriction from the mysql SESSION variable.

https://github.com/ShamblesX/SMF-Tools/blob/master/RemoveModeFromMysqlSession.php

RemoveModeFromMysqlSession ( 'NO_ZERO_DATE' );

or

RemoveModeFromMysqlSession ( 'STRICT_TRANS_TABLES' );

Thanks for the reply. Where do I run that query, on the root_smf structure? I'm a real noob at this, sorry.

It is not a query. It is an edit to the upgrade.php file.

Thanks. So if I edit the update file, can I then run it again without damaging anything, even though it's already half way through updating?

Quote
Quote from: PD3 on May 11, 2020, 12:37:49 PM
Quote from: shawnb61 on May 11, 2020, 11:50:58 AM
Quote from: PD3 on May 11, 2020, 11:48:06 AM
They tell me because it's a shared environment they're not prepared to mod the PHP

It's not a php setting, it's a mysql setting.

But then try the $mysql_set_mode suggestion from above.

Error
Static analysis:

4 errors were found during analysis.

Unexpected character. (near "$" at position 0)
Unexpected beginning of statement. (near "$" at position 0)
Unexpected beginning of statement. (near "mysql_set_mode" at position 1)
Unexpected beginning of statement. (near "true" at position 18)
SQL query:

$mysql_set_mode = true

MySQL said: Documentation

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '$mysql_set_mode = true' at line 1

Did you enter the code posted by shawnb61 at your Settings.php file correctly?

I think so. See attachment. I put the script in the window and then press the 'go' button highlighted.

Doug Heffernan

Quote from: PD3 on May 11, 2020, 02:59:13 PM
I think so. See attachment. I put the script in the window and then press the 'go' button highlighted.

You must add it to your Settings.php file and not run it as a query. Said file can be found in the root of your forum folder, the one that contains the db info.

PD3

Quote from: doug_ips on May 11, 2020, 04:11:49 PM
Quote from: PD3 on May 11, 2020, 02:59:13 PM
I think so. See attachment. I put the script in the window and then press the 'go' button highlighted.

You must add it to your Settings.php file and not run it as a query. Said file can be found in the root of your forum folder, the one that contains the db info.

Thanks -- noob mistake, I know  ::)

Doug Heffernan

Quote from: PD3 on May 11, 2020, 06:16:31 PM
Quote from: doug_ips on May 11, 2020, 04:11:49 PM
Quote from: PD3 on May 11, 2020, 02:59:13 PM
I think so. See attachment. I put the script in the window and then press the 'go' button highlighted.

You must add it to your Settings.php file and not run it as a query. Said file can be found in the root of your forum folder, the one that contains the db info.

Thanks -- noob mistake, I know  ::)

Do not worry about it. :)

Advertisement: