]> git.mxchange.org Git - friendica.git/blob - static/dbview.config.php
The "icid" field is deprecated
[friendica.git] / static / dbview.config.php
1 <?php
2 /**
3  * @copyright Copyright (C) 2020, Friendica
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         "post-view" => [
41                 "fields" => [
42                         "id" => ["item", "id"],
43                         "item_id" => ["item", "id"],
44                         "uid" => ["item", "uid"],
45                         "internal-uid" => ["item", "uid"],
46                         "parent" => ["item", "parent"],
47                         "uri" => ["item", "uri"],
48                         "uri-id" => ["item", "uri-id"],
49                         "internal-uri-id" => ["item", "uri-id"],
50                         "parent-uri" => ["item", "parent-uri"],
51                         "parent-uri-id" => ["item", "parent-uri-id"],
52                         "thr-parent" => ["item", "thr-parent"],
53                         "thr-parent-id" => ["item", "thr-parent-id"],
54                         "guid" => ["item", "guid"],
55                         "type" => ["item", "type"],
56                         "wall" => ["item", "wall"],
57                         "gravity" => ["item", "gravity"],
58                         "extid" => ["item", "extid"],
59                         "created" => ["item", "created"],
60                         "edited" => ["item", "edited"],
61                         "commented" => ["item", "commented"],
62                         "received" => ["item", "received"],
63                         "changed" => ["item", "changed"],
64                         "resource-id" => ["item", "resource-id"],
65                         "post-type" => ["item", "post-type"],
66                         "private" => ["item", "private"],
67                         "pubmail" => ["item", "pubmail"],
68                         "moderated" => ["item", "moderated"],
69                         "visible" => ["item", "visible"],
70                         "starred" => ["item", "starred"],
71                         "bookmark" => ["item", "bookmark"],
72                         "unseen" => ["item", "unseen"],
73                         "deleted" => ["item", "deleted"],
74                         "origin" => ["item", "origin"],
75                         "forum_mode" => ["item", "forum_mode"],
76                         "mention" => ["item", "mention"],
77                         "global" => ["item", "global"],
78                         "network" => ["item", "network"],
79                         "vid" => ["item", "vid"],
80                         "psid" => ["item", "psid"],
81                         "attach" => ["item", "attach"],
82                         "internal-file-count" => "(SELECT COUNT(*) FROM `post-category` WHERE `post-category`.`uri-id` = `item`.`uri-id`)",
83                         "file" => "NULL",
84                         "verb" => "IF (`item`.`vid` IS NULL, '', `verb`.`name`)",
85                         "title" => ["item-content", "title"],
86                         "content-warning" => ["item-content", "content-warning"],
87                         "raw-body" => ["item-content", "raw-body"],
88                         "body" => ["item-content", "body"],
89                         "rendered-hash" => ["item-content", "rendered-hash"],
90                         "rendered-html" => ["item-content", "rendered-html"],
91                         "language" => ["item-content", "language"],
92                         "plink" => ["item-content", "plink"],
93                         "location" => ["item-content", "location"],
94                         "coord" => ["item-content", "coord"],
95                         "app" => ["item-content", "app"],
96                         "object-type" => ["item-content", "object-type"],
97                         "object" => ["item-content", "object"],
98                         "target-type" => ["item-content", "target-type"],
99                         "target" => ["item-content", "target"],
100                         "contact-id" => ["item", "contact-id"],
101                         "contact-link" => ["contact", "url"],
102                         "contact-addr" => ["contact", "addr"],
103                         "contact-name" => ["contact", "name"],
104                         "contact-nick" => ["contact", "nick"],
105                         "contact-avatar" => ["contact", "thumb"],
106                         "contact-network" => ["contact", "network"],
107                         "contact-blocked" => ["contact", "blocked"],
108                         "contact-hidden" => ["contact", "hidden"],
109                         "contact-readonly" => ["contact", "readonly"],
110                         "contact-archive" => ["contact", "archive"],
111                         "contact-pending" => ["contact", "pending"],
112                         "contact-rel" => ["contact", "rel"],
113                         "contact-uid" => ["contact", "uid"],
114                         "contact-contact-type" => ["contact", "contact-type"],
115                         "writable" => "IF (`item`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `contact`.`writable`)",
116                         "self" => ["contact", "self"],
117                         "cid" => ["contact", "id"],
118                         "alias" => ["contact", "alias"],
119                         "photo" => ["contact", "photo"],
120                         "name-date" => ["contact", "name-date"],
121                         "uri-date" => ["contact", "uri-date"],
122                         "avatar-date" => ["contact", "avatar-date"],
123                         "thumb" => ["contact", "thumb"],
124                         "dfrn-id" => ["contact", "dfrn-id"],
125                         "author-id" => ["item", "author-id"],
126                         "author-link" => ["author", "url"],
127                         "author-addr" => ["author", "addr"],
128                         "author-name" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`name` != '', `contact`.`name`, `author`.`name`)",
129                         "author-nick" => ["author", "nick"],
130                         "author-avatar" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `author`.`thumb`)",
131                         "author-network" => ["author", "network"],
132                         "author-blocked" => ["author", "blocked"],
133                         "author-hidden" => ["author", "hidden"],
134                         "owner-id" => ["item", "owner-id"],
135                         "owner-link" => ["owner", "url"],
136                         "owner-addr" => ["owner", "addr"],
137                         "owner-name" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`name` != '', `contact`.`name`, `owner`.`name`)",
138                         "owner-nick" => ["owner", "nick"],
139                         "owner-avatar" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `owner`.`thumb`)",
140                         "owner-network" => ["owner", "network"],
141                         "owner-blocked" => ["owner", "blocked"],
142                         "owner-hidden" => ["owner", "hidden"],
143                         "causer-id" => ["item", "causer-id"],
144                         "causer-link" => ["causer", "url"],
145                         "causer-addr" => ["causer", "addr"],
146                         "causer-name" => ["causer", "name"],
147                         "causer-nick" => ["causer", "nick"], 
148                         "causer-avatar" => ["causer", "thumb"],
149                         "causer-network" => ["causer", "network"],
150                         "causer-blocked" => ["causer", "blocked"],
151                         "causer-hidden" => ["causer", "hidden"],
152                         "causer-contact-type" => ["causer", "contact-type"],
153                         "postopts" => ["post-delivery-data", "postopts"],
154                         "inform" => ["post-delivery-data", "inform"],
155                         "delivery_queue_count" => ["post-delivery-data", "queue_count"],
156                         "delivery_queue_done" => ["post-delivery-data", "queue_done"],
157                         "delivery_queue_failed" => ["post-delivery-data", "queue_failed"],
158                         "allow_cid" => "IF (`item`.`psid` IS NULL, '', `permissionset`.`allow_cid`)",
159                         "allow_gid" => "IF (`item`.`psid` IS NULL, '', `permissionset`.`allow_gid`)",
160                         "deny_cid" => "IF (`item`.`psid` IS NULL, '', `permissionset`.`deny_cid`)",
161                         "deny_gid" => "IF (`item`.`psid` IS NULL, '', `permissionset`.`deny_gid`)",
162                         "event-id" => ["item", "event-id"],
163                         "event-created" => ["event", "created"],
164                         "event-edited" => ["event", "edited"],
165                         "event-start" => ["event", "start"],
166                         "event-finish" => ["event", "finish"],
167                         "event-summary" => ["event", "summary"],
168                         "event-desc" => ["event", "desc"],
169                         "event-location" => ["event", "location"],
170                         "event-type" => ["event", "type"],
171                         "event-nofinish" => ["event", "nofinish"],
172                         "event-adjust" => ["event", "adjust"],
173                         "event-ignore" => ["event", "ignore"],
174                         "signed_text" => ["diaspora-interaction", "interaction"],
175                         "parent-guid" => ["parent-item", "guid"],
176                         "parent-network" => ["parent-item", "network"],
177                         "parent-author-id" => ["parent-item", "author-id"],
178                         "parent-author-link" => ["parent-item-author", "url"],  
179                         "parent-author-name" => ["parent-item-author", "name"],
180                         "parent-author-network" => ["parent-item-author", "network"], 
181                 ],
182                 "query" => "FROM `item`
183                         STRAIGHT_JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
184                         STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `item`.`author-id`
185                         STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `item`.`owner-id`
186                         STRAIGHT_JOIN `contact` AS `causer` ON `causer`.`id` = `item`.`causer-id`
187                         LEFT JOIN `verb` ON `verb`.`id` = `item`.`vid`
188                         LEFT JOIN `event` ON `event`.`id` = `item`.`event-id`
189                         LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `item`.`uri-id`
190                         LEFT JOIN `item-content` ON `item-content`.`uri-id` = `item`.`uri-id`
191                         LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `item`.`uri-id` AND `item`.`origin`
192                         LEFT JOIN `permissionset` ON `permissionset`.`id` = `item`.`psid`
193                         STRAIGHT_JOIN `item` AS `parent-item` ON `parent-item`.`uri-id` = `item`.`parent-uri-id` AND `parent-item`.`uid` = `item`.`uid`
194                         STRAIGHT_JOIN `contact` AS `parent-item-author` ON `parent-item-author`.`id` = `parent-item`.`author-id`"
195         ],
196         "post-thread-view" => [
197                 "fields" => [
198                         "id" => ["item", "id"],
199                         "iid" => ["thread", "iid"],
200                         "item_id" => ["item", "id"],
201                         "uid" => ["thread", "uid"],
202                         "internal-uid" => ["item", "uid"],
203                         "parent" => ["item", "parent"],
204                         "uri" => ["item", "uri"],
205                         "uri-id" => ["item", "uri-id"],
206                         "internal-uri-id" => ["item", "uri-id"],
207                         "parent-uri" => ["item", "parent-uri"],
208                         "parent-uri-id" => ["item", "parent-uri-id"],
209                         "thr-parent" => ["item", "thr-parent"],
210                         "thr-parent-id" => ["item", "thr-parent-id"],
211                         "guid" => ["item", "guid"],
212                         "type" => ["item", "type"],
213                         "wall" => ["thread", "wall"],
214                         "gravity" => ["item", "gravity"],
215                         "extid" => ["item", "extid"],
216                         "created" => ["thread", "created"],
217                         "edited" => ["item", "edited"],
218                         "commented" => ["thread", "commented"],
219                         "received" => ["thread", "received"],
220                         "changed" => ["thread", "changed"],
221                         "resource-id" => ["item", "resource-id"],
222                         "post-type" => ["thread", "post-type"],
223                         "private" => ["thread", "private"],
224                         "pubmail" => ["thread", "pubmail"],
225                         "moderated" => ["thread", "moderated"],
226                         "ignored" => ["thread", "ignored"],
227                         "visible" => ["thread", "visible"],
228                         "starred" => ["thread", "starred"],
229                         "bookmark" => ["item", "bookmark"],
230                         "unseen" => ["item", "unseen"],
231                         "deleted" => ["thread", "deleted"],
232                         "origin" => ["thread", "origin"],
233                         "forum_mode" => ["thread", "forum_mode"],
234                         "mention" => ["thread", "mention"],
235                         "global" => ["item", "global"],
236                         "network" => ["thread", "network"],
237                         "vid" => ["item", "vid"],
238                         "psid" => ["item", "psid"],
239                         "attach" => ["item", "attach"],
240                         "internal-file-count" => "(SELECT COUNT(*) FROM `post-category` WHERE `post-category`.`uri-id` = `item`.`uri-id`)",
241                         "file" => "NULL",
242                         "verb" => "IF (`item`.`vid` IS NULL, '', `verb`.`name`)",
243                         "title" => ["item-content", "title"],
244                         "content-warning" => ["item-content", "content-warning"],
245                         "raw-body" => ["item-content", "raw-body"],
246                         "body" => ["item-content", "body"],
247                         "rendered-hash" => ["item-content", "rendered-hash"],
248                         "rendered-html" => ["item-content", "rendered-html"],
249                         "language" => ["item-content", "language"],
250                         "plink" => ["item-content", "plink"],
251                         "location" => ["item-content", "location"],
252                         "coord" => ["item-content", "coord"],
253                         "app" => ["item-content", "app"],
254                         "object-type" => ["item-content", "object-type"],
255                         "object" => ["item-content", "object"],
256                         "target-type" => ["item-content", "target-type"],
257                         "target" => ["item-content", "target"],
258                         "contact-id" => ["thread", "contact-id"],
259                         "contact-link" => ["contact", "url"],
260                         "contact-addr" => ["contact", "addr"],
261                         "contact-name" => ["contact", "name"],
262                         "contact-nick" => ["contact", "nick"],
263                         "contact-avatar" => ["contact", "thumb"],
264                         "contact-network" => ["contact", "network"],
265                         "contact-blocked" => ["contact", "blocked"],
266                         "contact-hidden" => ["contact", "hidden"],
267                         "contact-readonly" => ["contact", "readonly"],
268                         "contact-archive" => ["contact", "archive"],
269                         "contact-pending" => ["contact", "pending"],
270                         "contact-rel" => ["contact", "rel"],
271                         "contact-uid" => ["contact", "uid"],
272                         "contact-contact-type" => ["contact", "contact-type"],
273                         "writable" => "IF (`item`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `contact`.`writable`)",
274                         "self" => ["contact", "self"],
275                         "cid" => ["contact", "id"],
276                         "alias" => ["contact", "alias"],
277                         "photo" => ["contact", "photo"],
278                         "name-date" => ["contact", "name-date"],
279                         "uri-date" => ["contact", "uri-date"],
280                         "avatar-date" => ["contact", "avatar-date"],
281                         "thumb" => ["contact", "thumb"],
282                         "dfrn-id" => ["contact", "dfrn-id"],
283                         "author-id" => ["thread", "author-id"],
284                         "author-link" => ["author", "url"],
285                         "author-addr" => ["author", "addr"],
286                         "author-name" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`name` != '', `contact`.`name`, `author`.`name`)",
287                         "author-nick" => ["author", "nick"],
288                         "author-avatar" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `author`.`thumb`)",
289                         "author-network" => ["author", "network"],
290                         "author-blocked" => ["author", "blocked"],
291                         "author-hidden" => ["author", "hidden"],
292                         "owner-id" => ["thread", "owner-id"],
293                         "owner-link" => ["owner", "url"],
294                         "owner-addr" => ["owner", "addr"],
295                         "owner-name" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`name` != '', `contact`.`name`, `owner`.`name`)",
296                         "owner-nick" => ["owner", "nick"],
297                         "owner-avatar" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `owner`.`thumb`)",
298                         "owner-network" => ["owner", "network"],
299                         "owner-blocked" => ["owner", "blocked"],
300                         "owner-hidden" => ["owner", "hidden"],
301                         "causer-id" => ["item", "causer-id"],
302                         "causer-link" => ["causer", "url"],
303                         "causer-addr" => ["causer", "addr"],
304                         "causer-name" => ["causer", "name"],
305                         "causer-nick" => ["causer", "nick"], 
306                         "causer-avatar" => ["causer", "thumb"],
307                         "causer-network" => ["causer", "network"],
308                         "causer-blocked" => ["causer", "blocked"],
309                         "causer-hidden" => ["causer", "hidden"],
310                         "causer-contact-type" => ["causer", "contact-type"],
311                         "postopts" => ["post-delivery-data", "postopts"],
312                         "inform" => ["post-delivery-data", "inform"],
313                         "delivery_queue_count" => ["post-delivery-data", "queue_count"],
314                         "delivery_queue_done" => ["post-delivery-data", "queue_done"],
315                         "delivery_queue_failed" => ["post-delivery-data", "queue_failed"],
316                         "allow_cid" => "IF (`item`.`psid` IS NULL, '', `permissionset`.`allow_cid`)",
317                         "allow_gid" => "IF (`item`.`psid` IS NULL, '', `permissionset`.`allow_gid`)",
318                         "deny_cid" => "IF (`item`.`psid` IS NULL, '', `permissionset`.`deny_cid`)",
319                         "deny_gid" => "IF (`item`.`psid` IS NULL, '', `permissionset`.`deny_gid`)",
320                         "event-id" => ["item", "event-id"],
321                         "event-created" => ["event", "created"],
322                         "event-edited" => ["event", "edited"],
323                         "event-start" => ["event", "start"],
324                         "event-finish" => ["event", "finish"],
325                         "event-summary" => ["event", "summary"],
326                         "event-desc" => ["event", "desc"],
327                         "event-location" => ["event", "location"],
328                         "event-type" => ["event", "type"],
329                         "event-nofinish" => ["event", "nofinish"],
330                         "event-adjust" => ["event", "adjust"],
331                         "event-ignore" => ["event", "ignore"],
332                         "signed_text" => ["diaspora-interaction", "interaction"],
333                         "parent-guid" => ["parent-item", "guid"],
334                         "parent-network" => ["parent-item", "network"],
335                         "parent-author-id" => ["parent-item", "author-id"],
336                         "parent-author-link" => ["parent-item-author", "url"],  
337                         "parent-author-name" => ["parent-item-author", "name"],
338                         "parent-author-network" => ["parent-item-author", "network"], 
339                 ],
340                 "query" => "FROM `thread`
341                         STRAIGHT_JOIN `item` ON `item`.`id` = `thread`.`iid`
342                         STRAIGHT_JOIN `contact` ON `contact`.`id` = `thread`.`contact-id`
343                         STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `thread`.`author-id`
344                         STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `thread`.`owner-id`
345                         STRAIGHT_JOIN `contact` AS `causer` ON `causer`.`id` = `item`.`causer-id`
346                         LEFT JOIN `verb` ON `verb`.`id` = `item`.`vid`
347                         LEFT JOIN `event` ON `event`.`id` = `item`.`event-id`
348                         LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `thread`.`uri-id`
349                         LEFT JOIN `item-content` ON `item-content`.`uri-id` = `thread`.`uri-id`
350                         LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `thread`.`uri-id` AND `thread`.`origin`
351                         LEFT JOIN `permissionset` ON `permissionset`.`id` = `item`.`psid`
352                         STRAIGHT_JOIN `item` AS `parent-item` ON `parent-item`.`id` = `item`.`parent`
353                         STRAIGHT_JOIN `contact` AS `parent-item-author` ON `parent-item-author`.`id` = `parent-item`.`author-id`"
354         ],
355         "category-view" => [
356                 "fields" => [
357                         "uri-id" => ["post-category", "uri-id"],
358                         "uid" => ["post-category", "uid"],
359                         "uri" => ["item-uri", "uri"],
360                         "guid" => ["item-uri", "guid"],
361                         "type" => ["post-category", "type"],
362                         "tid" => ["post-category", "tid"],
363                         "name" => ["tag", "name"],
364                         "url" => ["tag", "url"],
365                 ],
366                 "query" => "FROM `post-category`
367                         INNER JOIN `item-uri` ON `item-uri`.id = `post-category`.`uri-id`
368                         LEFT JOIN `tag` ON `post-category`.`tid` = `tag`.`id`"
369         ],
370         "tag-view" => [
371                 "fields" => [
372                         "uri-id" => ["post-tag", "uri-id"],
373                         "uri" => ["item-uri", "uri"],
374                         "guid" => ["item-uri", "guid"],
375                         "type" => ["post-tag", "type"],
376                         "tid" => ["post-tag", "tid"],
377                         "cid" => ["post-tag", "cid"],
378                         "name" => "CASE `cid` WHEN 0 THEN `tag`.`name` ELSE `contact`.`name` END",
379                         "url" => "CASE `cid` WHEN 0 THEN `tag`.`url` ELSE `contact`.`url` END",
380                 ],
381                 "query" => "FROM `post-tag`
382                         INNER JOIN `item-uri` ON `item-uri`.id = `post-tag`.`uri-id`
383                         LEFT JOIN `tag` ON `post-tag`.`tid` = `tag`.`id`
384                         LEFT JOIN `contact` ON `post-tag`.`cid` = `contact`.`id`"
385         ],
386         "network-item-view" => [
387                 "fields" => [
388                         "uri-id" => ["item", "parent-uri-id"],
389                         "uri" => ["item", "parent-uri"],
390                         "parent" => ["item", "parent"],
391                         "received" => ["item", "received"],
392                         "commented" => ["item", "commented"],
393                         "created" => ["item", "created"],
394                         "uid" => ["item", "uid"],
395                         "starred" => ["item", "starred"],
396                         "mention" => ["item", "mention"],
397                         "network" => ["item", "network"],
398                         "unseen" => ["item", "unseen"],
399                         "gravity" => ["item", "gravity"],
400                         "contact-id" => ["item", "contact-id"],
401                         "contact-type" => ["ownercontact", "contact-type"],
402                 ],
403                 "query" => "FROM `item`
404                         INNER JOIN `thread` ON `thread`.`iid` = `item`.`parent`
405                         STRAIGHT_JOIN `contact` ON `contact`.`id` = `thread`.`contact-id`
406                         LEFT JOIN `user-item` ON `user-item`.`iid` = `item`.`id` AND `user-item`.`uid` = `thread`.`uid`
407                         LEFT JOIN `user-contact` AS `author` ON `author`.`uid` = `thread`.`uid` AND `author`.`cid` = `thread`.`author-id`
408                         LEFT JOIN `user-contact` AS `owner` ON `owner`.`uid` = `thread`.`uid` AND `owner`.`cid` = `thread`.`owner-id`
409                         LEFT JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `thread`.`owner-id`
410                         WHERE `thread`.`visible` AND NOT `thread`.`deleted` AND NOT `thread`.`moderated`
411                         AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`)
412                         AND (`user-item`.`hidden` IS NULL OR NOT `user-item`.`hidden`)
413                         AND (`author`.`blocked` IS NULL OR NOT `author`.`blocked`)
414                         AND (`owner`.`blocked` IS NULL OR NOT `owner`.`blocked`)"
415         ],
416         "network-thread-view" => [
417                 "fields" => [
418                         "uri-id" => ["item", "uri-id"],
419                         "uri" => ["item", "uri"],
420                         "parent-uri-id" => ["item", "parent-uri-id"],
421                         "parent" => ["thread", "iid"],
422                         "received" => ["thread", "received"],
423                         "commented" => ["thread", "commented"],
424                         "created" => ["thread", "created"],
425                         "uid" => ["thread", "uid"],
426                         "starred" => ["thread", "starred"],
427                         "mention" => ["thread", "mention"],
428                         "network" => ["thread", "network"],
429                         "contact-id" => ["thread", "contact-id"],
430                         "contact-type" => ["ownercontact", "contact-type"],
431                 ],
432                 "query" => "FROM `thread`
433                         STRAIGHT_JOIN `contact` ON `contact`.`id` = `thread`.`contact-id`
434                         STRAIGHT_JOIN `item` ON `item`.`id` = `thread`.`iid`
435                         LEFT JOIN `user-item` ON `user-item`.`iid` = `item`.`id` AND `user-item`.`uid` = `thread`.`uid`
436                         LEFT JOIN `user-contact` AS `author` ON `author`.`uid` = `thread`.`uid` AND `author`.`cid` = `thread`.`author-id`
437                         LEFT JOIN `user-contact` AS `owner` ON `owner`.`uid` = `thread`.`uid` AND `owner`.`cid` = `thread`.`owner-id`
438                         LEFT JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `thread`.`owner-id`
439                         WHERE `thread`.`visible` AND NOT `thread`.`deleted` AND NOT `thread`.`moderated`
440                         AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`)
441                         AND (`user-item`.`hidden` IS NULL OR NOT `user-item`.`hidden`)
442                         AND (`author`.`blocked` IS NULL OR NOT `author`.`blocked`)
443                         AND (`owner`.`blocked` IS NULL OR NOT `owner`.`blocked`)"
444         ],
445         "owner-view" => [
446                 "fields" => [
447                         "id" => ["contact", "id"],
448                         "uid" => ["contact", "uid"],
449                         "created" => ["contact", "created"],
450                         "updated" => ["contact", "updated"],
451                         "self" => ["contact", "self"],
452                         "remote_self" => ["contact", "remote_self"],
453                         "rel" => ["contact", "rel"],
454                         "duplex" => ["contact", "duplex"],
455                         "network" => ["contact", "network"],
456                         "protocol" => ["contact", "protocol"],
457                         "name" => ["contact", "name"],
458                         "nick" => ["contact", "nick"],
459                         "location" => ["contact", "location"],
460                         "about" => ["contact", "about"],
461                         "keywords" => ["contact", "keywords"],
462                         "gender" => ["contact", "gender"],
463                         "xmpp" => ["contact", "xmpp"],
464                         "attag" => ["contact", "attag"],
465                         "avatar" => ["contact", "avatar"],
466                         "photo" => ["contact", "photo"],
467                         "thumb" => ["contact", "thumb"],
468                         "micro" => ["contact", "micro"],
469                         "site-pubkey" => ["contact", "site-pubkey"],
470                         "issued-id" => ["contact", "issued-id"],
471                         "dfrn-id" => ["contact", "dfrn-id"],
472                         "url" => ["contact", "url"],
473                         "nurl" => ["contact", "nurl"],
474                         "addr" => ["contact", "addr"],
475                         "alias" => ["contact", "alias"],
476                         "pubkey" => ["contact", "pubkey"],
477                         "prvkey" => ["contact", "prvkey"],
478                         "batch" => ["contact", "batch"],
479                         "request" => ["contact", "request"],
480                         "notify" => ["contact", "notify"],
481                         "poll" => ["contact", "poll"],
482                         "confirm" => ["contact", "confirm"],
483                         "poco" => ["contact", "poco"],
484                         "aes_allow" => ["contact", "aes_allow"],
485                         "ret-aes" => ["contact", "ret-aes"],
486                         "usehub" => ["contact", "usehub"],
487                         "subhub" => ["contact", "subhub"],
488                         "hub-verify" => ["contact", "hub-verify"],
489                         "last-update" => ["contact", "last-update"],
490                         "success_update" => ["contact", "success_update"],
491                         "failure_update" => ["contact", "failure_update"],
492                         "name-date" => ["contact", "name-date"],
493                         "uri-date" => ["contact", "uri-date"],
494                         "avatar-date" => ["contact", "avatar-date"],
495                         "picdate" => ["contact", "avatar-date"], /// @todo Replaces all uses of "picdate" with "avatar-date"
496                         "term-date" => ["contact", "term-date"],
497                         "last-item" => ["contact", "last-item"],
498                         "priority" => ["contact", "priority"],
499                         "blocked" => ["user", "blocked"],
500                         "block_reason" => ["contact", "block_reason"],
501                         "readonly" => ["contact", "readonly"],
502                         "writable" => ["contact", "writable"],
503                         "forum" => ["contact", "forum"],
504                         "prv" => ["contact", "prv"],
505                         "contact-type" => ["contact", "contact-type"],
506                         "manually-approve" => ["contact", "manually-approve"],
507                         "hidden" => ["contact", "hidden"],
508                         "archive" => ["contact", "archive"],
509                         "pending" => ["contact", "pending"],
510                         "deleted" => ["contact", "deleted"],
511                         "unsearchable" => ["contact", "unsearchable"],
512                         "sensitive" => ["contact", "sensitive"],
513                         "baseurl" => ["contact", "baseurl"],
514                         "reason" => ["contact", "reason"],
515                         "closeness" => ["contact", "closeness"],
516                         "info" => ["contact", "info"],
517                         "profile-id" => ["contact", "profile-id"],
518                         "bdyear" => ["contact", "bdyear"],
519                         "bd" => ["contact", "bd"],
520                         "notify_new_posts" => ["contact", "notify_new_posts"],
521                         "fetch_further_information" => ["contact", "fetch_further_information"],
522                         "ffi_keyword_denylist" => ["contact", "ffi_keyword_denylist"],
523                         "parent-uid" => ["user", "parent-uid"],
524                         "guid" => ["user", "guid"],
525                         "nickname" => ["user", "nickname"], /// @todo Replaces all uses of "nickname" with "nick"
526                         "email" => ["user", "email"],
527                         "openid" => ["user", "openid"],
528                         "timezone" => ["user", "timezone"],
529                         "language" => ["user", "language"],
530                         "register_date" => ["user", "register_date"],
531                         "login_date" => ["user", "login_date"],
532                         "default-location" => ["user", "default-location"],
533                         "allow_location" => ["user", "allow_location"],
534                         "theme" => ["user", "theme"],
535                         "upubkey" => ["user", "pubkey"],
536                         "uprvkey" => ["user", "prvkey"],
537                         "sprvkey" => ["user", "sprvkey"],
538                         "spubkey" => ["user", "spubkey"],
539                         "verified" => ["user", "verified"],
540                         "blockwall" => ["user", "blockwall"],
541                         "hidewall" => ["user", "hidewall"],
542                         "blocktags" => ["user", "blocktags"],
543                         "unkmail" => ["user", "unkmail"],
544                         "cntunkmail" => ["user", "cntunkmail"],
545                         "notify-flags" => ["user", "notify-flags"],
546                         "page-flags" => ["user", "page-flags"],
547                         "account-type" => ["user", "account-type"],
548                         "prvnets" => ["user", "prvnets"],
549                         "maxreq" => ["user", "maxreq"],
550                         "expire" => ["user", "expire"],
551                         "account_removed" => ["user", "account_removed"],
552                         "account_expired" => ["user", "account_expired"],
553                         "account_expires_on" => ["user", "account_expires_on"],
554                         "expire_notification_sent" => ["user", "expire_notification_sent"],
555                         "def_gid" => ["user", "def_gid"],
556                         "allow_cid" => ["user", "allow_cid"],
557                         "allow_gid" => ["user", "allow_gid"],
558                         "deny_cid" => ["user", "deny_cid"],
559                         "deny_gid" => ["user", "deny_gid"],
560                         "openidserver" => ["user", "openidserver"],
561                         "publish" => ["profile", "publish"],
562                         "net-publish" => ["profile", "net-publish"],
563                         "hide-friends" => ["profile", "hide-friends"],
564                         "prv_keywords" => ["profile", "prv_keywords"],
565                         "pub_keywords" => ["profile", "pub_keywords"],
566                         "address" => ["profile", "address"],
567                         "locality" => ["profile", "locality"],
568                         "region" => ["profile", "region"],
569                         "postal-code" => ["profile", "postal-code"],
570                         "country-name" => ["profile", "country-name"],
571                         "homepage" => ["profile", "homepage"],
572                         "dob" => ["profile", "dob"],
573                 ],
574                 "query" => "FROM `user`
575                         INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self`
576                         INNER JOIN `profile` ON `profile`.`uid` = `user`.`uid`"
577         ],
578         "pending-view" => [
579                 "fields" => [
580                         "id" => ["register", "id"],
581                         "hash" => ["register", "hash"],
582                         "created" => ["register", "created"],
583                         "uid" => ["register", "uid"],
584                         "password" => ["register", "password"],
585                         "language" => ["register", "language"],
586                         "note" => ["register", "note"],
587                         "self" => ["contact", "self"],
588                         "name" => ["contact", "name"],
589                         "url" => ["contact", "url"],
590                         "micro" => ["contact", "micro"],
591                         "email" => ["user", "email"],
592                         "nick" => ["contact", "nick"],
593                 ],
594                 "query" => "FROM `register`
595                         INNER JOIN `contact` ON `register`.`uid` = `contact`.`uid`
596                         INNER JOIN `user` ON `register`.`uid` = `user`.`uid`"
597         ],
598         "tag-search-view" => [
599                 "fields" => [
600                         "uri-id" => ["post-tag", "uri-id"],
601                         "iid" => ["item", "id"],
602                         "uri" => ["item", "uri"],
603                         "guid" => ["item", "guid"],
604                         "uid" => ["item", "uid"],
605                         "private" => ["item", "private"],
606                         "wall" => ["item", "wall"],
607                         "origin" => ["item", "origin"],
608                         "gravity" => ["item", "gravity"],
609                         "received" => ["item", "received"],                     
610                         "name" => ["tag", "name"],
611                 ],
612                 "query" => "FROM `post-tag`
613                         INNER JOIN `tag` ON `tag`.`id` = `post-tag`.`tid`
614                         INNER JOIN `item` ON `item`.`uri-id` = `post-tag`.`uri-id`
615                         WHERE `post-tag`.`type` = 1"
616         ],
617         "workerqueue-view" => [
618                 "fields" => [
619                         "pid" => ["process", "pid"],
620                         "priority" => ["workerqueue", "priority"],
621                 ],
622                 "query" => "FROM `process`
623                         INNER JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid`
624                         WHERE NOT `workerqueue`.`done`"
625         ],
626 ];
627