PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 2.22.0
GiveWP – Donation Plugin and Fundraising Platform v2.22.0
4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 2.31.0 2.31.1 All 253 releases
← All changes | src/MigrationLog/MigrationLogRepository.php +8 -6 4.16.32.22.0 View file →
@@ -142,17 +142,19 @@
142 142 }
143 143
144 144 /**
145 145 * Get completed migrations IDs
146 + *
147 + * @return array
146 148 */
147 - public function getCompletedMigrationsIDs(): array
149 + public function getCompletedMigrationsIDs()
148 150 {
149 151 $migrations = [];
150 152
151 153 try {
152 - $result = DB::table('give_migrations')
153 - ->where('status', MigrationLogStatus::SUCCESS)
154 - ->getAll();
154 + $result = DB::get_results(
155 + DB::prepare("SELECT * FROM {$this->migration_table} WHERE status = %s", MigrationLogStatus::SUCCESS)
156 + );
155 157 } catch (\Exception $exception) {
156 158 // This exception should happen only once, during the migration system storage update.
157 159 // But, we will log this error just in case to see if this is a repeating problem.
158 160 error_log($exception->getMessage());
@@ -194,12 +196,12 @@
194 196 public function getFailedMigrationsCountByIds($migrationIds)
195 197 {
196 198 try {
197 199 $query = sprintf(
198 - "SELECT count(id) FROM %s WHERE id IN ('%s') AND status = '%s'",
200 + "SELECT count(id) FROM %s WHERE id IN ('%s') AND status != '%s'",
199 201 $this->migration_table,
200 202 implode("','", array_map('esc_sql', $migrationIds)),
201 - MigrationLogStatus::FAILED
203 + MigrationLogStatus::SUCCESS
202 204 );
203 205
204 206 return DB::get_var($query);
205 207 } catch (\Exception $exception) {