Commit 9c26c21b authored by dj3c1t's avatar dj3c1t

importController command line only

parent 0349d41a
......@@ -11,9 +11,8 @@ class ImportController extends Controller {
public function previousVersionAction(Request $request) {
$importPreviousVersion = $this->get('sourceml.import_previous_version');
if(php_sapi_name() !== 'cli') {
return $this->render(
'Dj3c1tSourceMLBundle:Import:index.html.twig'
);
$importPreviousVersion->log(" ERROR command line only");
return new Response("");
}
try {
$importPreviousVersion->init();
......@@ -26,24 +25,4 @@ class ImportController extends Controller {
return new Response();
}
public function doImportAction(Request $request) {
$importPreviousVersion = $this->get('sourceml.import_previous_version');
try {
$importPreviousVersion->init();
$importPreviousVersion->import();
$importPreviousVersion->log("import done");
$this->get('session')->getFlashBag()->add('success', "L'upgrade s'est terminé avec succès");
}
catch(\Exception $e) {
$importPreviousVersion->log(" ERROR ".$e->getMessage());
$this->get('session')->getFlashBag()->add('error', "L'upgrade s'est terminé avec des erreurs");
}
return $this->render(
'Dj3c1tSourceMLBundle:Import:logs.html.twig',
array(
"logs" => $importPreviousVersion->getLogs(),
)
);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment