Commit 09679458 authored by Paul Ilea's avatar Paul Ilea
Browse files

[TASK] TYPO3 v8 compatibility updates

parent e000aa1c
......@@ -33,6 +33,7 @@ use TYPO3\CMS\Backend\Template\Components\DocHeaderComponent;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\VersionNumberUtility;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
......@@ -199,6 +200,8 @@ class MailController extends ActionController {
$this->view->assign('selectedLanguageRight', $selectedLanguages['right']);
$this->view->assign('mode', 'editor');
}
$this->view->assign('typo3Version', VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version));
}
/**
......
......@@ -31,6 +31,7 @@ use TYPO3\CMS\Backend\Template\Components\DocHeaderComponent;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\VersionNumberUtility;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
......@@ -90,6 +91,7 @@ class QueueController extends ActionController {
$this->view->assign('queue', $queue);
$this->view->assign('mode', 'queue');
}
$this->view->assign('typo3Version', VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version));
}
/**
......
......@@ -322,13 +322,22 @@ class MailTemplateService {
/** @var array $markerArray */
$markerArray = self::$registerArray[$this->extensionKey][$this->templateName]['marker'];
foreach ($markerArray as $marker) {
if ($marker['backend_translation_key']) {
$previewMarker[$marker['marker']] = LocalizationUtility::translate(
$marker['backend_translation_key'], $marker['extension_key']
);
} else {
$previewMarker[$marker['marker']] = $marker['value'];
$markerPath = GeneralUtility::trimExplode('.', $marker['marker']);
$temporaryMarkerArray = [];
foreach (array_reverse($markerPath) as $index => $markerPathSegment) {
if ($index === 0) {
if ($marker['backend_translation_key']) {
$temporaryMarkerArray[$markerPathSegment] = LocalizationUtility::translate(
$marker['backend_translation_key'], $marker['extension_key']
);
} else {
$temporaryMarkerArray[$markerPathSegment] = $marker['value'];
}
} else {
$temporaryMarkerArray = [ $markerPathSegment => $temporaryMarkerArray];
}
}
$previewMarker = array_merge_recursive($previewMarker, $temporaryMarkerArray);
}
$this->setIgnoreMailQueue(TRUE);
$this->setMarkers($previewMarker);
......
......@@ -58,18 +58,23 @@ class MigrateData extends AbstractUpdate {
*/
public function checkForUpdate(&$description) {
$description = 'Set the site_root_id for all the queue entries and templates if not set or pid = 0';
$oldRowsFound = FALSE;
$databaseConnection = $this->getDatabaseConnection();
$databaseConnection = $GLOBALS['TYPO3_DB'];
$where = 'site_root_id = 0';
foreach ($this->tables as $table) {
$result = $databaseConnection->exec_SELECTquery('*', $table, $where);
if ($result->num_rows > 0) {
return TRUE;
$oldRowsFound = TRUE;
break;
}
}
if (!$oldRowsFound || $this->isWizardDone()) {
return FALSE;
}
return FALSE;
return TRUE;
}
/**
......@@ -80,7 +85,7 @@ class MigrateData extends AbstractUpdate {
* @return bool Whether everything went smoothly or not
*/
public function performUpdate(array &$dbQueries, &$customMessages) {
$databaseConnection = $this->getDatabaseConnection();
$databaseConnection = $GLOBALS['TYPO3_DB'];
foreach ($this->tables as $table) {
$where = 'site_root_id = 0';
......@@ -111,7 +116,7 @@ class MigrateData extends AbstractUpdate {
* @return int
*/
private function retrieveFirstSiteRoot() {
$databaseConnection = $this->getDatabaseConnection();
$databaseConnection = $GLOBALS['TYPO3_DB'];
$where = "is_siteroot = 1 AND uid <> '0'";
$pagesResult = $databaseConnection->exec_SELECTgetSingleRow('uid', 'pages', $where, '', '', '1');
$dbQueries[] = $databaseConnection->debug_lastBuiltQuery;
......
{namespace sgm=SGalinski\SgMail\ViewHelpers}
<f:be.container enableClickMenu="FALSE" loadExtJs="FALSE" includeCssFiles="{0: '{f:uri.resource(path: \'StyleSheets/backend.css\')}'}"
includeRequireJsModules="{0: 'TYPO3/CMS/Backend/AjaxDataHandler', 1: 'TYPO3/CMS/Backend/ClickMenu', 2: 'TYPO3/CMS/Backend/Tooltip'}">
includeRequireJsModules="{
0: 'TYPO3/CMS/Backend/AjaxDataHandler',
1: '{f:if(condition: \'{typo3Version} < 8000000 \', then: \'TYPO3/CMS/Backend/ClickMenu\', else: \'TYPO3/CMS/Backend/ContextMenu\')}',
2: 'TYPO3/CMS/Backend/Tooltip'}">
<sgm:addJavaScriptFile javaScriptFile="{f:uri.resource(path: 'Scripts/Backend.js')}" />
<sgm:inlineLanguageLabels labels="backend.delete_template, backend.send_mail_manually, backend.send_mail_again" />
<div class="module" data-module-id="" data-module-name="">
......
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