| @@ -95,9 +95,9 @@ | ||
| 95 | 95 | $api->add_endpoint(); |
| 96 | 96 | update_option('give_default_api_version', 'v' . $api->get_version(), false); |
| 97 | 97 | |
| 98 | 98 | // Create databases. |
| 99 | - __give_register_tables(); | |
| 99 | + give_register_tables(); | |
| 100 | 100 | |
| 101 | 101 | // Add a temporary option to note that Give pages have been created. |
| 102 | 102 | Give_Cache::set('_give_installed', $options, 30, true); |
| 103 | 103 | |
| @@ -209,8 +209,9 @@ | ||
| 209 | 209 | |
| 210 | 210 | /** |
| 211 | 211 | * Drop Give's custom tables when a mu site is deleted. |
| 212 | 212 | * |
| 213 | + * @since 3.4.0 updated implementation to query all give_* tables | |
| 213 | 214 | * @since 1.4.3 |
| 214 | 215 | * |
| 215 | 216 | * @param array $tables The tables to drop. |
| 216 | 217 | * @param int $blog_id The Blog ID being deleted. |
| @@ -218,21 +219,22 @@ | ||
| 218 | 219 | * @return array The tables to drop. |
| 219 | 220 | */ |
| 220 | 221 | function give_wpmu_drop_tables($tables, $blog_id) |
| 221 | 222 | { |
| 223 | + global $wpdb; | |
| 224 | + | |
| 222 | 225 | switch_to_blog($blog_id); |
| 223 | - $custom_tables = __give_get_tables(); | |
| 224 | 226 | |
| 225 | - /* @var Give_DB $table */ | |
| 226 | - foreach ($custom_tables as $table) { | |
| 227 | - if ($table->installed()) { | |
| 228 | - $tables[] = $table->table_name; | |
| 229 | - } | |
| 227 | + $prefix = $wpdb->prefix . 'give_%'; | |
| 228 | + $giveTables = $wpdb->get_col("SHOW TABLES LIKE '{$prefix}'"); | |
| 229 | + | |
| 230 | + foreach ($giveTables as $table) { | |
| 231 | + $tables[] = $table; | |
| 230 | 232 | } |
| 231 | 233 | |
| 232 | 234 | restore_current_blog(); |
| 233 | 235 | |
| 234 | - return $tables; | |
| 236 | + return array_unique($tables); | |
| 235 | 237 | } |
| 236 | 238 | |
| 237 | 239 | add_filter('wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2); |
| 238 | 240 | |
| @@ -360,9 +362,14 @@ | ||
| 360 | 362 | 'gateways' => [ |
| 361 | 363 | 'manual' => 1, |
| 362 | 364 | 'offline' => 1, |
| 363 | 365 | ], |
| 366 | + 'gateways_v3' => [ | |
| 367 | + 'manual' => 1, | |
| 368 | + 'offline' => 1, | |
| 369 | + ], | |
| 364 | 370 | 'default_gateway' => 'manual', |
| 371 | + 'default_gateway_v3' => 'manual', | |
| 365 | 372 | |
| 366 | 373 | // Offline gateway setup. |
| 367 | 374 | 'global_offline_donation_content' => give_get_default_offline_donation_content(), |
| 368 | 375 | 'global_offline_donation_email' => give_get_default_offline_donation_content(), |
| @@ -491,9 +498,9 @@ | ||
| 491 | 498 | */ |
| 492 | 499 | function give_install_tables_on_plugin_update($old_version) |
| 493 | 500 | { |
| 494 | 501 | update_option('give_version_upgraded_from', $old_version, false); |
| 495 | - __give_register_tables(); | |
| 502 | + give_register_tables(); | |
| 496 | 503 | } |
| 497 | 504 | |
| 498 | 505 | add_action('update_option_give_version', 'give_install_tables_on_plugin_update', 0, 2); |
| 499 | 506 | |
| @@ -502,11 +509,12 @@ | ||
| 502 | 509 | * Get array of table class objects |
| 503 | 510 | * |
| 504 | 511 | * Note: only for internal purpose use |
| 505 | 512 | * |
| 513 | + * @since 4.9.0 rename function - PHP 8 compatibility | |
| 506 | 514 | * @sice 2.3.1 |
| 507 | 515 | */ |
| 508 | -function __give_get_tables() | |
| 516 | +function give_get_tables() | |
| 509 | 517 | { |
| 510 | 518 | $tables = [ |
| 511 | 519 | 'donors_db' => new Give_DB_Donors(), |
| 512 | 520 | 'donor_meta_db' => new Give_DB_Donor_Meta(), |
| @@ -524,15 +532,16 @@ | ||
| 524 | 532 | /** |
| 525 | 533 | * Register classes |
| 526 | 534 | * Note: only for internal purpose use |
| 527 | 535 | * |
| 536 | + * @since 4.9.0 rename function - PHP 8 compatibility | |
| 528 | 537 | * @since 2.21.0 Install migration table on fresh install because this table is required to run migrations. |
| 529 | 538 | * @since 2.3.1 |
| 530 | 539 | * @throws DatabaseMigrationException |
| 531 | 540 | */ |
| 532 | -function __give_register_tables() | |
| 541 | +function give_register_tables() | |
| 533 | 542 | { |
| 534 | - $tables = __give_get_tables(); | |
| 543 | + $tables = give_get_tables(); | |
| 535 | 544 | |
| 536 | 545 | /* @var Give_DB $table */ |
| 537 | 546 | foreach ($tables as $table) { |
| 538 | 547 | if (!$table->installed()) { |