/** * Sets maintenance mode "on" or "off" * * @param bool $isOn * @return bool */ public function set($isOn) { if ($isOn) { return $this->flagDir->touch(self::FLAG_FILENAME); } if ($this->flagDir->isExist(self::FLAG_FILENAME)) { return $this->flagDir->delete(self::FLAG_FILENAME); } return true; }
/** * Create flag in case when value is set to 'true', remove it if value is set to 'false'. * * @param string $pathToFlagFile * @param bool $value * @return $this */ protected function setFlagValue($pathToFlagFile, $value) { if ($value) { try { $this->varReaderWriter->touch($pathToFlagFile); } catch (FileSystemException $e) { throw new \RuntimeException(sprintf('"%s" cannot be created.', $pathToFlagFile)); } } else { if ($this->varReaderWriter->isExist($pathToFlagFile)) { $this->varReaderWriter->delete($pathToFlagFile); } } return $this; }
/** * Create flag for cleaning up var/generation, var/di and var/cache directories for subsequent * regeneration of this content * * @return void */ public function requestRegeneration() { $this->write->touch(self::REGENERATE_FLAG); }