Passed
Push — develop ( 0f8ae3...cf0423 )
by Felipe
05:58
created

Postgres96::hasUserSignals()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * PHPPgAdmin v6.0.0-beta.33
5
 */
6
7
namespace PHPPgAdmin\Database;
8
9
/**
10
 * @file
11
 * PostgreSQL 9.6 support
12
 */
13
class Postgres96 extends Postgres
14
{
15
    public $major_version = 9.6;
16
17
    // Administration functions
18
19
    /**
20
     * Returns all available process information.
21
     *
22
     * @param $database (optional) Find only connections to specified database
0 ignored issues
show
Bug introduced by
The type PHPPgAdmin\Database\optional was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
23
     *
24
     * @return \ADORecordSet A recordset
25
     */
26
    public function getProcesses($database = null)
27
    {
28
        if ($database === null) {
29
            $sql = "SELECT datid, datname, pid, usename, application_name, client_addr, state, wait_event_type, wait_event, state_change as query_start,
30
					CASE
31
                        WHEN state='active' THEN query
32
                        ELSE state
33
                    END AS query
34
					FROM pg_catalog.pg_stat_activity
35
					ORDER BY datname, usename, pid";
36
        } else {
37
            $this->clean($database);
38
            $sql = "SELECT datid, datname, pid, usename, application_name, client_addr, state, wait_event_type, wait_event, state_change as query_start,
39
					CASE
40
                        WHEN state='active' THEN query
41
                        ELSE state
42
                    END AS query
43
					FROM pg_catalog.pg_stat_activity
44
					WHERE datname='{$database}'
45
					ORDER BY usename, pid";
46
        }
47
48
        return $this->selectSet($sql);
49
    }
50
51
    public function hasUserSignals()
52
    {
53
        return true;
54
    }
55
}
56