Code Duplication    Length = 19-19 lines in 2 locations

src/voku/db/Helper.php 2 locations

@@ 23-41 (lines=19) @@
20
   *
21
   * @return int
22
   */
23
  public static function optimizeTables(array $tables = array(), DB $dbConnection = null)
24
  {
25
    if ($dbConnection === null) {
26
      $dbConnection = DB::getInstance();
27
    }
28
29
    $optimized = 0;
30
    if (!empty($tables)) {
31
      foreach ($tables as $table) {
32
        $optimize = 'OPTIMIZE TABLE ' . $dbConnection->quote_string($table);
33
        $result = $dbConnection->query($optimize);
34
        if ($result) {
35
          $optimized++;
36
        }
37
      }
38
    }
39
40
    return $optimized;
41
  }
42
43
  /**
44
   * Repair tables
@@ 51-69 (lines=19) @@
48
   *
49
   * @return int
50
   */
51
  public static function repairTables(array $tables = array(), DB $dbConnection = null)
52
  {
53
    if ($dbConnection === null) {
54
      $dbConnection = DB::getInstance();
55
    }
56
57
    $optimized = 0;
58
    if (!empty($tables)) {
59
      foreach ($tables as $table) {
60
        $optimize = 'REPAIR TABLE ' . $dbConnection->quote_string($table);
61
        $result = $dbConnection->query($optimize);
62
        if ($result) {
63
          $optimized++;
64
        }
65
      }
66
    }
67
68
    return $optimized;
69
  }
70
71
  /**
72
   * Check if "mysqlnd"-driver is used.