3 * @copyright Copyright (C) 2010-2023, 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" => ["post-thread-user", "post-user-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 "conversation" => ["conversation-item-uri", "uri"],
74 "conversation-id" => ["post-thread-user", "conversation-id"],
75 "quote-uri" => ["quote-item-uri", "uri"],
76 "quote-uri-id" => ["post-content", "quote-uri-id"],
77 "guid" => ["item-uri", "guid"],
78 "wall" => ["post-user", "wall"],
79 "gravity" => ["post-user", "gravity"],
80 "extid" => ["external-item-uri", "uri"],
81 "external-id" => ["post-user", "external-id"],
82 "created" => ["post-user", "created"],
83 "edited" => ["post-user", "edited"],
84 "commented" => ["post-thread-user", "commented"],
85 "received" => ["post-user", "received"],
86 "changed" => ["post-thread-user", "changed"],
87 "post-type" => ["post-user", "post-type"],
88 "post-reason" => ["post-user", "post-reason"],
89 "private" => ["post-user", "private"],
90 "pubmail" => ["post-thread-user", "pubmail"],
91 "visible" => ["post-user", "visible"],
92 "starred" => ["post-thread-user", "starred"],
93 "unseen" => ["post-user", "unseen"],
94 "deleted" => ["post-user", "deleted"],
95 "origin" => ["post-user", "origin"],
96 "parent-origin" => ["post-thread-user", "origin"],
97 "mention" => ["post-thread-user", "mention"],
98 "global" => ["post-user", "global"],
99 "featured" => "EXISTS(SELECT `type` FROM `post-collection` WHERE `type` = 0 AND `uri-id` = `post-user`.`uri-id`)",
100 "network" => ["post-user", "network"],
101 "protocol" => ["post-user", "protocol"],
102 "vid" => ["post-user", "vid"],
103 "psid" => ["post-user", "psid"],
104 "verb" => "IF (`post-user`.`vid` IS NULL, '', `verb`.`name`)",
105 "title" => ["post-content", "title"],
106 "content-warning" => ["post-content", "content-warning"],
107 "raw-body" => ["post-content", "raw-body"],
108 "body" => "IFNULL (`post-content`.`body`, '')",
109 "rendered-hash" => ["post-content", "rendered-hash"],
110 "rendered-html" => ["post-content", "rendered-html"],
111 "language" => ["post-content", "language"],
112 "plink" => ["post-content", "plink"],
113 "location" => ["post-content", "location"],
114 "coord" => ["post-content", "coord"],
115 "app" => ["post-content", "app"],
116 "object-type" => ["post-content", "object-type"],
117 "object" => ["post-content", "object"],
118 "target-type" => ["post-content", "target-type"],
119 "target" => ["post-content", "target"],
120 "resource-id" => ["post-content", "resource-id"],
121 "contact-id" => ["post-user", "contact-id"],
122 "contact-uri-id" => ["contact", "uri-id"],
123 "contact-link" => ["contact", "url"],
124 "contact-addr" => ["contact", "addr"],
125 "contact-name" => ["contact", "name"],
126 "contact-nick" => ["contact", "nick"],
127 "contact-avatar" => ["contact", "thumb"],
128 "contact-network" => ["contact", "network"],
129 "contact-blocked" => ["contact", "blocked"],
130 "contact-hidden" => ["contact", "hidden"],
131 "contact-readonly" => ["contact", "readonly"],
132 "contact-archive" => ["contact", "archive"],
133 "contact-pending" => ["contact", "pending"],
134 "contact-rel" => ["contact", "rel"],
135 "contact-uid" => ["contact", "uid"],
136 "contact-contact-type" => ["contact", "contact-type"],
137 "writable" => "IF (`post-user`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `contact`.`writable`)",
138 "self" => ["contact", "self"],
139 "cid" => ["contact", "id"],
140 "alias" => ["contact", "alias"],
141 "photo" => ["contact", "photo"],
142 "name-date" => ["contact", "name-date"],
143 "uri-date" => ["contact", "uri-date"],
144 "avatar-date" => ["contact", "avatar-date"],
145 "thumb" => ["contact", "thumb"],
146 "author-id" => ["post-user", "author-id"],
147 "author-uri-id" => ["author", "uri-id"],
148 "author-link" => ["author", "url"],
149 "author-addr" => ["author", "addr"],
150 "author-name" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`name` != '', `contact`.`name`, `author`.`name`)",
151 "author-nick" => ["author", "nick"],
152 "author-alias" => ["author", "alias"],
153 "author-avatar" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `author`.`thumb`)",
154 "author-network" => ["author", "network"],
155 "author-blocked" => ["author", "blocked"],
156 "author-hidden" => ["author", "hidden"],
157 "author-updated" => ["author", "updated"],
158 "author-gsid" => ["author", "gsid"],
159 "owner-id" => ["post-user", "owner-id"],
160 "owner-uri-id" => ["owner", "uri-id"],
161 "owner-link" => ["owner", "url"],
162 "owner-addr" => ["owner", "addr"],
163 "owner-name" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`name` != '', `contact`.`name`, `owner`.`name`)",
164 "owner-nick" => ["owner", "nick"],
165 "owner-alias" => ["owner", "alias"],
166 "owner-avatar" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `owner`.`thumb`)",
167 "owner-network" => ["owner", "network"],
168 "owner-blocked" => ["owner", "blocked"],
169 "owner-hidden" => ["owner", "hidden"],
170 "owner-updated" => ["owner", "updated"],
171 "owner-contact-type" => ["owner", "contact-type"],
172 "causer-id" => ["post-user", "causer-id"],
173 "causer-uri-id" => ["causer", "uri-id"],
174 "causer-link" => ["causer", "url"],
175 "causer-addr" => ["causer", "addr"],
176 "causer-name" => ["causer", "name"],
177 "causer-nick" => ["causer", "nick"],
178 "causer-alias" => ["causer", "alias"],
179 "causer-avatar" => ["causer", "thumb"],
180 "causer-network" => ["causer", "network"],
181 "causer-blocked" => ["causer", "blocked"],
182 "causer-hidden" => ["causer", "hidden"],
183 "causer-contact-type" => ["causer", "contact-type"],
184 "postopts" => ["post-delivery-data", "postopts"],
185 "inform" => ["post-delivery-data", "inform"],
186 "delivery_queue_count" => ["post-delivery-data", "queue_count"],
187 "delivery_queue_done" => ["post-delivery-data", "queue_done"],
188 "delivery_queue_failed" => ["post-delivery-data", "queue_failed"],
189 "allow_cid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`allow_cid`)",
190 "allow_gid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`allow_gid`)",
191 "deny_cid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`deny_cid`)",
192 "deny_gid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`deny_gid`)",
193 "event-id" => ["post-user", "event-id"],
194 "event-created" => ["event", "created"],
195 "event-edited" => ["event", "edited"],
196 "event-start" => ["event", "start"],
197 "event-finish" => ["event", "finish"],
198 "event-summary" => ["event", "summary"],
199 "event-desc" => ["event", "desc"],
200 "event-location" => ["event", "location"],
201 "event-type" => ["event", "type"],
202 "event-nofinish" => ["event", "nofinish"],
203 "event-ignore" => ["event", "ignore"],
204 "question-id" => ["post-question", "id"],
205 "question-multiple" => ["post-question", "multiple"],
206 "question-voters" => ["post-question", "voters"],
207 "question-end-time" => ["post-question", "end-time"],
208 "has-categories" => "EXISTS(SELECT `uri-id` FROM `post-category` WHERE `post-category`.`uri-id` = `post-user`.`uri-id` AND `post-category`.`uid` = `post-user`.`uid`)",
209 "has-media" => "EXISTS(SELECT `id` FROM `post-media` WHERE `post-media`.`uri-id` = `post-user`.`uri-id`)",
210 "signed_text" => ["diaspora-interaction", "interaction"],
211 "parent-guid" => ["parent-item-uri", "guid"],
212 "parent-network" => ["post-thread-user", "network"],
213 "parent-author-id" => ["post-thread-user", "author-id"],
214 "parent-author-link" => ["parent-post-author", "url"],
215 "parent-author-name" => ["parent-post-author", "name"],
216 "parent-author-nick" => ["parent-post-author", "nick"],
217 "parent-author-network" => ["parent-post-author", "network"],
219 "query" => "FROM `post-user`
220 INNER JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`
221 STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-user`.`contact-id`
222 STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-user`.`author-id`
223 STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-user`.`owner-id`
224 LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post-user`.`causer-id`
225 LEFT JOIN `item-uri` ON `item-uri`.`id` = `post-user`.`uri-id`
226 LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post-user`.`thr-parent-id`
227 LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post-user`.`parent-uri-id`
228 LEFT JOIN `item-uri` AS `conversation-item-uri` ON `conversation-item-uri`.`id` = `post-thread-user`.`conversation-id`
229 LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post-user`.`external-id`
230 LEFT JOIN `verb` ON `verb`.`id` = `post-user`.`vid`
231 LEFT JOIN `event` ON `event`.`id` = `post-user`.`event-id`
232 LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-user`.`uri-id`
233 LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-user`.`uri-id`
234 LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
235 LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-user`.`uri-id` AND `post-user`.`origin`
236 LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-user`.`uri-id`
237 LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-user`.`psid`
238 LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `post-thread-user`.`author-id`"
240 "post-thread-user-view" => [
242 "id" => ["post-user", "id"],
243 "post-user-id" => ["post-user", "id"],
244 "uid" => ["post-thread-user", "uid"],
245 "parent" => ["post-thread-user", "post-user-id"],
246 "uri" => ["item-uri", "uri"],
247 "uri-id" => ["post-thread-user", "uri-id"],
248 "parent-uri" => ["parent-item-uri", "uri"],
249 "parent-uri-id" => ["post-user", "parent-uri-id"],
250 "thr-parent" => ["thr-parent-item-uri", "uri"],
251 "thr-parent-id" => ["post-user", "thr-parent-id"],
252 "conversation" => ["conversation-item-uri", "uri"],
253 "conversation-id" => ["post-thread-user", "conversation-id"],
254 "quote-uri" => ["quote-item-uri", "uri"],
255 "quote-uri-id" => ["post-content", "quote-uri-id"],
256 "guid" => ["item-uri", "guid"],
257 "wall" => ["post-thread-user", "wall"],
258 "gravity" => ["post-user", "gravity"],
259 "extid" => ["external-item-uri", "uri"],
260 "external-id" => ["post-user", "external-id"],
261 "created" => ["post-thread-user", "created"],
262 "edited" => ["post-user", "edited"],
263 "commented" => ["post-thread-user", "commented"],
264 "received" => ["post-thread-user", "received"],
265 "changed" => ["post-thread-user", "changed"],
266 "post-type" => ["post-user", "post-type"],
267 "post-reason" => ["post-user", "post-reason"],
268 "private" => ["post-user", "private"],
269 "pubmail" => ["post-thread-user", "pubmail"],
270 "ignored" => ["post-thread-user", "ignored"],
271 "visible" => ["post-user", "visible"],
272 "starred" => ["post-thread-user", "starred"],
273 "unseen" => ["post-thread-user", "unseen"],
274 "deleted" => ["post-user", "deleted"],
275 "origin" => ["post-thread-user", "origin"],
276 "mention" => ["post-thread-user", "mention"],
277 "global" => ["post-user", "global"],
278 "featured" => "EXISTS(SELECT `type` FROM `post-collection` WHERE `type` = 0 AND `uri-id` = `post-thread-user`.`uri-id`)",
279 "network" => ["post-thread-user", "network"],
280 "vid" => ["post-user", "vid"],
281 "psid" => ["post-thread-user", "psid"],
282 "verb" => "IF (`post-user`.`vid` IS NULL, '', `verb`.`name`)",
283 "title" => ["post-content", "title"],
284 "content-warning" => ["post-content", "content-warning"],
285 "raw-body" => ["post-content", "raw-body"],
286 "body" => ["post-content", "body"],
287 "rendered-hash" => ["post-content", "rendered-hash"],
288 "rendered-html" => ["post-content", "rendered-html"],
289 "language" => ["post-content", "language"],
290 "plink" => ["post-content", "plink"],
291 "location" => ["post-content", "location"],
292 "coord" => ["post-content", "coord"],
293 "app" => ["post-content", "app"],
294 "object-type" => ["post-content", "object-type"],
295 "object" => ["post-content", "object"],
296 "target-type" => ["post-content", "target-type"],
297 "target" => ["post-content", "target"],
298 "resource-id" => ["post-content", "resource-id"],
299 "contact-id" => ["post-thread-user", "contact-id"],
300 "contact-uri-id" => ["contact", "uri-id"],
301 "contact-link" => ["contact", "url"],
302 "contact-addr" => ["contact", "addr"],
303 "contact-name" => ["contact", "name"],
304 "contact-nick" => ["contact", "nick"],
305 "contact-avatar" => ["contact", "thumb"],
306 "contact-network" => ["contact", "network"],
307 "contact-blocked" => ["contact", "blocked"],
308 "contact-hidden" => ["contact", "hidden"],
309 "contact-readonly" => ["contact", "readonly"],
310 "contact-archive" => ["contact", "archive"],
311 "contact-pending" => ["contact", "pending"],
312 "contact-rel" => ["contact", "rel"],
313 "contact-uid" => ["contact", "uid"],
314 "contact-contact-type" => ["contact", "contact-type"],
315 "writable" => "IF (`post-user`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `contact`.`writable`)",
316 "self" => ["contact", "self"],
317 "cid" => ["contact", "id"],
318 "alias" => ["contact", "alias"],
319 "photo" => ["contact", "photo"],
320 "name-date" => ["contact", "name-date"],
321 "uri-date" => ["contact", "uri-date"],
322 "avatar-date" => ["contact", "avatar-date"],
323 "thumb" => ["contact", "thumb"],
324 "author-id" => ["post-thread-user", "author-id"],
325 "author-uri-id" => ["author", "uri-id"],
326 "author-link" => ["author", "url"],
327 "author-addr" => ["author", "addr"],
328 "author-name" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`name` != '', `contact`.`name`, `author`.`name`)",
329 "author-nick" => ["author", "nick"],
330 "author-alias" => ["author", "alias"],
331 "author-avatar" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `author`.`thumb`)",
332 "author-network" => ["author", "network"],
333 "author-blocked" => ["author", "blocked"],
334 "author-hidden" => ["author", "hidden"],
335 "author-updated" => ["author", "updated"],
336 "author-gsid" => ["author", "gsid"],
337 "owner-id" => ["post-thread-user", "owner-id"],
338 "owner-uri-id" => ["owner", "uri-id"],
339 "owner-link" => ["owner", "url"],
340 "owner-addr" => ["owner", "addr"],
341 "owner-name" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`name` != '', `contact`.`name`, `owner`.`name`)",
342 "owner-nick" => ["owner", "nick"],
343 "owner-alias" => ["owner", "alias"],
344 "owner-avatar" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `owner`.`thumb`)",
345 "owner-network" => ["owner", "network"],
346 "owner-blocked" => ["owner", "blocked"],
347 "owner-hidden" => ["owner", "hidden"],
348 "owner-updated" => ["owner", "updated"],
349 "owner-contact-type" => ["owner", "contact-type"],
350 "causer-id" => ["post-thread-user", "causer-id"],
351 "causer-uri-id" => ["causer", "uri-id"],
352 "causer-link" => ["causer", "url"],
353 "causer-addr" => ["causer", "addr"],
354 "causer-name" => ["causer", "name"],
355 "causer-nick" => ["causer", "nick"],
356 "causer-alias" => ["causer", "alias"],
357 "causer-avatar" => ["causer", "thumb"],
358 "causer-network" => ["causer", "network"],
359 "causer-blocked" => ["causer", "blocked"],
360 "causer-hidden" => ["causer", "hidden"],
361 "causer-contact-type" => ["causer", "contact-type"],
362 "postopts" => ["post-delivery-data", "postopts"],
363 "inform" => ["post-delivery-data", "inform"],
364 "delivery_queue_count" => ["post-delivery-data", "queue_count"],
365 "delivery_queue_done" => ["post-delivery-data", "queue_done"],
366 "delivery_queue_failed" => ["post-delivery-data", "queue_failed"],
367 "allow_cid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`allow_cid`)",
368 "allow_gid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`allow_gid`)",
369 "deny_cid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`deny_cid`)",
370 "deny_gid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`deny_gid`)",
371 "event-id" => ["post-user", "event-id"],
372 "event-created" => ["event", "created"],
373 "event-edited" => ["event", "edited"],
374 "event-start" => ["event", "start"],
375 "event-finish" => ["event", "finish"],
376 "event-summary" => ["event", "summary"],
377 "event-desc" => ["event", "desc"],
378 "event-location" => ["event", "location"],
379 "event-type" => ["event", "type"],
380 "event-nofinish" => ["event", "nofinish"],
381 "event-ignore" => ["event", "ignore"],
382 "question-id" => ["post-question", "id"],
383 "question-multiple" => ["post-question", "multiple"],
384 "question-voters" => ["post-question", "voters"],
385 "question-end-time" => ["post-question", "end-time"],
386 "has-categories" => "EXISTS(SELECT `uri-id` FROM `post-category` WHERE `post-category`.`uri-id` = `post-thread-user`.`uri-id` AND `post-category`.`uid` = `post-thread-user`.`uid`)",
387 "has-media" => "EXISTS(SELECT `id` FROM `post-media` WHERE `post-media`.`uri-id` = `post-thread-user`.`uri-id`)",
388 "signed_text" => ["diaspora-interaction", "interaction"],
389 "parent-guid" => ["parent-item-uri", "guid"],
390 "parent-network" => ["post-thread-user", "network"],
391 "parent-author-id" => ["post-thread-user", "author-id"],
392 "parent-author-link" => ["author", "url"],
393 "parent-author-name" => ["author", "name"],
394 "parent-author-nick" => ["author", "nick"],
395 "parent-author-network" => ["author", "network"],
397 "query" => "FROM `post-thread-user`
398 INNER JOIN `post-user` ON `post-user`.`id` = `post-thread-user`.`post-user-id`
399 STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
400 STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-thread-user`.`author-id`
401 STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-thread-user`.`owner-id`
402 LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post-thread-user`.`causer-id`
403 LEFT JOIN `item-uri` ON `item-uri`.`id` = `post-thread-user`.`uri-id`
404 LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post-user`.`thr-parent-id`
405 LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post-user`.`parent-uri-id`
406 LEFT JOIN `item-uri` AS `conversation-item-uri` ON `conversation-item-uri`.`id` = `post-thread-user`.`conversation-id`
407 LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post-user`.`external-id`
408 LEFT JOIN `verb` ON `verb`.`id` = `post-user`.`vid`
409 LEFT JOIN `event` ON `event`.`id` = `post-user`.`event-id`
410 LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-thread-user`.`uri-id`
411 LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-thread-user`.`uri-id`
412 LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
413 LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-thread-user`.`uri-id` AND `post-thread-user`.`origin`
414 LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-thread-user`.`uri-id`
415 LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-thread-user`.`psid`"
419 "uri" => ["item-uri", "uri"],
420 "uri-id" => ["post", "uri-id"],
421 "parent-uri" => ["parent-item-uri", "uri"],
422 "parent-uri-id" => ["post", "parent-uri-id"],
423 "thr-parent" => ["thr-parent-item-uri", "uri"],
424 "thr-parent-id" => ["post", "thr-parent-id"],
425 "conversation" => ["conversation-item-uri", "uri"],
426 "conversation-id" => ["post-thread", "conversation-id"],
427 "quote-uri" => ["quote-item-uri", "uri"],
428 "quote-uri-id" => ["post-content", "quote-uri-id"],
429 "guid" => ["item-uri", "guid"],
430 "gravity" => ["post", "gravity"],
431 "extid" => ["external-item-uri", "uri"],
432 "external-id" => ["post", "external-id"],
433 "created" => ["post", "created"],
434 "edited" => ["post", "edited"],
435 "commented" => ["post-thread", "commented"],
436 "received" => ["post", "received"],
437 "changed" => ["post-thread", "changed"],
438 "post-type" => ["post", "post-type"],
439 "private" => ["post", "private"],
440 "visible" => ["post", "visible"],
441 "deleted" => ["post", "deleted"],
442 "global" => ["post", "global"],
443 "featured" => "EXISTS(SELECT `type` FROM `post-collection` WHERE `type` = 0 AND `uri-id` = `post`.`uri-id`)",
444 "network" => ["post", "network"],
445 "vid" => ["post", "vid"],
446 "verb" => "IF (`post`.`vid` IS NULL, '', `verb`.`name`)",
447 "title" => ["post-content", "title"],
448 "content-warning" => ["post-content", "content-warning"],
449 "raw-body" => ["post-content", "raw-body"],
450 "body" => ["post-content", "body"],
451 "rendered-hash" => ["post-content", "rendered-hash"],
452 "rendered-html" => ["post-content", "rendered-html"],
453 "language" => ["post-content", "language"],
454 "plink" => ["post-content", "plink"],
455 "location" => ["post-content", "location"],
456 "coord" => ["post-content", "coord"],
457 "app" => ["post-content", "app"],
458 "object-type" => ["post-content", "object-type"],
459 "object" => ["post-content", "object"],
460 "target-type" => ["post-content", "target-type"],
461 "target" => ["post-content", "target"],
462 "resource-id" => ["post-content", "resource-id"],
463 "contact-id" => ["post", "author-id"],
464 "contact-uri-id" => ["author", "uri-id"],
465 "contact-link" => ["author", "url"],
466 "contact-addr" => ["author", "addr"],
467 "contact-name" => ["author", "name"],
468 "contact-nick" => ["author", "nick"],
469 "contact-avatar" => ["author", "thumb"],
470 "contact-network" => ["author", "network"],
471 "contact-blocked" => ["author", "blocked"],
472 "contact-hidden" => ["author", "hidden"],
473 "contact-readonly" => ["author", "readonly"],
474 "contact-archive" => ["author", "archive"],
475 "contact-pending" => ["author", "pending"],
476 "contact-rel" => ["author", "rel"],
477 "contact-uid" => ["author", "uid"],
478 "contact-contact-type" => ["author", "contact-type"],
479 "writable" => "IF (`post`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `author`.`writable`)",
481 "cid" => ["author", "id"],
482 "alias" => ["author", "alias"],
483 "photo" => ["author", "photo"],
484 "name-date" => ["author", "name-date"],
485 "uri-date" => ["author", "uri-date"],
486 "avatar-date" => ["author", "avatar-date"],
487 "thumb" => ["author", "thumb"],
488 "author-id" => ["post", "author-id"],
489 "author-uri-id" => ["author", "uri-id"],
490 "author-link" => ["author", "url"],
491 "author-addr" => ["author", "addr"],
492 "author-name" => ["author", "name"],
493 "author-nick" => ["author", "nick"],
494 "author-alias" => ["author", "alias"],
495 "author-avatar" => ["author", "thumb"],
496 "author-network" => ["author", "network"],
497 "author-blocked" => ["author", "blocked"],
498 "author-hidden" => ["author", "hidden"],
499 "author-updated" => ["author", "updated"],
500 "author-gsid" => ["author", "gsid"],
501 "owner-id" => ["post", "owner-id"],
502 "owner-uri-id" => ["owner", "uri-id"],
503 "owner-link" => ["owner", "url"],
504 "owner-addr" => ["owner", "addr"],
505 "owner-name" => ["owner", "name"],
506 "owner-nick" => ["owner", "nick"],
507 "owner-alias" => ["owner", "alias"],
508 "owner-avatar" => ["owner", "thumb"],
509 "owner-network" => ["owner", "network"],
510 "owner-blocked" => ["owner", "blocked"],
511 "owner-hidden" => ["owner", "hidden"],
512 "owner-updated" => ["owner", "updated"],
513 "owner-contact-type" => ["owner", "contact-type"],
514 "causer-id" => ["post", "causer-id"],
515 "causer-uri-id" => ["causer", "uri-id"],
516 "causer-link" => ["causer", "url"],
517 "causer-addr" => ["causer", "addr"],
518 "causer-name" => ["causer", "name"],
519 "causer-nick" => ["causer", "nick"],
520 "causer-alias" => ["causer", "alias"],
521 "causer-avatar" => ["causer", "thumb"],
522 "causer-network" => ["causer", "network"],
523 "causer-blocked" => ["causer", "blocked"],
524 "causer-hidden" => ["causer", "hidden"],
525 "causer-contact-type" => ["causer", "contact-type"],
526 "question-id" => ["post-question", "id"],
527 "question-multiple" => ["post-question", "multiple"],
528 "question-voters" => ["post-question", "voters"],
529 "question-end-time" => ["post-question", "end-time"],
530 "has-categories" => "0",
531 "has-media" => "EXISTS(SELECT `id` FROM `post-media` WHERE `post-media`.`uri-id` = `post`.`uri-id`)",
532 "signed_text" => ["diaspora-interaction", "interaction"],
533 "parent-guid" => ["parent-item-uri", "guid"],
534 "parent-network" => ["post-thread", "network"],
535 "parent-author-id" => ["post-thread", "author-id"],
536 "parent-author-link" => ["parent-post-author", "url"],
537 "parent-author-name" => ["parent-post-author", "name"],
538 "parent-author-nick" => ["parent-post-author", "nick"],
539 "parent-author-network" => ["parent-post-author", "network"],
541 "query" => "FROM `post`
542 STRAIGHT_JOIN `post-thread` ON `post-thread`.`uri-id` = `post`.`parent-uri-id`
543 STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post`.`author-id`
544 STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post`.`owner-id`
545 LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post`.`causer-id`
546 LEFT JOIN `item-uri` ON `item-uri`.`id` = `post`.`uri-id`
547 LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post`.`thr-parent-id`
548 LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post`.`parent-uri-id`
549 LEFT JOIN `item-uri` AS `conversation-item-uri` ON `conversation-item-uri`.`id` = `post-thread`.`conversation-id`
550 LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post`.`external-id`
551 LEFT JOIN `verb` ON `verb`.`id` = `post`.`vid`
552 LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post`.`uri-id`
553 LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post`.`uri-id`
554 LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
555 LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post`.`uri-id`
556 LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `post-thread`.`author-id`"
558 "post-thread-view" => [
560 "uri" => ["item-uri", "uri"],
561 "uri-id" => ["post-thread", "uri-id"],
562 "parent-uri" => ["parent-item-uri", "uri"],
563 "parent-uri-id" => ["post", "parent-uri-id"],
564 "thr-parent" => ["thr-parent-item-uri", "uri"],
565 "thr-parent-id" => ["post", "thr-parent-id"],
566 "conversation" => ["conversation-item-uri", "uri"],
567 "conversation-id" => ["post-thread", "conversation-id"],
568 "quote-uri" => ["quote-item-uri", "uri"],
569 "quote-uri-id" => ["post-content", "quote-uri-id"],
570 "guid" => ["item-uri", "guid"],
571 "gravity" => ["post", "gravity"],
572 "extid" => ["external-item-uri", "uri"],
573 "external-id" => ["post", "external-id"],
574 "created" => ["post-thread", "created"],
575 "edited" => ["post", "edited"],
576 "commented" => ["post-thread", "commented"],
577 "received" => ["post-thread", "received"],
578 "changed" => ["post-thread", "changed"],
579 "post-type" => ["post", "post-type"],
580 "private" => ["post", "private"],
581 "visible" => ["post", "visible"],
582 "deleted" => ["post", "deleted"],
583 "global" => ["post", "global"],
584 "featured" => "EXISTS(SELECT `type` FROM `post-collection` WHERE `type` = 0 AND `uri-id` = `post-thread`.`uri-id`)",
585 "network" => ["post-thread", "network"],
586 "vid" => ["post", "vid"],
587 "verb" => "IF (`post`.`vid` IS NULL, '', `verb`.`name`)",
588 "title" => ["post-content", "title"],
589 "content-warning" => ["post-content", "content-warning"],
590 "raw-body" => ["post-content", "raw-body"],
591 "body" => ["post-content", "body"],
592 "rendered-hash" => ["post-content", "rendered-hash"],
593 "rendered-html" => ["post-content", "rendered-html"],
594 "language" => ["post-content", "language"],
595 "plink" => ["post-content", "plink"],
596 "location" => ["post-content", "location"],
597 "coord" => ["post-content", "coord"],
598 "app" => ["post-content", "app"],
599 "object-type" => ["post-content", "object-type"],
600 "object" => ["post-content", "object"],
601 "target-type" => ["post-content", "target-type"],
602 "target" => ["post-content", "target"],
603 "resource-id" => ["post-content", "resource-id"],
604 "contact-id" => ["post-thread", "author-id"],
605 "contact-uri-id" => ["author", "uri-id"],
606 "contact-link" => ["author", "url"],
607 "contact-addr" => ["author", "addr"],
608 "contact-name" => ["author", "name"],
609 "contact-nick" => ["author", "nick"],
610 "contact-avatar" => ["author", "thumb"],
611 "contact-network" => ["author", "network"],
612 "contact-blocked" => ["author", "blocked"],
613 "contact-hidden" => ["author", "hidden"],
614 "contact-readonly" => ["author", "readonly"],
615 "contact-archive" => ["author", "archive"],
616 "contact-pending" => ["author", "pending"],
617 "contact-rel" => ["author", "rel"],
618 "contact-uid" => ["author", "uid"],
619 "contact-contact-type" => ["author", "contact-type"],
620 "writable" => "IF (`post`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `author`.`writable`)",
622 "cid" => ["author", "id"],
623 "alias" => ["author", "alias"],
624 "photo" => ["author", "photo"],
625 "name-date" => ["author", "name-date"],
626 "uri-date" => ["author", "uri-date"],
627 "avatar-date" => ["author", "avatar-date"],
628 "thumb" => ["author", "thumb"],
629 "author-id" => ["post-thread", "author-id"],
630 "author-uri-id" => ["author", "uri-id"],
631 "author-link" => ["author", "url"],
632 "author-addr" => ["author", "addr"],
633 "author-name" => ["author", "name"],
634 "author-nick" => ["author", "nick"],
635 "author-alias" => ["author", "alias"],
636 "author-avatar" => ["author", "thumb"],
637 "author-network" => ["author", "network"],
638 "author-blocked" => ["author", "blocked"],
639 "author-hidden" => ["author", "hidden"],
640 "author-updated" => ["author", "updated"],
641 "author-gsid" => ["author", "gsid"],
642 "owner-id" => ["post-thread", "owner-id"],
643 "owner-uri-id" => ["owner", "uri-id"],
644 "owner-link" => ["owner", "url"],
645 "owner-addr" => ["owner", "addr"],
646 "owner-name" => ["owner", "name"],
647 "owner-nick" => ["owner", "nick"],
648 "owner-alias" => ["owner", "alias"],
649 "owner-avatar" => ["owner", "thumb"],
650 "owner-network" => ["owner", "network"],
651 "owner-blocked" => ["owner", "blocked"],
652 "owner-hidden" => ["owner", "hidden"],
653 "owner-updated" => ["owner", "updated"],
654 "owner-contact-type" => ["owner", "contact-type"],
655 "causer-id" => ["post-thread", "causer-id"],
656 "causer-uri-id" => ["causer", "uri-id"],
657 "causer-link" => ["causer", "url"],
658 "causer-addr" => ["causer", "addr"],
659 "causer-name" => ["causer", "name"],
660 "causer-nick" => ["causer", "nick"],
661 "causer-alias" => ["causer", "alias"],
662 "causer-avatar" => ["causer", "thumb"],
663 "causer-network" => ["causer", "network"],
664 "causer-blocked" => ["causer", "blocked"],
665 "causer-hidden" => ["causer", "hidden"],
666 "causer-contact-type" => ["causer", "contact-type"],
667 "question-id" => ["post-question", "id"],
668 "question-multiple" => ["post-question", "multiple"],
669 "question-voters" => ["post-question", "voters"],
670 "question-end-time" => ["post-question", "end-time"],
671 "has-categories" => "0",
672 "has-media" => "EXISTS(SELECT `id` FROM `post-media` WHERE `post-media`.`uri-id` = `post-thread`.`uri-id`)",
673 "total-comments" => "(SELECT COUNT(*) FROM `post` WHERE `parent-uri-id` = `post-thread`.`uri-id` AND `gravity` = 6)",
674 "total-actors" => "(SELECT COUNT(DISTINCT(`author-id`)) FROM `post` WHERE `parent-uri-id` = `post-thread`.`uri-id` AND `gravity` = 6)",
675 "signed_text" => ["diaspora-interaction", "interaction"],
676 "parent-guid" => ["parent-item-uri", "guid"],
677 "parent-network" => ["post-thread", "network"],
678 "parent-author-id" => ["post-thread", "author-id"],
679 "parent-author-link" => ["author", "url"],
680 "parent-author-name" => ["author", "name"],
681 "parent-author-nick" => ["author", "nick"],
682 "parent-author-network" => ["author", "network"],
684 "query" => "FROM `post-thread`
685 INNER JOIN `post` ON `post`.`uri-id` = `post-thread`.`uri-id`
686 STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-thread`.`author-id`
687 STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-thread`.`owner-id`
688 LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post-thread`.`causer-id`
689 LEFT JOIN `item-uri` ON `item-uri`.`id` = `post-thread`.`uri-id`
690 LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post`.`thr-parent-id`
691 LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post`.`parent-uri-id`
692 LEFT JOIN `item-uri` AS `conversation-item-uri` ON `conversation-item-uri`.`id` = `post-thread`.`conversation-id`
693 LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post`.`external-id`
694 LEFT JOIN `verb` ON `verb`.`id` = `post`.`vid`
695 LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-thread`.`uri-id`
696 LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-thread`.`uri-id`
697 LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
698 LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-thread`.`uri-id`"
702 "uri-id" => ["post-category", "uri-id"],
703 "uid" => ["post-category", "uid"],
704 "type" => ["post-category", "type"],
705 "tid" => ["post-category", "tid"],
706 "name" => ["tag", "name"],
707 "url" => ["tag", "url"],
709 "query" => "FROM `post-category`
710 LEFT JOIN `tag` ON `post-category`.`tid` = `tag`.`id`"
712 "collection-view" => [
714 "uri-id" => ["post-collection", "uri-id"],
715 "type" => ["post-collection", "type"],
716 "cid" => ["post-collection", "author-id"],
717 "received" => ["post", "received"],
718 "created" => ["post", "created"],
719 "commented" => ["post-thread", "commented"],
720 "private" => ["post", "private"],
721 "visible" => ["post", "visible"],
722 "deleted" => ["post", "deleted"],
723 "thr-parent-id" => ["post", "thr-parent-id"],
724 "author-id" => ["post-collection", "author-id"],
725 "gravity" => ["post", "gravity"],
727 "query" => "FROM `post-collection`
728 INNER JOIN `post` ON `post-collection`.`uri-id` = `post`.`uri-id`
729 INNER JOIN `post-thread` ON `post-thread`.`uri-id` = `post`.`parent-uri-id`"
733 "uri-id" => ["post-media", "uri-id"],
734 "type" => ["post-media", "type"],
735 "received" => ["post", "received"],
736 "created" => ["post", "created"],
737 "private" => ["post", "private"],
738 "visible" => ["post", "visible"],
739 "deleted" => ["post", "deleted"],
740 "thr-parent-id" => ["post", "thr-parent-id"],
741 "author-id" => ["post", "author-id"],
742 "gravity" => ["post", "gravity"],
744 "query" => "FROM `post-media`
745 INNER JOIN `post` ON `post-media`.`uri-id` = `post`.`uri-id`"
749 "uri-id" => ["post-tag", "uri-id"],
750 "type" => ["post-tag", "type"],
751 "tid" => ["post-tag", "tid"],
752 "cid" => ["post-tag", "cid"],
753 "name" => "CASE `cid` WHEN 0 THEN `tag`.`name` ELSE `contact`.`name` END",
754 "url" => "CASE `cid` WHEN 0 THEN `tag`.`url` ELSE `contact`.`url` END",
755 "tag-type" => "CASE `cid` WHEN 0 THEN `tag`.`type` ELSE 1 END",
757 "query" => "FROM `post-tag`
758 LEFT JOIN `tag` ON `post-tag`.`tid` = `tag`.`id`
759 LEFT JOIN `contact` ON `post-tag`.`cid` = `contact`.`id`"
761 "network-item-view" => [
763 "uri-id" => ["post-user", "uri-id"],
764 "parent" => ["post-thread-user", "post-user-id"],
765 "received" => ["post-user", "received"],
766 "commented" => ["post-thread-user", "commented"],
767 "created" => ["post-user", "created"],
768 "uid" => ["post-user", "uid"],
769 "starred" => ["post-thread-user", "starred"],
770 "mention" => ["post-thread-user", "mention"],
771 "network" => ["post-user", "network"],
772 "unseen" => ["post-user", "unseen"],
773 "gravity" => ["post-user", "gravity"],
774 "contact-id" => ["post-user", "contact-id"],
775 "contact-type" => ["ownercontact", "contact-type"],
777 "query" => "FROM `post-user`
778 INNER JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`
779 STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
780 STRAIGHT_JOIN `contact` AS `authorcontact` ON `authorcontact`.`id` = `post-thread-user`.`author-id`
781 STRAIGHT_JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread-user`.`owner-id`
782 LEFT JOIN `user-contact` AS `author` ON `author`.`uid` = `post-thread-user`.`uid` AND `author`.`cid` = `post-thread-user`.`author-id`
783 LEFT JOIN `user-contact` AS `owner` ON `owner`.`uid` = `post-thread-user`.`uid` AND `owner`.`cid` = `post-thread-user`.`owner-id`
784 WHERE `post-user`.`visible` AND NOT `post-user`.`deleted`
785 AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`)
786 AND (`post-user`.`hidden` IS NULL OR NOT `post-user`.`hidden`)
787 AND NOT `authorcontact`.`blocked` AND NOT `ownercontact`.`blocked`
788 AND (`author`.`blocked` IS NULL OR NOT `author`.`blocked`)
789 AND (`owner`.`blocked` IS NULL OR NOT `owner`.`blocked`)"
791 "network-thread-view" => [
793 "uri-id" => ["post-thread-user", "uri-id"],
794 "parent" => ["post-thread-user", "post-user-id"],
795 "received" => ["post-thread-user", "received"],
796 "commented" => ["post-thread-user", "commented"],
797 "created" => ["post-thread-user", "created"],
798 "uid" => ["post-thread-user", "uid"],
799 "starred" => ["post-thread-user", "starred"],
800 "mention" => ["post-thread-user", "mention"],
801 "network" => ["post-thread-user", "network"],
802 "contact-id" => ["post-thread-user", "contact-id"],
803 "contact-type" => ["ownercontact", "contact-type"],
805 "query" => "FROM `post-thread-user`
806 INNER JOIN `post-user` ON `post-user`.`id` = `post-thread-user`.`post-user-id`
807 STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
808 STRAIGHT_JOIN `contact` AS `authorcontact` ON `authorcontact`.`id` = `post-thread-user`.`author-id`
809 STRAIGHT_JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread-user`.`owner-id`
810 LEFT JOIN `user-contact` AS `author` ON `author`.`uid` = `post-thread-user`.`uid` AND `author`.`cid` = `post-thread-user`.`author-id`
811 LEFT JOIN `user-contact` AS `owner` ON `owner`.`uid` = `post-thread-user`.`uid` AND `owner`.`cid` = `post-thread-user`.`owner-id`
812 WHERE `post-user`.`visible` AND NOT `post-user`.`deleted`
813 AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`)
814 AND (`post-thread-user`.`hidden` IS NULL OR NOT `post-thread-user`.`hidden`)
815 AND NOT `authorcontact`.`blocked` AND NOT `ownercontact`.`blocked`
816 AND (`author`.`blocked` IS NULL OR NOT `author`.`blocked`)
817 AND (`owner`.`blocked` IS NULL OR NOT `owner`.`blocked`)"
821 "id" => ["contact", "id"],
822 "uid" => ["contact", "uid"],
823 "created" => ["contact", "created"],
824 "updated" => ["contact", "updated"],
825 "self" => ["contact", "self"],
826 "remote_self" => ["contact", "remote_self"],
827 "rel" => ["contact", "rel"],
828 "network" => ["contact", "network"],
829 "protocol" => ["contact", "protocol"],
830 "name" => ["contact", "name"],
831 "nick" => ["contact", "nick"],
832 "location" => ["contact", "location"],
833 "about" => ["contact", "about"],
834 "keywords" => ["contact", "keywords"],
835 "xmpp" => ["contact", "xmpp"],
836 "matrix" => ["contact", "matrix"],
837 "attag" => ["contact", "attag"],
838 "avatar" => ["contact", "avatar"],
839 "photo" => ["contact", "photo"],
840 "thumb" => ["contact", "thumb"],
841 "micro" => ["contact", "micro"],
842 "header" => ["contact", "header"],
843 "url" => ["contact", "url"],
844 "nurl" => ["contact", "nurl"],
845 "uri-id" => ["contact", "uri-id"],
846 "addr" => ["contact", "addr"],
847 "alias" => ["contact", "alias"],
848 "pubkey" => ["contact", "pubkey"],
849 "prvkey" => ["contact", "prvkey"],
850 "batch" => ["contact", "batch"],
851 "request" => ["contact", "request"],
852 "notify" => ["contact", "notify"],
853 "poll" => ["contact", "poll"],
854 "confirm" => ["contact", "confirm"],
855 "poco" => ["contact", "poco"],
856 "subhub" => ["contact", "subhub"],
857 "hub-verify" => ["contact", "hub-verify"],
858 "last-update" => ["contact", "last-update"],
859 "success_update" => ["contact", "success_update"],
860 "failure_update" => ["contact", "failure_update"],
861 "name-date" => ["contact", "name-date"],
862 "uri-date" => ["contact", "uri-date"],
863 "avatar-date" => ["contact", "avatar-date"],
864 "picdate" => ["contact", "avatar-date"], /// @todo Replaces all uses of "picdate" with "avatar-date"
865 "term-date" => ["contact", "term-date"],
866 "last-item" => ["contact", "last-item"],
867 "priority" => ["contact", "priority"],
868 "blocked" => ["user", "blocked"],
869 "block_reason" => ["contact", "block_reason"],
870 "readonly" => ["contact", "readonly"],
871 "writable" => ["contact", "writable"],
872 "forum" => ["contact", "forum"],
873 "prv" => ["contact", "prv"],
874 "contact-type" => ["contact", "contact-type"],
875 "manually-approve" => ["contact", "manually-approve"],
876 "hidden" => ["contact", "hidden"],
877 "archive" => ["contact", "archive"],
878 "pending" => ["contact", "pending"],
879 "deleted" => ["contact", "deleted"],
880 "unsearchable" => ["contact", "unsearchable"],
881 "sensitive" => ["contact", "sensitive"],
882 "baseurl" => ["contact", "baseurl"],
883 "reason" => ["contact", "reason"],
884 "info" => ["contact", "info"],
885 "bdyear" => ["contact", "bdyear"],
886 "bd" => ["contact", "bd"],
887 "notify_new_posts" => ["contact", "notify_new_posts"],
888 "fetch_further_information" => ["contact", "fetch_further_information"],
889 "ffi_keyword_denylist" => ["contact", "ffi_keyword_denylist"],
890 "parent-uid" => ["user", "parent-uid"],
891 "guid" => ["user", "guid"],
892 "nickname" => ["user", "nickname"], /// @todo Replaces all uses of "nickname" with "nick"
893 "email" => ["user", "email"],
894 "openid" => ["user", "openid"],
895 "timezone" => ["user", "timezone"],
896 "language" => ["user", "language"],
897 "register_date" => ["user", "register_date"],
898 "login_date" => ["user", "login_date"],
899 "last-activity" => ["user", "last-activity"],
900 "default-location" => ["user", "default-location"],
901 "allow_location" => ["user", "allow_location"],
902 "theme" => ["user", "theme"],
903 "upubkey" => ["user", "pubkey"],
904 "uprvkey" => ["user", "prvkey"],
905 "sprvkey" => ["user", "sprvkey"],
906 "spubkey" => ["user", "spubkey"],
907 "verified" => ["user", "verified"],
908 "blockwall" => ["user", "blockwall"],
909 "hidewall" => ["user", "hidewall"],
910 "blocktags" => ["user", "blocktags"],
911 "unkmail" => ["user", "unkmail"],
912 "cntunkmail" => ["user", "cntunkmail"],
913 "notify-flags" => ["user", "notify-flags"],
914 "page-flags" => ["user", "page-flags"],
915 "account-type" => ["user", "account-type"],
916 "prvnets" => ["user", "prvnets"],
917 "maxreq" => ["user", "maxreq"],
918 "expire" => ["user", "expire"],
919 "account_removed" => ["user", "account_removed"],
920 "account_expired" => ["user", "account_expired"],
921 "account_expires_on" => ["user", "account_expires_on"],
922 "expire_notification_sent" => ["user", "expire_notification_sent"],
923 "def_gid" => ["user", "def_gid"],
924 "allow_cid" => ["user", "allow_cid"],
925 "allow_gid" => ["user", "allow_gid"],
926 "deny_cid" => ["user", "deny_cid"],
927 "deny_gid" => ["user", "deny_gid"],
928 "openidserver" => ["user", "openidserver"],
929 "publish" => ["profile", "publish"],
930 "net-publish" => ["profile", "net-publish"],
931 "hide-friends" => ["profile", "hide-friends"],
932 "prv_keywords" => ["profile", "prv_keywords"],
933 "pub_keywords" => ["profile", "pub_keywords"],
934 "address" => ["profile", "address"],
935 "locality" => ["profile", "locality"],
936 "region" => ["profile", "region"],
937 "postal-code" => ["profile", "postal-code"],
938 "country-name" => ["profile", "country-name"],
939 "homepage" => ["profile", "homepage"],
940 "homepage_verified" => ["profile", "homepage_verified"],
941 "dob" => ["profile", "dob"],
943 "query" => "FROM `user`
944 INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self`
945 INNER JOIN `profile` ON `profile`.`uid` = `user`.`uid`"
949 "id" => ["contact", "id"],
950 "url" => ["contact", "url"],
951 "nurl" => ["contact", "nurl"],
952 "uri-id" => ["contact", "uri-id"],
953 "guid" => ["item-uri", "guid"],
954 "addr" => ["contact", "addr"],
955 "alias" => ["contact", "alias"],
956 "name" => ["contact", "name"],
957 "nick" => ["contact", "nick"],
958 "about" => ["contact", "about"],
959 "keywords" => ["contact", "keywords"],
960 "xmpp" => ["contact", "xmpp"],
961 "matrix" => ["contact", "matrix"],
962 "avatar" => ["contact", "avatar"],
963 "photo" => ["contact", "photo"],
964 "thumb" => ["contact", "thumb"],
965 "micro" => ["contact", "micro"],
966 "header" => ["contact", "header"],
967 "created" => ["contact", "created"],
968 "updated" => ["contact", "updated"],
969 "network" => ["contact", "network"],
970 "protocol" => ["contact", "protocol"],
971 "location" => ["contact", "location"],
972 "attag" => ["contact", "attag"],
973 "pubkey" => ["contact", "pubkey"],
974 "prvkey" => ["contact", "prvkey"],
975 "subscribe" => ["contact", "subscribe"],
976 "last-update" => ["contact", "last-update"],
977 "success_update" => ["contact", "success_update"],
978 "failure_update" => ["contact", "failure_update"],
979 "failed" => ["contact", "failed"],
980 "last-item" => ["contact", "last-item"],
981 "last-discovery" => ["contact", "last-discovery"],
982 "contact-type" => ["contact", "contact-type"],
983 "manually-approve" => ["contact", "manually-approve"],
984 "unsearchable" => ["contact", "unsearchable"],
985 "sensitive" => ["contact", "sensitive"],
986 "baseurl" => ["contact", "baseurl"],
987 "gsid" => ["contact", "gsid"],
988 "info" => ["contact", "info"],
989 "bdyear" => ["contact", "bdyear"],
990 "bd" => ["contact", "bd"],
991 "poco" => ["contact", "poco"],
992 "name-date" => ["contact", "name-date"],
993 "uri-date" => ["contact", "uri-date"],
994 "avatar-date" => ["contact", "avatar-date"],
995 "term-date" => ["contact", "term-date"],
996 "global-ignored" => ["contact", "hidden"],
997 "global-blocked" => ["contact", "blocked"],
998 "hidden" => ["contact", "hidden"],
999 "archive" => ["contact", "archive"],
1000 "deleted" => ["contact", "deleted"],
1001 "blocked" => ["contact", "blocked"],
1002 "dfrn-notify" => ["contact", "notify"],
1003 "dfrn-poll" => ["contact", "poll"],
1004 "diaspora-guid" => ["item-uri", "guid"],
1005 "diaspora-batch" => ["diaspora-contact", "batch"],
1006 "diaspora-notify" => ["diaspora-contact", "notify"],
1007 "diaspora-poll" => ["diaspora-contact", "poll"],
1008 "diaspora-alias" => ["diaspora-contact", "alias"],
1009 "ap-uuid" => ["apcontact", "uuid"],
1010 "ap-type" => ["apcontact", "type"],
1011 "ap-following" => ["apcontact", "following"],
1012 "ap-followers" => ["apcontact", "followers"],
1013 "ap-inbox" => ["apcontact", "inbox"],
1014 "ap-outbox" => ["apcontact", "outbox"],
1015 "ap-sharedinbox" => ["apcontact", "sharedinbox"],
1016 "ap-generator" => ["apcontact", "generator"],
1017 "ap-following_count" => ["apcontact", "following_count"],
1018 "ap-followers_count" => ["apcontact", "followers_count"],
1019 "ap-statuses_count" => ["apcontact", "statuses_count"],
1020 "site_name" => ["gserver", "site_name"],
1021 "platform" => ["gserver", "platform"],
1022 "version" => ["gserver", "version"],
1023 "server-blocked" => ["gserver", "blocked"],
1024 "server-failed" => ["gserver", "failed"],
1026 "query" => "FROM `contact`
1027 LEFT JOIN `item-uri` ON `item-uri`.`id` = `contact`.`uri-id`
1028 LEFT JOIN `apcontact` ON `apcontact`.`uri-id` = `contact`.`uri-id`
1029 LEFT JOIN `diaspora-contact` ON `diaspora-contact`.`uri-id` = contact.`uri-id`
1030 LEFT JOIN `gserver` ON `gserver`.`id` = contact.`gsid`
1031 WHERE `contact`.`uid` = 0"
1033 "account-user-view" => [
1035 "id" => ["ucontact", "id"],
1036 "pid" => ["contact", "id"],
1037 "uid" => ["ucontact", "uid"],
1038 "url" => ["contact", "url"],
1039 "nurl" => ["contact", "nurl"],
1040 "uri-id" => ["contact", "uri-id"],
1041 "guid" => ["item-uri", "guid"],
1042 "addr" => ["contact", "addr"],
1043 "alias" => ["contact", "alias"],
1044 "name" => ["contact", "name"],
1045 "nick" => ["contact", "nick"],
1046 "about" => ["contact", "about"],
1047 "keywords" => ["contact", "keywords"],
1048 "xmpp" => ["contact", "xmpp"],
1049 "matrix" => ["contact", "matrix"],
1050 "avatar" => ["contact", "avatar"],
1051 "photo" => ["contact", "photo"],
1052 "thumb" => ["contact", "thumb"],
1053 "micro" => ["contact", "micro"],
1054 "header" => ["contact", "header"],
1055 "created" => ["contact", "created"],
1056 "updated" => ["contact", "updated"],
1057 "self" => ["ucontact", "self"],
1058 "remote_self" => ["ucontact", "remote_self"],
1059 "rel" => ["ucontact", "rel"],
1060 "network" => ["contact", "network"],
1061 "protocol" => ["ucontact", "protocol"],
1062 "location" => ["contact", "location"],
1063 "attag" => ["ucontact", "attag"],
1064 "pubkey" => ["contact", "pubkey"],
1065 "prvkey" => ["contact", "prvkey"],
1066 "subscribe" => ["contact", "subscribe"],
1067 "last-update" => ["contact", "last-update"],
1068 "success_update" => ["contact", "success_update"],
1069 "failure_update" => ["contact", "failure_update"],
1070 "failed" => ["contact", "failed"],
1071 "last-item" => ["contact", "last-item"],
1072 "last-discovery" => ["contact", "last-discovery"],
1073 "contact-type" => ["contact", "contact-type"],
1074 "manually-approve" => ["contact", "manually-approve"],
1075 "unsearchable" => ["contact", "unsearchable"],
1076 "sensitive" => ["contact", "sensitive"],
1077 "baseurl" => ["contact", "baseurl"],
1078 "gsid" => ["contact", "gsid"],
1079 "info" => ["ucontact", "info"],
1080 "bdyear" => ["contact", "bdyear"],
1081 "bd" => ["contact", "bd"],
1082 "poco" => ["contact", "poco"],
1083 "name-date" => ["contact", "name-date"],
1084 "uri-date" => ["contact", "uri-date"],
1085 "avatar-date" => ["contact", "avatar-date"],
1086 "term-date" => ["contact", "term-date"],
1087 "global-ignored" => ["contact", "hidden"],
1088 "global-blocked" => ["contact", "blocked"],
1089 "hidden" => ["ucontact", "hidden"],
1090 "archive" => ["ucontact", "archive"],
1091 "pending" => ["ucontact", "pending"],
1092 "deleted" => ["ucontact", "deleted"],
1093 "notify_new_posts" => ["ucontact", "notify_new_posts"],
1094 "fetch_further_information" => ["ucontact", "fetch_further_information"],
1095 "ffi_keyword_denylist" => ["ucontact", "ffi_keyword_denylist"],
1096 "rating" => ["ucontact", "rating"],
1097 "readonly" => ["ucontact", "readonly"],
1098 "blocked" => ["ucontact", "blocked"],
1099 "block_reason" => ["ucontact", "block_reason"],
1100 "subhub" => ["ucontact", "subhub"],
1101 "hub-verify" => ["ucontact", "hub-verify"],
1102 "reason" => ["ucontact", "reason"],
1103 "dfrn-notify" => ["contact", "notify"],
1104 "dfrn-poll" => ["contact", "poll"],
1105 "diaspora-guid" => ["item-uri", "guid"],
1106 "diaspora-batch" => ["diaspora-contact", "batch"],
1107 "diaspora-notify" => ["diaspora-contact", "notify"],
1108 "diaspora-poll" => ["diaspora-contact", "poll"],
1109 "diaspora-alias" => ["diaspora-contact", "alias"],
1110 "diaspora-interacting_count" => ["diaspora-contact", "interacting_count"],
1111 "diaspora-interacted_count" => ["diaspora-contact", "interacted_count"],
1112 "diaspora-post_count" => ["diaspora-contact", "post_count"],
1113 "ap-uuid" => ["apcontact", "uuid"],
1114 "ap-type" => ["apcontact", "type"],
1115 "ap-following" => ["apcontact", "following"],
1116 "ap-followers" => ["apcontact", "followers"],
1117 "ap-inbox" => ["apcontact", "inbox"],
1118 "ap-outbox" => ["apcontact", "outbox"],
1119 "ap-sharedinbox" => ["apcontact", "sharedinbox"],
1120 "ap-generator" => ["apcontact", "generator"],
1121 "ap-following_count" => ["apcontact", "following_count"],
1122 "ap-followers_count" => ["apcontact", "followers_count"],
1123 "ap-statuses_count" => ["apcontact", "statuses_count"],
1124 "site_name" => ["gserver", "site_name"],
1125 "platform" => ["gserver", "platform"],
1126 "version" => ["gserver", "version"],
1127 "server-blocked" => ["gserver", "blocked"],
1128 "server-failed" => ["gserver", "failed"],
1130 "query" => "FROM `contact` AS `ucontact`
1131 INNER JOIN `contact` ON `contact`.`uri-id` = `ucontact`.`uri-id` AND `contact`.`uid` = 0
1132 LEFT JOIN `item-uri` ON `item-uri`.`id` = `ucontact`.`uri-id`
1133 LEFT JOIN `apcontact` ON `apcontact`.`uri-id` = `ucontact`.`uri-id`
1134 LEFT JOIN `diaspora-contact` ON `diaspora-contact`.`uri-id` = `ucontact`.`uri-id`
1135 LEFT JOIN `gserver` ON `gserver`.`id` = contact.`gsid`"
1139 "id" => ["register", "id"],
1140 "hash" => ["register", "hash"],
1141 "created" => ["register", "created"],
1142 "uid" => ["register", "uid"],
1143 "password" => ["register", "password"],
1144 "language" => ["register", "language"],
1145 "note" => ["register", "note"],
1146 "self" => ["contact", "self"],
1147 "name" => ["contact", "name"],
1148 "url" => ["contact", "url"],
1149 "micro" => ["contact", "micro"],
1150 "email" => ["user", "email"],
1151 "nick" => ["contact", "nick"],
1153 "query" => "FROM `register`
1154 INNER JOIN `contact` ON `register`.`uid` = `contact`.`uid`
1155 INNER JOIN `user` ON `register`.`uid` = `user`.`uid`"
1157 "tag-search-view" => [
1159 "uri-id" => ["post-tag", "uri-id"],
1160 "uid" => ["post-user", "uid"],
1161 "iid" => ["post-user", "id"],
1162 "private" => ["post-user", "private"],
1163 "wall" => ["post-user", "wall"],
1164 "origin" => ["post-user", "origin"],
1165 "global" => ["post-user", "global"],
1166 "gravity" => ["post-user", "gravity"],
1167 "received" => ["post-user", "received"],
1168 "network" => ["post-user", "network"],
1169 "author-id" => ["post-user", "author-id"],
1170 "name" => ["tag", "name"],
1172 "query" => "FROM `post-tag`
1173 INNER JOIN `tag` ON `tag`.`id` = `post-tag`.`tid`
1174 STRAIGHT_JOIN `post-user` ON `post-user`.`uri-id` = `post-tag`.`uri-id`
1175 WHERE `post-tag`.`type` = 1"
1177 "workerqueue-view" => [
1179 "pid" => ["process", "pid"],
1180 "priority" => ["workerqueue", "priority"],
1182 "query" => "FROM `process`
1183 INNER JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid`
1184 WHERE NOT `workerqueue`.`done`"
1186 "profile_field-view" => [
1188 "id" => ["profile_field", "id"],
1189 "uid" => ["profile_field", "uid"],
1190 "label" => ["profile_field", "label"],
1191 "value" => ["profile_field", "value"],
1192 "order" => ["profile_field", "order"],
1193 "psid"=> ["profile_field", "psid"],
1194 "allow_cid" => ["permissionset", "allow_cid"],
1195 "allow_gid" => ["permissionset", "allow_gid"],
1196 "deny_cid" => ["permissionset", "deny_cid"],
1197 "deny_gid" => ["permissionset", "deny_gid"],
1198 "created" => ["profile_field", "created"],
1199 "edited" => ["profile_field", "edited"],
1201 "query" => "FROM `profile_field`
1202 INNER JOIN `permissionset` ON `permissionset`.`id` = `profile_field`.`psid`"
1204 "diaspora-contact-view" => [
1206 "uri-id" => ["diaspora-contact", "uri-id"],
1207 "url" => ["item-uri", "uri"],
1208 "guid" => ["item-uri", "guid"],
1209 "addr" => ["diaspora-contact", "addr"],
1210 "alias" => ["diaspora-contact", "alias"],
1211 "nick" => ["diaspora-contact", "nick"],
1212 "name" => ["diaspora-contact", "name"],
1213 "given-name" => ["diaspora-contact", "given-name"],
1214 "family-name" => ["diaspora-contact", "family-name"],
1215 "photo" => ["diaspora-contact", "photo"],
1216 "photo-medium" => ["diaspora-contact", "photo-medium"],
1217 "photo-small" => ["diaspora-contact", "photo-small"],
1218 "batch" => ["diaspora-contact", "batch"],
1219 "notify" => ["diaspora-contact", "notify"],
1220 "poll" => ["diaspora-contact", "poll"],
1221 "subscribe" => ["diaspora-contact", "subscribe"],
1222 "searchable" => ["diaspora-contact", "searchable"],
1223 "pubkey" => ["diaspora-contact", "pubkey"],
1224 "baseurl" => ["gserver", "url"],
1225 "gsid" => ["diaspora-contact", "gsid"],
1226 "created" => ["diaspora-contact", "created"],
1227 "updated" => ["diaspora-contact", "updated"],
1228 "interacting_count" => ["diaspora-contact", "interacting_count"],
1229 "interacted_count" => ["diaspora-contact", "interacted_count"],
1230 "post_count" => ["diaspora-contact", "post_count"],
1232 "query" => "FROM `diaspora-contact`
1233 INNER JOIN `item-uri` ON `item-uri`.`id` = `diaspora-contact`.`uri-id`
1234 LEFT JOIN `gserver` ON `gserver`.`id` = `diaspora-contact`.`gsid`"