Passed
Pull Request — develop (#210)
by
unknown
08:24
created

MiscTrait::getTabsView()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 60
Code Lines 48

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 48
dl 0
loc 60
rs 9.1344
c 0
b 0
f 0
cc 1
nc 1
nop 2

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
/**
4
 * PHPPgAdmin v6.0.0-beta.49
5
 */
6
7
namespace PHPPgAdmin\Traits;
8
9
use PHPPgAdmin\Decorators\Decorator;
10
11
/**
12
 * @file
13
 * A trait to deal with nav tabs
14
 */
15
16
/**
17
 * A trait to deal with nav tabs.
18
 *
19
 * @package PHPPgAdmin
20
 */
21
trait MiscTrait
22
{
23
    public function getSubjectParams($subject)
24
    {
25
        $plugin_manager = $this->plugin_manager;
26
27
        $vars = [];
28
29
        switch ($subject) {
30
            case 'root':
31
                $vars = [
32
                    'params' => [
33
                        'subject' => 'root',
34
                    ],
35
                ];
36
37
                break;
38
            case 'server':
39
                $vars = ['params' => [
40
                    'server'  => $_REQUEST['server'],
41
                    'subject' => 'server',
42
                ]];
43
44
                break;
45
            case 'role':
46
                $vars = ['params' => [
47
                    'server'   => $_REQUEST['server'],
48
                    'subject'  => 'role',
49
                    'action'   => 'properties',
50
                    'rolename' => $_REQUEST['rolename'],
51
                ]];
52
53
                break;
54
            case 'database':
55
                $vars = ['params' => [
56
                    'server'   => $_REQUEST['server'],
57
                    'subject'  => 'database',
58
                    'database' => $_REQUEST['database'],
59
                ]];
60
61
                break;
62
            case 'schema':
63
                $vars = ['params' => [
64
                    'server'   => $_REQUEST['server'],
65
                    'subject'  => 'schema',
66
                    'database' => $_REQUEST['database'],
67
                    'schema'   => $_REQUEST['schema'],
68
                ]];
69
70
                break;
71
            case 'table':
72
                $vars = ['params' => [
73
                    'server'   => $_REQUEST['server'],
74
                    'subject'  => 'table',
75
                    'database' => $_REQUEST['database'],
76
                    'schema'   => $_REQUEST['schema'],
77
                    'table'    => $_REQUEST['table'],
78
                ]];
79
80
                break;
81
            case 'selectrows':
82
                $vars = [
83
                    'url'    => 'tables',
84
                    'params' => [
85
                        'server'   => $_REQUEST['server'],
86
                        'subject'  => 'table',
87
                        'database' => $_REQUEST['database'],
88
                        'schema'   => $_REQUEST['schema'],
89
                        'table'    => $_REQUEST['table'],
90
                        'action'   => 'confselectrows',
91
                    ], ];
92
93
                break;
94
            case 'view':
95
                $vars = ['params' => [
96
                    'server'   => $_REQUEST['server'],
97
                    'subject'  => 'view',
98
                    'database' => $_REQUEST['database'],
99
                    'schema'   => $_REQUEST['schema'],
100
                    'view'     => $_REQUEST['view'],
101
                ]];
102
103
                break;
104
            case 'matview':
105
                $vars = ['params' => [
106
                    'server'   => $_REQUEST['server'],
107
                    'subject'  => 'matview',
108
                    'database' => $_REQUEST['database'],
109
                    'schema'   => $_REQUEST['schema'],
110
                    'matview'  => $_REQUEST['matview'],
111
                ]];
112
113
                break;
114
            case 'fulltext':
115
            case 'ftscfg':
116
                $vars = ['params' => [
117
                    'server'   => $_REQUEST['server'],
118
                    'subject'  => 'fulltext',
119
                    'database' => $_REQUEST['database'],
120
                    'schema'   => $_REQUEST['schema'],
121
                    'action'   => 'viewconfig',
122
                    'ftscfg'   => $_REQUEST['ftscfg'],
123
                ]];
124
125
                break;
126
            case 'function':
127
                $vars = ['params' => [
128
                    'server'       => $_REQUEST['server'],
129
                    'subject'      => 'function',
130
                    'database'     => $_REQUEST['database'],
131
                    'schema'       => $_REQUEST['schema'],
132
                    'function'     => $_REQUEST['function'],
133
                    'function_oid' => $_REQUEST['function_oid'],
134
                ]];
135
136
                break;
137
            case 'aggregate':
138
                $vars = ['params' => [
139
                    'server'   => $_REQUEST['server'],
140
                    'subject'  => 'aggregate',
141
                    'action'   => 'properties',
142
                    'database' => $_REQUEST['database'],
143
                    'schema'   => $_REQUEST['schema'],
144
                    'aggrname' => $_REQUEST['aggrname'],
145
                    'aggrtype' => $_REQUEST['aggrtype'],
146
                ]];
147
148
                break;
149
            case 'column':
150
                if (isset($_REQUEST['table'])) {
151
                    $vars = ['params' => [
152
                        'server'   => $_REQUEST['server'],
153
                        'subject'  => 'column',
154
                        'database' => $_REQUEST['database'],
155
                        'schema'   => $_REQUEST['schema'],
156
                        'table'    => $_REQUEST['table'],
157
                        'column'   => $_REQUEST['column'],
158
                    ]];
159
                } elseif (isset($_REQUEST['view'])) {
160
                    $vars = ['params' => [
161
                        'server'   => $_REQUEST['server'],
162
                        'subject'  => 'column',
163
                        'database' => $_REQUEST['database'],
164
                        'schema'   => $_REQUEST['schema'],
165
                        'view'     => $_REQUEST['view'],
166
                        'column'   => $_REQUEST['column'],
167
                    ]];
168
                } elseif (isset($_REQUEST['matview'])) {
169
                    $vars = ['params' => [
170
                        'server'   => $_REQUEST['server'],
171
                        'subject'  => 'column',
172
                        'database' => $_REQUEST['database'],
173
                        'schema'   => $_REQUEST['schema'],
174
                        'matview'  => $_REQUEST['matview'],
175
                        'column'   => $_REQUEST['column'],
176
                    ]];
177
                }
178
179
                break;
180
            case 'plugin':
181
                $vars = [
182
                    'url'    => 'plugin',
183
                    'params' => [
184
                        'server'  => $_REQUEST['server'],
185
                        'subject' => 'plugin',
186
                        'plugin'  => $_REQUEST['plugin'],
187
                    ], ];
188
189
                if (!is_null($plugin_manager->getPlugin($_REQUEST['plugin']))) {
190
                    $vars['params'] = array_merge($vars['params'], $plugin_manager->getPlugin($_REQUEST['plugin'])->get_subject_params());
191
                }
192
193
                break;
194
            default:
195
                return false;
196
        }
197
198
        if (!isset($vars['url'])) {
199
            $vars['url'] = SUBFOLDER.'/redirect';
200
        }
201
        if ($vars['url'] == SUBFOLDER.'/redirect' && isset($vars['params']['subject'])) {
202
            $vars['url'] = SUBFOLDER.'/redirect/'.$vars['params']['subject'];
203
            unset($vars['params']['subject']);
204
        }
205
206
        return $vars;
207
    }
208
209
    public function maybeClipStr($str, $params)
210
    {
211
        if (isset($params['map'], $params['map'][$str])) {
212
            $str = $params['map'][$str];
213
        }
214
        // Clip the value if the 'clip' parameter is true.
215
        if (!isset($params['clip']) || $params['clip'] !== true) {
216
            return $str;
217
        }
218
        $maxlen   = isset($params['cliplen']) && is_integer($params['cliplen']) ? $params['cliplen'] : $this->conf['max_chars'];
219
        $ellipsis = isset($params['ellipsis']) ? $params['ellipsis'] : $this->lang['strellipsis'];
220
        if (strlen($str) > $maxlen) {
221
            $str = substr($str, 0, $maxlen - 1).$ellipsis;
222
        }
223
224
        return $str;
225
    }
226
227
    public function printBoolean($type, &$str, $params, $lang)
228
    {
229
        if ($type === 'yesno') {
230
            $this->coalesceArr($params, 'true', $lang['stryes']);
231
            $this->coalesceArr($params, 'false', $lang['strno']);
232
        }
233
234
        if (is_bool($str)) {
235
            $str = $str ? 't' : 'f';
236
        }
237
238
        switch ($str) {
239
            case 't':
240
                $out   = (isset($params['true']) ? $params['true'] : $lang['strtrue']);
241
                $align = 'center';
242
243
                break;
244
            case 'f':
245
                $out   = (isset($params['false']) ? $params['false'] : $lang['strfalse']);
246
                $align = 'center';
247
248
                break;
249
            default:
250
                $align = null;
251
                $out   = htmlspecialchars($str);
252
        }
253
254
        return [$str, $align, $out];
255
    }
256
257
    /**
258
     * Render a value into HTML using formatting rules specified
259
     * by a type name and parameters.
260
     *
261
     * @param null|string $str    The string to change
262
     * @param string      $type   Field type (optional), this may be an internal PostgreSQL type, or:
263
     *                            yesno    - same as bool, but renders as 'Yes' or 'No'.
264
     *                            pre      - render in a <pre> block.
265
     *                            nbsp     - replace all spaces with &nbsp;'s
266
     *                            verbatim - render exactly as supplied, no escaping what-so-ever.
267
     *                            callback - render using a callback function supplied in the 'function' param.
268
     * @param array       $params Type parameters (optional), known parameters:
269
     *                            null     - string to display if $str is null, or set to TRUE to use a default 'NULL' string,
270
     *                            otherwise nothing is rendered.
271
     *                            clip     - if true, clip the value to a fixed length, and append an ellipsis...
272
     *                            cliplen  - the maximum length when clip is enabled (defaults to $conf['max_chars'])
273
     *                            ellipsis - the string to append to a clipped value (defaults to $lang['strellipsis'])
274
     *                            tag      - an HTML element name to surround the value.
275
     *                            class    - a class attribute to apply to any surrounding HTML element.
276
     *                            align    - an align attribute ('left','right','center' etc.)
277
     *                            true     - (type='bool') the representation of true.
278
     *                            false    - (type='bool') the representation of false.
279
     *                            function - (type='callback') a function name, accepts args ($str, $params) and returns a rendering.
280
     *                            lineno   - prefix each line with a line number.
281
     *                            map      - an associative array.
282
     *
283
     * @return string The HTML rendered value
284
     */
285
    public function printVal($str, $type = null, $params = [])
286
    {
287
        $lang = $this->lang;
288
        if ($this->_data === null) {
289
            $data = $this->getDatabaseAccessor();
290
        } else {
291
            $data = $this->_data;
292
        }
293
294
        // Shortcircuit for a NULL value
295
        if (is_null($str)) {
296
            return isset($params['null'])
297
            ? ($params['null'] === true ? '<i>NULL</i>' : $params['null'])
298
            : '';
299
        }
300
301
        $str = $this->maybeClipStr($str, $params);
302
303
        $out   = '';
304
        $class = '';
305
306
        switch ($type) {
307
            case 'int2':
308
            case 'int4':
309
            case 'int8':
310
            case 'float4':
311
            case 'float8':
312
            case 'money':
313
            case 'numeric':
314
            case 'oid':
315
            case 'xid':
316
            case 'cid':
317
            case 'tid':
318
                $align = 'right';
319
                $out   = nl2br(htmlspecialchars(\PHPPgAdmin\Traits\HelperTrait::br2ln($str)));
320
321
                break;
322
            case 'yesno':
323
            case 'bool':
324
            case 'boolean':
325
                list($str, $align, $out) = $this->printBoolean($type, $str, $params, $lang);
326
327
                break;
328
            case 'bytea':
329
                $tag   = 'div';
330
                $class = 'pre';
331
                $out   = $data->escapeBytea($str);
332
333
                break;
334
            case 'errormsg':
335
                $tag   = 'pre';
336
                $class = 'error';
337
                $out   = htmlspecialchars($str);
338
339
                break;
340
            case 'pre':
341
                $tag = 'pre';
342
                $out = htmlspecialchars($str);
343
344
                break;
345
            case 'prenoescape':
346
                $tag = 'pre';
347
                $out = $str;
348
349
                break;
350
            case 'nbsp':
351
                $out = nl2br(str_replace(' ', '&nbsp;', \PHPPgAdmin\Traits\HelperTrait::br2ln($str)));
352
353
                break;
354
            case 'verbatim':
355
                $out = $str;
356
357
                break;
358
            case 'callback':
359
                $out = $params['function']($str, $params);
360
361
                break;
362
            case 'prettysize':
363
                $out = \PHPPgAdmin\Traits\HelperTrait::formatSizeUnits($str, $lang);
364
365
                break;
366
            default:
367
                // If the string contains at least one instance of >1 space in a row, a tab
368
                // character, a space at the start of a line, or a space at the start of
369
                // the whole string then render within a pre-formatted element (<pre>).
370
                if (preg_match('/(^ |  |\t|\n )/m', $str)) {
371
                    $tag   = 'pre';
372
                    $class = 'data';
373
                    $out   = htmlspecialchars($str);
374
                } else {
375
                    //$tag = 'span';
376
                    $out = nl2br(htmlspecialchars(\PHPPgAdmin\Traits\HelperTrait::br2ln($str)));
377
                }
378
        }
379
380
        $this->adjustClassAlignTag($class, $align, $tag, $out, $params);
381
382
        // Add line numbers if 'lineno' param is true
383
        /*if (isset($params['lineno']) && $params['lineno'] === true) {
384
        $lines = explode(PHP_EOL, $str);
385
        $num   = count($lines);
386
        if ($num > 0) {
387
        $temp = "<table>\n<tr><td class=\"{$class}\" style=\"vertical-align: top; padding-right: 10px;\"><pre class=\"{$class}\">";
388
        for ($i = 1; $i <= $num; ++$i) {
389
        $temp .= $i . PHP_EOL;
390
        }
391
        $temp .= "</pre></td><td class=\"{$class}\" style=\"vertical-align: top;\">{$out}</td></tr></table>".PHP_EOL;
392
        $out = $temp;
393
        }
394
        unset($lines);
395
        }*/
396
397
        return $out;
398
    }
399
400
    public function adjustClassAlignTag(&$class, &$align, &$tag, &$out, $params)
401
    {
402
        if (isset($params['class'])) {
403
            $class = $params['class'];
404
        }
405
406
        if (isset($params['align'])) {
407
            $align = $params['align'];
408
        }
409
410
        if (!isset($tag) && (!empty($class) || isset($align))) {
411
            $tag = 'div';
412
        }
413
414
        if (isset($tag)) {
415
            $alignattr = isset($align) ? " style=\"text-align: {$align}\"" : '';
416
            $classattr = !empty($class) ? " class=\"{$class}\"" : '';
417
            $out       = "<{$tag}{$alignattr}{$classattr}>{$out}</{$tag}>";
418
        }
419
    }
420
421
    /**
422
     * Gets the tabs for root view.
423
     *
424
     * @param array                          $lang The language array
425
     * @param \PHPPgAdmin\Database\ADOdbBase $data The database accesor instance
426
     *
427
     * @return array The tabs for root view
428
     */
429
    public function getTabsRoot($lang, $data)
0 ignored issues
show
Unused Code introduced by
The parameter $data is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

429
    public function getTabsRoot($lang, /** @scrutinizer ignore-unused */ $data)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
430
    {
431
        $tabs = [
432
            'intro'   => [
433
                'title' => $lang['strintroduction'],
434
                'url'   => 'intro',
435
                'icon'  => 'Introduction',
436
            ],
437
            'servers' => [
438
                'title' => $lang['strservers'],
439
                'url'   => 'servers',
440
                'icon'  => 'Servers',
441
            ],
442
        ];
443
444
        return $tabs;
445
    }
446
447
    /**
448
     * Gets the tabs for server view.
449
     *
450
     * @param array                          $lang The language array
451
     * @param \PHPPgAdmin\Database\ADOdbBase $data The database accesor instance
452
     *
453
     * @return array The tabs for server view
454
     */
455
    public function getTabsServer($lang, $data)
456
    {
457
        $hide_users = true;
458
        $hide_roles = false;
459
        if ($data) {
0 ignored issues
show
introduced by
$data is of type PHPPgAdmin\Database\ADOdbBase, thus it always evaluated to true.
Loading history...
460
            $hide_users = !$data->isSuperUser();
0 ignored issues
show
introduced by
The method isSuperUser() does not exist on PHPPgAdmin\Database\ADOdbBase. Maybe you want to declare this class abstract? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

460
            $hide_users = !$data->/** @scrutinizer ignore-call */ isSuperUser();
Loading history...
461
        }
462
463
        $tabs = [
464
            'databases' => [
465
                'title'   => $lang['strdatabases'],
466
                'url'     => 'alldb',
467
                'urlvars' => ['subject' => 'server'],
468
                'help'    => 'pg.database',
469
                'icon'    => 'Databases',
470
            ],
471
            'users'     => [
472
                'title'   => $lang['strusers'],
473
                'url'     => 'users',
474
                'urlvars' => ['subject' => 'server'],
475
                'hide'    => $hide_roles,
476
                'help'    => 'pg.user',
477
                'icon'    => 'Users',
478
            ],
479
        ];
480
481
        if ($data && $data->hasRoles()) {
482
            $tabs = array_merge($tabs, [
483
                'roles' => [
484
                    'title'   => $lang['strroles'],
485
                    'url'     => 'roles',
486
                    'urlvars' => ['subject' => 'server'],
487
                    'hide'    => $hide_roles,
488
                    'help'    => 'pg.role',
489
                    'icon'    => 'Roles',
490
                ],
491
            ]);
492
        } else {
493
            $tabs = array_merge($tabs, [
494
                'groups' => [
495
                    'title'   => $lang['strgroups'],
496
                    'url'     => 'groups',
497
                    'urlvars' => ['subject' => 'server'],
498
                    'hide'    => $hide_users,
499
                    'help'    => 'pg.group',
500
                    'icon'    => 'UserGroups',
501
                ],
502
            ]);
503
        }
504
505
        $tabs = array_merge($tabs, [
506
            'account'     => [
507
                'title'   => $lang['straccount'],
508
                'url'     => ($data && $data->hasRoles()) ? 'roles' : 'users',
509
                'urlvars' => ['subject' => 'server', 'action' => 'account'],
510
                'hide'    => !$hide_users,
511
                'help'    => 'pg.role',
512
                'icon'    => 'User',
513
            ],
514
            'tablespaces' => [
515
                'title'   => $lang['strtablespaces'],
516
                'url'     => 'tablespaces',
517
                'urlvars' => ['subject' => 'server'],
518
                'hide'    => !$data || !$data->hasTablespaces(),
519
                'help'    => 'pg.tablespace',
520
                'icon'    => 'Tablespaces',
521
            ],
522
            'export'      => [
523
                'title'   => $lang['strexport'],
524
                'url'     => 'alldb',
525
                'urlvars' => ['subject' => 'server', 'action' => 'export'],
526
                'hide'    => !$this->isDumpEnabled(),
527
                'icon'    => 'Export',
528
            ],
529
        ]);
530
531
        return $tabs;
532
    }
533
534
    /**
535
     * Gets the tabs for database view.
536
     *
537
     * @param array                          $lang The language array
538
     * @param \PHPPgAdmin\Database\ADOdbBase $data The database accesor instance
539
     *
540
     * @return array The tabs for database view
541
     */
542
    public function getTabsDatabase($lang, $data)
543
    {
544
        $hide_advanced = ($this->conf['show_advanced'] === false);
545
        $tabs          = [
546
            'schemas'    => [
547
                'title'   => $lang['strschemas'],
548
                'url'     => 'schemas',
549
                'urlvars' => ['subject' => 'database'],
550
                'help'    => 'pg.schema',
551
                'icon'    => 'Schemas',
552
            ],
553
            'sql'        => [
554
                'title'   => $lang['strsql'],
555
                'url'     => 'database',
556
                'urlvars' => ['subject' => 'database', 'action' => 'sql', 'new' => 1],
557
                'help'    => 'pg.sql',
558
                'tree'    => false,
559
                'icon'    => 'SqlEditor',
560
            ],
561
            'find'       => [
562
                'title'   => $lang['strfind'],
563
                'url'     => 'database',
564
                'urlvars' => ['subject' => 'database', 'action' => 'find'],
565
                'tree'    => false,
566
                'icon'    => 'Search',
567
            ],
568
            'variables'  => [
569
                'title'   => $lang['strvariables'],
570
                'url'     => 'database',
571
                'urlvars' => ['subject' => 'database', 'action' => 'variables'],
572
                'help'    => 'pg.variable',
573
                'tree'    => false,
574
                'icon'    => 'Variables',
575
            ],
576
            'processes'  => [
577
                'title'   => $lang['strprocesses'],
578
                'url'     => 'database',
579
                'urlvars' => ['subject' => 'database', 'action' => 'processes'],
580
                'help'    => 'pg.process',
581
                'tree'    => false,
582
                'icon'    => 'Processes',
583
            ],
584
            'locks'      => [
585
                'title'   => $lang['strlocks'],
586
                'url'     => 'database',
587
                'urlvars' => ['subject' => 'database', 'action' => 'locks'],
588
                'help'    => 'pg.locks',
589
                'tree'    => false,
590
                'icon'    => 'Key',
591
            ],
592
            'admin'      => [
593
                'title'   => $lang['stradmin'],
594
                'url'     => 'database',
595
                'urlvars' => ['subject' => 'database', 'action' => 'admin'],
596
                'tree'    => false,
597
                'icon'    => 'Admin',
598
            ],
599
            'privileges' => [
600
                'title'   => $lang['strprivileges'],
601
                'url'     => 'privileges',
602
                'urlvars' => ['subject' => 'database'],
603
                'hide'    => !isset($data->privlist['database']),
604
                'help'    => 'pg.privilege',
605
                'tree'    => false,
606
                'icon'    => 'Privileges',
607
            ],
608
            'languages'  => [
609
                'title'   => $lang['strlanguages'],
610
                'url'     => 'languages',
611
                'urlvars' => ['subject' => 'database'],
612
                'hide'    => $hide_advanced,
613
                'help'    => 'pg.language',
614
                'icon'    => 'Languages',
615
            ],
616
            'casts'      => [
617
                'title'   => $lang['strcasts'],
618
                'url'     => 'casts',
619
                'urlvars' => ['subject' => 'database'],
620
                'hide'    => $hide_advanced,
621
                'help'    => 'pg.cast',
622
                'icon'    => 'Casts',
623
            ],
624
            'export'     => [
625
                'title'   => $lang['strexport'],
626
                'url'     => 'database',
627
                'urlvars' => ['subject' => 'database', 'action' => 'export'],
628
                'hide'    => !$this->isDumpEnabled(),
629
                'tree'    => false,
630
                'icon'    => 'Export',
631
            ],
632
        ];
633
634
        return $tabs;
635
    }
636
637
    public function getTabsSchema($lang, $data)
638
    {
639
        $hide_advanced = ($this->conf['show_advanced'] === false);
640
        $tabs          = [
641
            'tables'      => [
642
                'title'   => $lang['strtables'],
643
                'url'     => 'tables',
644
                'urlvars' => ['subject' => 'schema'],
645
                'help'    => 'pg.table',
646
                'icon'    => 'Tables',
647
            ],
648
            'views'       => [
649
                'title'   => $lang['strviews'],
650
                'url'     => 'views',
651
                'urlvars' => ['subject' => 'schema'],
652
                'help'    => 'pg.view',
653
                'icon'    => 'Views',
654
            ],
655
            'matviews'    => [
656
                'title'   => 'M '.$lang['strviews'],
657
                'url'     => 'materializedviews',
658
                'urlvars' => ['subject' => 'schema'],
659
                'help'    => 'pg.matview',
660
                'icon'    => 'MViews',
661
            ],
662
            'sequences'   => [
663
                'title'   => $lang['strsequences'],
664
                'url'     => 'sequences',
665
                'urlvars' => ['subject' => 'schema'],
666
                'help'    => 'pg.sequence',
667
                'icon'    => 'Sequences',
668
            ],
669
            'functions'   => [
670
                'title'   => $lang['strfunctions'],
671
                'url'     => 'functions',
672
                'urlvars' => ['subject' => 'schema'],
673
                'help'    => 'pg.function',
674
                'icon'    => 'Functions',
675
            ],
676
            'fulltext'    => [
677
                'title'   => $lang['strfulltext'],
678
                'url'     => 'fulltext',
679
                'urlvars' => ['subject' => 'schema'],
680
                'help'    => 'pg.fts',
681
                'tree'    => true,
682
                'icon'    => 'Fts',
683
            ],
684
            'domains'     => [
685
                'title'   => $lang['strdomains'],
686
                'url'     => 'domains',
687
                'urlvars' => ['subject' => 'schema'],
688
                'help'    => 'pg.domain',
689
                'icon'    => 'Domains',
690
            ],
691
            'aggregates'  => [
692
                'title'   => $lang['straggregates'],
693
                'url'     => 'aggregates',
694
                'urlvars' => ['subject' => 'schema'],
695
                'hide'    => $hide_advanced,
696
                'help'    => 'pg.aggregate',
697
                'icon'    => 'Aggregates',
698
            ],
699
            'types'       => [
700
                'title'   => $lang['strtypes'],
701
                'url'     => 'types',
702
                'urlvars' => ['subject' => 'schema'],
703
                'hide'    => $hide_advanced,
704
                'help'    => 'pg.type',
705
                'icon'    => 'Types',
706
            ],
707
            'operators'   => [
708
                'title'   => $lang['stroperators'],
709
                'url'     => 'operators',
710
                'urlvars' => ['subject' => 'schema'],
711
                'hide'    => $hide_advanced,
712
                'help'    => 'pg.operator',
713
                'icon'    => 'Operators',
714
            ],
715
            'opclasses'   => [
716
                'title'   => $lang['stropclasses'],
717
                'url'     => 'opclasses',
718
                'urlvars' => ['subject' => 'schema'],
719
                'hide'    => $hide_advanced,
720
                'help'    => 'pg.opclass',
721
                'icon'    => 'OperatorClasses',
722
            ],
723
            'conversions' => [
724
                'title'   => $lang['strconversions'],
725
                'url'     => 'conversions',
726
                'urlvars' => ['subject' => 'schema'],
727
                'hide'    => $hide_advanced,
728
                'help'    => 'pg.conversion',
729
                'icon'    => 'Conversions',
730
            ],
731
            'privileges'  => [
732
                'title'   => $lang['strprivileges'],
733
                'url'     => 'privileges',
734
                'urlvars' => ['subject' => 'schema'],
735
                'help'    => 'pg.privilege',
736
                'tree'    => false,
737
                'icon'    => 'Privileges',
738
            ],
739
            'export'      => [
740
                'title'   => $lang['strexport'],
741
                'url'     => 'schemas',
742
                'urlvars' => ['subject' => 'schema', 'action' => 'export'],
743
                'hide'    => !$this->isDumpEnabled(),
744
                'tree'    => false,
745
                'icon'    => 'Export',
746
            ],
747
        ];
748
        if (!$data->hasFTS()) {
749
            unset($tabs['fulltext']);
750
        }
751
752
        return $tabs;
753
    }
754
755
    public function getTabsTable($lang, $data)
0 ignored issues
show
Unused Code introduced by
The parameter $data is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

755
    public function getTabsTable($lang, /** @scrutinizer ignore-unused */ $data)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
756
    {
757
        $tabs = [
758
            'columns'     => [
759
                'title'   => $lang['strcolumns'],
760
                'url'     => 'tblproperties',
761
                'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')],
762
                'icon'    => 'Columns',
763
                'branch'  => true,
764
            ],
765
            'browse'      => [
766
                'title'   => $lang['strbrowse'],
767
                'icon'    => 'Columns',
768
                'url'     => 'display',
769
                'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')],
770
                'return'  => 'table',
771
                'branch'  => true,
772
            ],
