Code Duplication    Length = 18-19 lines in 2 locations

classes/DomainMOD/Scheduler.php 1 location

@@ 59-77 (lines=19) @@
56
        $stmt->execute();
57
    }
58
59
    public function updateTime($task_id, $timestamp, $next_run)
60
    {
61
        $current_time = $this->time->stamp();
62
        $duration = $this->getTimeDifference($timestamp, $current_time);
63
64
        $pdo = $this->system->db();
65
66
        $stmt = $pdo->prepare("
67
            UPDATE scheduler
68
            SET last_run = :last_run,
69
                last_duration = :last_duration,
70
                next_run = :next_run
71
            WHERE id = :task_id");
72
        $stmt->bindValue('last_run', $current_time, \PDO::PARAM_STR);
73
        $stmt->bindValue('last_duration', $duration, \PDO::PARAM_STR);
74
        $stmt->bindValue('next_run', $next_run, \PDO::PARAM_STR);
75
        $stmt->bindValue('task_id', $task_id, \PDO::PARAM_INT);
76
        $stmt->execute();
77
    }
78
79
    public function getTimeDifference($start_time, $end_time)
80
    {

classes/DomainMOD/DwStats.php 1 location

@@ 119-136 (lines=18) @@
116
            FROM `dw_servers`")->fetchColumn();
117
    }
118
119
    public function updateTable($total_dw_servers, $total_dw_accounts, $total_dw_dns_zones, $total_dw_records)
120
    {
121
        $pdo = $this->system->db();
122
123
        $stmt = $pdo->prepare("
124
            INSERT INTO dw_server_totals
125
            (dw_servers, dw_accounts, dw_dns_zones, dw_dns_records, insert_time)
126
            VALUES
127
            (:total_dw_servers, :total_dw_accounts, :total_dw_dns_zones, :total_dw_records, :insert_time)");
128
        $stmt->bindValue('total_dw_servers', $total_dw_servers, \PDO::PARAM_INT);
129
        $stmt->bindValue('total_dw_accounts', $total_dw_accounts, \PDO::PARAM_INT);
130
        $stmt->bindValue('total_dw_dns_zones', $total_dw_dns_zones, \PDO::PARAM_INT);
131
        $stmt->bindValue('total_dw_records', $total_dw_records, \PDO::PARAM_INT);
132
        $bind_timestamp = $this->time->stamp();
133
        $stmt->bindValue('insert_time', $bind_timestamp, \PDO::PARAM_STR);
134
        $stmt->execute();
135
136
    }
137
138
    public function getServerTotals()
139
    {