]> git.mxchange.org Git - friendica.git/blob - static/dbview.config.php
82ccaa9d1259c12eaf92647c9bf1ee232b3ed0d7
[friendica.git] / static / dbview.config.php
1 <?php
2 /**
3  * @copyright Copyright (C) 2010-2022, the Friendica project
4  *
5  * @license GNU AGPL version 3 or any later version
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU Affero General Public License as
9  * published by the Free Software Foundation, either version 3 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU Affero General Public License for more details.
16  *
17  * You should have received a copy of the GNU Affero General Public License
18  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
19  *
20  * Main view structure configuration file.
21  *
22  * Here are described all the view Friendica needs to work.
23  *
24  * Syntax (braces indicate optionale values):
25  * "<view name>" => [
26  *      "fields" => [
27  *              "<field name>" => ["table", "field"],
28  *              "<field name>" => "SQL expression",
29  *              ...
30  *      ],
31  *      "query" => "FROM `table` INNER JOIN `other-table` ..."
32  *      ],
33  * ],
34  *
35  * If you need to make any change, make sure to increment the DB_UPDATE_VERSION constant value in dbstructure.config.php.
36  *
37  */
38
39  return [
40         "application-view" => [
41                 "fields" => [
42                         "id" => ["application", "id"],
43                         "uid" => ["application-token", "uid"],
44                         "name" => ["application", "name"],
45                         "redirect_uri" => ["application", "redirect_uri"],
46                         "website" => ["application", "website"],
47                         "client_id" => ["application", "client_id"],
48                         "client_secret" => ["application", "client_secret"],
49                         "code" => ["application-token", "code"],
50                         "access_token" => ["application-token", "access_token"],
51                         "created_at" => ["application-token", "created_at"],
52                         "scopes" => ["application-token", "scopes"],
53                         "read" => ["application-token", "read"],
54                         "write" => ["application-token", "write"],
55                         "follow" => ["application-token", "follow"],
56                         "push" => ["application-token", "push"],
57                 ],
58                 "query" => "FROM `application-token`
59                         INNER JOIN `application` ON `application-token`.`application-id` = `application`.`id`"
60         ],
61         "post-user-view" => [
62                 "fields" => [
63                         "id" => ["post-user", "id"],
64                         "post-user-id" => ["post-user", "id"],
65                         "uid" => ["post-user", "uid"],
66                         "parent" => ["parent-post", "id"],
67                         "uri" => ["item-uri", "uri"],
68                         "uri-id" => ["post-user", "uri-id"],
69                         "parent-uri" => ["parent-item-uri", "uri"],
70                         "parent-uri-id" => ["post-user", "parent-uri-id"],
71                         "thr-parent" => ["thr-parent-item-uri", "uri"],
72                         "thr-parent-id" => ["post-user", "thr-parent-id"],
73                         "guid" => ["item-uri", "guid"],
74                         "wall" => ["post-user", "wall"],
75                         "gravity" => ["post-user", "gravity"],
76                         "extid" => ["external-item-uri", "uri"],
77                         "external-id" => ["post-user", "external-id"],
78                         "created" => ["post-user", "created"],
79                         "edited" => ["post-user", "edited"],
80                         "commented" => ["post-thread-user", "commented"],
81                         "received" => ["post-user", "received"],
82                         "changed" => ["post-thread-user", "changed"],
83                         "post-type" => ["post-user", "post-type"],
84                         "post-reason" => ["post-user", "post-reason"],
85                         "private" => ["post-user", "private"],
86                         "pubmail" => ["post-thread-user", "pubmail"],
87                         "visible" => ["post-user", "visible"],
88                         "starred" => ["post-thread-user", "starred"],
89                         "unseen" => ["post-user", "unseen"],
90                         "deleted" => ["post-user", "deleted"],
91                         "origin" => ["post-user", "origin"],
92                         "parent-origin" => ["post-thread-user", "origin"],
93                         "mention" => ["post-thread-user", "mention"],
94                         "global" => ["post-user", "global"],
95                         "featured" => "EXISTS(SELECT `type` FROM `post-collection` WHERE `type` = 0 AND `uri-id` = `post-user`.`uri-id`)",
96                         "network" => ["post-user", "network"],
97                         "vid" => ["post-user", "vid"],
98                         "psid" => ["post-user", "psid"],
99                         "verb" => "IF (`post-user`.`vid` IS NULL, '', `verb`.`name`)",
100                         "title" => ["post-content", "title"],
101                         "content-warning" => ["post-content", "content-warning"],
102                         "raw-body" => ["post-content", "raw-body"],
103                         "body" => "IFNULL (`post-content`.`body`, '')",
104                         "rendered-hash" => ["post-content", "rendered-hash"],
105                         "rendered-html" => ["post-content", "rendered-html"],
106                         "language" => ["post-content", "language"],
107                         "plink" => ["post-content", "plink"],
108                         "location" => ["post-content", "location"],
109                         "coord" => ["post-content", "coord"],
110                         "app" => ["post-content", "app"],
111                         "object-type" => ["post-content", "object-type"],
112                         "object" => ["post-content", "object"],
113                         "target-type" => ["post-content", "target-type"],
114                         "target" => ["post-content", "target"],
115                         "resource-id" => ["post-content", "resource-id"],
116                         "contact-id" => ["post-user", "contact-id"],
117                         "contact-link" => ["contact", "url"],
118                         "contact-addr" => ["contact", "addr"],
119                         "contact-name" => ["contact", "name"],
120                         "contact-nick" => ["contact", "nick"],
121                         "contact-avatar" => ["contact", "thumb"],
122                         "contact-network" => ["contact", "network"],
123                         "contact-blocked" => ["contact", "blocked"],
124                         "contact-hidden" => ["contact", "hidden"],
125                         "contact-readonly" => ["contact", "readonly"],
126                         "contact-archive" => ["contact", "archive"],
127                         "contact-pending" => ["contact", "pending"],
128                         "contact-rel" => ["contact", "rel"],
129                         "contact-uid" => ["contact", "uid"],
130                         "contact-contact-type" => ["contact", "contact-type"],
131                         "writable" => "IF (`post-user`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `contact`.`writable`)",
132                         "self" => ["contact", "self"],
133                         "cid" => ["contact", "id"],
134                         "alias" => ["contact", "alias"],
135                         "photo" => ["contact", "photo"],
136                         "name-date" => ["contact", "name-date"],
137                         "uri-date" => ["contact", "uri-date"],
138                         "avatar-date" => ["contact", "avatar-date"],
139                         "thumb" => ["contact", "thumb"],
140                         "author-id" => ["post-user", "author-id"],
141                         "author-link" => ["author", "url"],
142                         "author-addr" => ["author", "addr"],
143                         "author-name" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`name` != '', `contact`.`name`, `author`.`name`)",
144                         "author-nick" => ["author", "nick"],
145                         "author-avatar" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `author`.`thumb`)",
146                         "author-network" => ["author", "network"],
147                         "author-blocked" => ["author", "blocked"],
148                         "author-hidden" => ["author", "hidden"],
149                         "owner-id" => ["post-user", "owner-id"],
150                         "owner-link" => ["owner", "url"],
151                         "owner-addr" => ["owner", "addr"],
152                         "owner-name" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`name` != '', `contact`.`name`, `owner`.`name`)",
153                         "owner-nick" => ["owner", "nick"],
154                         "owner-avatar" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `owner`.`thumb`)",
155                         "owner-network" => ["owner", "network"],
156                         "owner-blocked" => ["owner", "blocked"],
157                         "owner-hidden" => ["owner", "hidden"],
158                         "owner-contact-type" => ["owner", "contact-type"],
159                         "causer-id" => ["post-user", "causer-id"],
160                         "causer-link" => ["causer", "url"],
161                         "causer-addr" => ["causer", "addr"],
162                         "causer-name" => ["causer", "name"],
163                         "causer-nick" => ["causer", "nick"],
164                         "causer-avatar" => ["causer", "thumb"],
165                         "causer-network" => ["causer", "network"],
166                         "causer-blocked" => ["causer", "blocked"],
167                         "causer-hidden" => ["causer", "hidden"],
168                         "causer-contact-type" => ["causer", "contact-type"],
169                         "postopts" => ["post-delivery-data", "postopts"],
170                         "inform" => ["post-delivery-data", "inform"],
171                         "delivery_queue_count" => ["post-delivery-data", "queue_count"],
172                         "delivery_queue_done" => ["post-delivery-data", "queue_done"],
173                         "delivery_queue_failed" => ["post-delivery-data", "queue_failed"],
174                         "allow_cid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`allow_cid`)",
175                         "allow_gid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`allow_gid`)",
176                         "deny_cid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`deny_cid`)",
177                         "deny_gid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`deny_gid`)",
178                         "event-id" => ["post-user", "event-id"],
179                         "event-created" => ["event", "created"],
180                         "event-edited" => ["event", "edited"],
181                         "event-start" => ["event", "start"],
182                         "event-finish" => ["event", "finish"],
183                         "event-summary" => ["event", "summary"],
184                         "event-desc" => ["event", "desc"],
185                         "event-location" => ["event", "location"],
186                         "event-type" => ["event", "type"],
187                         "event-nofinish" => ["event", "nofinish"],
188                         "event-ignore" => ["event", "ignore"],
189                         "question-id" => ["post-question", "id"],
190                         "question-multiple" => ["post-question", "multiple"],
191                         "question-voters" => ["post-question", "voters"],
192                         "question-end-time" => ["post-question", "end-time"],
193                         "signed_text" => ["diaspora-interaction", "interaction"],
194                         "parent-guid" => ["parent-item-uri", "guid"],
195                         "parent-network" => ["parent-post", "network"],
196                         "parent-author-id" => ["parent-post", "author-id"],
197                         "parent-author-link" => ["parent-post-author", "url"],
198                         "parent-author-name" => ["parent-post-author", "name"],
199                         "parent-author-nick" => ["parent-post-author", "nick"],
200                         "parent-author-network" => ["parent-post-author", "network"],
201                         "parent-author-blocked" => ["parent-post-author", "blocked"],
202                         "parent-author-hidden" => ["parent-post-author", "hidden"],
203                 ],
204                 "query" => "FROM `post-user`
205                         STRAIGHT_JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`
206                         STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-user`.`contact-id`
207                         STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-user`.`author-id`
208                         STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-user`.`owner-id`
209                         LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post-user`.`causer-id`
210                         LEFT JOIN `item-uri` ON `item-uri`.`id` = `post-user`.`uri-id`
211                         LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post-user`.`thr-parent-id`
212                         LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post-user`.`parent-uri-id`
213                         LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post-user`.`external-id`
214                         LEFT JOIN `verb` ON `verb`.`id` = `post-user`.`vid`
215                         LEFT JOIN `event` ON `event`.`id` = `post-user`.`event-id`
216                         LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-user`.`uri-id`
217                         LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-user`.`uri-id`
218                         LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-user`.`uri-id` AND `post-user`.`origin`
219                         LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-user`.`uri-id`
220                         LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-user`.`psid`
221                         LEFT JOIN `post-user` AS `parent-post` ON `parent-post`.`uri-id` = `post-user`.`parent-uri-id` AND `parent-post`.`uid` = `post-user`.`uid`
222                         LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`"
223         ],
224         "post-thread-user-view" => [
225                 "fields" => [
226                         "id" => ["post-user", "id"],
227                         "post-user-id" => ["post-user", "id"],
228                         "uid" => ["post-thread-user", "uid"],
229                         "parent" => ["parent-post", "id"],
230                         "uri" => ["item-uri", "uri"],
231                         "uri-id" => ["post-thread-user", "uri-id"],
232                         "parent-uri" => ["parent-item-uri", "uri"],
233                         "parent-uri-id" => ["post-user", "parent-uri-id"],
234                         "thr-parent" => ["thr-parent-item-uri", "uri"],
235                         "thr-parent-id" => ["post-user", "thr-parent-id"],
236                         "guid" => ["item-uri", "guid"],
237                         "wall" => ["post-thread-user", "wall"],
238                         "gravity" => ["post-user", "gravity"],
239                         "extid" => ["external-item-uri", "uri"],
240                         "external-id" => ["post-user", "external-id"],
241                         "created" => ["post-thread-user", "created"],
242                         "edited" => ["post-user", "edited"],
243                         "commented" => ["post-thread-user", "commented"],
244                         "received" => ["post-thread-user", "received"],
245                         "changed" => ["post-thread-user", "changed"],
246                         "post-type" => ["post-user", "post-type"],
247                         "post-reason" => ["post-user", "post-reason"],
248                         "private" => ["post-user", "private"],
249                         "pubmail" => ["post-thread-user", "pubmail"],
250                         "ignored" => ["post-thread-user", "ignored"],
251                         "visible" => ["post-user", "visible"],
252                         "starred" => ["post-thread-user", "starred"],
253                         "unseen" => ["post-thread-user", "unseen"],
254                         "deleted" => ["post-user", "deleted"],
255                         "origin" => ["post-thread-user", "origin"],
256                         "mention" => ["post-thread-user", "mention"],
257                         "global" => ["post-user", "global"],
258                         "featured" => "EXISTS(SELECT `type` FROM `post-collection` WHERE `type` = 0 AND `uri-id` = `post-thread-user`.`uri-id`)",
259                         "network" => ["post-thread-user", "network"],
260                         "vid" => ["post-user", "vid"],
261                         "psid" => ["post-thread-user", "psid"],
262                         "verb" => "IF (`post-user`.`vid` IS NULL, '', `verb`.`name`)",
263                         "title" => ["post-content", "title"],
264                         "content-warning" => ["post-content", "content-warning"],
265                         "raw-body" => ["post-content", "raw-body"],
266                         "body" => ["post-content", "body"],
267                         "rendered-hash" => ["post-content", "rendered-hash"],
268                         "rendered-html" => ["post-content", "rendered-html"],
269                         "language" => ["post-content", "language"],
270                         "plink" => ["post-content", "plink"],
271                         "location" => ["post-content", "location"],
272                         "coord" => ["post-content", "coord"],
273                         "app" => ["post-content", "app"],
274                         "object-type" => ["post-content", "object-type"],
275                         "object" => ["post-content", "object"],
276                         "target-type" => ["post-content", "target-type"],
277                         "target" => ["post-content", "target"],
278                         "resource-id" => ["post-content", "resource-id"],
279                         "contact-id" => ["post-thread-user", "contact-id"],
280                         "contact-link" => ["contact", "url"],
281                         "contact-addr" => ["contact", "addr"],
282                         "contact-name" => ["contact", "name"],
283                         "contact-nick" => ["contact", "nick"],
284                         "contact-avatar" => ["contact", "thumb"],
285                         "contact-network" => ["contact", "network"],
286                         "contact-blocked" => ["contact", "blocked"],
287                         "contact-hidden" => ["contact", "hidden"],
288                         "contact-readonly" => ["contact", "readonly"],
289                         "contact-archive" => ["contact", "archive"],
290                         "contact-pending" => ["contact", "pending"],
291                         "contact-rel" => ["contact", "rel"],
292                         "contact-uid" => ["contact", "uid"],
293                         "contact-contact-type" => ["contact", "contact-type"],
294                         "writable" => "IF (`post-user`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `contact`.`writable`)",
295                         "self" => ["contact", "self"],
296                         "cid" => ["contact", "id"],
297                         "alias" => ["contact", "alias"],
298                         "photo" => ["contact", "photo"],
299                         "name-date" => ["contact", "name-date"],
300                         "uri-date" => ["contact", "uri-date"],
301                         "avatar-date" => ["contact", "avatar-date"],
302                         "thumb" => ["contact", "thumb"],
303                         "author-id" => ["post-thread-user", "author-id"],
304                         "author-link" => ["author", "url"],
305                         "author-addr" => ["author", "addr"],
306                         "author-name" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`name` != '', `contact`.`name`, `author`.`name`)",
307                         "author-nick" => ["author", "nick"],
308                         "author-avatar" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `author`.`thumb`)",
309                         "author-network" => ["author", "network"],
310                         "author-blocked" => ["author", "blocked"],
311                         "author-hidden" => ["author", "hidden"],
312                         "owner-id" => ["post-thread-user", "owner-id"],
313                         "owner-link" => ["owner", "url"],
314                         "owner-addr" => ["owner", "addr"],
315                         "owner-name" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`name` != '', `contact`.`name`, `owner`.`name`)",
316                         "owner-nick" => ["owner", "nick"],
317                         "owner-avatar" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `owner`.`thumb`)",
318                         "owner-network" => ["owner", "network"],
319                         "owner-blocked" => ["owner", "blocked"],
320                         "owner-hidden" => ["owner", "hidden"],
321                         "owner-contact-type" => ["owner", "contact-type"],
322                         "causer-id" => ["post-thread-user", "causer-id"],
323                         "causer-link" => ["causer", "url"],
324                         "causer-addr" => ["causer", "addr"],
325                         "causer-name" => ["causer", "name"],
326                         "causer-nick" => ["causer", "nick"],
327                         "causer-avatar" => ["causer", "thumb"],
328                         "causer-network" => ["causer", "network"],
329                         "causer-blocked" => ["causer", "blocked"],
330                         "causer-hidden" => ["causer", "hidden"],
331                         "causer-contact-type" => ["causer", "contact-type"],
332                         "postopts" => ["post-delivery-data", "postopts"],
333                         "inform" => ["post-delivery-data", "inform"],
334                         "delivery_queue_count" => ["post-delivery-data", "queue_count"],
335                         "delivery_queue_done" => ["post-delivery-data", "queue_done"],
336                         "delivery_queue_failed" => ["post-delivery-data", "queue_failed"],
337                         "allow_cid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`allow_cid`)",
338                         "allow_gid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`allow_gid`)",
339                         "deny_cid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`deny_cid`)",
340                         "deny_gid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`deny_gid`)",
341                         "event-id" => ["post-user", "event-id"],
342                         "event-created" => ["event", "created"],
343                         "event-edited" => ["event", "edited"],
344                         "event-start" => ["event", "start"],
345                         "event-finish" => ["event", "finish"],
346                         "event-summary" => ["event", "summary"],
347                         "event-desc" => ["event", "desc"],
348                         "event-location" => ["event", "location"],
349                         "event-type" => ["event", "type"],
350                         "event-nofinish" => ["event", "nofinish"],
351                         "event-ignore" => ["event", "ignore"],
352                         "question-id" => ["post-question", "id"],
353                         "question-multiple" => ["post-question", "multiple"],
354                         "question-voters" => ["post-question", "voters"],
355                         "question-end-time" => ["post-question", "end-time"],
356                         "signed_text" => ["diaspora-interaction", "interaction"],
357                         "parent-guid" => ["parent-item-uri", "guid"],
358                         "parent-network" => ["parent-post", "network"],
359                         "parent-author-id" => ["parent-post", "author-id"],
360                         "parent-author-link" => ["parent-post-author", "url"],
361                         "parent-author-name" => ["parent-post-author", "name"],
362                         "parent-author-network" => ["parent-post-author", "network"],
363                         "parent-author-blocked" => ["parent-post-author", "blocked"],
364                         "parent-author-hidden" => ["parent-post-author", "hidden"],
365                 ],
366                 "query" => "FROM `post-thread-user`
367                         INNER JOIN `post-user` ON `post-user`.`id` = `post-thread-user`.`post-user-id`
368                         STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
369                         STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-thread-user`.`author-id`
370                         STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-thread-user`.`owner-id`
371                         LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post-thread-user`.`causer-id`
372                         LEFT JOIN `item-uri` ON `item-uri`.`id` = `post-thread-user`.`uri-id`
373                         LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post-user`.`thr-parent-id`
374                         LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post-user`.`parent-uri-id`
375                         LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post-user`.`external-id`
376                         LEFT JOIN `verb` ON `verb`.`id` = `post-user`.`vid`
377                         LEFT JOIN `event` ON `event`.`id` = `post-user`.`event-id`
378                         LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-thread-user`.`uri-id`
379                         LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-thread-user`.`uri-id`
380                         LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-thread-user`.`uri-id` AND `post-thread-user`.`origin`
381                         LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-thread-user`.`uri-id`
382                         LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-thread-user`.`psid`
383                         LEFT JOIN `post-user` AS `parent-post` ON `parent-post`.`uri-id` = `post-user`.`parent-uri-id` AND `parent-post`.`uid` = `post-thread-user`.`uid`
384                         LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`"
385         ],
386         "post-view" => [
387                 "fields" => [
388                         "uri" => ["item-uri", "uri"],
389                         "uri-id" => ["post", "uri-id"],
390                         "parent-uri" => ["parent-item-uri", "uri"],
391                         "parent-uri-id" => ["post", "parent-uri-id"],
392                         "thr-parent" => ["thr-parent-item-uri", "uri"],
393                         "thr-parent-id" => ["post", "thr-parent-id"],
394                         "guid" => ["item-uri", "guid"],
395                         "gravity" => ["post", "gravity"],
396                         "extid" => ["external-item-uri", "uri"],
397                         "external-id" => ["post", "external-id"],
398                         "created" => ["post", "created"],
399                         "edited" => ["post", "edited"],
400                         "commented" => ["post-thread", "commented"],
401                         "received" => ["post", "received"],
402                         "changed" => ["post-thread", "changed"],
403                         "post-type" => ["post", "post-type"],
404                         "private" => ["post", "private"],
405                         "visible" => ["post", "visible"],
406                         "deleted" => ["post", "deleted"],
407                         "global" => ["post", "global"],
408                         "featured" => "EXISTS(SELECT `type` FROM `post-collection` WHERE `type` = 0 AND `uri-id` = `post`.`uri-id`)",
409                         "network" => ["post", "network"],
410                         "vid" => ["post", "vid"],
411                         "verb" => "IF (`post`.`vid` IS NULL, '', `verb`.`name`)",
412                         "title" => ["post-content", "title"],
413                         "content-warning" => ["post-content", "content-warning"],
414                         "raw-body" => ["post-content", "raw-body"],
415                         "body" => ["post-content", "body"],
416                         "rendered-hash" => ["post-content", "rendered-hash"],
417                         "rendered-html" => ["post-content", "rendered-html"],
418                         "language" => ["post-content", "language"],
419                         "plink" => ["post-content", "plink"],
420                         "location" => ["post-content", "location"],
421                         "coord" => ["post-content", "coord"],
422                         "app" => ["post-content", "app"],
423                         "object-type" => ["post-content", "object-type"],
424                         "object" => ["post-content", "object"],
425                         "target-type" => ["post-content", "target-type"],
426                         "target" => ["post-content", "target"],
427                         "resource-id" => ["post-content", "resource-id"],
428                         "contact-id" => ["post", "author-id"],
429                         "contact-link" => ["author", "url"],
430                         "contact-addr" => ["author", "addr"],
431                         "contact-name" => ["author", "name"],
432                         "contact-nick" => ["author", "nick"],
433                         "contact-avatar" => ["author", "thumb"],
434                         "contact-network" => ["author", "network"],
435                         "contact-blocked" => ["author", "blocked"],
436                         "contact-hidden" => ["author", "hidden"],
437                         "contact-readonly" => ["author", "readonly"],
438                         "contact-archive" => ["author", "archive"],
439                         "contact-pending" => ["author", "pending"],
440                         "contact-rel" => ["author", "rel"],
441                         "contact-uid" => ["author", "uid"],
442                         "contact-contact-type" => ["author", "contact-type"],
443                         "writable" => "IF (`post`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `author`.`writable`)",
444                         "self" => "false",
445                         "cid" => ["author", "id"],
446                         "alias" => ["author", "alias"],
447                         "photo" => ["author", "photo"],
448                         "name-date" => ["author", "name-date"],
449                         "uri-date" => ["author", "uri-date"],
450                         "avatar-date" => ["author", "avatar-date"],
451                         "thumb" => ["author", "thumb"],
452                         "author-id" => ["post", "author-id"],
453                         "author-link" => ["author", "url"],
454                         "author-addr" => ["author", "addr"],
455                         "author-name" => ["author", "name"],
456                         "author-nick" => ["author", "nick"],
457                         "author-avatar" => ["author", "thumb"],
458                         "author-network" => ["author", "network"],
459                         "author-blocked" => ["author", "blocked"],
460                         "author-hidden" => ["author", "hidden"],
461                         "owner-id" => ["post", "owner-id"],
462                         "owner-link" => ["owner", "url"],
463                         "owner-addr" => ["owner", "addr"],
464                         "owner-name" => ["owner", "name"],
465                         "owner-nick" => ["owner", "nick"],
466                         "owner-avatar" => ["owner", "thumb"],
467                         "owner-network" => ["owner", "network"],
468                         "owner-blocked" => ["owner", "blocked"],
469                         "owner-hidden" => ["owner", "hidden"],
470                         "owner-contact-type" => ["owner", "contact-type"],
471                         "causer-id" => ["post", "causer-id"],
472                         "causer-link" => ["causer", "url"],
473                         "causer-addr" => ["causer", "addr"],
474                         "causer-name" => ["causer", "name"],
475                         "causer-nick" => ["causer", "nick"],
476                         "causer-avatar" => ["causer", "thumb"],
477                         "causer-network" => ["causer", "network"],
478                         "causer-blocked" => ["causer", "blocked"],
479                         "causer-hidden" => ["causer", "hidden"],
480                         "causer-contact-type" => ["causer", "contact-type"],
481                         "question-id" => ["post-question", "id"],
482                         "question-multiple" => ["post-question", "multiple"],
483                         "question-voters" => ["post-question", "voters"],
484                         "question-end-time" => ["post-question", "end-time"],
485                         "signed_text" => ["diaspora-interaction", "interaction"],
486                         "parent-guid" => ["parent-item-uri", "guid"],
487                         "parent-network" => ["parent-post", "network"],
488                         "parent-author-id" => ["parent-post", "author-id"],
489                         "parent-author-link" => ["parent-post-author", "url"],
490                         "parent-author-name" => ["parent-post-author", "name"],
491                         "parent-author-network" => ["parent-post-author", "network"],
492                         "parent-author-blocked" => ["parent-post-author", "blocked"],
493                         "parent-author-hidden" => ["parent-post-author", "hidden"],
494                 ],
495                 "query" => "FROM `post`
496                         STRAIGHT_JOIN `post-thread` ON `post-thread`.`uri-id` = `post`.`parent-uri-id`
497                         STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post`.`author-id`
498                         STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post`.`owner-id`
499                         LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post`.`causer-id`
500                         LEFT JOIN `item-uri` ON `item-uri`.`id` = `post`.`uri-id`
501                         LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post`.`thr-parent-id`
502                         LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post`.`parent-uri-id`
503                         LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post`.`external-id`
504                         LEFT JOIN `verb` ON `verb`.`id` = `post`.`vid`
505                         LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post`.`uri-id`
506                         LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post`.`uri-id`
507                         LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post`.`uri-id`
508                         LEFT JOIN `post` AS `parent-post` ON `parent-post`.`uri-id` = `post`.`parent-uri-id`
509                         LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`"
510         ],
511         "post-thread-view" => [
512                 "fields" => [
513                         "uri" => ["item-uri", "uri"],
514                         "uri-id" => ["post-thread", "uri-id"],
515                         "parent-uri" => ["parent-item-uri", "uri"],
516                         "parent-uri-id" => ["post", "parent-uri-id"],
517                         "thr-parent" => ["thr-parent-item-uri", "uri"],
518                         "thr-parent-id" => ["post", "thr-parent-id"],
519                         "guid" => ["item-uri", "guid"],
520                         "gravity" => ["post", "gravity"],
521                         "extid" => ["external-item-uri", "uri"],
522                         "external-id" => ["post", "external-id"],
523                         "created" => ["post-thread", "created"],
524                         "edited" => ["post", "edited"],
525                         "commented" => ["post-thread", "commented"],
526                         "received" => ["post-thread", "received"],
527                         "changed" => ["post-thread", "changed"],
528                         "post-type" => ["post", "post-type"],
529                         "private" => ["post", "private"],
530                         "visible" => ["post", "visible"],
531                         "deleted" => ["post", "deleted"],
532                         "global" => ["post", "global"],
533                         "featured" => "EXISTS(SELECT `type` FROM `post-collection` WHERE `type` = 0 AND `uri-id` = `post-thread`.`uri-id`)",
534                         "network" => ["post-thread", "network"],
535                         "vid" => ["post", "vid"],
536                         "verb" => "IF (`post`.`vid` IS NULL, '', `verb`.`name`)",
537                         "title" => ["post-content", "title"],
538                         "content-warning" => ["post-content", "content-warning"],
539                         "raw-body" => ["post-content", "raw-body"],
540                         "body" => ["post-content", "body"],
541                         "rendered-hash" => ["post-content", "rendered-hash"],
542                         "rendered-html" => ["post-content", "rendered-html"],
543                         "language" => ["post-content", "language"],
544                         "plink" => ["post-content", "plink"],
545                         "location" => ["post-content", "location"],
546                         "coord" => ["post-content", "coord"],
547                         "app" => ["post-content", "app"],
548                         "object-type" => ["post-content", "object-type"],
549                         "object" => ["post-content", "object"],
550                         "target-type" => ["post-content", "target-type"],
551                         "target" => ["post-content", "target"],
552                         "resource-id" => ["post-content", "resource-id"],
553                         "contact-id" => ["post-thread", "author-id"],
554                         "contact-link" => ["author", "url"],
555                         "contact-addr" => ["author", "addr"],
556                         "contact-name" => ["author", "name"],
557                         "contact-nick" => ["author", "nick"],
558                         "contact-avatar" => ["author", "thumb"],
559                         "contact-network" => ["author", "network"],
560                         "contact-blocked" => ["author", "blocked"],
561                         "contact-hidden" => ["author", "hidden"],
562                         "contact-readonly" => ["author", "readonly"],
563                         "contact-archive" => ["author", "archive"],
564                         "contact-pending" => ["author", "pending"],
565                         "contact-rel" => ["author", "rel"],
566                         "contact-uid" => ["author", "uid"],
567                         "contact-contact-type" => ["author", "contact-type"],
568                         "writable" => "IF (`post`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `author`.`writable`)",
569                         "self" => "false",
570                         "cid" => ["author", "id"],
571                         "alias" => ["author", "alias"],
572                         "photo" => ["author", "photo"],
573                         "name-date" => ["author", "name-date"],
574                         "uri-date" => ["author", "uri-date"],
575                         "avatar-date" => ["author", "avatar-date"],
576                         "thumb" => ["author", "thumb"],
577                         "author-id" => ["post-thread", "author-id"],
578                         "author-link" => ["author", "url"],
579                         "author-addr" => ["author", "addr"],
580                         "author-name" => ["author", "name"],
581                         "author-nick" => ["author", "nick"],
582                         "author-avatar" => ["author", "thumb"],
583                         "author-network" => ["author", "network"],
584                         "author-blocked" => ["author", "blocked"],
585                         "author-hidden" => ["author", "hidden"],
586                         "owner-id" => ["post-thread", "owner-id"],
587                         "owner-link" => ["owner", "url"],
588                         "owner-addr" => ["owner", "addr"],
589                         "owner-name" => ["owner", "name"],
590                         "owner-nick" => ["owner", "nick"],
591                         "owner-avatar" => ["owner", "thumb"],
592                         "owner-network" => ["owner", "network"],
593                         "owner-blocked" => ["owner", "blocked"],
594                         "owner-hidden" => ["owner", "hidden"],
595                         "owner-contact-type" => ["owner", "contact-type"],
596                         "causer-id" => ["post-thread", "causer-id"],
597                         "causer-link" => ["causer", "url"],
598                         "causer-addr" => ["causer", "addr"],
599                         "causer-name" => ["causer", "name"],
600                         "causer-nick" => ["causer", "nick"],
601                         "causer-avatar" => ["causer", "thumb"],
602                         "causer-network" => ["causer", "network"],
603                         "causer-blocked" => ["causer", "blocked"],
604                         "causer-hidden" => ["causer", "hidden"],
605                         "causer-contact-type" => ["causer", "contact-type"],
606                         "question-id" => ["post-question", "id"],
607                         "question-multiple" => ["post-question", "multiple"],
608                         "question-voters" => ["post-question", "voters"],
609                         "question-end-time" => ["post-question", "end-time"],
610                         "signed_text" => ["diaspora-interaction", "interaction"],
611                         "parent-guid" => ["parent-item-uri", "guid"],
612                         "parent-network" => ["parent-post", "network"],
613                         "parent-author-id" => ["parent-post", "author-id"],
614                         "parent-author-link" => ["parent-post-author", "url"],
615                         "parent-author-name" => ["parent-post-author", "name"],
616                         "parent-author-network" => ["parent-post-author", "network"],
617                         "parent-author-blocked" => ["parent-post-author", "blocked"],
618                         "parent-author-hidden" => ["parent-post-author", "hidden"],
619                 ],
620                 "query" => "FROM `post-thread`
621                         INNER JOIN `post` ON `post`.`uri-id` = `post-thread`.`uri-id`
622                         STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-thread`.`author-id`
623                         STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-thread`.`owner-id`
624                         LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post-thread`.`causer-id`
625                         LEFT JOIN `item-uri` ON `item-uri`.`id` = `post-thread`.`uri-id`
626                         LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post`.`thr-parent-id`
627                         LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post`.`parent-uri-id`
628                         LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post`.`external-id`
629                         LEFT JOIN `verb` ON `verb`.`id` = `post`.`vid`
630                         LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-thread`.`uri-id`
631                         LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-thread`.`uri-id`
632                         LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-thread`.`uri-id`
633                         LEFT JOIN `post` AS `parent-post` ON `parent-post`.`uri-id` = `post`.`parent-uri-id`
634                         LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`"
635         ],
636         "category-view" => [
637                 "fields" => [
638                         "uri-id" => ["post-category", "uri-id"],
639                         "uid" => ["post-category", "uid"],
640                         "type" => ["post-category", "type"],
641                         "tid" => ["post-category", "tid"],
642                         "name" => ["tag", "name"],
643                         "url" => ["tag", "url"],
644                 ],
645                 "query" => "FROM `post-category`
646                         LEFT JOIN `tag` ON `post-category`.`tid` = `tag`.`id`"
647         ],
648         "collection-view" => [
649                 "fields" => [
650                         "uri-id" => ["post-collection", "uri-id"],
651                         "type" => ["post-collection", "type"],
652                         "cid" => ["post", "author-id"],
653                         "received" => ["post", "received"],
654                         "created" => ["post", "created"],
655                 ],
656                 "query" => "FROM `post-collection`
657                         INNER JOIN `post` ON `post-collection`.`uri-id` = `post`.`uri-id`"
658         ],
659         "tag-view" => [
660                 "fields" => [
661                         "uri-id" => ["post-tag", "uri-id"],
662                         "type" => ["post-tag", "type"],
663                         "tid" => ["post-tag", "tid"],
664                         "cid" => ["post-tag", "cid"],
665                         "name" => "CASE `cid` WHEN 0 THEN `tag`.`name` ELSE `contact`.`name` END",
666                         "url" => "CASE `cid` WHEN 0 THEN `tag`.`url` ELSE `contact`.`url` END",
667                 ],
668                 "query" => "FROM `post-tag`
669                         LEFT JOIN `tag` ON `post-tag`.`tid` = `tag`.`id`
670                         LEFT JOIN `contact` ON `post-tag`.`cid` = `contact`.`id`"
671         ],
672         "network-item-view" => [
673                 "fields" => [
674                         "uri-id" => ["post-user", "uri-id"],
675                         "parent" => ["parent-post", "id"],
676                         "received" => ["post-user", "received"],
677                         "commented" => ["post-thread-user", "commented"],
678                         "created" => ["post-user", "created"],
679                         "uid" => ["post-user", "uid"],
680                         "starred" => ["post-thread-user", "starred"],
681                         "mention" => ["post-thread-user", "mention"],
682                         "network" => ["post-user", "network"],
683                         "unseen" => ["post-user", "unseen"],
684                         "gravity" => ["post-user", "gravity"],
685                         "contact-id" => ["post-user", "contact-id"],
686                         "contact-type" => ["ownercontact", "contact-type"],
687                 ],
688                 "query" => "FROM `post-user`
689                         STRAIGHT_JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`                  
690                         INNER JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
691                         LEFT JOIN `user-contact` AS `author` ON `author`.`uid` = `post-thread-user`.`uid` AND `author`.`cid` = `post-thread-user`.`author-id`
692                         LEFT JOIN `user-contact` AS `owner` ON `owner`.`uid` = `post-thread-user`.`uid` AND `owner`.`cid` = `post-thread-user`.`owner-id`
693                         INNER JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread-user`.`owner-id`
694                         LEFT JOIN `post-user` AS `parent-post` ON `parent-post`.`uri-id` = `post-user`.`parent-uri-id` AND `parent-post`.`uid` = `post-user`.`uid`
695                         WHERE `post-user`.`visible` AND NOT `post-user`.`deleted`
696                         AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`)
697                         AND (`post-user`.`hidden` IS NULL OR NOT `post-user`.`hidden`)
698                         AND (`author`.`blocked` IS NULL OR NOT `author`.`blocked`)
699                         AND (`owner`.`blocked` IS NULL OR NOT `owner`.`blocked`)"
700         ],
701         "network-thread-view" => [
702                 "fields" => [
703                         "uri-id" => ["post-thread-user", "uri-id"],
704                         "parent" => ["parent-post", "id"],
705                         "received" => ["post-thread-user", "received"],
706                         "commented" => ["post-thread-user", "commented"],
707                         "created" => ["post-thread-user", "created"],
708                         "uid" => ["post-thread-user", "uid"],
709                         "starred" => ["post-thread-user", "starred"],
710                         "mention" => ["post-thread-user", "mention"],
711                         "network" => ["post-thread-user", "network"],
712                         "contact-id" => ["post-thread-user", "contact-id"],
713                         "contact-type" => ["ownercontact", "contact-type"],
714                 ],
715                 "query" => "FROM `post-thread-user`
716                         INNER JOIN `post-user` ON `post-user`.`id` = `post-thread-user`.`post-user-id`
717                         STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
718                         LEFT JOIN `user-contact` AS `author` ON `author`.`uid` = `post-thread-user`.`uid` AND `author`.`cid` = `post-thread-user`.`author-id`
719                         LEFT JOIN `user-contact` AS `owner` ON `owner`.`uid` = `post-thread-user`.`uid` AND `owner`.`cid` = `post-thread-user`.`owner-id`
720                         LEFT JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread-user`.`owner-id`
721                         LEFT JOIN `post-user` AS `parent-post` ON `parent-post`.`uri-id` = `post-user`.`parent-uri-id` AND `parent-post`.`uid` = `post-user`.`uid`
722                         WHERE `post-user`.`visible` AND NOT `post-user`.`deleted`
723                         AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`)
724                         AND (`post-thread-user`.`hidden` IS NULL OR NOT `post-thread-user`.`hidden`)
725                         AND (`author`.`blocked` IS NULL OR NOT `author`.`blocked`)
726                         AND (`owner`.`blocked` IS NULL OR NOT `owner`.`blocked`)"
727         ],
728         "owner-view" => [
729                 "fields" => [
730                         "id" => ["contact", "id"],
731                         "uid" => ["contact", "uid"],
732                         "created" => ["contact", "created"],
733                         "updated" => ["contact", "updated"],
734                         "self" => ["contact", "self"],
735                         "remote_self" => ["contact", "remote_self"],
736                         "rel" => ["contact", "rel"],
737                         "network" => ["contact", "network"],
738                         "protocol" => ["contact", "protocol"],
739                         "name" => ["contact", "name"],
740                         "nick" => ["contact", "nick"],
741                         "location" => ["contact", "location"],
742                         "about" => ["contact", "about"],
743                         "keywords" => ["contact", "keywords"],
744                         "xmpp" => ["contact", "xmpp"],
745                         "matrix" => ["contact", "matrix"],
746                         "attag" => ["contact", "attag"],
747                         "avatar" => ["contact", "avatar"],
748                         "photo" => ["contact", "photo"],
749                         "thumb" => ["contact", "thumb"],
750                         "micro" => ["contact", "micro"],
751                         "header" => ["contact", "header"],
752                         "url" => ["contact", "url"],
753                         "nurl" => ["contact", "nurl"],
754                         "uri-id" => ["contact", "uri-id"],
755                         "addr" => ["contact", "addr"],
756                         "alias" => ["contact", "alias"],
757                         "pubkey" => ["contact", "pubkey"],
758                         "prvkey" => ["contact", "prvkey"],
759                         "batch" => ["contact", "batch"],
760                         "request" => ["contact", "request"],
761                         "notify" => ["contact", "notify"],
762                         "poll" => ["contact", "poll"],
763                         "confirm" => ["contact", "confirm"],
764                         "poco" => ["contact", "poco"],
765                         "subhub" => ["contact", "subhub"],
766                         "hub-verify" => ["contact", "hub-verify"],
767                         "last-update" => ["contact", "last-update"],
768                         "success_update" => ["contact", "success_update"],
769                         "failure_update" => ["contact", "failure_update"],
770                         "name-date" => ["contact", "name-date"],
771                         "uri-date" => ["contact", "uri-date"],
772                         "avatar-date" => ["contact", "avatar-date"],
773                         "picdate" => ["contact", "avatar-date"], /// @todo Replaces all uses of "picdate" with "avatar-date"
774                         "term-date" => ["contact", "term-date"],
775                         "last-item" => ["contact", "last-item"],
776                         "priority" => ["contact", "priority"],
777                         "blocked" => ["user", "blocked"],
778                         "block_reason" => ["contact", "block_reason"],
779                         "readonly" => ["contact", "readonly"],
780                         "writable" => ["contact", "writable"],
781                         "forum" => ["contact", "forum"],
782                         "prv" => ["contact", "prv"],
783                         "contact-type" => ["contact", "contact-type"],
784                         "manually-approve" => ["contact", "manually-approve"],
785                         "hidden" => ["contact", "hidden"],
786                         "archive" => ["contact", "archive"],
787                         "pending" => ["contact", "pending"],
788                         "deleted" => ["contact", "deleted"],
789                         "unsearchable" => ["contact", "unsearchable"],
790                         "sensitive" => ["contact", "sensitive"],
791                         "baseurl" => ["contact", "baseurl"],
792                         "reason" => ["contact", "reason"],
793                         "info" => ["contact", "info"],
794                         "bdyear" => ["contact", "bdyear"],
795                         "bd" => ["contact", "bd"],
796                         "notify_new_posts" => ["contact", "notify_new_posts"],
797                         "fetch_further_information" => ["contact", "fetch_further_information"],
798                         "ffi_keyword_denylist" => ["contact", "ffi_keyword_denylist"],
799                         "parent-uid" => ["user", "parent-uid"],
800                         "guid" => ["user", "guid"],
801                         "nickname" => ["user", "nickname"], /// @todo Replaces all uses of "nickname" with "nick"
802                         "email" => ["user", "email"],
803                         "openid" => ["user", "openid"],
804                         "timezone" => ["user", "timezone"],
805                         "language" => ["user", "language"],
806                         "register_date" => ["user", "register_date"],
807                         "login_date" => ["user", "login_date"],
808                         "default-location" => ["user", "default-location"],
809                         "allow_location" => ["user", "allow_location"],
810                         "theme" => ["user", "theme"],
811                         "upubkey" => ["user", "pubkey"],
812                         "uprvkey" => ["user", "prvkey"],
813                         "sprvkey" => ["user", "sprvkey"],
814                         "spubkey" => ["user", "spubkey"],
815                         "verified" => ["user", "verified"],
816                         "blockwall" => ["user", "blockwall"],
817                         "hidewall" => ["user", "hidewall"],
818                         "blocktags" => ["user", "blocktags"],
819                         "unkmail" => ["user", "unkmail"],
820                         "cntunkmail" => ["user", "cntunkmail"],
821                         "notify-flags" => ["user", "notify-flags"],
822                         "page-flags" => ["user", "page-flags"],
823                         "account-type" => ["user", "account-type"],
824                         "prvnets" => ["user", "prvnets"],
825                         "maxreq" => ["user", "maxreq"],
826                         "expire" => ["user", "expire"],
827                         "account_removed" => ["user", "account_removed"],
828                         "account_expired" => ["user", "account_expired"],
829                         "account_expires_on" => ["user", "account_expires_on"],
830                         "expire_notification_sent" => ["user", "expire_notification_sent"],
831                         "def_gid" => ["user", "def_gid"],
832                         "allow_cid" => ["user", "allow_cid"],
833                         "allow_gid" => ["user", "allow_gid"],
834                         "deny_cid" => ["user", "deny_cid"],
835                         "deny_gid" => ["user", "deny_gid"],
836                         "openidserver" => ["user", "openidserver"],
837                         "publish" => ["profile", "publish"],
838                         "net-publish" => ["profile", "net-publish"],
839                         "hide-friends" => ["profile", "hide-friends"],
840                         "prv_keywords" => ["profile", "prv_keywords"],
841                         "pub_keywords" => ["profile", "pub_keywords"],
842                         "address" => ["profile", "address"],
843                         "locality" => ["profile", "locality"],
844                         "region" => ["profile", "region"],
845                         "postal-code" => ["profile", "postal-code"],
846                         "country-name" => ["profile", "country-name"],
847                         "homepage" => ["profile", "homepage"],
848                         "dob" => ["profile", "dob"],
849                 ],
850                 "query" => "FROM `user`
851                         INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self`
852                         INNER JOIN `profile` ON `profile`.`uid` = `user`.`uid`"
853         ],
854         "account-view" => [
855                 "fields" => [
856                         "id" => ["contact", "id"],
857                         "url" => ["contact", "url"],
858                         "nurl" => ["contact", "nurl"],
859                         "uri-id" => ["contact", "uri-id"],
860                         "guid" => ["item-uri", "guid"],
861                         "addr" => ["contact", "addr"],
862                         "alias" => ["contact", "alias"],
863                         "name" => ["contact", "name"],
864                         "nick" => ["contact", "nick"],
865                         "about" => ["contact", "about"],
866                         "keywords" => ["contact", "keywords"],
867                         "xmpp" => ["contact", "xmpp"],
868                         "matrix" => ["contact", "matrix"],
869                         "avatar" => ["contact", "avatar"],
870                         "photo" => ["contact", "photo"],
871                         "thumb" => ["contact", "thumb"],
872                         "micro" => ["contact", "micro"],
873                         "header" => ["contact", "header"],
874                         "created" => ["contact", "created"],
875                         "updated" => ["contact", "updated"],
876                         "network" => ["contact", "network"],
877                         "protocol" => ["contact", "protocol"],
878                         "location" => ["contact", "location"],
879                         "attag" => ["contact", "attag"],
880                         "pubkey" => ["contact", "pubkey"],
881                         "prvkey" => ["contact", "prvkey"],
882                         "subscribe" => ["contact", "subscribe"],
883                         "last-update" => ["contact", "last-update"],
884                         "success_update" => ["contact", "success_update"],
885                         "failure_update" => ["contact", "failure_update"],
886                         "failed" => ["contact", "failed"],
887                         "last-item" => ["contact", "last-item"],
888                         "last-discovery" => ["contact", "last-discovery"],
889                         "contact-type" => ["contact", "contact-type"],
890                         "manually-approve" => ["contact", "manually-approve"],
891                         "unsearchable" => ["contact", "unsearchable"],
892                         "sensitive" => ["contact", "sensitive"],
893                         "baseurl" => ["contact", "baseurl"],
894                         "gsid" => ["contact", "gsid"],
895                         "info" => ["contact", "info"],
896                         "bdyear" => ["contact", "bdyear"],
897                         "bd" => ["contact", "bd"],
898                         "poco" => ["contact", "poco"],
899                         "name-date" => ["contact", "name-date"],
900                         "uri-date" => ["contact", "uri-date"],
901                         "avatar-date" => ["contact", "avatar-date"],
902                         "term-date" => ["contact", "term-date"],
903                         "global-ignored" => ["contact", "hidden"],
904                         "global-blocked" => ["contact", "blocked"],
905                         "hidden" => ["contact", "hidden"],
906                         "archive" => ["contact", "archive"],
907                         "deleted" => ["contact", "deleted"],
908                         "blocked" => ["contact", "blocked"],
909                         "dfrn-notify" => ["contact", "notify"],
910                         "dfrn-poll" => ["contact", "poll"],
911                         "diaspora-guid" => ["fcontact", "guid"],
912                         "diaspora-batch" => ["fcontact", "batch"],
913                         "diaspora-notify" => ["fcontact", "notify"],
914                         "diaspora-poll" => ["fcontact", "poll"],
915                         "diaspora-alias" => ["fcontact", "alias"],
916                         "ap-uuid" => ["apcontact", "uuid"],
917                         "ap-type" => ["apcontact", "type"],
918                         "ap-following" => ["apcontact", "following"],
919                         "ap-followers" => ["apcontact", "followers"],
920                         "ap-inbox" => ["apcontact", "inbox"],
921                         "ap-outbox" => ["apcontact", "outbox"],
922                         "ap-sharedinbox" => ["apcontact", "sharedinbox"],
923                         "ap-generator" => ["apcontact", "generator"],
924                         "ap-following_count" => ["apcontact", "following_count"],
925                         "ap-followers_count" => ["apcontact", "followers_count"],
926                         "ap-statuses_count" => ["apcontact", "statuses_count"],
927                         "site_name" => ["gserver", "site_name"],
928                         "platform" => ["gserver", "platform"],
929                         "version" => ["gserver", "version"],
930                 ],
931                 "query" => "FROM `contact`
932                         LEFT JOIN `item-uri` ON `item-uri`.`id` = `contact`.`uri-id`
933                         LEFT JOIN `apcontact` ON `apcontact`.`uri-id` = `contact`.`uri-id`
934                         LEFT JOIN `fcontact` ON `fcontact`.`uri-id` = contact.`uri-id`
935                         LEFT JOIN `gserver` ON `gserver`.`id` = contact.`gsid`
936                         WHERE `contact`.`uid` = 0"                      
937         ],
938         "account-user-view" => [
939                 "fields" => [
940                         "id" => ["ucontact", "id"],
941                         "pid" => ["contact", "id"],
942                         "uid" => ["ucontact", "uid"],
943                         "url" => ["contact", "url"],
944                         "nurl" => ["contact", "nurl"],
945                         "uri-id" => ["contact", "uri-id"],
946                         "guid" => ["item-uri", "guid"],
947                         "addr" => ["contact", "addr"],
948                         "alias" => ["contact", "alias"],
949                         "name" => ["contact", "name"],
950                         "nick" => ["contact", "nick"],
951                         "about" => ["contact", "about"],
952                         "keywords" => ["contact", "keywords"],
953                         "xmpp" => ["contact", "xmpp"],
954                         "matrix" => ["contact", "matrix"],
955                         "avatar" => ["contact", "avatar"],
956                         "photo" => ["contact", "photo"],
957                         "thumb" => ["contact", "thumb"],
958                         "micro" => ["contact", "micro"],
959                         "header" => ["contact", "header"],
960                         "created" => ["contact", "created"],
961                         "updated" => ["contact", "updated"],
962                         "self" => ["ucontact", "self"],
963                         "remote_self" => ["ucontact", "remote_self"],
964                         "rel" =>  ["ucontact", "rel"],
965                         "network" => ["contact", "network"],
966                         "protocol" => ["ucontact", "protocol"],
967                         "location" => ["contact", "location"],
968                         "attag" => ["ucontact", "attag"],
969                         "pubkey" => ["contact", "pubkey"],
970                         "prvkey" => ["contact", "prvkey"],
971                         "subscribe" => ["contact", "subscribe"],
972                         "last-update" => ["contact", "last-update"],
973                         "success_update" => ["contact", "success_update"],
974                         "failure_update" => ["contact", "failure_update"],
975                         "failed" => ["contact", "failed"],
976                         "last-item" => ["contact", "last-item"],
977                         "last-discovery" => ["contact", "last-discovery"],
978                         "contact-type" => ["contact", "contact-type"],
979                         "manually-approve" => ["contact", "manually-approve"],
980                         "unsearchable" => ["contact", "unsearchable"],
981                         "sensitive" => ["contact", "sensitive"],
982                         "baseurl" => ["contact", "baseurl"],
983                         "gsid" => ["contact", "gsid"],
984                         "info" => ["ucontact", "info"],
985                         "bdyear" => ["contact", "bdyear"],
986                         "bd" => ["contact", "bd"],
987                         "poco" => ["contact", "poco"],
988                         "name-date" => ["contact", "name-date"],
989                         "uri-date" => ["contact", "uri-date"],
990                         "avatar-date" => ["contact", "avatar-date"],
991                         "term-date" => ["contact", "term-date"],
992                         "global-ignored" => ["contact", "hidden"],
993                         "global-blocked" => ["contact", "blocked"],
994                         "hidden" => ["ucontact", "hidden"],
995                         "archive" => ["ucontact", "archive"],
996                         "pending" => ["ucontact", "pending"],
997                         "deleted" => ["ucontact", "deleted"],
998                         "notify_new_posts" => ["ucontact", "notify_new_posts"],
999                         "fetch_further_information" => ["ucontact", "fetch_further_information"],
1000                         "ffi_keyword_denylist" => ["ucontact", "ffi_keyword_denylist"],
1001                         "rating" => ["ucontact", "rating"],
1002                         "readonly" => ["ucontact", "readonly"],
1003                         "blocked" => ["ucontact", "blocked"],
1004                         "block_reason" => ["ucontact", "block_reason"],
1005                         "subhub" => ["ucontact", "subhub"],
1006                         "hub-verify" => ["ucontact", "hub-verify"],
1007                         "reason" => ["ucontact", "reason"],
1008                         "dfrn-notify" => ["contact", "notify"],
1009                         "dfrn-poll" => ["contact", "poll"],
1010                         "diaspora-guid" => ["fcontact", "guid"],
1011                         "diaspora-batch" => ["fcontact", "batch"],
1012                         "diaspora-notify" => ["fcontact", "notify"],
1013                         "diaspora-poll" => ["fcontact", "poll"],
1014                         "diaspora-alias" => ["fcontact", "alias"],
1015                         "ap-uuid" => ["apcontact", "uuid"],
1016                         "ap-type" => ["apcontact", "type"],
1017                         "ap-following" => ["apcontact", "following"],
1018                         "ap-followers" => ["apcontact", "followers"],
1019                         "ap-inbox" => ["apcontact", "inbox"],
1020                         "ap-outbox" => ["apcontact", "outbox"],
1021                         "ap-sharedinbox" => ["apcontact", "sharedinbox"],
1022                         "ap-generator" => ["apcontact", "generator"],
1023                         "ap-following_count" => ["apcontact", "following_count"],
1024                         "ap-followers_count" => ["apcontact", "followers_count"],
1025                         "ap-statuses_count" => ["apcontact", "statuses_count"],
1026                         "site_name" => ["gserver", "site_name"],
1027                         "platform" => ["gserver", "platform"],
1028                         "version" => ["gserver", "version"],
1029                 ],
1030                 "query" => "FROM `contact` AS `ucontact`
1031                         INNER JOIN `contact` ON `contact`.`uri-id` = `ucontact`.`uri-id` AND `contact`.`uid` = 0
1032                         LEFT JOIN `item-uri` ON `item-uri`.`id` = `ucontact`.`uri-id`
1033                         LEFT JOIN `apcontact` ON `apcontact`.`uri-id` = `ucontact`.`uri-id`
1034                         LEFT JOIN `fcontact` ON `fcontact`.`uri-id` = `ucontact`.`uri-id` AND `fcontact`.`network` = 'dspr'
1035                         LEFT JOIN `gserver` ON `gserver`.`id` = contact.`gsid`"
1036         ],
1037         "pending-view" => [
1038                 "fields" => [
1039                         "id" => ["register", "id"],
1040                         "hash" => ["register", "hash"],
1041                         "created" => ["register", "created"],
1042                         "uid" => ["register", "uid"],
1043                         "password" => ["register", "password"],
1044                         "language" => ["register", "language"],
1045                         "note" => ["register", "note"],
1046                         "self" => ["contact", "self"],
1047                         "name" => ["contact", "name"],
1048                         "url" => ["contact", "url"],
1049                         "micro" => ["contact", "micro"],
1050                         "email" => ["user", "email"],
1051                         "nick" => ["contact", "nick"],
1052                 ],
1053                 "query" => "FROM `register`
1054                         INNER JOIN `contact` ON `register`.`uid` = `contact`.`uid`
1055                         INNER JOIN `user` ON `register`.`uid` = `user`.`uid`"
1056         ],
1057         "tag-search-view" => [
1058                 "fields" => [
1059                         "uri-id" => ["post-tag", "uri-id"],
1060                         "uid" => ["post-user", "uid"],
1061                         "iid" => ["post-user", "id"],
1062                         "private" => ["post-user", "private"],
1063                         "wall" => ["post-user", "wall"],
1064                         "origin" => ["post-user", "origin"],
1065                         "global" => ["post-user", "global"],
1066                         "gravity" => ["post-user", "gravity"],
1067                         "received" => ["post-user", "received"],
1068                         "network" => ["post-user", "network"],
1069                         "author-id" => ["post-user", "author-id"],
1070                         "name" => ["tag", "name"],
1071                 ],
1072                 "query" => "FROM `post-tag`
1073                         INNER JOIN `tag` ON `tag`.`id` = `post-tag`.`tid`
1074                         STRAIGHT_JOIN `post-user` ON `post-user`.`uri-id` = `post-tag`.`uri-id`
1075                         WHERE `post-tag`.`type` = 1"
1076         ],
1077         "workerqueue-view" => [
1078                 "fields" => [
1079                         "pid" => ["process", "pid"],
1080                         "priority" => ["workerqueue", "priority"],
1081                 ],
1082                 "query" => "FROM `process`
1083                         INNER JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid`
1084                         WHERE NOT `workerqueue`.`done`"
1085         ],
1086         "profile_field-view" => [
1087                 "fields" => [
1088                         "id" => ["profile_field", "id"],
1089                         "uid" => ["profile_field", "uid"],
1090                         "label" => ["profile_field", "label"],
1091                         "value" => ["profile_field", "value"],
1092                         "order" => ["profile_field", "order"],
1093                         "psid"=> ["profile_field", "psid"],
1094                         "allow_cid" => ["permissionset", "allow_cid"],
1095                         "allow_gid" => ["permissionset", "allow_gid"],
1096                         "deny_cid" => ["permissionset", "deny_cid"],
1097                         "deny_gid" => ["permissionset", "deny_gid"],
1098                         "created" => ["profile_field", "created"],
1099                         "edited" => ["profile_field", "edited"],
1100                 ],
1101                 "query" => "FROM `profile_field`
1102                         INNER JOIN `permissionset` ON `permissionset`.`id` = `profile_field`.`psid`"
1103         ],
1104 ];
1105