Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php namespace App\Command; use Symfony\Component\Console\Input\InputInterface; use Sym..

Decoded Output download

<?php 
 namespace App\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Validator\Validator\ValidatorInterface; use App\Command\Command as BaseCommand; use App\Entity\Database as DatabaseEntity; use App\System\CommandExecutor; use App\Entity\Manager\SiteManager as SiteEntityManager; use App\Entity\Manager\DatabaseManager as DatabaseEntityManager; use App\Entity\Manager\DatabaseServerManager as DatabaseServerEntityManager; use App\System\Command\DeleteOldFilesRecursiveCommand; use App\System\Command\FindChmodCommand; use App\System\Command\ChownCommand; use App\Database\Exporter as DatabaseExporter; class DatabaseBackupCommand extends BaseCommand { private const RETENTION_PERIOD = 7; private SiteEntityManager $siteEntityManager; private DatabaseEntityManager $databaseEntityManager; private DatabaseServerEntityManager $databaseServerEntityManager; private CommandExecutor $commandExecutor; private ValidatorInterface $validator; private int $retentionPeriod = 0; public function __construct(SiteEntityManager $siteEntityManager, DatabaseEntityManager $databaseEntityManager, DatabaseServerEntityManager $databaseServerEntityManager, ValidatorInterface $validator) { goto d2a25; d2a25: $this->siteEntityManager = $siteEntityManager; goto f4574; B11ad: $this->databaseServerEntityManager = $databaseServerEntityManager; goto D4139; f4574: $this->databaseEntityManager = $databaseEntityManager; goto B11ad; D4139: $this->commandExecutor = new CommandExecutor(); goto ae5a1; ee70b: parent::__construct(); goto D1049; ae5a1: $this->validator = $validator; goto ee70b; D1049: } protected function configure() : void { goto eb1d1; d3e7e: $this->setDescription("clpctl db:backup --ignoreDatabases='db1,db2' --retentionPeriod=7"); goto b0dd0; C1672: $this->addOption("retentionPeriod", null, InputOption::VALUE_OPTIONAL, '', self::RETENTION_PERIOD); goto F07e1; eb1d1: $this->setName("db:backup"); goto d3e7e; b0dd0: $this->addOption("ignoreDatabases", null, InputOption::VALUE_OPTIONAL); goto C1672; F07e1: } protected function execute(InputInterface $input, OutputInterface $output) : int { try { goto Eea6e; f33f8: $siteEntities = $this->siteEntityManager->findAll(); goto D8feb; a743f: return BaseCommand::SUCCESS; goto E67cc; F5464: Ab37d: goto a743f; F49d0: Bcf43: goto F5464; df7c2: $ignoredDatabases = explode(",", $input->getOption("ignoreDatabases")); goto Bb9ab; Bb9ab: $this->retentionPeriod = (int) $input->getOption("retentionPeriod"); goto f33f8; de90c: foreach ($siteEntities as $siteEntity) { goto Afbcf; Afbcf: $databaseEntities = $siteEntity->getDatabases(); goto a0c25; B70b4: foreach ($databaseEntities as $databaseEntity) { goto be0c9; E1c4b: ac8d9: goto be0b2; d85b3: $this->createDatabaseDump($databaseEntity); goto F3894; be0c9: $databaseName = $databaseEntity->getName(); goto Cddde; F3894: B53a2: goto E1c4b; Cddde: if (!(false === in_array($databaseName, $ignoredDatabases))) { goto B53a2; } goto d85b3; be0b2: } goto c1bf6; df653: Ee193: goto c356b; f8801: Be71b: goto df653; c1bf6: E40fa: goto f8801; a0c25: if (!count($databaseEntities)) { goto Be71b; } goto B70b4; c356b: } goto F49d0; D8feb: if (!count($siteEntities)) { goto Ab37d; } goto de90c; Eea6e: $this->validateInput($input); goto df7c2; E67cc: } catch (\Exception $e) { goto af3b7; a2ae0: $output->writeln(sprintf("<error>%s</error>", $errorMessage)); goto fced7; af3b7: $errorMessage = $e->getMessage(); goto a2ae0; fced7: return BaseCommand::FAILURE; goto Eb5e3; Eb5e3: } } private function createDatabaseDump(DatabaseEntity $databaseEntity) : void { try { goto D0edf; e9ed2: $siteUser = $siteEntity->getUser(); goto Ad33b; D0edf: $dateTime = new \DateTime("now", new \DateTimeZone("UTC")); goto B1ef3; bebd4: $databaseExporter = new DatabaseExporter($databaseEntity); goto b935c; b957d: $databaseExporter->createOutputDirectory(); goto a4695; Ad33b: $databaseName = $databaseEntity->getName(); goto d82b9; af3e0: $outputDirectory = sprintf("%s/%s/%s/", rtrim($backupDirectory, "/"), $databaseName, $dateTime->format("Y-m-d")); goto Df4c7; A8a10: $this->resetPermissions($databaseEntity); goto D1a39; Df4c7: $outputFile = sprintf("%s/%s", rtrim($outputDirectory, "/"), sprintf("%s_%s.sql.gz", $databaseName, $dateTime->getTimestamp())); goto bebd4; a4695: $databaseExporter->export(); goto A8a10; b935c: $databaseExporter->setFile($outputFile); goto b957d; B1ef3: $siteEntity = $databaseEntity->getSite(); goto e9ed2; D1a39: $this->cleanUpBackups($databaseEntity); goto c292b; d82b9: $backupDirectory = sprintf("/home/%s/backups/databases/", $siteUser); goto af3e0; c292b: } catch (\Exception $e) { $logger = $this->getLogger(); $logger->exception($e); } } private function resetPermissions(DatabaseEntity $databaseEntity) { goto E4e16; D01dc: $this->commandExecutor->execute($backupDirectoryChmodCommand); goto b6076; b7e26: $backupDirectoryChownCommand->setFile($backupDirectory); goto ad473; Fab4c: $backupDirectoryChownCommand->setGroup($siteUser); goto B1f11; F2d03: $backupDirectory = sprintf("/home/%s/backups/databases/", $siteUser); goto F3f6e; Aba13: $backupDirectoryChmodCommand->setFileChmod(760); goto ec3da; c9289: $siteUser = $siteEntity->getUser(); goto F2d03; C5fad: $backupDirectoryChmodCommand->setDirectoryChmod(750); goto Aba13; F3f6e: $backupDirectoryChownCommand = new ChownCommand(); goto b7e26; ad473: $backupDirectoryChownCommand->setRecursive(true); goto bb0a0; Ed019: $backupDirectoryChmodCommand->setFile($backupDirectory); goto C5fad; E4e16: $siteEntity = $databaseEntity->getSite(); goto c9289; ec3da: $this->commandExecutor->execute($backupDirectoryChownCommand); goto D01dc; bb0a0: $backupDirectoryChownCommand->setUser($siteUser); goto Fab4c; B1f11: $backupDirectoryChmodCommand = new FindChmodCommand(); goto Ed019; b6076: } private function cleanUpBackups(DatabaseEntity $databaseEntity) { goto bc643; bb935: $deleteOldBackupsCommand = new DeleteOldFilesRecursiveCommand(); goto ac973; d980d: $siteUser = $siteEntity->getUser(); goto D51c0; Efad2: $deleteOldBackupsCommand->setRetentionPeriod($this->retentionPeriod); goto Cf576; D51c0: $databaseBackupDirectory = sprintf("/home/%s/backups/databases/", $siteUser); goto bb935; ac973: $deleteOldBackupsCommand->setDirectory($databaseBackupDirectory); goto Efad2; bc643: $siteEntity = $databaseEntity->getSite(); goto d980d; Cf576: $this->commandExecutor->execute($deleteOldBackupsCommand, 360); goto d176a; d176a: } } ?>

