| @@ -142,19 +142,17 @@ | ||
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | /** |
| 145 | 145 | * Get completed migrations IDs |
| 146 | - * | |
| 147 | - * @return array | |
| 148 | 146 | */ |
| 149 | - public function getCompletedMigrationsIDs() | |
| 147 | + public function getCompletedMigrationsIDs(): array | |
| 150 | 148 | { |
| 151 | 149 | $migrations = []; |
| 152 | 150 | |
| 153 | 151 | try { |
| 154 | - $result = DB::get_results( | |
| 155 | - DB::prepare("SELECT * FROM {$this->migration_table} WHERE status = %s", MigrationLogStatus::SUCCESS) | |
| 156 | - ); | |
| 152 | + $result = DB::table('give_migrations') | |
| 153 | + ->where('status', MigrationLogStatus::SUCCESS) | |
| 154 | + ->getAll(); | |
| 157 | 155 | } catch (\Exception $exception) { |
| 158 | 156 | // This exception should happen only once, during the migration system storage update. |
| 159 | 157 | // But, we will log this error just in case to see if this is a repeating problem. |
| 160 | 158 | error_log($exception->getMessage()); |
| @@ -196,12 +194,12 @@ | ||
| 196 | 194 | public function getFailedMigrationsCountByIds($migrationIds) |
| 197 | 195 | { |
| 198 | 196 | try { |
| 199 | 197 | $query = sprintf( |
| 200 | - "SELECT count(id) FROM %s WHERE id IN ('%s') AND status != '%s'", | |
| 198 | + "SELECT count(id) FROM %s WHERE id IN ('%s') AND status = '%s'", | |
| 201 | 199 | $this->migration_table, |
| 202 | 200 | implode("','", array_map('esc_sql', $migrationIds)), |
| 203 | - MigrationLogStatus::SUCCESS | |
| 201 | + MigrationLogStatus::FAILED | |
| 204 | 202 | ); |
| 205 | 203 | |
| 206 | 204 | return DB::get_var($query); |
| 207 | 205 | } catch (\Exception $exception) { |