Skip to content

Commit

Permalink
Merge pull request #26 from martijnvdkerkhof/patch-1
Browse files Browse the repository at this point in the history
Remove use of warning suppression with @ symbol
  • Loading branch information
Hexmage authored Sep 27, 2021
2 parents d4fdfea + f82a70c commit a4afe6f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,23 @@ public function getFileName($locale = 'en_US', $requiredExists = true)
$vendor = $this->getLanguageVendor();
$directoryPath = $this->directoryList->getRoot() . '/app/i18n/' . $vendor . '/missing/';
if (!is_dir($directoryPath)) {
@mkdir($directoryPath, 0777, true);
$mkdirResult = mkdir($directoryPath, 0777, true);
if (false === $mkdirResult) {
throw new \Magento\Framework\Exception\LocalizedException(
new \Magento\Framework\Phrase('Failed to create directory %1', [$directoryPath])
);
}
}
// Fallback for e.g., Magento Cloud, where /app directory has no write access
if (!is_dir($directoryPath)) {
$directoryPath = $this->directoryList->getRoot() . '/var/i18n/' . $vendor . '/missing/';
if (!is_dir($directoryPath)) {
@mkdir($directoryPath, 0777, true);
$mkdirResult = mkdir($directoryPath, 0777, true);
if (false === $mkdirResult) {
throw new \Magento\Framework\Exception\LocalizedException(
new \Magento\Framework\Phrase('Failed to create directory %1', [$directoryPath])
);
}
}
}

Expand Down

0 comments on commit a4afe6f

Please sign in to comment.