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