/** * @return boolean */ private function isRunning() { // Check if we have records in running state, if so read PID & check if process is active /* @var AclChangeset $runningAclChangeset */ $runningAclChangeset = $this->em->getRepository('KunstmaanAdminBundle:AclChangeset')->findRunningChangeset(); if (!is_null($runningAclChangeset)) { // Found running process, check if PID is still running if (!$this->shellHelper->isRunning($runningAclChangeset->getPid())) { // PID not running, process probably failed... $runningAclChangeset->setStatus(AclChangeset::STATUS_FAILED); $this->em->persist($runningAclChangeset); $this->em->flush($runningAclChangeset); } } return false; }
/** * Handle form entry of permission changes. * * @param Request $request * * @return bool */ public function bindRequest(Request $request) { $changes = $request->request->get('permission-hidden-fields'); if (empty($changes)) { return true; } // Just apply the changes to the current node (non recursively) $this->applyAclChangeset($this->resource, $changes, false); // Apply recursively (on request) $applyRecursive = $request->request->get('applyRecursive'); if ($applyRecursive) { // Serialize changes & store them in DB $user = $this->tokenStorage->getToken()->getUser(); $this->createAclChangeSet($this->resource, $changes, $user); $cmd = 'php ' . $this->kernel->getRootDir() . '/console kuma:acl:apply'; $cmd .= ' --env=' . $this->kernel->getEnvironment(); $this->shellHelper->runInBackground($cmd); } return true; }