773
            'select'      => [
774
                'title'   => $lang['strselect'],
775
                'icon'    => 'Search',
776
                'url'     => 'tables',
777
                'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table'), 'action' => 'confselectrows'],
778
                'help'    => 'pg.sql.select',
779
            ],
780
            'insert'      => [
781
                'title'   => $lang['strinsert'],
782
                'url'     => 'tables',
783
                'urlvars' => [
784
                    'action' => 'confinsertrow',
785
                    'table'  => Decorator::field('table'),
786
                ],
787
                'help'    => 'pg.sql.insert',
788
                'icon'    => 'Operator',
789
            ],
790
            'indexes'     => [
791
                'title'   => $lang['strindexes'],
792
                'url'     => 'indexes',
793
                'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')],
794
                'help'    => 'pg.index',
795
                'icon'    => 'Indexes',
796
                'branch'  => true,
797
            ],
798
            'constraints' => [
799
                'title'   => $lang['strconstraints'],
800
                'url'     => 'constraints',
801
                'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')],
802
                'help'    => 'pg.constraint',
803
                'icon'    => 'Constraints',
804
                'branch'  => true,
805
            ],
806
            'triggers'    => [
807
                'title'   => $lang['strtriggers'],
808
                'url'     => 'triggers',
809
                'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')],
