| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
namespace Jet_Form_Builder\Migrations\Versions; |
| 5 |
|
| 6 |
use Jet_Form_Builder\Migrations\Auto_Migrator; |
| 7 |
use JFB_Modules\Validation\Advanced_Rules\Ssr_Callback_Allowlist; |
| 8 |
|
| 9 |
// If this file is called directly, abort. |
| 10 |
if ( ! defined( 'WPINC' ) ) { |
| 11 |
die; |
| 12 |
} |
| 13 |
|
| 14 |
/** |
| 15 |
* Runs a time-boxed backfill of the SSR "Server-Side callback" allowlist |
| 16 |
* (`Ssr_Callback_Allowlist::rebuild_from_all_forms()`). When the forms table is large |
| 17 |
* enough that a full scan would exceed its time budget, progress (a form-ID cursor plus |
| 18 |
* the partial callback accumulator) is persisted and the call throws, leaving this |
| 19 |
* migration "not installed" so the next capable admin's `admin_init` request resumes the |
| 20 |
* scan automatically. The backfill does not depend on WP-Cron or AJAX. |
| 21 |
* |
| 22 |
* @since 3.6.5.2 |
| 23 |
*/ |
| 24 |
class Version_3_6_5_2 extends Base_Migration { |
| 25 |
|
| 26 |
public function up( \wpdb $wpdb ) { |
| 27 |
Ssr_Callback_Allowlist::rebuild_from_all_forms(); |
| 28 |
} |
| 29 |
|
| 30 |
public function down( \wpdb $wpdb ) { |
| 31 |
delete_post_meta_by_key( Ssr_Callback_Allowlist::META_KEY ); |
| 32 |
delete_option( Ssr_Callback_Allowlist::OPTION_KEY ); |
| 33 |
delete_option( Ssr_Callback_Allowlist::REBUILD_PROGRESS_OPTION ); |
| 34 |
delete_transient( Ssr_Callback_Allowlist::REBUILD_LOCK_TRANSIENT ); |
| 35 |
delete_option( Auto_Migrator::DB_VERSION_OPTION ); |
| 36 |
} |
| 37 |
} |
| 38 |
|