]> git.mxchange.org Git - friendica.git/commit - doc/database/db_oembed.md
Fix for MySQL 5.7+
authorAlexandre Alapetite <alexandre@alapetite.fr>
Tue, 11 Apr 2017 21:00:45 +0000 (23:00 +0200)
committerAlexandre Alapetite <alexandre@alapetite.fr>
Tue, 11 Apr 2017 21:00:45 +0000 (23:00 +0200)
commitd2901dcb00c3b0a2b7ad04aff18e4e9787b292d3
tree25504b8d77f819ccafa0a1c7dc64be758fa150db
parent0d2bf557de7e3b44d16cadf85dabf05546a4828e
Fix for MySQL 5.7+

https://github.com/friendica/friendica/issues/2786

Only tested on Ubuntu 16.10 with MySQL 5.7.17.

https://dev.mysql.com/doc/refman/8.0/en/timestamp-initialization.html

https://dev.mysql.com/doc/refman/8.0/en/sql-mode.html#sqlmode_no_zero_date
As of MySQL 5.7.4, NO_ZERO_DATE is deprecated.

Patch based on the following search & replace (and then reverting some
changes in libraries):

```sh
grep -l '= "0000-00-00"' -r . | xargs sed -i -e "s/= \"0000-00-00\"/=
'0000-00-00'/g"

grep -l "0000-00-00" -r . | xargs sed -i -e "s/0000-00-00/0001-01-01/g"

grep -l "!= '0001-01-01'" -r . | xargs sed -i -e "s/!= '0001-01-01'/>
'0001-01-01'/g"

grep -l " === '0001-01-01'" -r . | xargs sed -i -e "s/ === '0001-01-01'/
<= '0001-01-01'/g"

grep -l " == '0001-01-01'" -r . | xargs sed -i -e "s/ == '0001-01-01'/
<= '0001-01-01'/g"

grep -l "strpos(\$dob, '0000-') === 0" -r . | xargs sed -i -e
"s/strpos(\$dob, '0000-') === 0/strpos(\$dob, '0000-') === 0 ||
strpos(\$dob, '0001-') === 0/g"

grep -l 'array("", "0001-01-01")' -r . | xargs sed -i -e 's/array("",
"0001-01-01")/array("", "0000-00-00", "0001-01-01")/g'

grep -l "\$dob = '0000-'" -r . | xargs sed -i -e "s/\$dob =
'0000-'/\$dob = '0001-'/g"
```
37 files changed:
database.sql
doc/database/db_attach.md
doc/database/db_cache.md
doc/database/db_contact.md
doc/database/db_conv.md
doc/database/db_event.md
doc/database/db_fcontact.md
doc/database/db_fsuggest.md
doc/database/db_gcontact.md
doc/database/db_glink.md
doc/database/db_gserver.md
doc/database/db_intro.md
doc/database/db_item.md
doc/database/db_locks.md
doc/database/db_mail.md
doc/database/db_mailacct.md
doc/database/db_notify.md
doc/database/db_oembed.md
doc/database/db_parsed_url.md
doc/database/db_photo.md
doc/database/db_profile.md
doc/database/db_queue.md
doc/database/db_register.md
doc/database/db_spam.md
doc/database/db_term.md
doc/database/db_thread.md
doc/database/db_user.md
doc/database/db_workerqueue.md
friendica_test_data.sql
include/Contact.php
include/datetime.php
include/dbstructure.php
include/dfrn.php
include/diaspora.php
include/identity.php
mod/hovercard.php
mod/profiles.php