Commit 407f8c49 authored by Benni Mack's avatar Benni Mack Committed by Wouter Wolters
Browse files

[TASK] Code and comment clean up

There are several places with typos, or wrong comments.

Additionally, some places still contain a check for PATH_site which dates
back to TYPO3 versions before a clean bootstrap was in place, and
where strict checks in conditions were forgotten.

Resolves: #81031
Releases: master, 8.7
Change-Id: I44e4f1647c52d0eaa843664b08cd05d56ab66aaf
Reviewed-on: https://review.typo3.org/52626


Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Reviewed-by: default avatarThomas Hohn <thomas@hohn.dk>
Reviewed-by: default avatarHenrik Elsner <helsner@dfau.de>
Reviewed-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
parent 8cd574ee
......@@ -90,8 +90,8 @@ class RequestHandler implements RequestHandlerInterface
->checkBackendIpOrDie()
->checkSslBackendAndRedirectIfNeeded()
->initializeBackendRouter()
->loadBaseTca(true)
->loadExtTables(true)
->loadBaseTca()
->loadExtTables()
->initializeBackendUser()
->initializeBackendAuthentication($proceedIfNoUserIsLoggedIn)
->initializeLanguageObject()
......
......@@ -423,7 +423,7 @@ class GeneralUtility
// According to RFC lowercase-representation is recommended
$address = strtolower($address);
// Normalized representation has 39 characters (0000:0000:0000:0000:0000:0000:0000:0000)
if (strlen($address) == 39) {
if (strlen($address) === 39) {
// Already in full expanded form
return $address;
}
......@@ -435,7 +435,7 @@ class GeneralUtility
$left = count($chunksLeft);
$right = count($chunksRight);
// Special case: leading zero-only blocks count to 1, should be 0
if ($left == 1 && strlen($chunksLeft[0]) == 0) {
if ($left === 1 && strlen($chunksLeft[0]) === 0) {
$left = 0;
}
$hiddenBlocks = 8 - ($left + $right);
......@@ -445,7 +445,7 @@ class GeneralUtility
$hiddenPart .= '0000:';
$h++;
}
if ($left == 0) {
if ($left === 0) {
$stageOneAddress = $hiddenPart . $chunks[1];
} else {
$stageOneAddress = $chunks[0] . ':' . $hiddenPart . $chunks[1];
......@@ -1962,10 +1962,6 @@ class GeneralUtility
*/
public static function writeFileToTypo3tempDir($filepath, $content)
{
if (!defined('PATH_site')) {
return 'PATH_site constant was NOT defined!';
}
// Parse filepath into directory and basename:
$fI = pathinfo($filepath);
$fI['dirname'] .= '/';
......@@ -1995,13 +1991,13 @@ class GeneralUtility
}
// Checking dir-name again (sub-dir might have been created):
if (@is_dir($dirName)) {
if ($filepath == $dirName . $fI['basename']) {
if ($filepath === $dirName . $fI['basename']) {
static::writeFile($filepath, $content);
if (!@is_file($filepath)) {
return 'The file was not written to the disk. Please, check that you have write permissions to the typo3temp/ directory.';
}
} else {
return 'Calculated filelocation didn\'t match input "' . $filepath . '".';
return 'Calculated file location didn\'t match input "' . $filepath . '".';
}
} else {
return '"' . $dirName . '" is not a directory!';
......
......@@ -1561,7 +1561,7 @@ class TypoScriptFrontendController
$c = 0;
$page = [];
foreach ($pageArray as $pV) {
if ($c == $pO) {
if ($c === $pO) {
$page = $pV;
break;
}
......@@ -1670,7 +1670,7 @@ class TypoScriptFrontendController
* @param array $row The page record to evaluate (needs fields: hidden, starttime, endtime, fe_group)
* @param bool $bypassGroupCheck Bypass group-check
* @return bool TRUE, if record is viewable.
* @see TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer::getTreeList(), checkPagerecordForIncludeSection()
* @see \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::getTreeList(), checkPagerecordForIncludeSection()
*/
public function checkEnableFields($row, $bypassGroupCheck = false)
{
......@@ -1716,7 +1716,7 @@ class TypoScriptFrontendController
* @param array $row The page record to evaluate (needs fields: extendToSubpages + hidden, starttime, endtime, fe_group)
* @return bool Returns TRUE if either extendToSubpages is not checked or if the enableFields does not disable the page record.
* @access private
* @see checkEnableFields(), TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer::getTreeList(), checkRootlineForIncludeSection()
* @see checkEnableFields(), \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::getTreeList(), checkRootlineForIncludeSection()
*/
public function checkPagerecordForIncludeSection($row)
{
......@@ -1983,7 +1983,7 @@ class TypoScriptFrontendController
} elseif ($code !== '') {
// Check if URL is relative
$url_parts = parse_url($code);
if ($url_parts['host'] == '') {
if ($url_parts['host'] === '') {
$url_parts['host'] = GeneralUtility::getIndpEnv('HTTP_HOST');
if ($code[0] === '/') {
$code = GeneralUtility::getIndpEnv('TYPO3_REQUEST_HOST') . $code;
......@@ -4238,7 +4238,7 @@ class TypoScriptFrontendController
$result = min($result, $this->getFirstTimeValueForRecord($tableDef, $now));
}
// We return + 1 second just to ensure that cache is definitely regenerated
return $result == PHP_INT_MAX ? PHP_INT_MAX : $result - $now + 1;
return $result === PHP_INT_MAX ? PHP_INT_MAX : $result - $now + 1;
}
/**
......
......@@ -20,7 +20,7 @@ namespace TYPO3\CMS\Frontend\Hooks;
class FrontendHooks
{
/**
* Include the preview block in cause we're looking at a hidden page
* Include the preview block in case we're looking at a hidden page
* in the LIVE workspace
*
* @param array $params
......
......@@ -1543,7 +1543,6 @@ class PageRepository
if (!empty($GLOBALS['TCA'][$table]['ctrl']['versioningWS'])
&& (int)VersionState::cast($row['t3ver_state'])->equals(VersionState::MOVE_PLACEHOLDER)
) {
// Only for WS ver 2... (moving) - enabled by default with CMS7
// If t3ver_move_id is not found, then find it (but we like best if it is here)
if (!isset($row['t3ver_move_id'])) {
$moveIDRec = $this->getRawRecord($table, $row['uid'], 't3ver_move_id', true);
......
......@@ -150,7 +150,7 @@ class PageLinkBuilder extends AbstractTypolinkBuilder
}
if ($conf['useCacheHash']) {
$params = $tsfe->linkVars . $addQueryParams . '&id=' . $page['uid'];
if (trim($params, '& ') != '') {
if (trim($params, '& ') !== '') {
$cacheHash = GeneralUtility::makeInstance(CacheHashCalculator::class);
$cHash = $cacheHash->generateForParameters($params);
$addQueryParams .= $cHash ? '&cHash=' . $cHash : '';
......@@ -282,7 +282,7 @@ class PageLinkBuilder extends AbstractTypolinkBuilder
return $tsfe->MP;
}
// Find closest meeting point
// Find closest mount point
// Gets rootline of linked-to page
$tCR_rootline = $tsfe->sys_page->getRootLine($pageId, '', true);
$inverseTmplRootline = array_reverse($tsfe->tmpl->rootLine);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment