Php.php in DRD Agent 8.3
File
src/Agent/Action/Php.php
View source
<?php
namespace Drupal\drd_agent\Agent\Action;
use Exception;
class Php extends Base {
public function execute() {
$args = $this
->getArguments();
try {
if (!empty($args['php'])) {
$filename = 'temporary://drd_agent_php.inc';
file_put_contents($filename, $args['php']);
require_once $filename;
unlink($filename);
}
} catch (Exception $ex) {
$this->messenger
->addMessage(t('Error while executing PHP: :msg', [
':msg' => $ex
->getMessage(),
]), 'error');
}
return [];
}
}
Classes
Name |
Description |
Php |
Provides a 'Php' code. |