810
                'help'    => 'pg.trigger',
811
                'icon'    => 'Triggers',
812
                'branch'  => true,
813
            ],
814
            'rules'       => [
815
                'title'   => $lang['strrules'],
816
                'url'     => 'rules',
817
                'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')],
818
                'help'    => 'pg.rule',
819
                'icon'    => 'Rules',
820
                'branch'  => true,
821
            ],
822
            'admin'       => [
823
                'title'   => $lang['stradmin'],
824
                'url'     => 'tables',
825
                'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table'), 'action' => 'admin'],
826
                'icon'    => 'Admin',
827
            ],
828
            'info'        => [
829
                'title'   => $lang['strinfo'],
830
                'url'     => 'info',
831
                'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')],
832
                'icon'    => 'Statistics',
833
            ],
834
            'privileges'  => [
835
                'title'   => $lang['strprivileges'],
836
                'url'     => 'privileges',
837
                'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')],
838
                'help'    => 'pg.privilege',
839
                'icon'    => 'Privileges',
840
            ],
841
            'import'      => [
842
                'title'   => $lang['strimport'],
843
                'url'     => 'tblproperties',
844
                'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table'), 'action' => 'import'],
845
                'icon'    => 'Import',
846
                'hide'    => false,
847
            ],
848
            'export'      => [
849
                'title'   => $lang['strexport'],
850
                'url'     => 'tblproperties',
851
                'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table'), 'action' => 'export'],
