Code Duplication    Length = 5-5 lines in 3 locations

include/classes/share.class.php 1 location

@@ 237-241 (lines=5) @@
234
      sleep($this->config['purge']['sleep']);
235
      $stmt = $this->mysqli->prepare("DELETE FROM $this->table WHERE id > ? AND id <= ? ORDER BY id LIMIT " . $this->config['purge']['shares']);
236
      $start = microtime(true);
237
      if ($this->checkStmt($stmt) && $stmt->bind_param('ii', $previous_upstream, $current_upstream) && $stmt->execute()) {
238
        $affected = $stmt->affected_rows;
239
      } else {
240
        return $this->sqlError();
241
      }
242
    }
243
    return true;
244
  }

include/classes/token.class.php 1 location

@@ 133-137 (lines=5) @@
130
    $failed = $this->deleted = 0;
131
    foreach ($aTokenTypes as $aTokenType) {
132
      $stmt = $this->mysqli->prepare("DELETE FROM $this->table WHERE (NOW() - time) > ? AND type = ?");
133
      if (! ($this->checkStmt($stmt) && $stmt->bind_param('ii', $aTokenType['expiration'], $aTokenType['id']) && $stmt->execute())) {
134
        $failed++;
135
      } else {
136
        $this->deleted += $stmt->affected_rows;
137
      }
138
    }
139
    if ($failed > 0) {
140
      $this->setCronMessage('Failed to delete ' . $failed . ' token types from ' . $this->table . ' table');

include/classes/notification.class.php 1 location

@@ 194-198 (lines=5) @@
191
    $failed = 0;
192
    $this->deleted = 0;
193
    $stmt = $this->mysqli->prepare("DELETE FROM $this->table WHERE time < (NOW() - INTERVAL ? DAY)");
194
    if (! ($this->checkStmt($stmt) && $stmt->bind_param('i', $days) && $stmt->execute())) {
195
      $failed++;
196
    } else {
197
      $this->deleted += $stmt->affected_rows;
198
    }
199
    if ($failed > 0) {
200
      $this->setCronMessage('Failed to delete ' . $failed . ' notifications from ' . $this->table . ' table');
201
      return false;