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