1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* PHPPgAdmin 6.0.0 |
5
|
|
|
*/ |
6
|
|
|
|
7
|
|
|
namespace PHPPgAdmin\Help; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Help links for PostgreSQL 7.4 documentation. |
11
|
|
|
* |
12
|
|
|
* @SuppressWarnings(PHPMD) |
13
|
|
|
*/ |
14
|
|
|
class PostgresDoc |
15
|
|
|
{ |
16
|
|
|
use \PHPPgAdmin\Traits\HelperTrait; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* @var float |
20
|
|
|
*/ |
21
|
|
|
protected $major_version; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @var array |
25
|
|
|
*/ |
26
|
|
|
protected $help_topics; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @var array |
30
|
|
|
*/ |
31
|
|
|
protected $conf; |
32
|
|
|
|
33
|
|
|
public function __construct($conf, $major_version) |
34
|
|
|
{ |
35
|
|
|
$this->major_version = $major_version; |
36
|
|
|
$this->conf = $conf; |
37
|
|
|
|
38
|
|
|
// TODO: Check and fix links |
39
|
|
|
$this->help_topics = [ |
40
|
|
|
'pg.database' => 'managing-databases.html', |
41
|
|
|
'pg.database.create' => ['sql-createdatabase.html', 'manage-ag-createdb.html'], |
42
|
|
|
'pg.database.alter' => 'sql-alterdatabase.html', |
43
|
|
|
'pg.database.drop' => ['sql-dropdatabase.html', 'manage-ag-dropdb.html'], |
44
|
|
|
'pg.admin.analyze' => 'sql-analyze.html', |
45
|
|
|
'pg.admin.vacuum' => 'sql-vacuum.html', |
46
|
|
|
'pg.cast' => ['sql-expressions.html#SQL-SYNTAX-TYPE-CASTS', 'sql-createcast.html'], |
47
|
|
|
'pg.cast.create' => 'sql-createcast.html', |
48
|
|
|
'pg.cast.drop' => 'sql-dropcast.html', |
49
|
|
|
'pg.column.add' => ['ddl-alter.html#AEN2115', 'sql-altertable.html'], |
50
|
|
|
'pg.column.alter' => ['ddl-alter.html', 'sql-altertable.html'], |
51
|
|
|
'pg.column.drop' => ['ddl-alter.html#AEN2124', 'sql-altertable.html'], |
52
|
|
|
'pg.constraint' => 'ddl-constraints.html', |
53
|
|
|
'pg.constraint.add' => 'ddl-alter.html#AEN2131', |
54
|
|
|
'pg.constraint.check' => 'ddl-constraints.html#AEN1895', |
55
|
|
|
'pg.constraint.drop' => 'ddl-alter.html#AEN2140', |
56
|
|
|
'pg.constraint.foreign_key' => 'ddl-constraints.html#DDL-CONSTRAINTS-FK', |
57
|
|
|
'pg.constraint.primary_key' => 'ddl-constraints.html#AEN1972', |
58
|
|
|
'pg.constraint.unique_key' => 'ddl-constraints.html#AEN1950', |
59
|
|
|
|
60
|
|
|
'pg.conversion' => 'multibyte.html', |
61
|
|
|
'pg.conversion.alter' => 'sql-alterconversion.html', |
62
|
|
|
'pg.conversion.create' => 'sql-createconversion.html', |
63
|
|
|
'pg.conversion.drop' => 'sql-dropconversion.html', |
64
|
|
|
|
65
|
|
|
'pg.domain' => 'extend-type-system.html#AEN28657', |
66
|
|
|
'pg.domain.alter' => 'sql-alterdomain.html', |
67
|
|
|
'pg.domain.create' => 'sql-createdomain.html', |
68
|
|
|
'pg.domain.drop' => 'sql-dropdomain.html', |
69
|
|
|
|
70
|
|
|
'pg.function' => ['xfunc.html', 'functions.html', 'sql-expressions.html#AEN1599'], |
71
|
|
|
'pg.function.alter' => 'sql-alterfunction.html', |
72
|
|
|
'pg.function.create' => 'sql-createfunction.html', |
73
|
|
|
'pg.function.create.c' => ['xfunc-c.html', 'sql-createfunction.html'], |
74
|
|
|
'pg.function.create.internal' => ['xfunc-internal.html', 'sql-createfunction.html'], |
75
|
|
|
'pg.function.create.pl' => ['xfunc-sql.html', 'xfunc-pl.html', 'sql-createfunction.html'], |
76
|
|
|
'pg.function.drop' => 'sql-dropfunction.html', |
77
|
|
|
|
78
|
|
|
'pg.group' => 'groups.html', |
79
|
|
|
'pg.group.alter' => ['sql-altergroup.html', 'groups.html'], |
80
|
|
|
'pg.group.create' => 'sql-creategroup.html', |
81
|
|
|
'pg.group.drop' => 'sql-dropgroup.html', |
82
|
|
|
|
83
|
|
|
'pg.index' => 'indexes.html', |
84
|
|
|
'pg.index.cluster' => 'sql-cluster.html', |
85
|
|
|
'pg.index.drop' => 'sql-dropindex.html', |
86
|
|
|
'pg.index.create' => 'sql-createindex.html', |
87
|
|
|
'pg.index.reindex' => 'sql-reindex.html', |
88
|
|
|
|
89
|
|
|
'pg.language' => 'xplang.html', |
90
|
|
|
'pg.language.alter' => 'sql-alterlanguage.html', |
91
|
|
|
'pg.language.create' => 'sql-createlanguage.html', |
92
|
|
|
'pg.language.drop' => 'sql-droplanguage.html', |
93
|
|
|
|
94
|
|
|
'pg.opclass' => 'indexes-opclass.html', |
95
|
|
|
'pg.opclass.alter' => 'sql-alteropclass.html', |
96
|
|
|
'pg.opclass.create' => 'sql-createopclass.html', |
97
|
|
|
'pg.opclass.drop' => 'sql-dropopclass.html', |
98
|
|
|
|
99
|
|
|
'pg.operator' => ['xoper.html', 'functions.html', 'sql-expressions.html#AEN1570'], |
100
|
|
|
'pg.operator.alter' => 'sql-alteroperator.html', |
101
|
|
|
'pg.operator.create' => 'sql-createoperator.html', |
102
|
|
|
'pg.operator.drop' => 'sql-dropoperator.html', |
103
|
|
|
|
104
|
|
|
'pg.pl' => 'xplang.html', |
105
|
|
|
'pg.pl.plperl' => 'plperl.html', |
106
|
|
|
'pg.pl.plpgsql' => 'plpgsql.html', |
107
|
|
|
'pg.pl.plpython' => 'plpython.html', |
108
|
|
|
'pg.pl.pltcl' => 'pltcl.html', |
109
|
|
|
|
110
|
|
|
'pg.privilege' => ['privileges.html', 'ddl-priv.html'], |
111
|
|
|
'pg.privilege.grant' => 'sql-grant.html', |
112
|
|
|
'pg.privilege.revoke' => 'sql-revoke.html', |
113
|
|
|
|
114
|
|
|
'pg.process' => 'monitoring.html', |
115
|
|
|
|
116
|
|
|
'pg.rule' => 'rules.html', |
117
|
|
|
'pg.rule.create' => 'sql-createrule.html', |
118
|
|
|
'pg.rule.drop' => 'sql-droprule.html', |
119
|
|
|
|
120
|
|
|
'pg.schema' => 'ddl-schemas.html', |
121
|
|
|
'pg.schema.alter' => 'sql-alterschema.html', |
122
|
|
|
'pg.schema.create' => ['sql-createschema.html', 'ddl-schemas.html#DDL-SCHEMAS-CREATE'], |
123
|
|
|
'pg.schema.drop' => 'sql-dropschema.html', |
124
|
|
|
'pg.schema.search_path' => 'ddl-schemas.html#DDL-SCHEMAS-PATH', |
125
|
|
|
|
126
|
|
|
'pg.sequence' => 'functions-sequence.html', |
127
|
|
|
'pg.sequence.alter' => 'sql-altersequence.html', |
128
|
|
|
'pg.sequence.create' => 'sql-createsequence.html', |
129
|
|
|
'pg.sequence.drop' => 'sql-dropsequence.html', |
130
|
|
|
|
131
|
|
|
'pg.sql' => ['sql.html', 'sql-commands.html'], |
132
|
|
|
'pg.sql.insert' => 'sql-insert.html', |
133
|
|
|
'pg.sql.select' => 'sql-select.html', |
134
|
|
|
'pg.sql.update' => 'sql-update.html', |
135
|
|
|
|
136
|
|
|
'pg.table' => 'ddl.html#DDL-BASICS', |
137
|
|
|
'pg.table.alter' => 'sql-altertable.html', |
138
|
|
|
'pg.table.create' => 'sql-createtable.html', |
139
|
|
|
'pg.table.drop' => 'sql-droptable.html', |
140
|
|
|
'pg.table.empty' => 'sql-truncate.html', |
141
|
|
|
|
142
|
|
|
'pg.tablespace' => 'manage-ag-tablespaces.html', |
143
|
|
|
'pg.tablespace.alter' => 'sql-altertablespace.html', |
144
|
|
|
'pg.tablespace.create' => 'sql-createtablespace.html', |
145
|
|
|
'pg.tablespace.drop' => 'sql-droptablespace.html', |
146
|
|
|
|
147
|
|
|
'pg.trigger' => 'triggers.html', |
148
|
|
|
'pg.trigger.alter' => 'sql-altertrigger.html', |
149
|
|
|
'pg.trigger.create' => 'sql-createtrigger.html', |
150
|
|
|
'pg.trigger.drop' => 'sql-droptrigger.html', |
151
|
|
|
|
152
|
|
|
'pg.type' => ['xtypes.html', 'datatype.html', 'extend-type-system.html'], |
153
|
|
|
'pg.type.alter' => 'sql-altertype.html', |
154
|
|
|
'pg.type.create' => 'sql-createtype.html', |
155
|
|
|
'pg.type.drop' => 'sql-droptype.html', |
156
|
|
|
|
157
|
|
|
'pg.user.alter' => ['sql-alteruser.html', 'user-attributes.html'], |
158
|
|
|
'pg.user.create' => ['sql-createuser.html', 'user-manag.html#DATABASE-USERS'], |
159
|
|
|
'pg.user.drop' => ['sql-dropuser.html', 'user-manag.html#DATABASE-USERS'], |
160
|
|
|
|
161
|
|
|
'pg.variable' => 'runtime-config.html', |
162
|
|
|
|
163
|
|
|
'pg.view' => 'tutorial-views.html', |
164
|
|
|
'pg.view.alter' => ['sql-createview.html', 'sql-altertable.html'], |
165
|
|
|
'pg.view.create' => 'sql-createview.html', |
166
|
|
|
'pg.view.drop' => 'sql-dropview.html', |
167
|
|
|
|
168
|
|
|
'pg.aggregate' => ['xaggr.html', 'tutorial-agg.html', 'functions-aggregate.html', 'sql-expressions.html#SYNTAX-AGGREGATES'], |
169
|
|
|
'pg.aggregate.create' => 'sql-createaggregate.html', |
170
|
|
|
'pg.aggregate.drop' => 'sql-dropaggregate.html', |
171
|
|
|
'pg.aggregate.alter' => 'sql-alteraggregate.html', |
172
|
|
|
|
173
|
|
|
'pg.server' => 'admin.html', |
174
|
|
|
|
175
|
|
|
'pg.user' => 'user-manag.html', |
176
|
|
|
|
177
|
|
|
'pg.locks' => 'view-pg-locks.html', |
178
|
|
|
]; |
179
|
|
|
} |
180
|
|
|
|
181
|
|
|
public function getHelpBase() |
182
|
|
|
{ |
183
|
|
|
return \sprintf(\str_replace('http://', 'https://', $this->conf['help_base']), (string) ($this->major_version)); |
184
|
|
|
} |
185
|
|
|
|
186
|
|
|
/** |
187
|
|
|
* Undocumented function. |
188
|
|
|
* |
189
|
|
|
* @param null|string $topic |
190
|
|
|
* |
191
|
|
|
* @return null|string|string[] |
192
|
|
|
*/ |
193
|
|
|
public function getHelpTopics(?string $topic = null) |
194
|
|
|
{ |
195
|
|
|
return $topic ? $this->help_topics[$topic] ?? null : $this->help_topics; |
196
|
|
|
} |
197
|
|
|
|
198
|
|
|
/** |
199
|
|
|
* Undocumented function. |
200
|
|
|
* |
201
|
|
|
* @param string $topic |
202
|
|
|
* |
203
|
|
|
* @return null|string|string[] |
204
|
|
|
*/ |
205
|
|
|
public function getHelpTopic(string $topic) |
206
|
|
|
{ |
207
|
|
|
return $this->help_topics[$topic] ?? null; |
208
|
|
|
} |
209
|
|
|
} |
210
|
|
|
|