@@ -64,7 +64,14 @@ function wp_safe_remote_get( string $url, array $args ) {
6464}
6565function wp_remote_retrieve_response_code ( $ response ): int { return (int ) ( $ response ['response ' ]['code ' ] ?? 0 ); }
6666function wp_remote_retrieve_body ( $ response ): string { return (string ) ( $ response ['body ' ] ?? '' ); }
67- function update_option ( string $ key , $ value ): bool { $ GLOBALS ['ssi_plan_options ' ][ $ key ] = $ value ; return true ; }
67+ function get_option ( string $ key , mixed $ default = false ): mixed { return $ GLOBALS ['ssi_plan_options ' ][ $ key ] ?? $ default ; }
68+ function update_option ( string $ key , $ value ): bool {
69+ if ( array_key_exists ( $ key , $ GLOBALS ['ssi_plan_options ' ] ) && $ GLOBALS ['ssi_plan_options ' ][ $ key ] === $ value ) {
70+ return false ; // Core semantics: unchanged value writes no row and returns false.
71+ }
72+ $ GLOBALS ['ssi_plan_options ' ][ $ key ] = $ value ;
73+ return true ;
74+ }
6875function switch_theme ( string $ slug ): void { $ GLOBALS ['ssi_plan_options ' ]['stylesheet ' ] = $ slug ; }
6976function convert_smilies ( string $ content , string $ which = 'content ' ): string { return ( $ GLOBALS ['ssi_plan_options ' ]['use_smilies ' ] ?? true ) ? 'smilied- ' . $ which : $ content ; }
7077function sanitize_text_field ( string $ value ): string { return $ value ; }
@@ -438,6 +445,13 @@ function wp_insert_post( array $post, bool $wp_error ) {
438445$ assert ( true === $ GLOBALS ['ssi_plan_options ' ]['use_smilies ' ], 'activate-with-disable-smilies-false-keeps-smilies ' );
439446$ assert ( false === ( $ activated_off ['completed ' ]['runtime_policy ' ]['disable_smilies ' ]['requested ' ] ?? null ) && false === ( $ activated_off ['completed ' ]['runtime_policy ' ]['disable_smilies ' ]['applied ' ] ?? null ), 'disable-smilies-false-not-applied-on-activate ' );
440447
448+ // Repeated activating import: use_smilies already false, update_option returns false (unchanged value).
449+ $ GLOBALS ['ssi_plan_options ' ]['use_smilies ' ] = false ;
450+ $ receipt_repeat_policy = Static_Site_Importer_WordPress_Site_Plan_Materializer::materialize ( $ plan , array ( 'slug ' => 'site-plan ' , 'overwrite ' => true , 'activate ' => true , 'site_title ' => 'Repeat Policy ' ) );
451+ $ assert ( 'completed ' === $ receipt_repeat_policy ['status ' ], 'repeated-activating-import-completes ' );
452+ $ assert ( true === ( $ receipt_repeat_policy ['completed ' ]['runtime_policy ' ]['disable_smilies ' ]['requested ' ] ?? null ) && true === ( $ receipt_repeat_policy ['completed ' ]['runtime_policy ' ]['disable_smilies ' ]['applied ' ] ?? null ), 'repeated-activating-import-records-requested-and-applied ' );
453+ $ assert ( false === $ GLOBALS ['ssi_plan_options ' ]['use_smilies ' ], 'repeated-activating-import-keeps-use-smilies-false ' );
454+
441455$ repeat = Static_Site_Importer_WordPress_Site_Plan_Materializer::materialize ( $ plan , array ( 'slug ' => 'site-plan ' ) );
442456$ assert ( 'completed ' === $ repeat ['status ' ], 'reconciliation repeat completes ' );
443457$ assert ( count ( $ GLOBALS ['ssi_plan_posts ' ] ) === count ( $ plan ['pages ' ] ), 'reconciliation preserves source page identity ' );
0 commit comments