852
                'icon'    => 'Export',
853
                'hide'    => false,
854
            ],
855
        ];
856
857
        return $tabs;
858
    }
859
860
    public function getTabsView($lang, $data)
0 ignored issues
show
Unused Code introduced by
The parameter $data is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

860
    public function getTabsView($lang, /** @scrutinizer ignore-unused */ $data)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
861
    {
862
        $tabs = [
863
            'columns'    => [
864
                'title'   => $lang['strcolumns'],
865
                'url'     => 'viewproperties',
866
                'urlvars' => ['subject' => 'view', 'view' => Decorator::field('view')],
867
                'icon'    => 'Columns',
868
                'branch'  => true,
869
            ],
870
            'browse'     => [
871
                'title'   => $lang['strbrowse'],
872
                'icon'    => 'Columns',
873
                'url'     => 'display',
874
                'urlvars' => [
875
                    'action'  => 'confselectrows',
876
                    'return'  => 'schema',
877
                    'subject' => 'view',
878
                    'view'    => Decorator::field('view'),
879
                ],
880
                'branch'  => true,
881
            ],
882
            'select'     => [
883
                'title'   => $lang['strselect'],
884
                'icon'    => 'Search',
885
                'url'     => 'views',
886
                'urlvars' => ['action' => 'confselectrows', 'view' => Decorator::field('view')],
887
                'help'    => 'pg.sql.select',
888
            ],
889
            'definition' => [
890
                'title'   => $lang['strdefinition'],
891
                'url'     => 'viewproperties',
892
                'urlvars' => ['subject' => 'view', 'view' => Decorator::field('view'), 'action' => 'definition'],
893
                'icon'    => 'Definition',
894
            ],
895
            'rules'      => [
896
                'title'   => $lang['strrules'],
897
                'url'     => 'rules',
898
                'urlvars' => ['subject' => 'view', 'view' => Decorator::field('view')],
899
                'help'    => 'pg.rule',
900
                'icon'    => 'Rules',
901
                'branch'  => true,
902
            ],
903
            'privileges' => [
904
                'title'   => $lang['strprivileges'],
905
                'url'     => 'privileges',
906
                'urlvars' => ['subject' => 'view', 'view' => Decorator::field('view')],
907
                'help'    => 'pg.privilege',
908
                'icon'    => 'Privileges',
909
            ],
910
            'export'     => [
911
                'title'   => $lang['strexport'],
912
                'url'     => 'viewproperties',
913
                'urlvars' => ['subject' => 'view', 'view' => Decorator::field('view'), 'action' => 'export'],
914
                'icon'    => 'Export',
915
                'hide'    => false,
916
            ],
917
        ];
918
919
        return $tabs;
920
    }
