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