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