]> git.mxchange.org Git - friendica.git/blob - static/dbview.config.php
9722ca3819a62bc47351f0e7a826550b5ef8a252
[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                         "contact_id" => ["contact", "id"], /// @todo Replaces all uses of "contact_id" with "id"
107                         "picdate" => ["contact", "avatar-date"], /// @todo Replaces all uses of "picdate" with "avatar-date"
108                         "term-date" => ["contact", "term-date"],
109                         "last-item" => ["contact", "last-item"],                        
110                         "lastitem_date" => ["contact", "last-item"], /// @todo Replaces all uses of "lastitem_date" with "last-item"
111                         "priority" => ["contact", "priority"],
112                         "blocked" => ["contact", "blocked"], /// @todo Check if "blocked" from contact or from the users table
113                         "block_reason" => ["contact", "block_reason"],
114                         "readonly" => ["contact", "readonly"],
115                         "writable" => ["contact", "writable"],
116                         "forum" => ["contact", "forum"],
117                         "prv" => ["contact", "prv"],
118                         "contact-type" => ["contact", "contact-type"],
119                         "hidden" => ["contact", "hidden"],
120                         "archive" => ["contact", "archive"],
121                         "pending" => ["contact", "pending"],
122                         "deleted" => ["contact", "deleted"],
123                         "rating" => ["contact", "rating"],
124                         "unsearchable" => ["contact", "unsearchable"],
125                         "sensitive" => ["contact", "sensitive"],
126                         "baseurl" => ["contact", "baseurl"],
127                         "reason" => ["contact", "reason"],
128                         "closeness" => ["contact", "closeness"],
129                         "info" => ["contact", "info"],
130                         "profile-id" => ["contact", "profile-id"],
131                         "bdyear" => ["contact", "bdyear"],
132                         "bd" => ["contact", "bd"],
133                         "notify_new_posts" => ["notify_new_posts"],
134                         "fetch_further_information" => ["fetch_further_information"],
135                         "ffi_keyword_blacklist" => ["ffi_keyword_blacklist"],
136                         "guid" => ["user", "guid"],
137                         "theme" => ["user", "theme"],
138                         "language" => ["user", "language"],
139                         "email" => ["user", "email"],
140                         "uprvkey" => ["user", "prvkey"],
141                         "upubkey" => ["user", "pubkey"],
142                         "timezone" => ["user", "timezone"],
143                         "nickname" => ["user", "nickname"], /// @todo Replaces all uses of "nickname" with "nick"
144                         "username" => ["user", "username"], /// @todo Replaces all uses of "username" with "name"
145                         "sprvkey" => ["user", "sprvkey"],
146                         "spubkey" => ["user", "spubkey"],
147                         "page-flags" => ["user", "page-flags"],
148                         "account-type" => ["user", "account-type"],
149                         "prvnets" => ["user", "prvnets"],
150                         "account_removed" => ["user", "account_removed"],
151                         "hidewall" => ["user", "hidewall"],
152                         "login_date" => ["user", "login_date"],
153                         "register_date" => ["user", "register_date"],
154                         "verified" => ["user", "verified"],
155                         "expire" => ["user", "expire"],
156                         "expire_notification_sent" => ["user", "expire_notification_sent"],                     
157                         "account_removed" => ["user", "account_removed"],
158                         "account_expired" => ["user", "account_expired"],
159                         "account_expires_on" => ["user", "account_expires_on"],
160                         "publish" => ["profile", "publish"],
161                         "net-publish" => ["profile", "net-publish"],
162                         "hide-friends" => ["profile", "hide-friends"],
163                         "prv_keywords" => ["profile", "prv_keywords"],
164                         "pub_keywords" => ["profile", "pub_keywords"],
165                         "address" => ["profile", "address"],
166                         "locality" => ["profile", "locality"],
167                         "region" => ["profile", "region"],
168                         "postal-code" => ["profile", "postal-code"],
169                         "country-name" => ["profile", "country-name"],
170                         "homepage" => ["profile", "homepage"],
171                         "xmpp" => ["profile", "xmpp"],
172                         "dob" => ["profile", "dob"],
173                 ],
174                 "query" => "FROM `user`
175                         INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self`
176                         INNER JOIN `profile` ON `profile`.`uid` = `user`.`uid`"
177         ],
178         "pending-view" => [
179                 "fields" => [
180                         "id" => ["register", "id"],
181                         "hash" => ["register", "hash"],
182                         "created" => ["register", "created"],
183                         "uid" => ["register", "uid"],
184                         "password" => ["register", "password"],
185                         "language" => ["register", "language"],
186                         "note" => ["register", "note"],
187                         "self" => ["contact", "self"],
188                         "name" => ["contact", "name"],
189                         "url" => ["contact", "url"],
190                         "micro" => ["contact", "micro"],
191                         "email" => ["user", "email"],
192                         "nick" => ["contact", "nick"],
193                 ],
194                 "query" => "FROM `register`
195                         INNER JOIN `contact` ON `register`.`uid` = `contact`.`uid`
196                         INNER JOIN `user` ON `register`.`uid` = `user`.`uid`"
197         ],
198 ];
199