8 use Symfony\Component\Console\Output\OutputInterface;
97 private $functionCallPath;
102 private $userCollection;
129 \
Magento\Store\Model\Config\StoreView $storeView,
131 UserCollection $userCollection =
null,
134 $this->writer = $writer;
135 $this->reader = $reader;
139 $this->driverFile = $driverFile;
140 $this->storeView = $storeView;
142 $this->userCollection = $userCollection ?: $this->objectManager->get(UserCollection::class);
143 $this->locale = $locale ?: $this->objectManager->get(Locale::class);
144 $this->functionCallPath =
145 PHP_BINARY .
' -f ' .
BP . DIRECTORY_SEPARATOR .
'bin' . DIRECTORY_SEPARATOR .
'magento ';
184 $output->writeln(
'Starting deployment of static content');
185 $cmd = $this->functionCallPath .
'setup:static-content:deploy -f ' 186 . implode(
' ', $this->getUsedLocales());
192 $execOutput = $this->shell->execute($cmd);
194 $output->writeln(
'Something went wrong while deploying static content. See the error log for details.');
198 $output->writeln(
'Deployment of static content complete');
206 private function getAdminUserInterfaceLocales()
209 foreach ($this->userCollection as
$user) {
221 private function getUsedLocales()
223 $usedLocales = array_merge(
224 $this->storeView->retrieveLocales(),
225 $this->getAdminUserInterfaceLocales()
230 if (!$this->locale->isValid($locale)) {
231 throw new \InvalidArgumentException(
232 $locale .
' argument has invalid value, run info:language:list for list of available locales' 238 array_unique($usedLocales)
251 $output->writeln(
'Starting compilation');
259 $cmd = $this->functionCallPath .
'setup:di:compile';
268 $execOutput = $this->shell->execute($cmd);
270 $output->writeln(
'Something went wrong while compiling generated code. See the error log for details.');
274 $output->writeln(
'Compilation complete');
285 $excludePatterns = [
'#.htaccess#',
'#deployed_version.txt#'];
286 foreach ($directoryCodeList as
$code) {
289 if ($this->driverFile->isExists($directoryPath)) {
290 $files = $this->driverFile->readDirectory($directoryPath);
291 foreach (
$files as $file) {
292 foreach ($excludePatterns as
$pattern) {
297 if ($this->driverFile->isFile($file)) {
298 $this->driverFile->deleteFile($file);
300 $this->driverFile->deleteDirectory($file);
305 $this->filesystem->getDirectoryWrite(
$code)
328 foreach ($directoryCodeList as
$code) {
329 $directoryPath = $this->directoryList->getPath(
$code);
330 if ($this->driverFile->isExists($directoryPath)) {
331 $this->filesystem->getDirectoryWrite(
$code)
332 ->changePermissionsRecursively(
'', $dirPermissions, $filePermissions);
334 $this->driverFile->createDirectory($directoryPath, $dirPermissions);
360 self::PERMISSIONS_DIR,
361 self::PERMISSIONS_FILE
const TMP_MATERIALIZATION_DIR
compile(OutputInterface $output)
cleanupFilesystem($directoryCodeList)
if(!file_exists($installConfigFile)) if(!defined('TESTS_INSTALLATION_DB_CONFIG_FILE')) $shell
__construct(\Magento\Framework\App\DeploymentConfig\Writer $writer, \Magento\Framework\App\DeploymentConfig\Reader $reader, \Magento\Framework\ObjectManagerInterface $objectManager, \Magento\Framework\Filesystem $filesystem, \Magento\Framework\App\Filesystem\DirectoryList $directoryList, \Magento\Framework\Filesystem\Driver\File $driverFile, \Magento\Store\Model\Config\StoreView $storeView, \Magento\Framework\ShellInterface $shell, UserCollection $userCollection=null, Locale $locale=null)
deployStaticContent(OutputInterface $output)
regenerateStatic(OutputInterface $output)
changePermissions($directoryCodeList, $dirPermissions, $filePermissions)
foreach($appDirs as $dir) $files