@@ -17,9 +17,25 @@ public function run() : void {
1717 'wp2static_deploy ' ,
1818 [ $ this , 'deploy ' ],
1919 15 ,
20+ 2
21+ );
22+
23+ add_action (
24+ 'admin_menu ' ,
25+ [ $ this , 'addOptionsPage ' ],
26+ 15 ,
2027 1
2128 );
2229
30+ do_action (
31+ 'wp2static_register_addon ' ,
32+ 'wp2static-addon-s3 ' ,
33+ 'deploy ' ,
34+ 'S3 Deployment ' ,
35+ 'https://wp2static.com/addons/s3/ ' ,
36+ 'Deploys to S3 with optional CloudFront cache invalidation '
37+ );
38+
2339 if ( defined ( 'WP_CLI ' ) ) {
2440 \WP_CLI ::add_command (
2541 'wp2static s3 ' ,
@@ -222,7 +238,11 @@ public static function renderS3Page() : void {
222238 }
223239
224240
225- public function deploy ( string $ processed_site_path ) : void {
241+ public function deploy ( string $ processed_site_path , string $ enabled_deployer ) : void {
242+ if ( $ enabled_deployer !== 'wp2static-addon-s3 ' ) {
243+ return ;
244+ }
245+
226246 \WP2Static \WsLog::l ( 'S3 Addon deploying ' );
227247
228248 $ s3_deployer = new Deployer ();
@@ -419,7 +439,7 @@ public static function saveOptionsFromUI() : void {
419439 [ 'name ' => 'cfMaxPathsToInvalidate ' ]
420440 );
421441
422- wp_safe_redirect ( admin_url ( 'admin.php?page=wp2static-s3 ' ) );
442+ wp_safe_redirect ( admin_url ( 'admin.php?page=wp2static-addon- s3 ' ) );
423443 exit ;
424444 }
425445
@@ -446,5 +466,15 @@ public static function getValue( string $name ) : string {
446466
447467 return $ option_value ;
448468 }
449- }
450469
470+ public function addOptionsPage () : void {
471+ add_submenu_page (
472+ null ,
473+ 'S3 Deployment Options ' ,
474+ 'S3 Deployment Options ' ,
475+ 'manage_options ' ,
476+ 'wp2static-addon-s3 ' ,
477+ [ $ this , 'renderS3Page ' ]
478+ );
479+ }
480+ }
0 commit comments