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