Commit d561b172 authored by Fabian Galinski's avatar Fabian Galinski

[TASK] Compatibility issues with TYPO3 9

parent e1c6e855
......@@ -30,10 +30,7 @@ use TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException;
use TYPO3\CMS\Core\Context\Exception\AspectNotFoundException;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
use TYPO3\CMS\Core\Domain\Repository\PageRepositoryGetPageOverlayHookInterface;
use TYPO3\CMS\Core\Domain\Repository\PageRepositoryGetRecordOverlayHookInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Domain\Repository\PageRepository;
use TYPO3\Languagevisibility\Exception\TableNotSupportedException;
use TYPO3\Languagevisibility\Service\FrontendServices;
......@@ -42,7 +39,8 @@ use TYPO3\Languagevisibility\Service\FrontendServices;
*
* @package Aoe\Languagevisibility\Hooks
*/
class PageHook implements PageRepositoryGetPageOverlayHookInterface, PageRepositoryGetRecordOverlayHookInterface {
class PageHook implements \LanguageVisibilityPageRepositoryGetPageOverlayHookInterface,
\LanguageVisibilityPageRepositoryGetRecordOverlayHookInterface {
/**
* This function has various possible results:
......@@ -56,13 +54,13 @@ class PageHook implements PageRepositoryGetPageOverlayHookInterface, PageReposit
*
* @param mixed $pageInput
* @param integer $lUid Passed ad reference!
* @param PageRepository $parent
* @param \LanguageVisibilityPageRepository $parent
* @return void
* @throws NoSuchCacheException
* @throws AspectNotFoundException|TableNotSupportedException
* @throws Exception
*/
public function getPageOverlay_preProcess(&$pageInput, &$lUid, PageRepository $parent): void {
public function getPageOverlay_preProcess(&$pageInput, &$lUid, \LanguageVisibilityPageRepository $parent): void {
if (is_int($pageInput)) {
$pageId = $pageInput;
} elseif (is_array($pageInput) && isset($pageInput['uid'])) {
......@@ -103,12 +101,14 @@ class PageHook implements PageRepositoryGetPageOverlayHookInterface, PageReposit
}
}
public function getRecordOverlay_preProcess($table, &$row, &$sys_language_content, $OLmode, PageRepository $parent
public function getRecordOverlay_preProcess(
$table, &$row, &$sys_language_content, $OLmode, \LanguageVisibilityPageRepository $parent
) {
// Do nothing
}
public function getRecordOverlay_postProcess($table, &$row, &$sys_language_content, $OLmode, PageRepository $parent
public function getRecordOverlay_postProcess(
$table, &$row, &$sys_language_content, $OLmode, \LanguageVisibilityPageRepository $parent
) {
// Do nothing
}
......
......@@ -25,16 +25,17 @@ namespace TYPO3\Languagevisibility\Xclass;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Context\Exception\AspectNotFoundException;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\Languagevisibility\Service\FrontendServices;
/**
* Class PageRepository
*
* The LanguageVisibilityPageRepository is a class_alias from the ext_localconf.php.
*
* @package TYPO3\Languagevisibility\Xclass
*/
class PageRepository extends \TYPO3\CMS\Core\Domain\Repository\PageRepository {
class PageRepository extends \LanguageVisibilityPageRepository {
/**
* This just checks, if the wanted page is available for the current language with the languagevisibility filters
* from the backend. (The Table)
......
......@@ -33,7 +33,6 @@ use TYPO3\CMS\Core\Context\WorkspaceAspect;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Persistence\Generic\Query;
use TYPO3\CMS\Extbase\Persistence\QueryInterface;
use TYPO3\CMS\Core\Domain\Repository\PageRepository;
use TYPO3\CMS\Extbase\Persistence\Generic\Qom;
use TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface;
use TYPO3\Languagevisibility\Service\FrontendServices;
......@@ -69,7 +68,7 @@ class Typo3DbBackend extends \TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo
}
$context = GeneralUtility::makeInstance(Context::class);
$pageRepository = GeneralUtility::makeInstance(PageRepository::class, $context);
$pageRepository = GeneralUtility::makeInstance(\LanguageVisibilityPageRepository::class, $context);
$overlaidRows = [];
foreach ($rows as $row) {
......@@ -201,7 +200,7 @@ class Typo3DbBackend extends \TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo
$context = clone $context;
$context->setAspect('workspace', GeneralUtility::makeInstance(WorkspaceAspect::class, $workspaceUid));
}
$pageRepository = GeneralUtility::makeInstance(PageRepository::class, $context);
$pageRepository = GeneralUtility::makeInstance(\LanguageVisibilityPageRepository::class, $context);
// Fetches the move-placeholder in case it is supported
// by the table and if there's only one row in the result set
......
......@@ -59,8 +59,59 @@ call_user_func(
['className' => \TYPO3\Languagevisibility\Xclass\Typo3DbBackend::class];
$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class] =
['className' => \TYPO3\Languagevisibility\Xclass\ContentObjectRenderer::class];
$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][\TYPO3\CMS\Core\Domain\Repository\PageRepository::class] =
['className' => \TYPO3\Languagevisibility\Xclass\PageRepository::class];
if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '10.3.0', '<')) {
if (!class_exists('LanguageVisibilityPageRepository')) {
/** @noinspection PhpIgnoredClassAliasDeclaration */
class_alias(\TYPO3\CMS\Frontend\Page\PageRepository::class, 'LanguageVisibilityPageRepository');
}
if (!class_exists('LanguageVisibilityPageRepositoryGetPageOverlayHookInterface')) {
/** @noinspection PhpIgnoredClassAliasDeclaration */
class_alias(
\TYPO3\CMS\Frontend\Page\PageRepositoryGetPageOverlayHookInterface::class,
'LanguageVisibilityPageRepositoryGetPageOverlayHookInterface'
);
}
if (!class_exists('LanguageVisibilityPageRepositoryGetRecordOverlayHookInterface')) {
/** @noinspection PhpIgnoredClassAliasDeclaration */
class_alias(
\TYPO3\CMS\Frontend\Page\PageRepositoryGetRecordOverlayHookInterface::class,
'LanguageVisibilityPageRepositoryGetRecordOverlayHookInterface'
);
}
$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][\TYPO3\CMS\Frontend\Page\PageRepository::class] =
['className' => \TYPO3\Languagevisibility\Xclass\PageRepository::class];
} else {
if (!class_exists('LanguageVisibilityPageRepository')) {
/** @noinspection PhpUndefinedClassInspection */
class_alias(
\TYPO3\CMS\Core\Domain\Repository\PageRepository::class,
'LanguageVisibilityPageRepository'
);
}
if (!class_exists('LanguageVisibilityPageRepositoryGetPageOverlayHookInterface')) {
/** @noinspection PhpIgnoredClassAliasDeclaration */
class_alias(
\TYPO3\CMS\Core\Domain\Repository\PageRepositoryGetPageOverlayHookInterface::class,
'LanguageVisibilityPageRepositoryGetPageOverlayHookInterface'
);
}
if (!class_exists('LanguageVisibilityPageRepositoryGetRecordOverlayHookInterface')) {
/** @noinspection PhpIgnoredClassAliasDeclaration */
class_alias(
\TYPO3\CMS\Core\Domain\Repository\PageRepositoryGetRecordOverlayHookInterface::class,
'LanguageVisibilityPageRepositoryGetRecordOverlayHookInterface'
);
}
$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][\TYPO3\CMS\Core\Domain\Repository\PageRepository::class] =
['className' => \TYPO3\Languagevisibility\Xclass\PageRepository::class];
}
if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('mask')) {
$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects']['MASK\Mask\Helper\InlineHelper'] =
......
Markdown is supported
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