921
922
    public function getTabsMatview($lang, $data)
0 ignored issues
show
Unused Code introduced by
The parameter $data is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

922
    public function getTabsMatview($lang, /** @scrutinizer ignore-unused */ $data)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
923
    {
924
        $tabs = [
925
            'columns'    => [
926
                'title'   => $lang['strcolumns'],
927
                'url'     => 'materializedviewproperties',
928
                'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview')],
929
                'icon'    => 'Columns',
930
                'branch'  => true,
931
            ],
932
            'browse'     => [
933
                'title'   => $lang['strbrowse'],
934
                'icon'    => 'Columns',
935
                'url'     => 'display',
936
                'urlvars' => [
937
                    'action'  => 'confselectrows',
938
                    'return'  => 'schema',
939
                    'subject' => 'matview',
940
                    'matview' => Decorator::field('matview'),
941
                ],
942
                'branch'  => true,
943
            ],
944
            'select'     => [
945
                'title'   => $lang['strselect'],
946
                'icon'    => 'Search',
947
                'url'     => 'materializedviews',
948
                'urlvars' => ['action' => 'confselectrows', 'matview' => Decorator::field('matview')],
949
                'help'    => 'pg.sql.select',
950
            ],
951
            'definition' => [
952
                'title'   => $lang['strdefinition'],
953
                'url'     => 'materializedviewproperties',
954
                'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview'), 'action' => 'definition'],
