/** * Assert file existence * * @return bool * @throws \Magento\Framework\Exception\FileSystemException */ protected function assertValid() { if (!$this->driver->isExists($this->path)) { throw new FileSystemException(new \Magento\Framework\Phrase('The file "%1" doesn\'t exist', [$this->path])); } return true; }
/** * Assert file existence * * @return bool * @throws \Magento\Framework\Filesystem\FilesystemException */ protected function assertValid() { if (!$this->driver->isExists($this->path)) { throw new FilesystemException(sprintf('The file "%s" doesn\'t exist', $this->path)); } return true; }
/** * @return string */ protected function getLockFile() { $lockFileDir = $this->filesystem->getDirectoryRead(DirectoryList::VAR_DIR)->getAbsolutePath(); $lockFile = $lockFileDir . DIRECTORY_SEPARATOR . $this->lockFileName; if (!$this->filesystemDriver->isExists($lockFile)) { $this->filesystemDriver->filePutContents($lockFile, 0); } return $lockFile; }
/** * @return string */ protected function getLockFile() { $lockFileDir = dirname(dirname(dirname(dirname(__DIR__)))) . DIRECTORY_SEPARATOR . 'var'; $lockFile = $lockFileDir . DIRECTORY_SEPARATOR . $this->lockFileName; if (!$this->filesystem->isExists($lockFile)) { $this->filesystem->filePutContents($lockFile, 0); } return $lockFile; }
/** * Checks that application is installed and DI resources are cleared * * @return string[] */ private function checkEnvironment() { $messages = []; if (!$this->deploymentConfig->isAvailable()) { $messages[] = 'You cannot run this command because the Magento application is not installed.'; } /** * By the time the command is able to execute, the Object Management configuration is already contaminated * by old config info, and it's too late to just clear the files in code. * * TODO: reconfigure OM in runtime so DI resources can be cleared after command launches * */ $path = $this->directoryList->getPath(DirectoryList::DI); if ($this->fileDriver->isExists($path)) { $messages[] = "DI configuration must be cleared before running compiler. Please delete '{$path}'."; } return $messages; }
/** * Checks that application is installed and DI resources are cleared * * @return string[] */ private function checkEnvironment() { $messages = []; $config = $this->deploymentConfig->get(ConfigOptionsListConstants::KEY_MODULES); if (!$config) { $messages[] = 'You cannot run this command because modules are not enabled. You can enable modules by' . ' running the \'module:enable --all\' command.'; } /** * By the time the command is able to execute, the Object Management configuration is already contaminated * by old config info, and it's too late to just clear the files in code. * * TODO: reconfigure OM in runtime so DI resources can be cleared after command launches * */ $path = $this->directoryList->getPath(DirectoryList::DI); if ($this->fileDriver->isExists($path)) { $messages[] = "DI configuration must be cleared before running compiler. Please delete '{$path}'."; } return $messages; }
/** * Check a file or directory exists * * @param string $path [optional] * @return bool * @throws \Magento\Framework\Exception\FileSystemException */ public function isExist($path = null) { return $this->driver->isExists($this->driver->getAbsolutePath($this->path, $path)); }