Skip to content

Commit

Permalink
Merge pull request #152 from Quetzacoalt91/fix-undefined-trans
Browse files Browse the repository at this point in the history
Fix undefined trans in Workspace class
  • Loading branch information
Quetzacoalt91 committed Sep 3, 2018
2 parents 7260ef5 + c4d7e9f commit 5e822cd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
6 changes: 5 additions & 1 deletion classes/UpgradeContainer.php
Expand Up @@ -432,7 +432,11 @@ public function getWorkspace()
$paths[] = $this->getProperty($property);
}

$this->workspace = new Workspace($this->getLogger(), $paths);
$this->workspace = new Workspace(
$this->getLogger(),
$this->getTranslator(),
$paths
);

return $this->workspace;
}
Expand Down
12 changes: 9 additions & 3 deletions classes/Workspace.php
Expand Up @@ -36,25 +36,31 @@ class Workspace
*/
private $logger;

/**
* @var UpgradeTools\Translator
*/
private $translator;

/**
* @var array List of paths used by autoupgrade
*/
private $paths;

public function __construct(LoggerInterface $logger, array $paths)
public function __construct(LoggerInterface $logger, $translator, array $paths)
{
$this->logger = $logger;
$this->translator = $translator;
$this->paths = $paths;
}

public function createFolders()
{
foreach ($this->paths as $path) {
if (!file_exists($path) && !mkdir($path)) {
$this->logger->error($this->trans('Unable to create directory %s', array($path), 'Modules.Autoupgrade.Admin'));
$this->logger->error($this->translator->trans('Unable to create directory %s', array($path), 'Modules.Autoupgrade.Admin'));
}
if (!is_writable($path)) {
$this->logger->error($this->trans('Unable to write in the directory "%s"', array($path), 'Modules.Autoupgrade.Admin'));
$this->logger->error($this->translator->trans('Unable to write in the directory "%s"', array($path), 'Modules.Autoupgrade.Admin'));
}
}
}
Expand Down

0 comments on commit 5e822cd

Please sign in to comment.