3 * @copyright Copyright (C) 2010-2021, the Friendica project
5 * @license GNU AGPL version 3 or any later version
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.
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.
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/>.
20 * Main view structure configuration file.
22 * Here are described all the view Friendica needs to work.
24 * Syntax (braces indicate optionale values):
27 * "<field name>" => ["table", "field"],
28 * "<field name>" => "SQL expression",
31 * "query" => "FROM `table` INNER JOIN `other-table` ..."
35 * If you need to make any change, make sure to increment the DB_UPDATE_VERSION constant value in dbstructure.config.php.
40 "application-view" => [
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"],
58 "query" => "FROM `application-token`
59 INNER JOIN `application` ON `application-token`.`application-id` = `application`.`id`"
63 "id" => ["post-user", "id"],
64 "post-user-id" => ["post-user", "id"],
65 "uid" => ["post-user", "uid"],
66 "parent" => ["parent-post", "id"],
67 "uri" => ["item-uri", "uri"],
68 "uri-id" => ["post-user", "uri-id"],
69 "parent-uri" => ["parent-item-uri", "uri"],
70 "parent-uri-id" => ["post-user", "parent-uri-id"],
71 "thr-parent" => ["thr-parent-item-uri", "uri"],
72 "thr-parent-id" => ["post-user", "thr-parent-id"],
73 "guid" => ["item-uri", "guid"],
74 "wall" => ["post-user", "wall"],
75 "gravity" => ["post-user", "gravity"],
76 "extid" => ["external-item-uri", "uri"],
77 "external-id" => ["post-user", "external-id"],
78 "created" => ["post-user", "created"],
79 "edited" => ["post-user", "edited"],
80 "commented" => ["post-thread-user", "commented"],
81 "received" => ["post-user", "received"],
82 "changed" => ["post-thread-user", "changed"],
83 "post-type" => ["post-user", "post-type"],
84 "post-reason" => ["post-user", "post-reason"],
85 "private" => ["post-user", "private"],
86 "pubmail" => ["post-thread-user", "pubmail"],
87 "visible" => ["post-user", "visible"],
88 "starred" => ["post-thread-user", "starred"],
89 "pinned" => ["post-thread-user", "pinned"],
90 "unseen" => ["post-user", "unseen"],
91 "deleted" => ["post-user", "deleted"],
92 "origin" => ["post-user", "origin"],
93 "parent-origin" => ["post-thread-user", "origin"],
94 "forum_mode" => ["post-thread-user", "forum_mode"],
95 "mention" => ["post-thread-user", "mention"],
96 "global" => ["post-user", "global"],
97 "network" => ["post-user", "network"],
98 "vid" => ["post-user", "vid"],
99 "psid" => ["post-user", "psid"],
100 "verb" => "IF (`post-user`.`vid` IS NULL, '', `verb`.`name`)",
101 "title" => ["post-content", "title"],
102 "content-warning" => ["post-content", "content-warning"],
103 "raw-body" => ["post-content", "raw-body"],
104 "body" => ["post-content", "body"],
105 "rendered-hash" => ["post-content", "rendered-hash"],
106 "rendered-html" => ["post-content", "rendered-html"],
107 "language" => ["post-content", "language"],
108 "plink" => ["post-content", "plink"],
109 "location" => ["post-content", "location"],
110 "coord" => ["post-content", "coord"],
111 "app" => ["post-content", "app"],
112 "object-type" => ["post-content", "object-type"],
113 "object" => ["post-content", "object"],
114 "target-type" => ["post-content", "target-type"],
115 "target" => ["post-content", "target"],
116 "resource-id" => ["post-content", "resource-id"],
117 "contact-id" => ["post-user", "contact-id"],
118 "contact-link" => ["contact", "url"],
119 "contact-addr" => ["contact", "addr"],
120 "contact-name" => ["contact", "name"],
121 "contact-nick" => ["contact", "nick"],
122 "contact-avatar" => ["contact", "thumb"],
123 "contact-network" => ["contact", "network"],
124 "contact-blocked" => ["contact", "blocked"],
125 "contact-hidden" => ["contact", "hidden"],
126 "contact-readonly" => ["contact", "readonly"],
127 "contact-archive" => ["contact", "archive"],
128 "contact-pending" => ["contact", "pending"],
129 "contact-rel" => ["contact", "rel"],
130 "contact-uid" => ["contact", "uid"],
131 "contact-contact-type" => ["contact", "contact-type"],
132 "writable" => "IF (`post-user`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `contact`.`writable`)",
133 "self" => ["contact", "self"],
134 "cid" => ["contact", "id"],
135 "alias" => ["contact", "alias"],
136 "photo" => ["contact", "photo"],
137 "name-date" => ["contact", "name-date"],
138 "uri-date" => ["contact", "uri-date"],
139 "avatar-date" => ["contact", "avatar-date"],
140 "thumb" => ["contact", "thumb"],
141 "dfrn-id" => ["contact", "dfrn-id"],
142 "author-id" => ["post-user", "author-id"],
143 "author-link" => ["author", "url"],
144 "author-addr" => ["author", "addr"],
145 "author-name" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`name` != '', `contact`.`name`, `author`.`name`)",
146 "author-nick" => ["author", "nick"],
147 "author-avatar" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `author`.`thumb`)",
148 "author-network" => ["author", "network"],
149 "author-blocked" => ["author", "blocked"],
150 "author-hidden" => ["author", "hidden"],
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-contact-type" => ["owner", "contact-type"],
161 "causer-id" => ["post-user", "causer-id"],
162 "causer-link" => ["causer", "url"],
163 "causer-addr" => ["causer", "addr"],
164 "causer-name" => ["causer", "name"],
165 "causer-nick" => ["causer", "nick"],
166 "causer-avatar" => ["causer", "thumb"],
167 "causer-network" => ["causer", "network"],
168 "causer-blocked" => ["causer", "blocked"],
169 "causer-hidden" => ["causer", "hidden"],
170 "causer-contact-type" => ["causer", "contact-type"],
171 "postopts" => ["post-delivery-data", "postopts"],
172 "inform" => ["post-delivery-data", "inform"],
173 "delivery_queue_count" => ["post-delivery-data", "queue_count"],
174 "delivery_queue_done" => ["post-delivery-data", "queue_done"],
175 "delivery_queue_failed" => ["post-delivery-data", "queue_failed"],
176 "allow_cid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`allow_cid`)",
177 "allow_gid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`allow_gid`)",
178 "deny_cid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`deny_cid`)",
179 "deny_gid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`deny_gid`)",
180 "event-id" => ["post-user", "event-id"],
181 "event-created" => ["event", "created"],
182 "event-edited" => ["event", "edited"],
183 "event-start" => ["event", "start"],
184 "event-finish" => ["event", "finish"],
185 "event-summary" => ["event", "summary"],
186 "event-desc" => ["event", "desc"],
187 "event-location" => ["event", "location"],
188 "event-type" => ["event", "type"],
189 "event-nofinish" => ["event", "nofinish"],
190 "event-adjust" => ["event", "adjust"],
191 "event-ignore" => ["event", "ignore"],
192 "signed_text" => ["diaspora-interaction", "interaction"],
193 "parent-guid" => ["parent-item-uri", "guid"],
194 "parent-network" => ["parent-post", "network"],
195 "parent-author-id" => ["parent-post", "author-id"],
196 "parent-author-link" => ["parent-post-author", "url"],
197 "parent-author-name" => ["parent-post-author", "name"],
198 "parent-author-network" => ["parent-post-author", "network"],
199 "parent-author-blocked" => ["parent-post-author", "blocked"],
200 "parent-author-hidden" => ["parent-post-author", "hidden"],
202 "query" => "FROM `post-user`
203 STRAIGHT_JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`
204 STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-user`.`contact-id`
205 STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-user`.`author-id`
206 STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-user`.`owner-id`
207 LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post-user`.`causer-id`
208 LEFT JOIN `item-uri` ON `item-uri`.`id` = `post-user`.`uri-id`
209 LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post-user`.`thr-parent-id`
210 LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post-user`.`parent-uri-id`
211 LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post-user`.`external-id`
212 LEFT JOIN `verb` ON `verb`.`id` = `post-user`.`vid`
213 LEFT JOIN `event` ON `event`.`id` = `post-user`.`event-id`
214 LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-user`.`uri-id`
215 LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-user`.`uri-id`
216 LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-user`.`uri-id` AND `post-user`.`origin`
217 LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-user`.`psid`
218 LEFT JOIN `post-user` AS `parent-post` ON `parent-post`.`uri-id` = `post-user`.`parent-uri-id` AND `parent-post`.`uid` = `post-user`.`uid`
219 LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`"
221 "post-thread-user-view" => [
223 "id" => ["post-user", "id"],
224 "post-user-id" => ["post-user", "id"],
225 "uid" => ["post-thread-user", "uid"],
226 "parent" => ["parent-post", "id"],
227 "uri" => ["item-uri", "uri"],
228 "uri-id" => ["post-thread-user", "uri-id"],
229 "parent-uri" => ["parent-item-uri", "uri"],
230 "parent-uri-id" => ["post-user", "parent-uri-id"],
231 "thr-parent" => ["thr-parent-item-uri", "uri"],
232 "thr-parent-id" => ["post-user", "thr-parent-id"],
233 "guid" => ["item-uri", "guid"],
234 "wall" => ["post-thread-user", "wall"],
235 "gravity" => ["post-user", "gravity"],
236 "extid" => ["external-item-uri", "uri"],
237 "external-id" => ["post-user", "external-id"],
238 "created" => ["post-thread-user", "created"],
239 "edited" => ["post-user", "edited"],
240 "commented" => ["post-thread-user", "commented"],
241 "received" => ["post-thread-user", "received"],
242 "changed" => ["post-thread-user", "changed"],
243 "post-type" => ["post-user", "post-type"],
244 "post-reason" => ["post-user", "post-reason"],
245 "private" => ["post-user", "private"],
246 "pubmail" => ["post-thread-user", "pubmail"],
247 "ignored" => ["post-thread-user", "ignored"],
248 "visible" => ["post-user", "visible"],
249 "starred" => ["post-thread-user", "starred"],
250 "pinned" => ["post-thread-user", "pinned"],
251 "unseen" => ["post-thread-user", "unseen"],
252 "deleted" => ["post-user", "deleted"],
253 "origin" => ["post-thread-user", "origin"],
254 "forum_mode" => ["post-thread-user", "forum_mode"],
255 "mention" => ["post-thread-user", "mention"],
256 "global" => ["post-user", "global"],
257 "network" => ["post-thread-user", "network"],
258 "vid" => ["post-user", "vid"],
259 "psid" => ["post-thread-user", "psid"],
260 "verb" => "IF (`post-user`.`vid` IS NULL, '', `verb`.`name`)",
261 "title" => ["post-content", "title"],
262 "content-warning" => ["post-content", "content-warning"],
263 "raw-body" => ["post-content", "raw-body"],
264 "body" => ["post-content", "body"],
265 "rendered-hash" => ["post-content", "rendered-hash"],
266 "rendered-html" => ["post-content", "rendered-html"],
267 "language" => ["post-content", "language"],
268 "plink" => ["post-content", "plink"],
269 "location" => ["post-content", "location"],
270 "coord" => ["post-content", "coord"],
271 "app" => ["post-content", "app"],
272 "object-type" => ["post-content", "object-type"],
273 "object" => ["post-content", "object"],
274 "target-type" => ["post-content", "target-type"],
275 "target" => ["post-content", "target"],
276 "resource-id" => ["post-content", "resource-id"],
277 "contact-id" => ["post-thread-user", "contact-id"],
278 "contact-link" => ["contact", "url"],
279 "contact-addr" => ["contact", "addr"],
280 "contact-name" => ["contact", "name"],
281 "contact-nick" => ["contact", "nick"],
282 "contact-avatar" => ["contact", "thumb"],
283 "contact-network" => ["contact", "network"],
284 "contact-blocked" => ["contact", "blocked"],
285 "contact-hidden" => ["contact", "hidden"],
286 "contact-readonly" => ["contact", "readonly"],
287 "contact-archive" => ["contact", "archive"],
288 "contact-pending" => ["contact", "pending"],
289 "contact-rel" => ["contact", "rel"],
290 "contact-uid" => ["contact", "uid"],
291 "contact-contact-type" => ["contact", "contact-type"],
292 "writable" => "IF (`post-user`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `contact`.`writable`)",
293 "self" => ["contact", "self"],
294 "cid" => ["contact", "id"],
295 "alias" => ["contact", "alias"],
296 "photo" => ["contact", "photo"],
297 "name-date" => ["contact", "name-date"],
298 "uri-date" => ["contact", "uri-date"],
299 "avatar-date" => ["contact", "avatar-date"],
300 "thumb" => ["contact", "thumb"],
301 "dfrn-id" => ["contact", "dfrn-id"],
302 "author-id" => ["post-thread-user", "author-id"],
303 "author-link" => ["author", "url"],
304 "author-addr" => ["author", "addr"],
305 "author-name" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`name` != '', `contact`.`name`, `author`.`name`)",
306 "author-nick" => ["author", "nick"],
307 "author-avatar" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `author`.`thumb`)",
308 "author-network" => ["author", "network"],
309 "author-blocked" => ["author", "blocked"],
310 "author-hidden" => ["author", "hidden"],
311 "owner-id" => ["post-thread-user", "owner-id"],
312 "owner-link" => ["owner", "url"],
313 "owner-addr" => ["owner", "addr"],
314 "owner-name" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`name` != '', `contact`.`name`, `owner`.`name`)",
315 "owner-nick" => ["owner", "nick"],
316 "owner-avatar" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `owner`.`thumb`)",
317 "owner-network" => ["owner", "network"],
318 "owner-blocked" => ["owner", "blocked"],
319 "owner-hidden" => ["owner", "hidden"],
320 "owner-contact-type" => ["owner", "contact-type"],
321 "causer-id" => ["post-thread-user", "causer-id"],
322 "causer-link" => ["causer", "url"],
323 "causer-addr" => ["causer", "addr"],
324 "causer-name" => ["causer", "name"],
325 "causer-nick" => ["causer", "nick"],
326 "causer-avatar" => ["causer", "thumb"],
327 "causer-network" => ["causer", "network"],
328 "causer-blocked" => ["causer", "blocked"],
329 "causer-hidden" => ["causer", "hidden"],
330 "causer-contact-type" => ["causer", "contact-type"],
331 "postopts" => ["post-delivery-data", "postopts"],
332 "inform" => ["post-delivery-data", "inform"],
333 "delivery_queue_count" => ["post-delivery-data", "queue_count"],
334 "delivery_queue_done" => ["post-delivery-data", "queue_done"],
335 "delivery_queue_failed" => ["post-delivery-data", "queue_failed"],
336 "allow_cid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`allow_cid`)",
337 "allow_gid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`allow_gid`)",
338 "deny_cid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`deny_cid`)",
339 "deny_gid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`deny_gid`)",
340 "event-id" => ["post-user", "event-id"],
341 "event-created" => ["event", "created"],
342 "event-edited" => ["event", "edited"],
343 "event-start" => ["event", "start"],
344 "event-finish" => ["event", "finish"],
345 "event-summary" => ["event", "summary"],
346 "event-desc" => ["event", "desc"],
347 "event-location" => ["event", "location"],
348 "event-type" => ["event", "type"],
349 "event-nofinish" => ["event", "nofinish"],
350 "event-adjust" => ["event", "adjust"],
351 "event-ignore" => ["event", "ignore"],
352 "signed_text" => ["diaspora-interaction", "interaction"],
353 "parent-guid" => ["parent-item-uri", "guid"],
354 "parent-network" => ["parent-post", "network"],
355 "parent-author-id" => ["parent-post", "author-id"],
356 "parent-author-link" => ["parent-post-author", "url"],
357 "parent-author-name" => ["parent-post-author", "name"],
358 "parent-author-network" => ["parent-post-author", "network"],
360 "query" => "FROM `post-thread-user`
361 INNER JOIN `post-user` ON `post-user`.`id` = `post-thread-user`.`post-user-id`
362 STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
363 STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-thread-user`.`author-id`
364 STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-thread-user`.`owner-id`
365 LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post-thread-user`.`causer-id`
366 LEFT JOIN `item-uri` ON `item-uri`.`id` = `post-thread-user`.`uri-id`
367 LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post-user`.`thr-parent-id`
368 LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post-user`.`parent-uri-id`
369 LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post-user`.`external-id`
370 LEFT JOIN `verb` ON `verb`.`id` = `post-user`.`vid`
371 LEFT JOIN `event` ON `event`.`id` = `post-user`.`event-id`
372 LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-thread-user`.`uri-id`
373 LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-thread-user`.`uri-id`
374 LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-thread-user`.`uri-id` AND `post-thread-user`.`origin`
375 LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-thread-user`.`psid`
376 LEFT JOIN `post-user` AS `parent-post` ON `parent-post`.`uri-id` = `post-user`.`parent-uri-id` AND `parent-post`.`uid` = `post-thread-user`.`uid`
377 LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`"
381 "uri" => ["item-uri", "uri"],
382 "uri-id" => ["post", "uri-id"],
383 "parent-uri" => ["parent-item-uri", "uri"],
384 "parent-uri-id" => ["post", "parent-uri-id"],
385 "thr-parent" => ["thr-parent-item-uri", "uri"],
386 "thr-parent-id" => ["post", "thr-parent-id"],
387 "guid" => ["item-uri", "guid"],
388 "gravity" => ["post", "gravity"],
389 "extid" => ["external-item-uri", "uri"],
390 "external-id" => ["post", "external-id"],
391 "created" => ["post", "created"],
392 "edited" => ["post", "edited"],
393 "commented" => ["post-thread", "commented"],
394 "received" => ["post", "received"],
395 "changed" => ["post-thread", "changed"],
396 "post-type" => ["post", "post-type"],
397 "private" => ["post", "private"],
398 "visible" => ["post", "visible"],
399 "deleted" => ["post", "deleted"],
400 "global" => ["post", "global"],
401 "network" => ["post", "network"],
402 "vid" => ["post", "vid"],
403 "verb" => "IF (`post`.`vid` IS NULL, '', `verb`.`name`)",
404 "title" => ["post-content", "title"],
405 "content-warning" => ["post-content", "content-warning"],
406 "raw-body" => ["post-content", "raw-body"],
407 "body" => ["post-content", "body"],
408 "rendered-hash" => ["post-content", "rendered-hash"],
409 "rendered-html" => ["post-content", "rendered-html"],
410 "language" => ["post-content", "language"],
411 "plink" => ["post-content", "plink"],
412 "location" => ["post-content", "location"],
413 "coord" => ["post-content", "coord"],
414 "app" => ["post-content", "app"],
415 "object-type" => ["post-content", "object-type"],
416 "object" => ["post-content", "object"],
417 "target-type" => ["post-content", "target-type"],
418 "target" => ["post-content", "target"],
419 "resource-id" => ["post-content", "resource-id"],
420 "author-id" => ["post", "author-id"],
421 "author-link" => ["author", "url"],
422 "author-addr" => ["author", "addr"],
423 "author-name" => ["author", "name"],
424 "author-nick" => ["author", "nick"],
425 "author-avatar" => ["author", "thumb"],
426 "author-network" => ["author", "network"],
427 "author-blocked" => ["author", "blocked"],
428 "author-hidden" => ["author", "hidden"],
429 "owner-id" => ["post", "owner-id"],
430 "owner-link" => ["owner", "url"],
431 "owner-addr" => ["owner", "addr"],
432 "owner-name" => ["owner", "name"],
433 "owner-nick" => ["owner", "nick"],
434 "owner-avatar" => ["owner", "thumb"],
435 "owner-network" => ["owner", "network"],
436 "owner-blocked" => ["owner", "blocked"],
437 "owner-hidden" => ["owner", "hidden"],
438 "owner-contact-type" => ["owner", "contact-type"],
439 "causer-id" => ["post", "causer-id"],
440 "causer-link" => ["causer", "url"],
441 "causer-addr" => ["causer", "addr"],
442 "causer-name" => ["causer", "name"],
443 "causer-nick" => ["causer", "nick"],
444 "causer-avatar" => ["causer", "thumb"],
445 "causer-network" => ["causer", "network"],
446 "causer-blocked" => ["causer", "blocked"],
447 "causer-hidden" => ["causer", "hidden"],
448 "causer-contact-type" => ["causer", "contact-type"],
449 "signed_text" => ["diaspora-interaction", "interaction"],
450 "parent-guid" => ["parent-item-uri", "guid"],
451 "parent-network" => ["parent-post", "network"],
452 "parent-author-id" => ["parent-post", "author-id"],
453 "parent-author-link" => ["parent-post-author", "url"],
454 "parent-author-name" => ["parent-post-author", "name"],
455 "parent-author-network" => ["parent-post-author", "network"],
457 "query" => "FROM `post`
458 STRAIGHT_JOIN `post-thread` ON `post-thread`.`uri-id` = `post`.`parent-uri-id`
459 STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post`.`author-id`
460 STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post`.`owner-id`
461 LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post`.`causer-id`
462 LEFT JOIN `item-uri` ON `item-uri`.`id` = `post`.`uri-id`
463 LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post`.`thr-parent-id`
464 LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post`.`parent-uri-id`
465 LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post`.`external-id`
466 LEFT JOIN `verb` ON `verb`.`id` = `post`.`vid`
467 LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post`.`uri-id`
468 LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post`.`uri-id`
469 LEFT JOIN `post` AS `parent-post` ON `parent-post`.`uri-id` = `post`.`parent-uri-id`
470 LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`"
472 "post-thread-view" => [
474 "uri" => ["item-uri", "uri"],
475 "uri-id" => ["post-thread", "uri-id"],
476 "parent-uri" => ["parent-item-uri", "uri"],
477 "parent-uri-id" => ["post", "parent-uri-id"],
478 "thr-parent" => ["thr-parent-item-uri", "uri"],
479 "thr-parent-id" => ["post", "thr-parent-id"],
480 "guid" => ["item-uri", "guid"],
481 "gravity" => ["post", "gravity"],
482 "extid" => ["external-item-uri", "uri"],
483 "external-id" => ["post", "external-id"],
484 "created" => ["post-thread", "created"],
485 "edited" => ["post", "edited"],
486 "commented" => ["post-thread", "commented"],
487 "received" => ["post-thread", "received"],
488 "changed" => ["post-thread", "changed"],
489 "post-type" => ["post", "post-type"],
490 "private" => ["post", "private"],
491 "visible" => ["post", "visible"],
492 "deleted" => ["post", "deleted"],
493 "global" => ["post", "global"],
494 "network" => ["post-thread", "network"],
495 "vid" => ["post", "vid"],
496 "verb" => "IF (`post`.`vid` IS NULL, '', `verb`.`name`)",
497 "title" => ["post-content", "title"],
498 "content-warning" => ["post-content", "content-warning"],
499 "raw-body" => ["post-content", "raw-body"],
500 "body" => ["post-content", "body"],
501 "rendered-hash" => ["post-content", "rendered-hash"],
502 "rendered-html" => ["post-content", "rendered-html"],
503 "language" => ["post-content", "language"],
504 "plink" => ["post-content", "plink"],
505 "location" => ["post-content", "location"],
506 "coord" => ["post-content", "coord"],
507 "app" => ["post-content", "app"],
508 "object-type" => ["post-content", "object-type"],
509 "object" => ["post-content", "object"],
510 "target-type" => ["post-content", "target-type"],
511 "target" => ["post-content", "target"],
512 "resource-id" => ["post-content", "resource-id"],
513 "author-id" => ["post-thread", "author-id"],
514 "author-link" => ["author", "url"],
515 "author-addr" => ["author", "addr"],
516 "author-name" => ["author", "name"],
517 "author-nick" => ["author", "nick"],
518 "author-avatar" => ["author", "thumb"],
519 "author-network" => ["author", "network"],
520 "author-blocked" => ["author", "blocked"],
521 "author-hidden" => ["author", "hidden"],
522 "owner-id" => ["post-thread", "owner-id"],
523 "owner-link" => ["owner", "url"],
524 "owner-addr" => ["owner", "addr"],
525 "owner-name" => ["owner", "name"],
526 "owner-nick" => ["owner", "nick"],
527 "owner-avatar" => ["owner", "thumb"],
528 "owner-network" => ["owner", "network"],
529 "owner-blocked" => ["owner", "blocked"],
530 "owner-hidden" => ["owner", "hidden"],
531 "owner-contact-type" => ["owner", "contact-type"],
532 "causer-id" => ["post-thread", "causer-id"],
533 "causer-link" => ["causer", "url"],
534 "causer-addr" => ["causer", "addr"],
535 "causer-name" => ["causer", "name"],
536 "causer-nick" => ["causer", "nick"],
537 "causer-avatar" => ["causer", "thumb"],
538 "causer-network" => ["causer", "network"],
539 "causer-blocked" => ["causer", "blocked"],
540 "causer-hidden" => ["causer", "hidden"],
541 "causer-contact-type" => ["causer", "contact-type"],
542 "signed_text" => ["diaspora-interaction", "interaction"],
543 "parent-guid" => ["parent-item-uri", "guid"],
544 "parent-network" => ["parent-post", "network"],
545 "parent-author-id" => ["parent-post", "author-id"],
546 "parent-author-link" => ["parent-post-author", "url"],
547 "parent-author-name" => ["parent-post-author", "name"],
548 "parent-author-network" => ["parent-post-author", "network"],
550 "query" => "FROM `post-thread`
551 INNER JOIN `post` ON `post`.`uri-id` = `post-thread`.`uri-id`
552 STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-thread`.`author-id`
553 STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-thread`.`owner-id`
554 LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post-thread`.`causer-id`
555 LEFT JOIN `item-uri` ON `item-uri`.`id` = `post-thread`.`uri-id`
556 LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post`.`thr-parent-id`
557 LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post`.`parent-uri-id`
558 LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post`.`external-id`
559 LEFT JOIN `verb` ON `verb`.`id` = `post`.`vid`
560 LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-thread`.`uri-id`
561 LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-thread`.`uri-id`
562 LEFT JOIN `post` AS `parent-post` ON `parent-post`.`uri-id` = `post`.`parent-uri-id`
563 LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`"
567 "uri-id" => ["post-category", "uri-id"],
568 "uid" => ["post-category", "uid"],
569 "type" => ["post-category", "type"],
570 "tid" => ["post-category", "tid"],
571 "name" => ["tag", "name"],
572 "url" => ["tag", "url"],
574 "query" => "FROM `post-category`
575 LEFT JOIN `tag` ON `post-category`.`tid` = `tag`.`id`"
579 "uri-id" => ["post-tag", "uri-id"],
580 "type" => ["post-tag", "type"],
581 "tid" => ["post-tag", "tid"],
582 "cid" => ["post-tag", "cid"],
583 "name" => "CASE `cid` WHEN 0 THEN `tag`.`name` ELSE `contact`.`name` END",
584 "url" => "CASE `cid` WHEN 0 THEN `tag`.`url` ELSE `contact`.`url` END",
586 "query" => "FROM `post-tag`
587 LEFT JOIN `tag` ON `post-tag`.`tid` = `tag`.`id`
588 LEFT JOIN `contact` ON `post-tag`.`cid` = `contact`.`id`"
590 "network-item-view" => [
592 "uri-id" => ["post-user", "uri-id"],
593 "parent" => ["parent-post", "id"],
594 "received" => ["post-user", "received"],
595 "commented" => ["post-thread-user", "commented"],
596 "created" => ["post-user", "created"],
597 "uid" => ["post-user", "uid"],
598 "starred" => ["post-thread-user", "starred"],
599 "mention" => ["post-thread-user", "mention"],
600 "network" => ["post-user", "network"],
601 "unseen" => ["post-user", "unseen"],
602 "gravity" => ["post-user", "gravity"],
603 "contact-id" => ["post-user", "contact-id"],
604 "contact-type" => ["ownercontact", "contact-type"],
606 "query" => "FROM `post-user`
607 STRAIGHT_JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`
608 INNER JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
609 LEFT JOIN `user-contact` AS `author` ON `author`.`uid` = `post-thread-user`.`uid` AND `author`.`cid` = `post-thread-user`.`author-id`
610 LEFT JOIN `user-contact` AS `owner` ON `owner`.`uid` = `post-thread-user`.`uid` AND `owner`.`cid` = `post-thread-user`.`owner-id`
611 INNER JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread-user`.`owner-id`
612 LEFT JOIN `post-user` AS `parent-post` ON `parent-post`.`uri-id` = `post-user`.`parent-uri-id` AND `parent-post`.`uid` = `post-user`.`uid`
613 WHERE `post-user`.`visible` AND NOT `post-user`.`deleted`
614 AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`)
615 AND (`post-user`.`hidden` IS NULL OR NOT `post-user`.`hidden`)
616 AND (`author`.`blocked` IS NULL OR NOT `author`.`blocked`)
617 AND (`owner`.`blocked` IS NULL OR NOT `owner`.`blocked`)"
619 "network-thread-view" => [
621 "uri-id" => ["post-thread-user", "uri-id"],
622 "parent" => ["parent-post", "id"],
623 "received" => ["post-thread-user", "received"],
624 "commented" => ["post-thread-user", "commented"],
625 "created" => ["post-thread-user", "created"],
626 "uid" => ["post-thread-user", "uid"],
627 "starred" => ["post-thread-user", "starred"],
628 "mention" => ["post-thread-user", "mention"],
629 "network" => ["post-thread-user", "network"],
630 "contact-id" => ["post-thread-user", "contact-id"],
631 "contact-type" => ["ownercontact", "contact-type"],
633 "query" => "FROM `post-thread-user`
634 INNER JOIN `post-user` ON `post-user`.`id` = `post-thread-user`.`post-user-id`
635 STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
636 LEFT JOIN `user-contact` AS `author` ON `author`.`uid` = `post-thread-user`.`uid` AND `author`.`cid` = `post-thread-user`.`author-id`
637 LEFT JOIN `user-contact` AS `owner` ON `owner`.`uid` = `post-thread-user`.`uid` AND `owner`.`cid` = `post-thread-user`.`owner-id`
638 LEFT JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread-user`.`owner-id`
639 LEFT JOIN `post-user` AS `parent-post` ON `parent-post`.`uri-id` = `post-user`.`parent-uri-id` AND `parent-post`.`uid` = `post-user`.`uid`
640 WHERE `post-user`.`visible` AND NOT `post-user`.`deleted`
641 AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`)
642 AND (`post-thread-user`.`hidden` IS NULL OR NOT `post-thread-user`.`hidden`)
643 AND (`author`.`blocked` IS NULL OR NOT `author`.`blocked`)
644 AND (`owner`.`blocked` IS NULL OR NOT `owner`.`blocked`)"
648 "id" => ["contact", "id"],
649 "uid" => ["contact", "uid"],
650 "created" => ["contact", "created"],
651 "updated" => ["contact", "updated"],
652 "self" => ["contact", "self"],
653 "remote_self" => ["contact", "remote_self"],
654 "rel" => ["contact", "rel"],
655 "duplex" => ["contact", "duplex"],
656 "network" => ["contact", "network"],
657 "protocol" => ["contact", "protocol"],
658 "name" => ["contact", "name"],
659 "nick" => ["contact", "nick"],
660 "location" => ["contact", "location"],
661 "about" => ["contact", "about"],
662 "keywords" => ["contact", "keywords"],
663 "gender" => ["contact", "gender"],
664 "xmpp" => ["contact", "xmpp"],
665 "attag" => ["contact", "attag"],
666 "avatar" => ["contact", "avatar"],
667 "photo" => ["contact", "photo"],
668 "thumb" => ["contact", "thumb"],
669 "micro" => ["contact", "micro"],
670 "site-pubkey" => ["contact", "site-pubkey"],
671 "issued-id" => ["contact", "issued-id"],
672 "dfrn-id" => ["contact", "dfrn-id"],
673 "url" => ["contact", "url"],
674 "nurl" => ["contact", "nurl"],
675 "addr" => ["contact", "addr"],
676 "alias" => ["contact", "alias"],
677 "pubkey" => ["contact", "pubkey"],
678 "prvkey" => ["contact", "prvkey"],
679 "batch" => ["contact", "batch"],
680 "request" => ["contact", "request"],
681 "notify" => ["contact", "notify"],
682 "poll" => ["contact", "poll"],
683 "confirm" => ["contact", "confirm"],
684 "poco" => ["contact", "poco"],
685 "aes_allow" => ["contact", "aes_allow"],
686 "ret-aes" => ["contact", "ret-aes"],
687 "usehub" => ["contact", "usehub"],
688 "subhub" => ["contact", "subhub"],
689 "hub-verify" => ["contact", "hub-verify"],
690 "last-update" => ["contact", "last-update"],
691 "success_update" => ["contact", "success_update"],
692 "failure_update" => ["contact", "failure_update"],
693 "name-date" => ["contact", "name-date"],
694 "uri-date" => ["contact", "uri-date"],
695 "avatar-date" => ["contact", "avatar-date"],
696 "picdate" => ["contact", "avatar-date"], /// @todo Replaces all uses of "picdate" with "avatar-date"
697 "term-date" => ["contact", "term-date"],
698 "last-item" => ["contact", "last-item"],
699 "priority" => ["contact", "priority"],
700 "blocked" => ["user", "blocked"],
701 "block_reason" => ["contact", "block_reason"],
702 "readonly" => ["contact", "readonly"],
703 "writable" => ["contact", "writable"],
704 "forum" => ["contact", "forum"],
705 "prv" => ["contact", "prv"],
706 "contact-type" => ["contact", "contact-type"],
707 "manually-approve" => ["contact", "manually-approve"],
708 "hidden" => ["contact", "hidden"],
709 "archive" => ["contact", "archive"],
710 "pending" => ["contact", "pending"],
711 "deleted" => ["contact", "deleted"],
712 "unsearchable" => ["contact", "unsearchable"],
713 "sensitive" => ["contact", "sensitive"],
714 "baseurl" => ["contact", "baseurl"],
715 "reason" => ["contact", "reason"],
716 "closeness" => ["contact", "closeness"],
717 "info" => ["contact", "info"],
718 "profile-id" => ["contact", "profile-id"],
719 "bdyear" => ["contact", "bdyear"],
720 "bd" => ["contact", "bd"],
721 "notify_new_posts" => ["contact", "notify_new_posts"],
722 "fetch_further_information" => ["contact", "fetch_further_information"],
723 "ffi_keyword_denylist" => ["contact", "ffi_keyword_denylist"],
724 "parent-uid" => ["user", "parent-uid"],
725 "guid" => ["user", "guid"],
726 "nickname" => ["user", "nickname"], /// @todo Replaces all uses of "nickname" with "nick"
727 "email" => ["user", "email"],
728 "openid" => ["user", "openid"],
729 "timezone" => ["user", "timezone"],
730 "language" => ["user", "language"],
731 "register_date" => ["user", "register_date"],
732 "login_date" => ["user", "login_date"],
733 "default-location" => ["user", "default-location"],
734 "allow_location" => ["user", "allow_location"],
735 "theme" => ["user", "theme"],
736 "upubkey" => ["user", "pubkey"],
737 "uprvkey" => ["user", "prvkey"],
738 "sprvkey" => ["user", "sprvkey"],
739 "spubkey" => ["user", "spubkey"],
740 "verified" => ["user", "verified"],
741 "blockwall" => ["user", "blockwall"],
742 "hidewall" => ["user", "hidewall"],
743 "blocktags" => ["user", "blocktags"],
744 "unkmail" => ["user", "unkmail"],
745 "cntunkmail" => ["user", "cntunkmail"],
746 "notify-flags" => ["user", "notify-flags"],
747 "page-flags" => ["user", "page-flags"],
748 "account-type" => ["user", "account-type"],
749 "prvnets" => ["user", "prvnets"],
750 "maxreq" => ["user", "maxreq"],
751 "expire" => ["user", "expire"],
752 "account_removed" => ["user", "account_removed"],
753 "account_expired" => ["user", "account_expired"],
754 "account_expires_on" => ["user", "account_expires_on"],
755 "expire_notification_sent" => ["user", "expire_notification_sent"],
756 "def_gid" => ["user", "def_gid"],
757 "allow_cid" => ["user", "allow_cid"],
758 "allow_gid" => ["user", "allow_gid"],
759 "deny_cid" => ["user", "deny_cid"],
760 "deny_gid" => ["user", "deny_gid"],
761 "openidserver" => ["user", "openidserver"],
762 "publish" => ["profile", "publish"],
763 "net-publish" => ["profile", "net-publish"],
764 "hide-friends" => ["profile", "hide-friends"],
765 "prv_keywords" => ["profile", "prv_keywords"],
766 "pub_keywords" => ["profile", "pub_keywords"],
767 "address" => ["profile", "address"],
768 "locality" => ["profile", "locality"],
769 "region" => ["profile", "region"],
770 "postal-code" => ["profile", "postal-code"],
771 "country-name" => ["profile", "country-name"],
772 "homepage" => ["profile", "homepage"],
773 "dob" => ["profile", "dob"],
775 "query" => "FROM `user`
776 INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self`
777 INNER JOIN `profile` ON `profile`.`uid` = `user`.`uid`"
781 "id" => ["register", "id"],
782 "hash" => ["register", "hash"],
783 "created" => ["register", "created"],
784 "uid" => ["register", "uid"],
785 "password" => ["register", "password"],
786 "language" => ["register", "language"],
787 "note" => ["register", "note"],
788 "self" => ["contact", "self"],
789 "name" => ["contact", "name"],
790 "url" => ["contact", "url"],
791 "micro" => ["contact", "micro"],
792 "email" => ["user", "email"],
793 "nick" => ["contact", "nick"],
795 "query" => "FROM `register`
796 INNER JOIN `contact` ON `register`.`uid` = `contact`.`uid`
797 INNER JOIN `user` ON `register`.`uid` = `user`.`uid`"
799 "tag-search-view" => [
801 "uri-id" => ["post-tag", "uri-id"],
802 "uid" => ["post-user", "uid"],
803 "iid" => ["post-user", "id"],
804 "private" => ["post-user", "private"],
805 "wall" => ["post-user", "wall"],
806 "origin" => ["post-user", "origin"],
807 "global" => ["post-user", "global"],
808 "gravity" => ["post-user", "gravity"],
809 "received" => ["post-user", "received"],
810 "network" => ["post-user", "network"],
811 "author-id" => ["post-user", "author-id"],
812 "name" => ["tag", "name"],
814 "query" => "FROM `post-tag`
815 INNER JOIN `tag` ON `tag`.`id` = `post-tag`.`tid`
816 STRAIGHT_JOIN `post-user` ON `post-user`.`uri-id` = `post-tag`.`uri-id`
817 WHERE `post-tag`.`type` = 1"
819 "workerqueue-view" => [
821 "pid" => ["process", "pid"],
822 "priority" => ["workerqueue", "priority"],
824 "query" => "FROM `process`
825 INNER JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid`
826 WHERE NOT `workerqueue`.`done`"