955
                'icon'    => 'Definition',
956
            ],
957
            'indexes'    => [
958
                'title'   => $lang['strindexes'],
959
                'url'     => 'indexes',
960
                'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview')],
961
                'help'    => 'pg.index',
962
                'icon'    => 'Indexes',
963
                'branch'  => true,
964
            ],
965
            /*'constraints' => [
966
            'title' => $lang['strconstraints'],
967
            'url' => 'constraints',
968
            'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview')],
969
            'help' => 'pg.constraint',
970
            'icon' => 'Constraints',
971
            'branch' => true,
972
             */
973
974
            'rules'      => [
975
                'title'   => $lang['strrules'],
976
                'url'     => 'rules',
977
                'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview')],
978
                'help'    => 'pg.rule',
979
                'icon'    => 'Rules',
980
                'branch'  => true,
981
            ],
982
            'privileges' => [
983
                'title'   => $lang['strprivileges'],
984
                'url'     => 'privileges',
985
                'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview')],
986
                'help'    => 'pg.privilege',
987
                'icon'    => 'Privileges',
988
            ],
989
            'export'     => [
990
                'title'   => $lang['strexport'],
991
                'url'     => 'materializedviewproperties',
992
                'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview'), 'action' => 'export'],
993
                'icon'    => 'Export',
