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