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