Page 1 of 1

Admin database restore

Posted: Tue Dec 31, 2024 7:21 am
by Pierre_P
I am trying to restore a backup through my admin side but it's complaining and fatal errors.
I did check the file paths to be correct.
Tried on local test server and live server

Phoenix v1.0.9.10
PHP 8.2

Code: Select all

Fatal error: Uncaught mysqli_sql_exception: Invalid default value for 'date_added' in /--removed--/includes/system/versioned/1.0.8.9/sql_file.php:45 Stack trace: #0 /--removed--/includes/system/versioned/1.0.8.9/sql_file.php(45): mysqli->next_result() #1 /--removed--/includes/system/versioned/1.0.8.9/sql_file.php(50): sql_file->run_sql('# CE Phoenix, E...') #2 /--removed--/includes/system/versioned/1.0.8.9/sql_file.php(117): sql_file->run_sql_or_die('# CE Phoenix, E...') #3 /--removed--/includes/system/versioned/1.0.8.9/sql_file.php(147): sql_file->restore_sql('/usr/www/users/...') #4 /--removed--/admin/includes/actions/backup/restore_now.php(16): sql_file->decompress_and_restore() #5 /--removed--/admin/includes/segments/process_action.php(19): require('/usr/www/users/...') #6 /--removed--/admin/backup.php(30): require('/usr/www/users/...') #7 {main} thrown in /--removed--/includes/system/versioned/1.0.8.9/sql_file.php on line 45

Re: Admin database restore

Posted: Tue Dec 31, 2024 10:08 am
by burt
https://stackoverflow.com/questions/919 ... tamp-field
That is because of server SQL Mode - NO_ZERO_DATE.

From the reference: NO_ZERO_DATE - In strict mode, doesn't allow '0000-00-00' as a valid date. You can still insert zero dates with the IGNORE option. When not in strict mode, the date is accepted but a warning is generated.

Re: Admin database restore

Posted: Tue Dec 31, 2024 11:23 am
by Pierre_P
Understandable the date is set to NOW() i suppose in the sql

This happens also in a new install.
Where to fix?

Re: Admin database restore

Posted: Tue Dec 31, 2024 9:24 pm
by ecartz
Pierre_P wrote: Tue Dec 31, 2024 11:23 am Where to fix?
I'd try the table definition in the SQL. Try running the table definition SQL manually in phpMyAdmin or similar to see if it gives better error messages. If that runs without errors, try the inserts with date_added.

Or turn off NO_ZERO_DATE or strict mode on the database.