PluginProbe
Hostinger Tools / 3.0.78
Hostinger Tools v3.0.78
3.0.78 3.0.77 3.0.76 3.0.75 3.0.74 3.0.73 3.0.72 3.0.71 3.0.70 3.0.69 3.0.68 3.0.67 3.0.66 1.8.1 1.8.2 1.8.3 1.9.1 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 All 109 releases
hostinger / includes / Mcp / Handlers / WebsiteUpdated.php

WebsiteUpdated.php in Hostinger Tools 3.0.78, at includes/Mcp/Handlers/WebsiteUpdated.php

32 lines 882 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Hostinger\Mcp\Handlers;
4
5
6 use Hostinger\Admin\Jobs\ActionScheduler;
7
8 defined( 'ABSPATH' ) || exit;
9 class WebsiteUpdated extends EventHandler {
10
11 const MCP_SITE_TRANSIENT = 'hostinger_mcp_site_status';
12 const MCP_SITE_TRANSIENT_LIFETIME = 1200; // 20 mins
13
14 public function send( array $args = array() ): void {
15 if ( ! $this->can_send( $args ) ) {
16 return;
17 }
18
19 $status = ActionScheduler::STATUS_FAILED;
20
21 if ( $this->send_to_proxy( $args ) ) {
22 $status = ActionScheduler::STATUS_COMPLETE;
23 }
24
25 set_transient( self::MCP_SITE_TRANSIENT, $status, self::MCP_SITE_TRANSIENT_LIFETIME );
26 }
27
28 public function can_send( array $args = array() ): bool {
29 return parent::can_send( $args ) && get_transient( self::MCP_SITE_TRANSIENT ) !== ActionScheduler::STATUS_COMPLETE;
30 }
31 }
32