Did this file decode correctly?

Original Code

<?php
 namespace App\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Validator\Validator\ValidatorInterface; use App\Command\Command as BaseCommand; use App\Entity\Database as DatabaseEntity; use App\System\CommandExecutor; use App\Entity\Manager\SiteManager as SiteEntityManager; use App\Entity\Manager\DatabaseManager as DatabaseEntityManager; use App\Entity\Manager\DatabaseServerManager as DatabaseServerEntityManager; use App\System\Command\DeleteOldFilesRecursiveCommand; use App\System\Command\FindChmodCommand; use App\System\Command\ChownCommand; use App\Database\Exporter as DatabaseExporter; class DatabaseBackupCommand extends BaseCommand { private const RETENTION_PERIOD = 7; private SiteEntityManager $siteEntityManager; private DatabaseEntityManager $databaseEntityManager; private DatabaseServerEntityManager $databaseServerEntityManager; private CommandExecutor $commandExecutor; private ValidatorInterface $validator; private int $retentionPeriod = 0; public function __construct(SiteEntityManager $siteEntityManager, DatabaseEntityManager $databaseEntityManager, DatabaseServerEntityManager $databaseServerEntityManager, ValidatorInterface $validator) { goto d2a25; d2a25: $this->siteEntityManager = $siteEntityManager; goto f4574; B11ad: $this->databaseServerEntityManager = $databaseServerEntityManager; goto D4139; f4574: $this->databaseEntityManager = $databaseEntityManager; goto B11ad; D4139: $this->commandExecutor = new CommandExecutor(); goto ae5a1; ee70b: parent::__construct(); goto D1049; ae5a1: $this->validator = $validator; goto ee70b; D1049: } protected function configure() : void { goto eb1d1; d3e7e: $this->setDescription("\x63\154\160\x63\x74\154\x20\144\142\72\x62\x61\x63\153\x75\160\40\55\x2d\x69\147\156\x6f\162\x65\104\x61\164\141\142\x61\x73\145\163\x3d\47\144\x62\x31\54\144\x62\x32\x27\x20\55\x2d\162\x65\x74\145\156\x74\151\157\156\x50\145\x72\151\157\144\x3d\67"); goto b0dd0; C1672: $this->addOption("\x72\145\x74\x65\156\164\151\x6f\x6e\120\x65\x72\151\157\x64", null, InputOption::VALUE_OPTIONAL, '', self::RETENTION_PERIOD); goto F07e1; eb1d1: $this->setName("\144\x62\x3a\x62\x61\143\153\165\x70"); goto d3e7e; b0dd0: $this->addOption("\151\147\156\157\x72\145\x44\x61\x74\141\x62\x61\163\x65\x73", null, InputOption::VALUE_OPTIONAL); goto C1672; F07e1: } protected function execute(InputInterface $input, OutputInterface $output) : int { try { goto Eea6e; f33f8: $siteEntities = $this->siteEntityManager->findAll(); goto D8feb; a743f: return BaseCommand::SUCCESS; goto E67cc; F5464: Ab37d: goto a743f; F49d0: Bcf43: goto F5464; df7c2: $ignoredDatabases = explode("\x2c", $input->getOption("\x69\147\x6e\x6f\162\145\x44\x61\164\x61\x62\141\x73\x65\x73")); goto Bb9ab; Bb9ab: $this->retentionPeriod = (int) $input->getOption("\x72\145\x74\x65\156\x74\x69\157\x6e\120\x65\x72\x69\x6f\144"); goto f33f8; de90c: foreach ($siteEntities as $siteEntity) { goto Afbcf; Afbcf: $databaseEntities = $siteEntity->getDatabases(); goto a0c25; B70b4: foreach ($databaseEntities as $databaseEntity) { goto be0c9; E1c4b: ac8d9: goto be0b2; d85b3: $this->createDatabaseDump($databaseEntity); goto F3894; be0c9: $databaseName = $databaseEntity->getName(); goto Cddde; F3894: B53a2: goto E1c4b; Cddde: if (!(false === in_array($databaseName, $ignoredDatabases))) { goto B53a2; } goto d85b3; be0b2: } goto c1bf6; df653: Ee193: goto c356b; f8801: Be71b: goto df653; c1bf6: E40fa: goto f8801; a0c25: if (!count($databaseEntities)) { goto Be71b; } goto B70b4; c356b: } goto F49d0; D8feb: if (!count($siteEntities)) { goto Ab37d; } goto de90c; Eea6e: $this->validateInput($input); goto df7c2; E67cc: } catch (\Exception $e) { goto af3b7; a2ae0: $output->writeln(sprintf("\74\x65\162\x72\157\162\76\x25\x73\74\x2f\x65\162\162\157\162\76", $errorMessage)); goto fced7; af3b7: $errorMessage = $e->getMessage(); goto a2ae0; fced7: return BaseCommand::FAILURE; goto Eb5e3; Eb5e3: } } private function createDatabaseDump(DatabaseEntity $databaseEntity) : void { try { goto D0edf; e9ed2: $siteUser = $siteEntity->getUser(); goto Ad33b; D0edf: $dateTime = new \DateTime("\156\157\167", new \DateTimeZone("\x55\124\103")); goto B1ef3; bebd4: $databaseExporter = new DatabaseExporter($databaseEntity); goto b935c; b957d: $databaseExporter->createOutputDirectory(); goto a4695; Ad33b: $databaseName = $databaseEntity->getName(); goto d82b9; af3e0: $outputDirectory = sprintf("\45\163\x2f\45\163\x2f\x25\x73\57", rtrim($backupDirectory, "\x2f"), $databaseName, $dateTime->format("\131\x2d\155\x2d\x64")); goto Df4c7; A8a10: $this->resetPermissions($databaseEntity); goto D1a39; Df4c7: $outputFile = sprintf("\45\x73\x2f\x25\163", rtrim($outputDirectory, "\57"), sprintf("\45\x73\x5f\x25\163\x2e\163\161\154\56\x67\x7a", $databaseName, $dateTime->getTimestamp())); goto bebd4; a4695: $databaseExporter->export(); goto A8a10; b935c: $databaseExporter->setFile($outputFile); goto b957d; B1ef3: $siteEntity = $databaseEntity->getSite(); goto e9ed2; D1a39: $this->cleanUpBackups($databaseEntity); goto c292b; d82b9: $backupDirectory = sprintf("\57\x68\x6f\x6d\x65\x2f\45\163\x2f\x62\141\x63\153\165\160\x73\57\x64\141\164\x61\142\x61\163\145\x73\x2f", $siteUser); goto af3e0; c292b: } catch (\Exception $e) { $logger = $this->getLogger(); $logger->exception($e); } } private function resetPermissions(DatabaseEntity $databaseEntity) { goto E4e16; D01dc: $this->commandExecutor->execute($backupDirectoryChmodCommand); goto b6076; b7e26: $backupDirectoryChownCommand->setFile($backupDirectory); goto ad473; Fab4c: $backupDirectoryChownCommand->setGroup($siteUser); goto B1f11; F2d03: $backupDirectory = sprintf("\x2f\x68\157\x6d\x65\x2f\x25\163\x2f\142\x61\x63\153\165\160\163\57\144\x61\x74\141\x62\x61\163\145\x73\57", $siteUser); goto F3f6e; Aba13: $backupDirectoryChmodCommand->setFileChmod(760); goto ec3da; c9289: $siteUser = $siteEntity->getUser(); goto F2d03; C5fad: $backupDirectoryChmodCommand->setDirectoryChmod(750); goto Aba13; F3f6e: $backupDirectoryChownCommand = new ChownCommand(); goto b7e26; ad473: $backupDirectoryChownCommand->setRecursive(true); goto bb0a0; Ed019: $backupDirectoryChmodCommand->setFile($backupDirectory); goto C5fad; E4e16: $siteEntity = $databaseEntity->getSite(); goto c9289; ec3da: $this->commandExecutor->execute($backupDirectoryChownCommand); goto D01dc; bb0a0: $backupDirectoryChownCommand->setUser($siteUser); goto Fab4c; B1f11: $backupDirectoryChmodCommand = new FindChmodCommand(); goto Ed019; b6076: } private function cleanUpBackups(DatabaseEntity $databaseEntity) { goto bc643; bb935: $deleteOldBackupsCommand = new DeleteOldFilesRecursiveCommand(); goto ac973; d980d: $siteUser = $siteEntity->getUser(); goto D51c0; Efad2: $deleteOldBackupsCommand->setRetentionPeriod($this->retentionPeriod); goto Cf576; D51c0: $databaseBackupDirectory = sprintf("\57\x68\x6f\x6d\x65\57\45\x73\x2f\142\x61\x63\153\x75\160\163\57\144\x61\164\x61\x62\x61\x73\145\x73\x2f", $siteUser); goto bb935; ac973: $deleteOldBackupsCommand->setDirectory($databaseBackupDirectory); goto Efad2; bc643: $siteEntity = $databaseEntity->getSite(); goto d980d; Cf576: $this->commandExecutor->execute($deleteOldBackupsCommand, 360); goto d176a; d176a: } }

Function Calls

None

Variables

None

Stats

MD5 17e1600e7e5dbed72bbe697ef7384f29
Eval Count 0
Decode Time 61 ms