]> git.mxchange.org Git - friendica.git/blob - static/dbview.config.php
Merge remote-tracking branch 'upstream/develop' into new-participation
[friendica.git] / static / dbview.config.php
1 <?php
2 /**
3  * @copyright Copyright (C) 2020, Friendica
4  *
5  * @license GNU AGPL version 3 or any later version
6  *
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.
11  *
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.
16  *
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/>.
19  *
20  * Main view structure configuration file.
21  *
22  * Here are described all the view Friendica needs to work.
23  *
24  * Syntax (braces indicate optionale values):
25  * "<view name>" => [
26  *      "fields" => [
27  *              "<field name>" => ["table", "field"],
28  *              "<field name>" => "SQL expression",
29  *              ...
30  *      ],
31  *      "query" => "FROM `table` INNER JOIN `other-table` ..."
32  *      ],
33  * ],
34  *
35  * If you need to make any change, make sure to increment the DB_UPDATE_VERSION constant value in dbstructure.config.php.
36  *
37  */
38
39 return [
40         "tag-view" => [
41                 "fields" => [
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",
50                 ],
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`"
55         ],
56         "owner-view" => [
57                 "fields" => [
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"],
184                 ],
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`"
188         ],
189         "pending-view" => [
190                 "fields" => [
191                         "id" => ["register", "id"],
192                         "hash" => ["register", "hash"],
193                         "created" => ["register", "created"],
194                         "uid" => ["register", "uid"],
195                         "password" => ["register", "password"],
196                         "language" => ["register", "language"],
197                         "note" => ["register", "note"],
198                         "self" => ["contact", "self"],
199                         "name" => ["contact", "name"],
200                         "url" => ["contact", "url"],
201                         "micro" => ["contact", "micro"],
202                         "email" => ["user", "email"],
203                         "nick" => ["contact", "nick"],
204                 ],
205                 "query" => "FROM `register`
206                         INNER JOIN `contact` ON `register`.`uid` = `contact`.`uid`
207                         INNER JOIN `user` ON `register`.`uid` = `user`.`uid`"
208         ],
209         "tag-search-view" => [
210                 "fields" => [
211                         "uri-id" => ["post-tag", "uri-id"],
212                         "iid" => ["item", "id"],
213                         "uri" => ["item", "uri"],
214                         "guid" => ["item", "guid"],
215                         "uid" => ["item", "uid"],
216                         "private" => ["item", "private"],
217                         "wall" => ["item", "wall"],
218                         "origin" => ["item", "origin"],
219                         "gravity" => ["item", "gravity"],
220                         "received" => ["item", "received"],                     
221                         "name" => ["tag", "name"],
222                 ],
223                 "query" => "FROM `post-tag`
224                         INNER JOIN `tag` ON `tag`.`id` = `post-tag`.`tid`
225                         INNER JOIN `item` ON `item`.`uri-id` = `post-tag`.`uri-id`
226                         WHERE `post-tag`.`type` = 1"
227         ],
228         "workerqueue-view" => [
229                 "fields" => [
230                         "pid" => ["process", "pid"],
231                         "priority" => ["workerqueue", "priority"],
232                 ],
233                 "query" => "FROM `process`
234                         INNER JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid`
235                         WHERE NOT `workerqueue`.`done`"
236         ],
237 ];
238