Welcome to mirror list, hosted at ThFree Co, Russian Federation.

PostgresDoc.php « help « src - github.com/HuasoFoundries/phpPgAdmin6.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: cfea21909aa9a9e5481f6deea8db001e19b4ce72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
<?php

/**
 * PHPPgAdmin 6.1.3
 */

namespace PHPPgAdmin\Help;

/**
 * Help links for PostgreSQL 7.4 documentation.
 *
 * @SuppressWarnings(PHPMD)
 */
class PostgresDoc
{
    use \PHPPgAdmin\Traits\HelperTrait;

    /**
     * @var float
     */
    protected $major_version;

    /**
     * @var array
     */
    protected $help_topics;

    /**
     * @var array
     */
    protected $conf;

    public function __construct($conf, $major_version)
    {
        $this->major_version = $major_version;
        $this->conf = $conf;

        // TODO: Check and fix links
        $this->help_topics = [
            'pg.database' => 'managing-databases.html',
            'pg.database.create' => ['sql-createdatabase.html', 'manage-ag-createdb.html'],
            'pg.database.alter' => 'sql-alterdatabase.html',
            'pg.database.drop' => ['sql-dropdatabase.html', 'manage-ag-dropdb.html'],
            'pg.admin.analyze' => 'sql-analyze.html',
            'pg.admin.vacuum' => 'sql-vacuum.html',
            'pg.cast' => ['sql-expressions.html#SQL-SYNTAX-TYPE-CASTS', 'sql-createcast.html'],
            'pg.cast.create' => 'sql-createcast.html',
            'pg.cast.drop' => 'sql-dropcast.html',
            'pg.column.add' => ['ddl-alter.html#AEN2115', 'sql-altertable.html'],
            'pg.column.alter' => ['ddl-alter.html', 'sql-altertable.html'],
            'pg.column.drop' => ['ddl-alter.html#AEN2124', 'sql-altertable.html'],
            'pg.constraint' => 'ddl-constraints.html',
            'pg.constraint.add' => 'ddl-alter.html#AEN2131',
            'pg.constraint.check' => 'ddl-constraints.html#AEN1895',
            'pg.constraint.drop' => 'ddl-alter.html#AEN2140',
            'pg.constraint.foreign_key' => 'ddl-constraints.html#DDL-CONSTRAINTS-FK',
            'pg.constraint.primary_key' => 'ddl-constraints.html#AEN1972',
            'pg.constraint.unique_key' => 'ddl-constraints.html#AEN1950',

            'pg.conversion' => 'multibyte.html',
            'pg.conversion.alter' => 'sql-alterconversion.html',
            'pg.conversion.create' => 'sql-createconversion.html',
            'pg.conversion.drop' => 'sql-dropconversion.html',

            'pg.domain' => 'extend-type-system.html#AEN28657',
            'pg.domain.alter' => 'sql-alterdomain.html',
            'pg.domain.create' => 'sql-createdomain.html',
            'pg.domain.drop' => 'sql-dropdomain.html',

            'pg.function' => ['xfunc.html', 'functions.html', 'sql-expressions.html#AEN1599'],
            'pg.function.alter' => 'sql-alterfunction.html',
            'pg.function.create' => 'sql-createfunction.html',
            'pg.function.create.c' => ['xfunc-c.html', 'sql-createfunction.html'],
            'pg.function.create.internal' => ['xfunc-internal.html', 'sql-createfunction.html'],
            'pg.function.create.pl' => ['xfunc-sql.html', 'xfunc-pl.html', 'sql-createfunction.html'],
            'pg.function.drop' => 'sql-dropfunction.html',

            'pg.group' => 'groups.html',
            'pg.group.alter' => ['sql-altergroup.html', 'groups.html'],
            'pg.group.create' => 'sql-creategroup.html',
            'pg.group.drop' => 'sql-dropgroup.html',

            'pg.index' => 'indexes.html',
            'pg.index.cluster' => 'sql-cluster.html',
            'pg.index.drop' => 'sql-dropindex.html',
            'pg.index.create' => 'sql-createindex.html',
            'pg.index.reindex' => 'sql-reindex.html',

            'pg.language' => 'xplang.html',
            'pg.language.alter' => 'sql-alterlanguage.html',
            'pg.language.create' => 'sql-createlanguage.html',
            'pg.language.drop' => 'sql-droplanguage.html',

            'pg.opclass' => 'indexes-opclass.html',
            'pg.opclass.alter' => 'sql-alteropclass.html',
            'pg.opclass.create' => 'sql-createopclass.html',
            'pg.opclass.drop' => 'sql-dropopclass.html',

            'pg.operator' => ['xoper.html', 'functions.html', 'sql-expressions.html#AEN1570'],
            'pg.operator.alter' => 'sql-alteroperator.html',
            'pg.operator.create' => 'sql-createoperator.html',
            'pg.operator.drop' => 'sql-dropoperator.html',

            'pg.pl' => 'xplang.html',
            'pg.pl.plperl' => 'plperl.html',
            'pg.pl.plpgsql' => 'plpgsql.html',
            'pg.pl.plpython' => 'plpython.html',
            'pg.pl.pltcl' => 'pltcl.html',

            'pg.privilege' => ['privileges.html', 'ddl-priv.html'],
            'pg.privilege.grant' => 'sql-grant.html',
            'pg.privilege.revoke' => 'sql-revoke.html',

            'pg.process' => 'monitoring.html',

            'pg.rule' => 'rules.html',
            'pg.rule.create' => 'sql-createrule.html',
            'pg.rule.drop' => 'sql-droprule.html',

            'pg.schema' => 'ddl-schemas.html',
            'pg.schema.alter' => 'sql-alterschema.html',
            'pg.schema.create' => ['sql-createschema.html', 'ddl-schemas.html#DDL-SCHEMAS-CREATE'],
            'pg.schema.drop' => 'sql-dropschema.html',
            'pg.schema.search_path' => 'ddl-schemas.html#DDL-SCHEMAS-PATH',

            'pg.sequence' => 'functions-sequence.html',
            'pg.sequence.alter' => 'sql-altersequence.html',
            'pg.sequence.create' => 'sql-createsequence.html',
            'pg.sequence.drop' => 'sql-dropsequence.html',

            'pg.sql' => ['sql.html', 'sql-commands.html'],
            'pg.sql.insert' => 'sql-insert.html',
            'pg.sql.select' => 'sql-select.html',
            'pg.sql.update' => 'sql-update.html',

            'pg.table' => 'ddl.html#DDL-BASICS',
            'pg.table.alter' => 'sql-altertable.html',
            'pg.table.create' => 'sql-createtable.html',
            'pg.table.drop' => 'sql-droptable.html',
            'pg.table.empty' => 'sql-truncate.html',

            'pg.tablespace' => 'manage-ag-tablespaces.html',
            'pg.tablespace.alter' => 'sql-altertablespace.html',
            'pg.tablespace.create' => 'sql-createtablespace.html',
            'pg.tablespace.drop' => 'sql-droptablespace.html',

            'pg.trigger' => 'triggers.html',
            'pg.trigger.alter' => 'sql-altertrigger.html',
            'pg.trigger.create' => 'sql-createtrigger.html',
            'pg.trigger.drop' => 'sql-droptrigger.html',

            'pg.type' => ['xtypes.html', 'datatype.html', 'extend-type-system.html'],
            'pg.type.alter' => 'sql-altertype.html',
            'pg.type.create' => 'sql-createtype.html',
            'pg.type.drop' => 'sql-droptype.html',

            'pg.user.alter' => ['sql-alteruser.html', 'user-attributes.html'],
            'pg.user.create' => ['sql-createuser.html', 'user-manag.html#DATABASE-USERS'],
            'pg.user.drop' => ['sql-dropuser.html', 'user-manag.html#DATABASE-USERS'],

            'pg.variable' => 'runtime-config.html',

            'pg.view' => 'tutorial-views.html',
            'pg.view.alter' => ['sql-createview.html', 'sql-altertable.html'],
            'pg.view.create' => 'sql-createview.html',
            'pg.view.drop' => 'sql-dropview.html',

            'pg.aggregate' => ['xaggr.html', 'tutorial-agg.html', 'functions-aggregate.html', 'sql-expressions.html#SYNTAX-AGGREGATES'],
            'pg.aggregate.create' => 'sql-createaggregate.html',
            'pg.aggregate.drop' => 'sql-dropaggregate.html',
            'pg.aggregate.alter' => 'sql-alteraggregate.html',

            'pg.server' => 'admin.html',

            'pg.user' => 'user-manag.html',

            'pg.locks' => 'view-pg-locks.html',
        ];
    }

    public function getHelpBase()
    {
        return \sprintf(\str_replace('http://', 'https://', $this->conf['help_base']), (string) ($this->major_version));
    }

    /**
     * Undocumented function.
     *
     * @param null|string $topic
     *
     * @return null|string|string[]
     */
    public function getHelpTopics(?string $topic = null)
    {
        return  $topic ? $this->help_topics[$topic] ?? null : $this->help_topics;
    }

    /**
     * Undocumented function.
     *
     * @param string $topic
     *
     * @return null|string|string[]
     */
    public function getHelpTopic(string $topic)
    {
        return  $this->help_topics[$topic] ?? null;
    }
}