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