994
                'hide'    => false,
995
            ],
996
        ];
997
998
        return $tabs;
999
    }
1000
1001
    public function getTabsFunction($lang, $data)
0 ignored issues
show
Unused Code introduced by
The parameter $data is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

1001
    public function getTabsFunction($lang, /** @scrutinizer ignore-unused */ $data)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
1002
    {
1003
        $tabs = [
1004
            'definition' => [
1005
                'title'   => $lang['strdefinition'],
1006
                'url'     => 'functions',
1007
                'urlvars' => [
1008
                    'subject'      => 'function',
1009
                    'function'     => Decorator::field('function'),
1010
                    'function_oid' => Decorator::field('function_oid'),
1011
                    'action'       => 'properties',
1012
                ],
1013
                'icon'    => 'Definition',
1014
            ],
1015
            'privileges' => [
1016
                'title'   => $lang['strprivileges'],
1017
                'url'     => 'privileges',
1018
                'urlvars' => [
1019
                    'subject'      => 'function',
1020
                    'function'     => Decorator::field('function'),
1021
                    'function_oid' => Decorator::field('function_oid'),
1022
                ],
1023
                'icon'    => 'Privileges',
1024
            ],
1025
            'show'       => [
1026
                'title'   => $lang['strshow'].' '.$lang['strdefinition'],
1027
                'url'     => 'functions',
1028
                'urlvars' => [
1029
                    'subject'      => 'function',
1030
                    'function'     => Decorator::field('function'),
1031
                    'function_oid' => Decorator::field('function_oid'),
1032
                    'action'       => 'show',
1033
                ],
1034
                'icon'    => 'Search',
1035
            ],
1036
        ];
1037
1038
        return $tabs;
1039
    }
1040
1041
    public function getTabsAggregate($lang, $data)
0 ignored issues
show
Unused Code introduced by
The parameter $data is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

1041
    public function getTabsAggregate($lang, /** @scrutinizer ignore-unused */ $data)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
1042
    {
1043
        $tabs = [
1044
            'definition' => [
1045
                'title'   => $lang['strdefinition'],
1046
                'url'     => 'aggregates',
1047
                'urlvars' => [
1048
                    'subject'  => 'aggregate',
1049
                    'aggrname' => Decorator::field('aggrname'),
1050
                    'aggrtype' => Decorator::field('aggrtype'),
1051
                    'action'   => 'properties',
1052
                ],
1053
                'icon'    => 'Definition',
1054
            ],
1055
        ];
1056
1057
        return $tabs;
1058
    }
1059
1060
    public function getTabsRole($lang, $data)
0 ignored issues
show
Unused Code introduced by
The parameter $data is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

1060
    public function getTabsRole($lang, /** @scrutinizer ignore-unused */ $data)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
1061
    {
1062
        $tabs = [
1063
            'definition' => [
1064
                'title'   => $lang['strdefinition'],
1065
                'url'     => 'roles',
1066
                'urlvars' => [
1067
                    'subject'  => 'role',
1068
                    'rolename' => Decorator::field('rolename'),
1069
                    'action'   => 'properties',
1070
                ],
1071
                'icon'    => 'Definition',
1072
            ],
1073
        ];
1074
1075
        return $tabs;
1076
    }
1077
1078
    public function getTabsPopup($lang, $data)
0 ignored issues
show
Unused Code introduced by
The parameter $data is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

1078
    public function getTabsPopup($lang, /** @scrutinizer ignore-unused */ $data)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
1079
    {
1080
        $tabs = [
1081
            'sql'  => [
1082
                'title'   => $lang['strsql'],
1083
                'url'     => \SUBFOLDER.'/src/views/sqledit',
1084
                'urlvars' => ['action' => 'sql', 'subject' => 'schema'],
1085
                'help'    => 'pg.sql',
1086
                'icon'    => 'SqlEditor',
1087
            ],
1088
            'find' => [
1089
                'title'   => $lang['strfind'],
1090
                'url'     => \SUBFOLDER.'/src/views/sqledit',
1091
                'urlvars' => ['action' => 'find', 'subject' => 'schema'],
1092
                'icon'    => 'Search',
1093
            ],
1094
        ];
1095
1096
        return $tabs;
1097
    }
1098
1099
    public function getTabsColumn($lang, $data)
0 ignored issues
show
Unused Code introduced by
The parameter $data is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

1099
    public function getTabsColumn($lang, /** @scrutinizer ignore-unused */ $data)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
