'.$string.'>');
+ $this->filesystem->appendToFile($this->rootlog.'cron.log', $string."\n");
+ }
+ private function writeln($string) {
+ $this->output->writeln($string);
+ $this->filesystem->appendToFile($this->rootlog.'cron.log', $string."\n");
+ }
+}
diff --git a/src/schedule-2.0/src/Controller/CronController.php b/src/schedule-2.0/src/Controller/CronController.php
index 4ade2f0..7f67661 100644
--- a/src/schedule-2.0/src/Controller/CronController.php
+++ b/src/schedule-2.0/src/Controller/CronController.php
@@ -11,6 +11,8 @@ use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\BufferedOutput;
use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\HttpFoundation\BinaryFileResponse;
+use Symfony\Component\HttpFoundation\ResponseHeaderBag;
use App\Entity\Cron as Entity;
use App\Form\CronType as Form;
@@ -70,53 +72,27 @@ class CronController extends AbstractController
]);
}
- public function execAction(Request $request, $id)
+ public function log()
+ {
+ return $this->render($this->render.'logs.html.twig', [
+ 'useheader' => true,
+ 'usesidebar' => true,
+ ]);
+ }
+
+ public function getlog(Request $request, $id)
{
- set_time_limit(0);
- $em = $this->getDoctrine()->getManager();
- $entity = $em->getRepository($this->labelentity)->find($id);
-
- if (!$entity) {
- throw $this->createNotFoundException('Unable to find entity.');
- }
-
- $kernel = $this->get('kernel');
- $application = new Application($kernel);
- $application->setAutoExit(false);
- $command = $application->find($entity->getCommand());
- $jsonparameter=json_decode($entity->getJsonargument(),true);
- $parameter = ($jsonparameter?new ArrayInput($jsonparameter):new ArrayInput([]));
-
-
- $output = new BufferedOutput(OutputInterface::VERBOSITY_NORMAL,false);
- $command->run($parameter, $output);
- $content = $output->fetch();
-
- return $this->render('CadolesCoreBundle:Core:command.html.twig', [
- 'useheader' => true,
- 'usemenu' => false,
- 'usesidebar' => true,
- "title" => $entity->getDescription(),
- "return_path" =>"cadoles_cron_config",
- "content" =>$content
- ]);
- }
-
- public function logAction(Request $request, $id)
- {
- $kernel = $this->get('kernel');
- $path = $this->get('kernel')->getRootDir() . '/../var/logs/'.$id.'.log';
- $content = file_get_contents($path);
-
- return $this->render('CadolesCronBundle:Cron:logs.html.twig', [
- 'useheader' => true,
- 'usemenu' => false,
- 'usesidebar' => true,
- "title" => "LOG = ".$id,
- "content" => $content
- ]);
- }
+ $path = $this->getParameter('kernel.project_dir');
+ if($id=="dump")
+ $file = $path . '/var/log/' . $this->getParameter("appAlias") . '.sql';
+ else
+ $file = $path . '/var/log/'.$id.'.log';
+
+ $response = new BinaryFileResponse($file);
+ $response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT);
+ return $response;
+ }
protected function getErrorForm($id,$form,$request,$data,$mode) {
diff --git a/src/schedule-2.0/src/Entity/Domaine.php b/src/schedule-2.0/src/Entity/Domaine.php
index fd3f73e..71a4c0c 100644
--- a/src/schedule-2.0/src/Entity/Domaine.php
+++ b/src/schedule-2.0/src/Entity/Domaine.php
@@ -28,6 +28,12 @@ class Domaine
*/
private $name;
+ /**
+ * @ORM\Column(name="category", type="string")
+ *
+ */
+ private $category;
+
/**
* @ORM\Column(type="text", nullable=true)
*/
@@ -55,6 +61,13 @@ class Domaine
return $this->id;
}
+ public function setId(int $id): self
+ {
+ $this->id = $id;
+
+ return $this;
+ }
+
public function getName(): ?string
{
return $this->name;
@@ -138,6 +151,18 @@ class Domaine
}
}
+ return $this;
+ }
+
+ public function getCategory(): ?string
+ {
+ return $this->category;
+ }
+
+ public function setCategory(string $category): self
+ {
+ $this->category = $category;
+
return $this;
}
diff --git a/src/schedule-2.0/src/Entity/Script.php b/src/schedule-2.0/src/Entity/Script.php
new file mode 100644
index 0000000..ac9885c
--- /dev/null
+++ b/src/schedule-2.0/src/Entity/Script.php
@@ -0,0 +1,50 @@
+id;
+ }
+
+ public function getName(): ?string
+ {
+ return $this->name;
+ }
+
+ public function setName(string $name): self
+ {
+ $this->name = $name;
+
+ return $this;
+ }
+}
diff --git a/src/schedule-2.0/src/Repository/ScriptRepository.php b/src/schedule-2.0/src/Repository/ScriptRepository.php
new file mode 100644
index 0000000..977a640
--- /dev/null
+++ b/src/schedule-2.0/src/Repository/ScriptRepository.php
@@ -0,0 +1,15 @@
+
- Ajouter
-
diff --git a/tmpl/schedule.cron b/tmpl/schedule.cron
new file mode 100644
index 0000000..d414f4b
--- /dev/null
+++ b/tmpl/schedule.cron
@@ -0,0 +1 @@
+* * * * * root /var/www/html/schedule/scripts/cron.sh &>/dev/null