Skip to content

Commit

Permalink
[BUGFIX] Replaced Deprecated PATH_site Constant, Updated Utility Func… (
Browse files Browse the repository at this point in the history
  • Loading branch information
masonen authored Jun 5, 2020
1 parent ab6acc1 commit 38752ac
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Classes/Service/AssetService.php
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ protected function copyReferencedFilesAndReplacePaths($contents, $regex, $origin
$newPath = basename($path);
$extension = pathinfo($newPath, PATHINFO_EXTENSION);
$temporaryFileName = 'vhs-assets-css-' . $checksum . '.' . $extension;
$temporaryFile = constant('PATH_site') . $this->getTempPath() . $temporaryFileName;
$temporaryFile = CoreUtility::getSitePath() . $this->getTempPath() . $temporaryFileName;
$rawPath = GeneralUtility::getFileAbsFileName(
$originalDirectory . (empty($originalDirectory) ? '' : '/')
) . $path;
Expand Down
3 changes: 2 additions & 1 deletion Classes/Utility/CoreUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public static function getSitePath(): string
if (defined('PATH_site')) {
return constant('PATH_site');
}
return Environment::getPublicPath();
/** @see https://docs.typo3.org/m/typo3/reference-coreapi/9.5/en-us/ApiOverview/GlobalValues/Constants/Index.html#path-site */
return Environment::getPublicPath() . '/';
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ protected function simulateFrontendEnvironment()
{
$this->tsfeBackup = true === isset($GLOBALS['TSFE']) ? $GLOBALS['TSFE'] : null;
$this->workingDirectoryBackup = getcwd();
chdir(constant('PATH_site'));
chdir(CoreUtility::getSitePath());
$typoScriptSetup = $this->configurationManager->getConfiguration(
ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT
);
Expand Down
2 changes: 1 addition & 1 deletion Classes/ViewHelpers/Resource/AbstractImageViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ protected function simulateFrontendEnvironment()
$template = GeneralUtility::makeInstance(TemplateService::class);
$template->tt_track = 0;
$template->init();
$template->getFileName_backPath = constant('PATH_site');
$template->getFileName_backPath = CoreUtility::getSitePath();
$GLOBALS['TSFE']->tmpl = $template;
$GLOBALS['TSFE']->tmpl->setup = $typoScriptSetup;
$GLOBALS['TSFE']->config = $typoScriptSetup;
Expand Down

0 comments on commit 38752ac

Please sign in to comment.