Skip to content

Commit

Permalink
Use of Constant TYPO3_cliMode (#58)
Browse files Browse the repository at this point in the history
* Use of Constant TYPO3_cliMode

Use Constant TYPO3_cliMode only in TYPO3 versions lower 8

* Update DyncssService.php

* Update DyncssService.php

* Update DyncssService.php

* Update DyncssService.php

* Update DyncssService.php
  • Loading branch information
woodyc79 authored and kaystrobach committed Sep 5, 2018
1 parent 762659e commit d7a353a
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions Classes/Service/DyncssService.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,25 @@ public static function getCompiledFile($inputFile)
*/
protected static function fixPathForInput($file)
{
if (empty($file)) {
throw new \InvalidArgumentException('fixPathForInput needs a valid $file, the given value was empty');
}
if (TYPO3_MODE === 'FE') {
$file = GeneralUtility::getFileAbsFileName($file);
} elseif (TYPO3_MODE === 'BE' && !TYPO3_cliMode) {
$file = GeneralUtility::resolveBackPath(PATH_typo3.$file);
return GeneralUtility::getFileAbsFileName($file);
}
if (TYPO3_MODE === 'BE' && !self::isCliRequest()) {
return GeneralUtility::resolveBackPath(PATH_typo3 . $file);
}

return $file;
}

protected static function isCliRequest()
{
if (\version_compare(TYPO3_version, '8.0.0', '>=')) {
return (TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_CLI);
}
return TYPO3_cliMode;
}

/**
* Fixes the path for fe or be usage.
Expand Down

0 comments on commit d7a353a

Please sign in to comment.