Browse Source

Abort tasks when the deployment lock is present

Jordi Boggiano 12 years ago
parent
commit
27a902d9a5

+ 8 - 0
src/Packagist/WebBundle/Command/DumpPackagesCommand.php

@@ -45,6 +45,14 @@ class DumpPackagesCommand extends ContainerAwareCommand
         $force = (Boolean) $input->getOption('force');
         $force = (Boolean) $input->getOption('force');
         $verbose = (Boolean) $input->getOption('verbose');
         $verbose = (Boolean) $input->getOption('verbose');
 
 
+        $deployLock = $this->getContainer()->getParameter('kernel.cache_dir').'/deploy.globallock';
+        if (file_exists($deployLock)) {
+            if ($verbose) {
+                $output->writeln('Aborting, '.$deployLock.' file present');
+            }
+            return;
+        }
+
         $doctrine = $this->getContainer()->get('doctrine');
         $doctrine = $this->getContainer()->get('doctrine');
 
 
         if ($force) {
         if ($force) {

+ 8 - 0
src/Packagist/WebBundle/Command/IndexPackagesCommand.php

@@ -49,6 +49,14 @@ class IndexPackagesCommand extends ContainerAwareCommand
         $force = $input->getOption('force');
         $force = $input->getOption('force');
         $package = $input->getArgument('package');
         $package = $input->getArgument('package');
 
 
+        $deployLock = $this->getContainer()->getParameter('kernel.cache_dir').'/deploy.globallock';
+        if (file_exists($deployLock)) {
+            if ($verbose) {
+                $output->writeln('Aborting, '.$deployLock.' file present');
+            }
+            return;
+        }
+
         $doctrine = $this->getContainer()->get('doctrine');
         $doctrine = $this->getContainer()->get('doctrine');
         $solarium = $this->getContainer()->get('solarium.client');
         $solarium = $this->getContainer()->get('solarium.client');