3 * @copyright Copyright (C) 2020, Friendica
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.
42 "uri-id" => ["post-category", "uri-id"],
43 "uid" => ["post-category", "uid"],
44 "uri" => ["item-uri", "uri"],
45 "guid" => ["item-uri", "guid"],
46 "type" => ["post-category", "type"],
47 "tid" => ["post-category", "tid"],
48 "name" => ["tag", "name"],
49 "url" => ["tag", "url"],
51 "query" => "FROM `post-category`
52 INNER JOIN `item-uri` ON `item-uri`.id = `post-category`.`uri-id`
53 LEFT JOIN `tag` ON `post-category`.`tid` = `tag`.`id`"
57 "uri-id" => ["post-tag", "uri-id"],
58 "uri" => ["item-uri", "uri"],
59 "guid" => ["item-uri", "guid"],
60 "type" => ["post-tag", "type"],
61 "tid" => ["post-tag", "tid"],
62 "cid" => ["post-tag", "cid"],
63 "name" => "CASE `cid` WHEN 0 THEN `tag`.`name` ELSE `contact`.`name` END",
64 "url" => "CASE `cid` WHEN 0 THEN `tag`.`url` ELSE `contact`.`url` END",
66 "query" => "FROM `post-tag`
67 INNER JOIN `item-uri` ON `item-uri`.id = `post-tag`.`uri-id`
68 LEFT JOIN `tag` ON `post-tag`.`tid` = `tag`.`id`
69 LEFT JOIN `contact` ON `post-tag`.`cid` = `contact`.`id`"
73 "id" => ["contact", "id"],
74 "uid" => ["contact", "uid"],
75 "created" => ["contact", "created"],
76 "updated" => ["contact", "updated"],
77 "self" => ["contact", "self"],
78 "remote_self" => ["contact", "remote_self"],
79 "rel" => ["contact", "rel"],
80 "duplex" => ["contact", "duplex"],
81 "network" => ["contact", "network"],
82 "protocol" => ["contact", "protocol"],
83 "name" => ["contact", "name"],
84 "nick" => ["contact", "nick"],
85 "location" => ["contact", "location"],
86 "about" => ["contact", "about"],
87 "keywords" => ["contact", "keywords"],
88 "gender" => ["contact", "gender"],
89 "xmpp" => ["contact", "xmpp"],
90 "attag" => ["contact", "attag"],
91 "avatar" => ["contact", "avatar"],
92 "photo" => ["contact", "photo"],
93 "thumb" => ["contact", "thumb"],
94 "micro" => ["contact", "micro"],
95 "site-pubkey" => ["contact", "site-pubkey"],
96 "issued-id" => ["contact", "issued-id"],
97 "dfrn-id" => ["contact", "dfrn-id"],
98 "url" => ["contact", "url"],
99 "nurl" => ["contact", "nurl"],
100 "addr" => ["contact", "addr"],
101 "alias" => ["contact", "alias"],
102 "pubkey" => ["contact", "pubkey"],
103 "prvkey" => ["contact", "prvkey"],
104 "batch" => ["contact", "batch"],
105 "request" => ["contact", "request"],
106 "notify" => ["contact", "notify"],
107 "poll" => ["contact", "poll"],
108 "confirm" => ["contact", "confirm"],
109 "poco" => ["contact", "poco"],
110 "aes_allow" => ["contact", "aes_allow"],
111 "ret-aes" => ["contact", "ret-aes"],
112 "usehub" => ["contact", "usehub"],
113 "subhub" => ["contact", "subhub"],
114 "hub-verify" => ["contact", "hub-verify"],
115 "last-update" => ["contact", "last-update"],
116 "success_update" => ["contact", "success_update"],
117 "failure_update" => ["contact", "failure_update"],
118 "name-date" => ["contact", "name-date"],
119 "uri-date" => ["contact", "uri-date"],
120 "avatar-date" => ["contact", "avatar-date"],
121 "picdate" => ["contact", "avatar-date"], /// @todo Replaces all uses of "picdate" with "avatar-date"
122 "term-date" => ["contact", "term-date"],
123 "last-item" => ["contact", "last-item"],
124 "priority" => ["contact", "priority"],
125 "blocked" => ["contact", "blocked"], /// @todo Check if "blocked" from contact or from the users table
126 "block_reason" => ["contact", "block_reason"],
127 "readonly" => ["contact", "readonly"],
128 "writable" => ["contact", "writable"],
129 "forum" => ["contact", "forum"],
130 "prv" => ["contact", "prv"],
131 "contact-type" => ["contact", "contact-type"],
132 "hidden" => ["contact", "hidden"],
133 "archive" => ["contact", "archive"],
134 "pending" => ["contact", "pending"],
135 "deleted" => ["contact", "deleted"],
136 "rating" => ["contact", "rating"],
137 "unsearchable" => ["contact", "unsearchable"],
138 "sensitive" => ["contact", "sensitive"],
139 "baseurl" => ["contact", "baseurl"],
140 "reason" => ["contact", "reason"],
141 "closeness" => ["contact", "closeness"],
142 "info" => ["contact", "info"],
143 "profile-id" => ["contact", "profile-id"],
144 "bdyear" => ["contact", "bdyear"],
145 "bd" => ["contact", "bd"],
146 "notify_new_posts" => ["contact", "notify_new_posts"],
147 "fetch_further_information" => ["contact", "fetch_further_information"],
148 "ffi_keyword_denylist" => ["contact", "ffi_keyword_denylist"],
149 "parent-uid" => ["user", "parent-uid"],
150 "guid" => ["user", "guid"],
151 "nickname" => ["user", "nickname"], /// @todo Replaces all uses of "nickname" with "nick"
152 "email" => ["user", "email"],
153 "openid" => ["user", "openid"],
154 "timezone" => ["user", "timezone"],
155 "language" => ["user", "language"],
156 "register_date" => ["user", "register_date"],
157 "login_date" => ["user", "login_date"],
158 "default-location" => ["user", "default-location"],
159 "allow_location" => ["user", "allow_location"],
160 "theme" => ["user", "theme"],
161 "upubkey" => ["user", "pubkey"],
162 "uprvkey" => ["user", "prvkey"],
163 "sprvkey" => ["user", "sprvkey"],
164 "spubkey" => ["user", "spubkey"],
165 "verified" => ["user", "verified"],
166 "blockwall" => ["user", "blockwall"],
167 "hidewall" => ["user", "hidewall"],
168 "blocktags" => ["user", "blocktags"],
169 "unkmail" => ["user", "unkmail"],
170 "cntunkmail" => ["user", "cntunkmail"],
171 "notify-flags" => ["user", "notify-flags"],
172 "page-flags" => ["user", "page-flags"],
173 "account-type" => ["user", "account-type"],
174 "prvnets" => ["user", "prvnets"],
175 "maxreq" => ["user", "maxreq"],
176 "expire" => ["user", "expire"],
177 "account_removed" => ["user", "account_removed"],
178 "account_expired" => ["user", "account_expired"],
179 "account_expires_on" => ["user", "account_expires_on"],
180 "expire_notification_sent" => ["user", "expire_notification_sent"],
181 "def_gid" => ["user", "def_gid"],
182 "allow_cid" => ["user", "allow_cid"],
183 "allow_gid" => ["user", "allow_gid"],
184 "deny_cid" => ["user", "deny_cid"],
185 "deny_gid" => ["user", "deny_gid"],
186 "openidserver" => ["user", "openidserver"],
187 "publish" => ["profile", "publish"],
188 "net-publish" => ["profile", "net-publish"],
189 "hide-friends" => ["profile", "hide-friends"],
190 "prv_keywords" => ["profile", "prv_keywords"],
191 "pub_keywords" => ["profile", "pub_keywords"],
192 "address" => ["profile", "address"],
193 "locality" => ["profile", "locality"],
194 "region" => ["profile", "region"],
195 "postal-code" => ["profile", "postal-code"],
196 "country-name" => ["profile", "country-name"],
197 "homepage" => ["profile", "homepage"],
198 "dob" => ["profile", "dob"],
200 "query" => "FROM `user`
201 INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self`
202 INNER JOIN `profile` ON `profile`.`uid` = `user`.`uid`"
206 "id" => ["register", "id"],
207 "hash" => ["register", "hash"],
208 "created" => ["register", "created"],
209 "uid" => ["register", "uid"],
210 "password" => ["register", "password"],
211 "language" => ["register", "language"],
212 "note" => ["register", "note"],
213 "self" => ["contact", "self"],
214 "name" => ["contact", "name"],
215 "url" => ["contact", "url"],
216 "micro" => ["contact", "micro"],
217 "email" => ["user", "email"],
218 "nick" => ["contact", "nick"],
220 "query" => "FROM `register`
221 INNER JOIN `contact` ON `register`.`uid` = `contact`.`uid`
222 INNER JOIN `user` ON `register`.`uid` = `user`.`uid`"
224 "tag-search-view" => [
226 "uri-id" => ["post-tag", "uri-id"],
227 "iid" => ["item", "id"],
228 "uri" => ["item", "uri"],
229 "guid" => ["item", "guid"],
230 "uid" => ["item", "uid"],
231 "private" => ["item", "private"],
232 "wall" => ["item", "wall"],
233 "origin" => ["item", "origin"],
234 "gravity" => ["item", "gravity"],
235 "received" => ["item", "received"],
236 "name" => ["tag", "name"],
238 "query" => "FROM `post-tag`
239 INNER JOIN `tag` ON `tag`.`id` = `post-tag`.`tid`
240 INNER JOIN `item` ON `item`.`uri-id` = `post-tag`.`uri-id`
241 WHERE `post-tag`.`type` = 1"
243 "workerqueue-view" => [
245 "pid" => ["process", "pid"],
246 "priority" => ["workerqueue", "priority"],
248 "query" => "FROM `process`
249 INNER JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid`
250 WHERE NOT `workerqueue`.`done`"