Skip to content

Commit

Permalink
Comment out site_launched event after discovering the data module i…
Browse files Browse the repository at this point in the history
…s handling that
  • Loading branch information
wpalani committed Jan 9, 2024
1 parent ff87639 commit dd6cae8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
6 changes: 5 additions & 1 deletion includes/Deactivation.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ public function __construct( Container $container ) {
* @return void
*/
public function handle() {
$this->site_launched_event();
/*
* The data module is currently handing the 'site_launched' event.
* We are commenting out the code below but keeping it as example for future events.
*/
// $this->site_launched_event();
$this->disable_coming_soon();
}

Expand Down
8 changes: 4 additions & 4 deletions includes/Events/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function __construct( $category = 'plugin_deactivation', $data = array()
/**
* Send the event to the data module endpoint.
*
* @return void
* @return WP_REST_Response REST response
*/
public function sendEvent() {
$event = array(
Expand All @@ -73,8 +73,8 @@ public function sendEvent() {
'data' => $this->data,
'queue' => false,
);

$request = $this->request->set_body_params( $event );
rest_do_request( $request );
$this->request->set_body( wp_json_encode( $event ) );
return rest_do_request( $this->request );
}
}
6 changes: 3 additions & 3 deletions includes/Events/SiteLaunched.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
class SiteLaunched extends Event {
/**
* Constructor.
* send event.
*
* @return void
*/
Expand All @@ -21,7 +21,7 @@ public function send() {
$this->data = array(
'ttl' => $this->getInstallTime(),
);

return $this->sendEvent();
}

Expand All @@ -35,4 +35,4 @@ private function getInstallTime() {

return time() - strtotime( $mm_install_time );
}
}
}

0 comments on commit dd6cae8

Please sign in to comment.