[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@18.222.75.85: ~ $
<?php

namespace MailPoet\Cron\Workers;

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


use MailPoet\Models\ScheduledTask;
use MailPoet\Models\StatisticsClicks;
use MailPoet\Models\StatisticsWooCommercePurchases;
use MailPoet\Statistics\Track\WooCommercePurchases;
use MailPoet\WooCommerce\Helper as WCHelper;
use MailPoetVendor\Carbon\Carbon;

class WooCommercePastOrders extends SimpleWorker {
  const TASK_TYPE = 'woocommerce_past_orders';
  const BATCH_SIZE = 20;

  /** @var WCHelper */
  private $woocommerceHelper;

  /** @var WooCommercePurchases */
  private $woocommercePurchases;

  public function __construct(
    WCHelper $woocommerceHelper,
    WooCommercePurchases $woocommercePurchases
  ) {
    $this->woocommerceHelper = $woocommerceHelper;
    $this->woocommercePurchases = $woocommercePurchases;
    parent::__construct();
  }

  public function checkProcessingRequirements() {
    return $this->woocommerceHelper->isWooCommerceActive() && empty($this->getCompletedTasks()); // run only once
  }

  public function processTaskStrategy(ScheduledTask $task, $timer) {
    $oldestClick = StatisticsClicks::orderByAsc('created_at')->limit(1)->findOne();
    if (!$oldestClick instanceof StatisticsClicks) {
      return true;
    }

    // continue from 'last_processed_id' from previous run
    $meta = $task->getMeta();
    $lastId = isset($meta['last_processed_id']) ? $meta['last_processed_id'] : 0;
    add_filter('posts_where', function ($where = '') use ($lastId) {
      global $wpdb;
      return $where . " AND {$wpdb->prefix}posts.ID > " . $lastId;
    }, 10, 2);

    $orderIds = $this->woocommerceHelper->wcGetOrders([
      'status' => 'completed',
      'date_completed' => '>=' . $oldestClick->createdAt,
      'orderby' => 'ID',
      'order' => 'ASC',
      'limit' => self::BATCH_SIZE,
      'return' => 'ids',
    ]);

    if (empty($orderIds)) {
      return true;
    }

    foreach ($orderIds as $orderId) {
      // clean all records for given order to fix wrong data inserted by a past buggy version
      StatisticsWooCommercePurchases::where('order_id', $orderId)->deleteMany();
      $this->woocommercePurchases->trackPurchase($orderId, false);
    }
    $task->meta = ['last_processed_id' => end($orderIds)];
    $task->save();
    return false;
  }

  public function getNextRunDate() {
    return Carbon::createFromTimestamp($this->wp->currentTime('timestamp')); // schedule immediately
  }
}

Filemanager

Name Type Size Permission Actions
KeyCheck Folder 0755
SendingQueue Folder 0755
StatsNotifications Folder 0755
AuthorizedSendingEmailsCheck.php File 888 B 0644
Beamer.php File 1.61 KB 0644
Bounce.php File 5.69 KB 0644
ExportFilesCleanup.php File 863 B 0644
InactiveSubscribers.php File 2.28 KB 0644
Scheduler.php File 8.62 KB 0644
SimpleWorker.php File 2.55 KB 0644
SubscriberLinkTokens.php File 1.06 KB 0644
SubscribersCountCacheRecalculation.php File 3.31 KB 0644
SubscribersEngagementScore.php File 2.36 KB 0644
SubscribersLastEngagement.php File 4.76 KB 0644
UnsubscribeTokens.php File 1.67 KB 0644
WooCommercePastOrders.php File 2.37 KB 0644
WooCommerceSync.php File 1.01 KB 0644
WorkersFactory.php File 3.96 KB 0644
index.php File 0 B 0644