1100
    {
1101
        $tabs = [
1102
            'properties' => [
1103
                'title'   => $lang['strcolprop'],
1104
                'url'     => 'colproperties',
1105
                'urlvars' => [
1106
                    'subject' => 'column',
1107
                    'table'   => Decorator::field('table'),
1108
                    'view'    => Decorator::field('view'),
1109
                    'column'  => Decorator::field('column'),
1110
                ],
1111
                'icon'    => 'Column',
1112
            ],
1113
            'privileges' => [
1114
                'title'   => $lang['strprivileges'],
1115
                'url'     => 'privileges',
1116
                'urlvars' => [
1117
                    'subject' => 'column',
1118
                    'table'   => Decorator::field('table'),
1119
                    'view'    => Decorator::field('view'),
1120
                    'column'  => Decorator::field('column'),
1121
                ],
1122
                'help'    => 'pg.privilege',
1123
                'icon'    => 'Privileges',
1124
            ],
1125
        ];
1126
        if (empty($tabs['properties']['urlvars']['table'])) {
1127
            unset($tabs['properties']['urlvars']['table']);
1128
        }
1129
        if (empty($tabs['privileges']['urlvars']['table'])) {
1130
            unset($tabs['privileges']['urlvars']['table']);
1131
        }
1132
1133
        return $tabs;
1134
    }
1135
1136
    public function getTabsFulltext($lang, $data)
1137
    {
1138
        $tabs = [
1139
            'ftsconfigs' => [
1140
                'title'   => $lang['strftstabconfigs'],
1141
                'url'     => 'fulltext',
1142
                'urlvars' => ['subject' => 'schema'],
1143
                'hide'    => !$data->hasFTS(),
1144
                'help'    => 'pg.ftscfg',
1145
                'tree'    => true,
1146
                'icon'    => 'FtsCfg',
1147
            ],
1148
            'ftsdicts'   => [
1149
                'title'   => $lang['strftstabdicts'],
1150
                'url'     => 'fulltext',
1151
                'urlvars' => ['subject' => 'schema', 'action' => 'viewdicts'],
1152
                'hide'    => !$data->hasFTS(),
1153
                'help'    => 'pg.ftsdict',
1154
                'tree'    => true,
1155
                'icon'    => 'FtsDict',
1156
            ],
1157
            'ftsparsers' => [
1158
                'title'   => $lang['strftstabparsers'],
1159
                'url'     => 'fulltext',
1160
                'urlvars' => ['subject' => 'schema', 'action' => 'viewparsers'],
1161
                'hide'    => !$data->hasFTS(),
1162
                'help'    => 'pg.ftsparser',
1163
                'tree'    => true,
1164
                'icon'    => 'FtsParser',
1165
            ],
1166
        ];
1167
1168
        return $tabs;
1169
    }
1170
1171
    /**
1172
     * Retrieve the tab info for a specific tab bar.
1173
     *
1174
     * @param string $section the name of the tab bar
1175
     *
1176
     * @return array array of tabs
1177
     */
1178
    public function getNavTabs($section)
1179
    {
1180
        $data           = $this->getDatabaseAccessor();
1181
        $lang           = $this->lang;
1182
        $plugin_manager = $this->plugin_manager;
1183
1184
        $hide_advanced = ($this->conf['show_advanced'] === false);
0 ignored issues
show
Unused Code introduced by
The assignment to $hide_advanced is dead and can be removed.
Loading history...
1185
        $tabs          = [];
1186
1187
        switch ($section) {
1188
            case 'root':$tabs = $this->getTabsRoot($lang, $data);
1189
1190
                break;
1191
            case 'server':$tabs = $this->getTabsServer($lang, $data);
1192
1193
                break;
1194
            case 'database':$tabs = $this->getTabsDatabase($lang, $data);
1195
1196
                break;
1197
            case 'schema':$tabs = $this->getTabsSchema($lang, $data);
1198
1199
                break;
1200
            case 'table':$tabs = $this->getTabsTable($lang, $data);
1201
1202
                break;
1203
            case 'view':$tabs = $this->getTabsView($lang, $data);
1204
1205
                break;
1206
            case 'matview':$tabs = $this->getTabsMatview($lang, $data);
1207
1208
                break;
1209
            case 'function':$tabs = $this->getTabsFunction($lang, $data);
1210
1211
                break;
1212
            case 'aggregate':$tabs = $this->getTabsAggregate($lang, $data);
1213
1214
                break;
1215
            case 'role':$tabs = $this->getTabsRole($lang, $data);
1216
1217
                break;
1218
            case 'popup':$tabs = $this->getTabsPopup($lang, $data);
1219
1220
                break;
1221
            case 'column':$tabs = $this->getTabsColumn($lang, $data);
1222
1223
                break;
1224
            case 'fulltext':$tabs = $this->getTabsFulltext($lang, $data);
1225
1226
                break;
1227
        }
1228
1229
        // Tabs hook's place
1230
        $plugin_functions_parameters = [
1231
            'tabs'    => &$tabs,
1232
            'section' => $section,
1233
        ];
1234
        $plugin_manager->doHook('tabs', $plugin_functions_parameters);
1235
1236
        return $tabs;
1237
    }
1238
1239
    /**
1240
     * Get the URL for the last active tab of a particular tab bar.
1241
     *
1242
     * @param string $section
1243
     *
1244
     * @return null|mixed
1245
     */
1246
    public function getLastTabURL($section)
1247
    {
1248
        //$data = $this->getDatabaseAccessor();
1249
1250
        $tabs = $this->getNavTabs($section);
1251
        if (isset($_SESSION['webdbLastTab'][$section], $tabs[$_SESSION['webdbLastTab'][$section]])) {
1252
            $tab = $tabs[$_SESSION['webdbLastTab'][$section]];
1253
        } else {
1254
            $tab = reset($tabs);
1255
        }
1256
        $this->prtrace(['section' => $section, 'tabs' => $tabs, 'tab' => $tab]);
1257
1258
        return isset($tab['url']) ? $tab : null;
1259
    }
1260
1261
    abstract public function getDatabaseAccessor($database = '', $server_id = null);
1262
1263
    abstract public function isDumpEnabled($all = false);
1264
1265
    abstract public function prtrace();
1266
}
1267