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"
```
This commit is contained in:
Alexandre Alapetite 2017-04-11 23:00:45 +02:00
parent 0d2bf557de
commit d2901dcb00
37 changed files with 139 additions and 139 deletions

View file

@ -169,7 +169,7 @@ CREATE TABLE IF NOT EXISTS `contact` (
`info` mediumtext,
`profile-id` int(11) NOT NULL DEFAULT 0,
`bdyear` varchar(4) NOT NULL DEFAULT '',
`bd` date NOT NULL DEFAULT '0000-00-00',
`bd` date NOT NULL DEFAULT '0001-01-01',
`notify_new_posts` tinyint(1) NOT NULL DEFAULT 0,
`fetch_further_information` tinyint(1) NOT NULL DEFAULT 0,
`ffi_keyword_blacklist` text,
@ -328,7 +328,7 @@ CREATE TABLE IF NOT EXISTS `gcontact` (
`about` text,
`keywords` text,
`gender` varchar(32) NOT NULL DEFAULT '',
`birthday` varchar(32) NOT NULL DEFAULT '0000-00-00',
`birthday` varchar(32) NOT NULL DEFAULT '0001-01-01',
`community` tinyint(1) NOT NULL DEFAULT 0,
`contact-type` tinyint(1) NOT NULL DEFAULT -1,
`hide` tinyint(1) NOT NULL DEFAULT 0,
@ -792,7 +792,7 @@ CREATE TABLE IF NOT EXISTS `profile` (
`hide-friends` tinyint(1) NOT NULL DEFAULT 0,
`name` varchar(255) NOT NULL DEFAULT '',
`pdesc` varchar(255) NOT NULL DEFAULT '',
`dob` varchar(32) NOT NULL DEFAULT '0000-00-00',
`dob` varchar(32) NOT NULL DEFAULT '0001-01-01',
`address` varchar(255) NOT NULL DEFAULT '',
`locality` varchar(255) NOT NULL DEFAULT '',
`region` varchar(255) NOT NULL DEFAULT '',

View file

@ -10,8 +10,8 @@ Table attach
| filetype | mimetype | varchar(64) | NO | | | |
| filesize | size in bytes | int(11) | NO | | 0 | |
| data | file data | longblob | NO | | NULL | |
| created | creation time | datetime | NO | | 0000-00-00 00:00:00 | |
| edited | last edit time | datetime | NO | | 0000-00-00 00:00:00 | |
| created | creation time | datetime | NO | | 0001-01-01 00:00:00 | |
| edited | last edit time | datetime | NO | | 0001-01-01 00:00:00 | |
| allow_cid | Access Control - list of allowed contact.id '<19><78> | mediumtext | NO | | NULL | |
| allow_gid | Access Control - list of allowed groups | mediumtext | NO | | NULL | |
| deny_cid | Access Control - list of denied contact.id | mediumtext | NO | | NULL | |

View file

@ -5,7 +5,7 @@ Table cache
| ------------ | ---------------------------------- | ------------ | ---- | --- | ------------------- | ----- |
| k | horizontal width + url or resource | varchar(255) | NO | PRI | NULL | |
| v | OEmbed response from site | text | NO | | NULL | |
| updated | datetime of cache insertion | datetime | NO | MUL | 0000-00-00 00:00:00 | |
| updated | datetime of cache insertion | datetime | NO | MUL | 0001-01-01 00:00:00 | |
| expire_mode | | int(11) | NO | | 0 | |
Return to [database documentation](help/database)

View file

@ -5,7 +5,7 @@ Table contact
|---------------------------|-----------------------------------------------------------|--------------|------|-----|---------------------|----------------|
| id | sequential ID | int(11) | NO | PRI | NULL | auto_increment |
| uid | user.id of the owner of this data | int(11) | NO | MUL | 0 | |
| created | | datetime | NO | | 0000-00-00 00:00:00 | |
| created | | datetime | NO | | 0001-01-01 00:00:00 | |
| self | 1 if the contact is the user him/her self | tinyint(1) | NO | | 0 | |
| remote_self | | tinyint(1) | NO | | 0 | |
| rel | The kind of the relation between the user and the contact | tinyint(1) | NO | | 0 | |
@ -41,14 +41,14 @@ Table contact
| usehub | | tinyint(1) | NO | | 0 | |
| subhub | | tinyint(1) | NO | | 0 | |
| hub-verify | | varchar(255) | NO | | | |
| last-update | Date of the last try to update the contact info | datetime | NO | | 0000-00-00 00:00:00 | |
| success_update | Date of the last successful contact update | datetime | NO | | 0000-00-00 00:00:00 | |
| failure_update | Date of the last failed update | datetime | NO | | 0000-00-00 00:00:00 | |
| name-date | | datetime | NO | | 0000-00-00 00:00:00 | |
| uri-date | | datetime | NO | | 0000-00-00 00:00:00 | |
| avatar-date | | datetime | NO | | 0000-00-00 00:00:00 | |
| term-date | | datetime | NO | | 0000-00-00 00:00:00 | |
| last-item | date of the last post | datetime | NO | | 0000-00-00 00:00:00 | |
| last-update | Date of the last try to update the contact info | datetime | NO | | 0001-01-01 00:00:00 | |
| success_update | Date of the last successful contact update | datetime | NO | | 0001-01-01 00:00:00 | |
| failure_update | Date of the last failed update | datetime | NO | | 0001-01-01 00:00:00 | |
| name-date | | datetime | NO | | 0001-01-01 00:00:00 | |
| uri-date | | datetime | NO | | 0001-01-01 00:00:00 | |
| avatar-date | | datetime | NO | | 0001-01-01 00:00:00 | |
| term-date | | datetime | NO | | 0001-01-01 00:00:00 | |
| last-item | date of the last post | datetime | NO | | 0001-01-01 00:00:00 | |
| priority | | tinyint(3) | NO | | 0 | |
| blocked | | tinyint(1) | NO | | 1 | |
| readonly | posts of the contact are readonly | tinyint(1) | NO | | 0 | |
@ -64,7 +64,7 @@ Table contact
| info | | mediumtext | NO | | NULL | |
| profile-id | | int(11) | NO | | 0 | |
| bdyear | | varchar(4) | NO | | | |
| bd | | date | NO | | 0000-00-00 | |
| bd | | date | NO | | 0001-01-01 | |
| notify_new_posts | | tinyint(1) | NO | | 0 | |
| fetch_further_information | | tinyint(1) | NO | | 0 | |
| ffi_keyword_blacklist | | mediumtext | NO | | NULL | |

View file

@ -8,8 +8,8 @@ Table conv
| recips | sender_handle;recipient_handle | mediumtext | NO | | NULL | |
| uid | user_id of the owner of this data | int(11) | NO | MUL | 0 | |
| creator | handle of creator | varchar(255) | NO | | | |
| created | creation timestamp | datetime | NO | | 0000-00-00 00:00:00 | |
| updated | edited timestamp | datetime | NO | | 0000-00-00 00:00:00 | |
| created | creation timestamp | datetime | NO | | 0001-01-01 00:00:00 | |
| updated | edited timestamp | datetime | NO | | 0001-01-01 00:00:00 | |
| subject | subject of initial message | mediumtext | NO | | NULL | |
Return to [database documentation](help/database)

View file

@ -7,10 +7,10 @@ Table event
| uid | user_id of the owner of this data | int(11) | NO | MUL | 0 | |
| cid | contact_id (ID of the contact in contact table) | int(11) | NO | | 0 | |
| uri | | varchar(255) | NO | | | |
| created | creation time | datetime | NO | | 0000-00-00 00:00:00 | |
| edited | last edit time | datetime | NO | | 0000-00-00 00:00:00 | |
| start | event start time | datetime | NO | | 0000-00-00 00:00:00 | |
| finish | event end time | datetime | NO | | 0000-00-00 00:00:00 | |
| created | creation time | datetime | NO | | 0001-01-01 00:00:00 | |
| edited | last edit time | datetime | NO | | 0001-01-01 00:00:00 | |
| start | event start time | datetime | NO | | 0001-01-01 00:00:00 | |
| finish | event end time | datetime | NO | | 0001-01-01 00:00:00 | |
| summary | short description or title of the event | text | NO | | NULL | |
| desc | event description | text | NO | | NULL | |
| location | event location | text | NO | | NULL | |

View file

@ -19,6 +19,6 @@ Table fcontact
| network | | varchar(32) | NO | | | |
| alias | | varchar(255) | NO | | | |
| pubkey | | text | NO | | NULL | |
| updated | | datetime | NO | | 0000-00-00 00:00:00 | |
| updated | | datetime | NO | | 0001-01-01 00:00:00 | |
Return to [database documentation](help/database)

View file

@ -11,6 +11,6 @@ Table fsuggest
| request | | varchar(255) | NO | | | |
| photo | | varchar(255) | NO | | | |
| note | | text | NO | | NULL | |
| created | | datetime | NO | | 0000-00-00 00:00:00 | |
| created | | datetime | NO | | 0001-01-01 00:00:00 | |
Return to [database documentation](help/database)

View file

@ -10,15 +10,15 @@ Table gcontact
| nurl | | varchar(255) | NO | MUL | | |
| photo | Link to the profile photo | varchar(255) | NO | | | |
| connect | | varchar(255) | NO | | | |
| created | | datetime | NO | | 0000-00-00 00:00:00 | |
| updated | | datetime | YES | MUL | 0000-00-00 00:00:00 | |
| last_contact | | datetime | YES | | 0000-00-00 00:00:00 | |
| last_failure | | datetime | YES | | 0000-00-00 00:00:00 | |
| created | | datetime | NO | | 0001-01-01 00:00:00 | |
| updated | | datetime | YES | MUL | 0001-01-01 00:00:00 | |
| last_contact | | datetime | YES | | 0001-01-01 00:00:00 | |
| last_failure | | datetime | YES | | 0001-01-01 00:00:00 | |
| location | | varchar(255) | NO | | | |
| about | | text | NO | | NULL | |
| keywords | puplic keywords (interests) | text | NO | | NULL | |
| gender | | varchar(32) | NO | | | |
| birthday | | varchar(32) | NO | | 0000-00-00 | |
| birthday | | varchar(32) | NO | | 0001-01-01 | |
| community | 1 if contact is forum account | tinyint(1) | NO | | 0 | |
| hide | 1 = should be hidden from search | tinyint(1) | NO | | 0 | |
| nsfw | 1 = contact posts nsfw content | tinyint(1) | NO | | 0 | |

View file

@ -8,6 +8,6 @@ Table glink
| uid | | int(11) | NO | | 0 | |
| gcid | | int(11) | NO | MUL | 0 | |
| zcid | | int(11) | NO | MUL | 0 | |
| updated | | datetime | NO | | 0000-00-00 00:00:00 | |
| updated | | datetime | NO | | 0001-01-01 00:00:00 | |
Return to [database documentation](help/database)

View file

@ -14,10 +14,10 @@ Table gserver
| noscrape | | varchar(255) | NO | | | |
| network | | varchar(32) | NO | | | |
| platform | | varchar(255) | NO | | | |
| created | | datetime | NO | | 0000-00-00 00:00:00 | |
| last_poco_query | | datetime | YES | | 0000-00-00 00:00:00 | |
| last_contact | | datetime | YES | | 0000-00-00 00:00:00 | |
| last_failure | | datetime | YES | | 0000-00-00 00:00:00 | |
| created | | datetime | NO | | 0001-01-01 00:00:00 | |
| last_poco_query | | datetime | YES | | 0001-01-01 00:00:00 | |
| last_contact | | datetime | YES | | 0001-01-01 00:00:00 | |
| last_failure | | datetime | YES | | 0001-01-01 00:00:00 | |
Return to [database documentation](help/database)

View file

@ -11,7 +11,7 @@ Table intro
| duplex | | tinyint(1) | NO | | 0 | |
| note | | text | NO | | NULL | |
| hash | | varchar(255) | NO | | | |
| datetime | | datetime | NO | | 0000-00-00 00:00:00 | |
| datetime | | datetime | NO | | 0001-01-01 00:00:00 | |
| blocked | | tinyint(1) | NO | | 1 | |
| ignore | | tinyint(1) | NO | | 0 | |

View file

@ -16,11 +16,11 @@ Table item
| parent-uri | uri of the parent to this item | varchar(255) | NO | MUL | | |
| extid | | varchar(255 | NO | MUL | | |
| thr-parent | If the parent of this item is not the top-level item in the conversation, the uri of the immediate parent; otherwise set to parent-uri | varchar(255) | NO | | | |
| created | Creation timestamp. | datetime | NO | | 0000-00-00 00:00:00 | |
| edited | Date of last edit (default is created) | datetime | NO | | 0000-00-00 00:00:00 | |
| commented | Date of last comment/reply to this item | datetime | NO | | 0000-00-00 00:00:00 | |
| received | datetime | datetime | NO | | 0000-00-00 00:00:00 | |
| changed | Date that something in the conversation changed, indicating clients should fetch the conversation again | datetime | NO | | 0000-00-00 00:00:00 | |
| created | Creation timestamp. | datetime | NO | | 0001-01-01 00:00:00 | |
| edited | Date of last edit (default is created) | datetime | NO | | 0001-01-01 00:00:00 | |
| commented | Date of last comment/reply to this item | datetime | NO | | 0001-01-01 00:00:00 | |
| received | datetime | datetime | NO | | 0001-01-01 00:00:00 | |
| changed | Date that something in the conversation changed, indicating clients should fetch the conversation again | datetime | NO | | 0001-01-01 00:00:00 | |
| owner-name | Name of the owner of this item | varchar(255) | NO | | | |
| owner-link | Link to the profile page of the owner of this item | varchar(255) | NO | | | |
| owner-avatar | Link to the avatar picture of the owner of this item | varchar(255) | NO | | | |

View file

@ -6,6 +6,6 @@ Table locks
| id | sequential ID | int(11) | NO | PRI | NULL | auto_increment |
| name | | varchar(128) | NO | | | |
| locked | | tinyint(1) | NO | | 0 | |
| created | | datetime | YES | | 0000-00-00 00:00:00 | |
| created | | datetime | YES | | 0001-01-01 00:00:00 | |
Return to [database documentation](help/database)

View file

@ -19,6 +19,6 @@ Table mail
| unknown | if sender not in the contact table this is 1 | varchar(255) | NO | | 0 | |
| uri | | varchar(255) | NO | MUL | | |
| parent-uri | | varchar(255) | NO | MUL | | |
| created | creation time of the private message | datetime | NO | | 0000-00-00 00:00:00 | |
| created | creation time of the private message | datetime | NO | | 0001-01-01 00:00:00 | |
Return to [database documentation](help/database)

View file

@ -15,6 +15,6 @@ Table mailacct
| action | | int(11) | NO | | 0 | |
| movetofolder | | varchar(255) | NO | | | |
| pubmail | | tinyint(1) | NO | | 0 | |
| last_check | | datetime | NO | | 0000-00-00 00:00:00 | |
| last_check | | datetime | NO | | 0001-01-01 00:00:00 | |
Return to [database documentation](help/database)

View file

@ -9,7 +9,7 @@ Table notify
| name | | varchar(255) | NO | | | |
| url | | varchar(255) | NO | | | |
| photo | | varchar(255) | NO | | | |
| date | | datetime | NO | | 0000-00-00 00:00:00 | |
| date | | datetime | NO | | 0001-01-01 00:00:00 | |
| msg | | mediumtext | YES | | NULL | |
| uid | user.id of the owner of this data | int(11) | NO | MUL | 0 | |
| link | | varchar(255) | NO | | | |

View file

@ -5,6 +5,6 @@ Table oembed
| ------------ | ---------------------------------- | ------------ | ---- | --- | ------------------- | ----- |
| url | page url | varchar(255) | NO | PRI | NULL | |
| content | OEmbed data of the page | text | NO | | NULL | |
| created | datetime of creation | datetime | NO | MUL | 0000-00-00 00:00:00 | |
| created | datetime of creation | datetime | NO | MUL | 0001-01-01 00:00:00 | |
Return to [database documentation](help/database)

View file

@ -7,6 +7,6 @@ Table parsed_url
| guessing | is the "guessing" mode active? | tinyint(1) | NO | PRI | 0 | |
| oembed | is the data the result of oembed? | tinyint(1) | NO | PRI | 0 | |
| content | page data | text | NO | | NULL | |
| created | datetime of creation | datetime | NO | MUL | 0000-00-00 00:00:00 | |
| created | datetime of creation | datetime | NO | MUL | 0001-01-01 00:00:00 | |
Return to [database documentation](help/database)

View file

@ -8,8 +8,8 @@ Table photo
| contact-id | contact.id | int(10) unsigned | NO | | 0 | |
| guid | A unique identifier for this photo | varchar(64) | NO | MUL | | |
| resource-id | | varchar(255) | NO | MUL | | |
| created | creation date | datetime | NO | | 0000-00-00 00:00:00 | |
| edited | last edited date | datetime | NO | | 0000-00-00 00:00:00 | |
| created | creation date | datetime | NO | | 0001-01-01 00:00:00 | |
| edited | last edited date | datetime | NO | | 0001-01-01 00:00:00 | |
| title | | varchar(255) | NO | | | |
| desc | | text | NO | | NULL | |
| album | The name of the album to which the photo belongs | varchar(255) | NO | | | |

View file

@ -10,7 +10,7 @@ Table profile
| hide-friends | Hide friend list from viewers of this profile | tinyint(1) | NO | | 0 | |
| name | | varchar(255) | NO | | | |
| pdesc | Title or description | varchar(255) | NO | | | |
| dob | Day of birth | varchar(32) | NO | | 0000-00-00 | |
| dob | Day of birth | varchar(32) | NO | | 0001-01-01 | |
| address | | varchar(255) | NO | | | |
| locality | | varchar(255) | NO | | | |
| region | | varchar(255) | NO | | | |
@ -20,7 +20,7 @@ Table profile
| gender | | varchar(32) | NO | | | |
| marital | | varchar(255) | NO | | | |
| with | | text | NO | | NULL | |
| howlong | | datetime | NO | | 0000-00-00 00:00:00 | |
| howlong | | datetime | NO | | 0001-01-01 00:00:00 | |
| sexual | | varchar(255) | NO | | | |
| politic | | varchar(255) | NO | | | |
| religion | | varchar(255) | NO | | | |

View file

@ -6,8 +6,8 @@ Table queue
| id | sequential ID | int(11) | NO | PRI | NULL | auto_increment |
| cid | | int(11) | NO | MUL | 0 | |
| network | | varchar(32) | NO | MUL | | |
| created | | datetime | NO | MUL | 0000-00-00 00:00:00 | |
| last | | datetime | NO | MUL | 0000-00-00 00:00:00 | |
| created | | datetime | NO | MUL | 0001-01-01 00:00:00 | |
| last | | datetime | NO | MUL | 0001-01-01 00:00:00 | |
| content | | mediumtext | NO | | NULL | |
| batch | | tinyint(1) | NO | MUL | 0 | |

View file

@ -5,7 +5,7 @@ Table register
| -------- | ------------- | ---------------- | ---- | --- | ------------------- | --------------- |
| id | sequential ID | int(11) unsigned | NO | PRI | NULL | auto_increment |
| hash | | varchar(255) | NO | | | |
| created | | datetime | NO | | 0000-00-00 00:00:00 | |
| created | | datetime | NO | | 0001-01-01 00:00:00 | |
| uid | user.id | int(11) unsigned | NO | | | |
| password | | varchar(255) | NO | | | |
| language | | varchar(16) | NO | | | |

View file

@ -8,6 +8,6 @@ Table spam
| spam | | int(11) | NO | MUL | 0 | |
| ham | | int(11) | NO | MUL | 0 | |
| term | | varchar(255) | NO | MUL | | |
| date | | datetime | NO | | 0000-00-00 00:00:00 | |
| date | | datetime | NO | | 0001-01-01 00:00:00 | |
Return to [database documentation](help/database)

View file

@ -12,8 +12,8 @@ Table term
| aid | | int(10) unsigned | NO | | 0 | |
| uid | | int(10) unsigned | NO | MUL | 0 | |
| guid | | varchar(255) | NO | MUL | | |
| created | | datetime | NO | | 0000-00-00 00:00:00 | |
| received | | datetime | NO | | 0000-00-00 00:00:00 | |
| created | | datetime | NO | | 0001-01-01 00:00:00 | |
| received | | datetime | NO | | 0001-01-01 00:00:00 | |
| global | | tinyint(1) | NO | | 0 | |
Return to [database documentation](help/database)

View file

@ -9,11 +9,11 @@ Table thread
| gcontact-id | Global Contact | int(11) unsigned | NO | | 0 | |
| owner-id | Item owner | int(11) unsigned | NO | MUL | 0 | |
| author-id | Item author | int(11) unsigned | NO | MUL | 0 | |
| created | | datetime | NO | MUL | 0000-00-00 00:00:00 | |
| edited | | datetime | NO | | 0000-00-00 00:00:00 | |
| commented | | datetime | NO | MUL | 0000-00-00 00:00:00 | |
| received | | datetime | NO | | 0000-00-00 00:00:00 | |
| changed | | datetime | NO | | 0000-00-00 00:00:00 | |
| created | | datetime | NO | MUL | 0001-01-01 00:00:00 | |
| edited | | datetime | NO | | 0001-01-01 00:00:00 | |
| commented | | datetime | NO | MUL | 0001-01-01 00:00:00 | |
| received | | datetime | NO | | 0001-01-01 00:00:00 | |
| changed | | datetime | NO | | 0001-01-01 00:00:00 | |
| wall | | tinyint(1) | NO | MUL | 0 | |
| private | | tinyint(1) | NO | | 0 | |
| pubmail | | tinyint(1) | NO | | 0 | |

View file

@ -12,8 +12,8 @@ Table user
| openid | | varchar(255) | NO | | | |
| timezone | PHP-legal timezone | varchar(128) | NO | | | |
| language | default language | varchar(32) | NO | | en | |
| register_date | timestamp of registration | datetime | NO | | 0000-00-00 00:00:00 | |
| login_date | timestamp of last login | datetime | NO | | 0000-00-00 00:00:00 | |
| register_date | timestamp of registration | datetime | NO | | 0001-01-01 00:00:00 | |
| login_date | timestamp of last login | datetime | NO | | 0001-01-01 00:00:00 | |
| default-location | Default for item.location | varchar(255) | NO | | | |
| allow_location | 1 allows to display the location | tinyint(1) | NO | | 0 | |
| theme | user theme preference | varchar(255) | NO | | | |
@ -36,8 +36,8 @@ Table user
| expire | | int(11) unsigned | NO | | 0 | |
| account_removed | if 1 the account is removed | tinyint(1) | NO | | 0 | |
| account_expired | | tinyint(1) | NO | | 0 | |
| account_expires_on | timestamp when account expires and will be deleted | datetime | NO | | 0000-00-00 00:00:00 | |
| expire_notification_sent | timestamp of last warning of account expiration | datetime | NO | | 0000-00-00 00:00:00 | |
| account_expires_on | timestamp when account expires and will be deleted | datetime | NO | | 0001-01-01 00:00:00 | |
| expire_notification_sent | timestamp of last warning of account expiration | datetime | NO | | 0001-01-01 00:00:00 | |
| service_class | service class for this account, determines what if any limits/restrictions are in place | varchar(32) | NO | | | |
| def_gid | | int(11) | NO | | 0 | |
| allow_cid | default permission for this user | mediumtext | NO | | NULL | |

View file

@ -6,8 +6,8 @@ Table workerqueue
| id | sequential ID | int(11) | NO | PRI | NULL | auto_increment |
| parameter | | text | NO | | NULL | |
| priority | | tinyint(3) unsigned | NO | | 0 | |
| created | | datetime | NO | MUL | 0000-00-00 00:00:00 | |
| created | | datetime | NO | MUL | 0001-01-01 00:00:00 | |
| pid | | int(11) | NO | | 0 | |
| executed | | datetime | NO | | 0000-00-00 00:00:00 | |
| executed | | datetime | NO | | 0001-01-01 00:00:00 | |
Return to [database documentation](help/database)

File diff suppressed because one or more lines are too long

View file

@ -254,7 +254,7 @@ function get_contact_details_by_url($url, $uid = -1, $default = array()) {
// "bd" always contains the upcoming birthday of a contact.
// "birthday" might contain the birthday including the year of birth.
if ($profile["birthday"] != "0000-00-00") {
if ($profile["birthday"] > '0001-01-01') {
$bd_timestamp = strtotime($profile["birthday"]);
$month = date("m", $bd_timestamp);
$day = date("d", $bd_timestamp);
@ -271,7 +271,7 @@ function get_contact_details_by_url($url, $uid = -1, $default = array()) {
$profile["bd"] = (++$current_year)."-".$month."-".$day;
}
} else {
$profile["bd"] = "0000-00-00";
$profile["bd"] = '0001-01-01';
}
} else {
$profile = $default;
@ -307,7 +307,7 @@ function get_contact_details_by_url($url, $uid = -1, $default = array()) {
$profile["location"] = "";
$profile["about"] = "";
$profile["gender"] = "";
$profile["birthday"] = "0000-00-00";
$profile["birthday"] = '0001-01-01';
}
$cache[$url][$uid] = $profile;

View file

@ -126,7 +126,7 @@ function datetime_convert($from = 'UTC', $to = 'UTC', $s = 'now', $fmt = "Y-m-d
// add 32 days so that we at least get year 00, and then hack around the fact that
// months and days always start with 1.
if(substr($s,0,10) == '0000-00-00') {
if(substr($s,0,10) <= '0001-01-01') {
$d = new DateTime($s . ' + 32 days', new DateTimeZone('UTC'));
return str_replace('1','0',$d->format($fmt));
}
@ -171,7 +171,7 @@ function dob($dob) {
$f = get_config('system','birthday_input_format');
if(! $f)
$f = 'ymd';
if($dob === '0000-00-00')
if($dob <= '0001-01-01')
$value = '';
else
$value = (($year) ? datetime_convert('UTC','UTC',$dob,'Y-m-d') : datetime_convert('UTC','UTC',$dob,'m-d'));
@ -189,7 +189,7 @@ function dob($dob) {
)
));
// if ($dob && $dob != '0000-00-00')
// if ($dob && $dob > '0001-01-01')
// $o = datesel($f,mktime(0,0,0,0,0,1900),mktime(),mktime(0,0,0,$month,$day,$year),'dob');
// else
// $o = datesel($f,mktime(0,0,0,0,0,1900),mktime(),false,'dob');
@ -553,7 +553,7 @@ function update_contact_birthdays() {
// This only handles foreign or alien networks where a birthday has been provided.
// In-network birthdays are handled within local_delivery
$r = q("SELECT * FROM contact WHERE `bd` != '' AND `bd` != '0000-00-00' AND SUBSTRING(`bd`,1,4) != `bdyear` ");
$r = q("SELECT * FROM contact WHERE `bd` != '' AND `bd` > '0001-01-01' AND SUBSTRING(`bd`,1,4) != `bdyear` ");
if (dbm::is_result($r)) {
foreach ($r as $rr) {

View file

@ -681,7 +681,7 @@ function db_definition($charset) {
"info" => array("type" => "mediumtext"),
"profile-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
"bdyear" => array("type" => "varchar(4)", "not null" => "1", "default" => ""),
"bd" => array("type" => "date", "not null" => "1", "default" => "0000-00-00"),
"bd" => array("type" => "date", "not null" => "1", "default" => "0001-01-01"),
"notify_new_posts" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
"fetch_further_information" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
"ffi_keyword_blacklist" => array("type" => "text"),
@ -840,7 +840,7 @@ function db_definition($charset) {
"about" => array("type" => "text"),
"keywords" => array("type" => "text"),
"gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
"birthday" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
"birthday" => array("type" => "varchar(32)", "not null" => "1", "default" => "0001-01-01"),
"community" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
"contact-type" => array("type" => "tinyint(1)", "not null" => "1", "default" => "-1"),
"hide" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
@ -1304,7 +1304,7 @@ function db_definition($charset) {
"hide-friends" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
"name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"pdesc" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"dob" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
"dob" => array("type" => "varchar(32)", "not null" => "1", "default" => "0001-01-01"),
"address" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"locality" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"region" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),

View file

@ -554,7 +554,7 @@ class dfrn {
xml::add_element($doc, $author, "poco:displayName", $profile["name"]);
xml::add_element($doc, $author, "poco:updated", $namdate);
if (trim($profile["dob"]) != "0000-00-00")
if (trim($profile["dob"]) > '0001-01-01')
xml::add_element($doc, $author, "poco:birthday", "0000-".date("m-d", strtotime($profile["dob"])));
xml::add_element($doc, $author, "poco:note", $profile["about"]);
@ -1402,7 +1402,7 @@ class dfrn {
// "poco:birthday" is the birthday in the format "yyyy-mm-dd"
$value = $xpath->evaluate($element . "/poco:birthday/text()", $context)->item(0)->nodeValue;
if (!in_array($value, array("", "0000-00-00"))) {
if (!in_array($value, array("", "0000-00-00", "0001-01-01"))) {
$bdyear = date("Y");
$value = str_replace("0000", $bdyear, $value);

View file

@ -3591,7 +3591,7 @@ class Diaspora {
if ($searchable === 'true') {
$dob = '1000-00-00';
if (($profile['dob']) && ($profile['dob'] != '0000-00-00'))
if (($profile['dob']) && ($profile['dob'] > '0001-01-01'))
$dob = ((intval($profile['dob'])) ? intval($profile['dob']) : '1000') .'-'. datetime_convert('UTC','UTC',$profile['dob'],'m-d');
$about = $profile['about'];

View file

@ -628,7 +628,7 @@ function advanced_profile(App $a) {
if($a->profile['gender']) $profile['gender'] = array( t('Gender:'), $a->profile['gender'] );
if(($a->profile['dob']) && ($a->profile['dob'] != '0000-00-00')) {
if(($a->profile['dob']) && ($a->profile['dob'] > '0001-01-01')) {
$year_bd_format = t('j F, Y');
$short_bd_format = t('j F');

View file

@ -75,7 +75,7 @@ function hovercard_content() {
'tags' => $contact["keywords"],
// 'nsfw' => intval($contact["nsfw"]),
// 'server_url' => $contact["server_url"],
'bd' => (($contact["birthday"] == "0000-00-00") ? "" : $contact["birthday"]),
'bd' => (($contact["birthday"] <= '0001-01-01') ? "" : $contact["birthday"]),
// 'generation' => $contact["generation"],
'account_type' => account_type($contact),
'actions' => $actions,

View file

@ -193,7 +193,7 @@ function profiles_post(App $a) {
return;
}
$dob = $_POST['dob'] ? escape_tags(trim($_POST['dob'])) : '0000-00-00'; // FIXME: Needs to be validated?
$dob = $_POST['dob'] ? escape_tags(trim($_POST['dob'])) : '0001-01-01'; // FIXME: Needs to be validated?
$y = substr($dob, 0, 4);
if ((! ctype_digit($y)) || ($y < 1900)) {
@ -201,15 +201,15 @@ function profiles_post(App $a) {
} else {
$ignore_year = false;
}
if ($dob != '0000-00-00') {
if (strpos($dob, '0000-') === 0) {
if ($dob > '0001-01-01') {
if (strpos($dob, '0000-') === 0 || strpos($dob, '0001-') === 0) {
$ignore_year = true;
$dob = substr($dob, 5);
}
$dob = datetime_convert('UTC', 'UTC', (($ignore_year) ? '1900-' . $dob : $dob), (($ignore_year) ? 'm-d' : 'Y-m-d'));
if ($ignore_year) {
$dob = '0000-' . $dob;
$dob = '0001-' . $dob;
}
}