Commit 3b82464b authored by Stefan Galinski's avatar Stefan Galinski 🎮

Merge branch 'feature_Upgrade-to-TYPO3-10' into 'master'

Feature upgrade to typo3 10

See merge request !6
parents f2d1d45b 78042ca7
......@@ -274,6 +274,10 @@ class TceMainHook {
* @internal param object $this
*/
public function checkRecordUpdateAccess($table, $id, $data, $res, $tcemain): ?int {
if (!BackendServices::isSupportedTable($table)) {
return $res;
}
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($table);
$queryBuilder->getRestrictions()->removeAll()->add(GeneralUtility::makeInstance(DeletedRestriction::class));
$row = $queryBuilder->select('*')
......
......@@ -113,7 +113,7 @@ class BackendServices extends AbstractServices {
if ($tanslationIdField !== '') {
// if the field which points to the original of the translation is
// not 0 a translation exists and we have an overlay record
$result = (int) $row[$tanslationIdField][0] !== 0;
$result = $row[$tanslationIdField] !== 0;
}
}
......
......@@ -30,6 +30,7 @@ use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Cache\CacheManager;
use TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException;
use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
use TYPO3\CMS\Core\Exception\SiteNotFoundException;
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
use TYPO3\CMS\Core\Site\SiteFinder;
......@@ -125,7 +126,6 @@ class FrontendServices extends AbstractServices implements SingletonInterface {
* @param $element
* @param $lUid
* @return mixed
* @throws Exception
*/
public static function getOverlayLanguageIdForElement($element, $lUid) {
$siteFinder = GeneralUtility::makeInstance(SiteFinder::class);
......@@ -138,11 +138,15 @@ class FrontendServices extends AbstractServices implements SingletonInterface {
try {
$site = $siteFinder->getSiteByPageId($pid);
} catch (Exception $e) {
} catch (SiteNotFoundException $e) {
return FALSE;
}
$language = $site->getLanguageById($lUid);
try {
$language = $site->getLanguageById($lUid);
} catch (\InvalidArgumentException $e) {
return FALSE;
}
if (!$language instanceof SiteLanguage) {
return FALSE;
......
......@@ -70,7 +70,6 @@ class VisibilityService implements SingletonInterface {
* @param SiteLanguage $language
* @param Element $element
* @return mixed
* @throws \Exception
*/
public function getOverlayLanguageIdForLanguageAndElement(SiteLanguage $language, Element $element) {
if ($this->isVisible($language, $element)) {
......@@ -123,7 +122,6 @@ class VisibilityService implements SingletonInterface {
* @param SiteLanguage $language
* @param Element $element
* @return boolean
* @throws \Exception
*/
public function isVisible(SiteLanguage $language, Element $element): bool {
$this->_relevantOverlayLanguageId = $language->getLanguageId();
......@@ -140,7 +138,6 @@ class VisibilityService implements SingletonInterface {
* @param $language
* @param $element
* @return bool
* @throws \Exception
*/
public function resolveVisibility($visibility, $language, $element): bool {
......@@ -249,7 +246,6 @@ class VisibilityService implements SingletonInterface {
* @param SiteLanguage $language
* @param Element $element
* @return string
* @throws DBALException
*/
public function getVisibilitySetting(SiteLanguage $language, Element $element): string {
......@@ -289,7 +285,6 @@ class VisibilityService implements SingletonInterface {
* @param SiteLanguage $language
* @param Element $element
* @return Visibility
* @throws DBALException
*/
protected function getVisibility(SiteLanguage $language, Element $element): Visibility {
$visibility = new Visibility();
......@@ -371,19 +366,18 @@ class VisibilityService implements SingletonInterface {
*
* @param $languageUid
* @return string
* @throws DBALException
*/
protected function getDefaultVisibilityForPagesByLanguage($languageUid): string {
if ($this->cachedDefaultVisibilityForPages === NULL) {
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
->getConnectionForTable('sys_language');
$results = $queryBuilder->prepare('SELECT uid FROM sys_language');
->getQueryBuilderForTable('sys_language');
$results = $queryBuilder->select('uid')
->from('sys_language')
->execute();
$this->cachedDefaultVisibilityForPages[0] = 'fallback';
if ($results->execute()) {
foreach ($results->fetchAll() as $entry) {
$this->cachedDefaultVisibilityForPages[$entry['uid']] = 'active';
}
while ($entry = $results->fetch()) {
$this->cachedDefaultVisibilityForPages[$entry['uid']] = 'active';
}
}
......
......@@ -30,9 +30,10 @@ use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Context\Exception\AspectNotFoundException;
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\Frontend\Page\PageRepository;
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;
......@@ -67,9 +68,8 @@ class Typo3DbBackend extends \TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo
return $rows;
}
$context = $this->objectManager->get(Context::class);
$pageRepository = $this->objectManager->get(PageRepository::class, $context);
$context = GeneralUtility::makeInstance(Context::class);
$pageRepository = GeneralUtility::makeInstance(PageRepository::class, $context);
$overlaidRows = [];
foreach ($rows as $row) {
......@@ -192,16 +192,16 @@ class Typo3DbBackend extends \TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo
return $rows;
}
$context = $this->objectManager->get(Context::class);
$context = GeneralUtility::makeInstance(Context::class);
if ($workspaceUid === NULL) {
$workspaceUid = $context->getPropertyFromAspect('workspace', 'id');
} else {
// A custom query is needed, so a custom context is cloned
$workspaceUid = (int) $workspaceUid;
$context = clone $context;
$context->setAspect('workspace', $this->objectManager->get(WorkspaceAspect::class, $workspaceUid));
$context->setAspect('workspace', GeneralUtility::makeInstance(WorkspaceAspect::class, $workspaceUid));
}
$pageRepository = $this->objectManager->get(PageRepository::class, $context);
$pageRepository = GeneralUtility::makeInstance(PageRepository::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
......
......@@ -5,3 +5,7 @@
- Install Tool: Apply all changed fields.
- Upgrade Wizard: Execute the "VisibilitySettingsMigrationWizard"-Wizard.
- Remove all old fields.
# Version 4 Breaking Changes
- Dropped TYPO3 8 Support
......@@ -5,12 +5,12 @@
"keywords": ["TYPO3 CMS", "language"],
"homepage": "https://www.sgalinski.de",
"license": ["GPL-2.0-or-later"],
"version": "3.0.1",
"version": "3.0.2-dev",
"support": {
"issues": "https://gitlab.sgalinski.de/typo3/languagevisibility"
},
"require": {
"typo3/cms-core": "^9.5.2"
"typo3/cms-core": "^9.5.2 || ^10.4.0"
},
"require-dev": {
"roave/security-advisories": "dev-master"
......
......@@ -8,7 +8,7 @@
# writing. "version" and "dependencies" must not be touched!
########################################################################
$EM_CONF[$_EXTKEY] = [
$EM_CONF['languagevisibility'] = [
'title' => 'Language Visibility',
'description' => 'Enables multi level language fallback and introduces the languagevisibility concept. Fork of the AOE GmbH extension',
'category' => 'fe',
......@@ -20,18 +20,18 @@ $EM_CONF[$_EXTKEY] = [
'conflicts' => '',
'priority' => '',
'module' => '',
'state' => 'stable',
'state' => 'experimental',
'internal' => '',
'uploadfolder' => 0,
'createDirs' => '',
'modify_tables' => '',
'clearCacheOnLoad' => 1,
'lockType' => '',
'version' => '3.0.1',
'version' => '3.0.2-dev',
'constraints' => [
'depends' => [
'php' => '7.2.0-7.3.99',
'typo3' => '9.5.0-9.5.99',
'php' => '7.3.0-7.4.99',
'typo3' => '9.5.0-10.4.99',
],
'conflicts' => [
'danp_languagefallback_patch' => '',
......
......@@ -2,7 +2,7 @@
# Table structure for table 'pages'
#
CREATE TABLE pages (
tx_languagevisibility_visibility text NOT NULL,
tx_languagevisibility_visibility text NOT NULL
);
#
......@@ -16,14 +16,8 @@ CREATE TABLE tt_content (
# Table structure for table 'tx_languagevisibility_visibility_flag'
#
CREATE TABLE tx_languagevisibility_visibility_flag (
uid int(11) NOT NULL auto_increment,
pid int(11) DEFAULT '0' NOT NULL,
tstamp int(11) unsigned DEFAULT '0' NOT NULL,
crdate int(11) unsigned DEFAULT '0' NOT NULL,
cruser_id int(11) unsigned DEFAULT '0' NOT NULL,
record_table text NOT NULL,
record_uid text DEFAULT '' NOT NULL,
record_language_uid int(11) DEFAULT '0' NOT NULL,
flag text NOT NULL,
PRIMARY KEY (uid)
flag text NOT NULL
);
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