Skip to content

Commit ca6c80c

Browse files
committed
Add safe-mode functionality again to guessPluralRule()
1 parent c4d3d6c commit ca6c80c

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

src/Phpbb/TranslationValidator/Validator/ValidatorRunner.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,14 +233,20 @@ protected function printErrorLevel(Output $output)
233233
*/
234234
protected function guessPluralRule(): int
235235
{
236-
// TODO: Check for safeMode and langParser integration here in that function
237236
$filePath = $this->originPath . '/' . $this->originLanguagePath . 'composer.json';
238237

239238
if (file_exists($filePath))
240239
{
241-
242-
$fileContents = (string) file_get_contents($filePath);
243-
$jsonContent = json_decode($fileContents, true);
240+
// Safe mode for safe execution on a server
241+
if ($this->safeMode)
242+
{
243+
$jsonContent = self::langParser($filePath);
244+
}
245+
else
246+
{
247+
$fileContents = (string) file_get_contents($filePath);
248+
$jsonContent = json_decode($fileContents, true);
249+
}
244250

245251
if (!isset($jsonContent['extra']['plural-rule']))
246252
{

0 commit comments

Comments
 (0)