Commit 38becb6e authored by Christian Kuhn's avatar Christian Kuhn Committed by Benni Mack
Browse files

[!!!][TASK] Do not handle 'uploadsfolder' in ext_emconf anymore

With TCA type=group with internal_type=file and
file_reference being dropped, the uploads/ folder
is unused and obsolete.
The patch drops further related code in this area,
especially the ext_emconf.php property uploadsfolder
is obsolete. It is dropped from all ext_emconf.php
files together with its handling in extensionmanager.

Change-Id: I93abc7d614b17adf4d0f2f896e346d3147c49472
Resolves: #87445
Releases: master
Reviewed-on: https://review.typo3.org/59443


Tested-by: default avatarTYPO3com <noreply@typo3.com>
Reviewed-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
parent 86574626
......@@ -4,7 +4,6 @@ $EM_CONF[$_EXTKEY] = [
'description' => 'Shows info about TYPO3, installed extensions and a separate module for available modules.',
'category' => 'module',
'state' => 'stable',
'uploadfolder' => 0,
'createDirs' => '',
'clearCacheOnLoad' => 0,
'author' => 'TYPO3 Core Team',
......
......@@ -4,7 +4,6 @@ $EM_CONF[$_EXTKEY] = [
'description' => 'The TYPO3 admin panel provides a panel with additional functionality in the frontend (Debugging, Caching, Preview...)',
'category' => 'fe',
'state' => 'stable',
'uploadfolder' => 0,
'createDirs' => '',
'clearCacheOnLoad' => 1,
'author' => 'TYPO3 Core Team',
......
......@@ -4,7 +4,6 @@ $EM_CONF[$_EXTKEY] = [
'description' => 'Classes for the TYPO3 backend.',
'category' => 'be',
'state' => 'stable',
'uploadfolder' => 0,
'createDirs' => '',
'clearCacheOnLoad' => 0,
'author' => 'TYPO3 Core Team',
......
......@@ -4,7 +4,6 @@ $EM_CONF[$_EXTKEY] = [
'description' => 'Displays backend log, both per page and system wide. Available as the module Tools>Log (system wide overview) and Web>Info/Log (page relative overview).',
'category' => 'module',
'state' => 'stable',
'uploadfolder' => 0,
'createDirs' => '',
'clearCacheOnLoad' => 0,
'author' => 'TYPO3 Core Team',
......
......@@ -7,7 +7,6 @@ $EM_CONF[$_EXTKEY] = [
'author_email' => 'typo3cms@typo3.org',
'author_company' => '',
'state' => 'stable',
'uploadfolder' => 0,
'createDirs' => '',
'clearCacheOnLoad' => 0,
'version' => '10.0.0',
......
......@@ -16,7 +16,6 @@ namespace TYPO3\CMS\Core\Database;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\Database\Query\QueryHelper;
use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
use TYPO3\CMS\Core\Localization\LanguageService;
......@@ -58,7 +57,7 @@ class QueryGenerator
'41_' => 'binary AND does not equal',
'42_' => 'binary OR equals',
'43_' => 'binary OR does not equal',
// Type = multiple, relation, files , offset = 64
// Type = multiple, relation, offset = 64
'64_' => 'equals',
'65_' => 'does not equal',
'66_' => 'contains',
......@@ -117,7 +116,7 @@ class QueryGenerator
'41' => '(#FIELD# & #VALUE#)!=#VALUE#',
'42' => '(#FIELD# | #VALUE#)=#VALUE#',
'43' => '(#FIELD# | #VALUE#)!=#VALUE#',
// Type = multiple, relation, files , offset = 64
// Type = multiple, relation, offset = 64
'64' => '#FIELD# = \'#VALUE#\'',
'65' => '#FIELD# != \'#VALUE#\'',
'66' => '#FIELD# LIKE \'%#VALUE#%\' AND #FIELD# LIKE \'%#VALUE1#%\'',
......@@ -157,7 +156,6 @@ class QueryGenerator
'number' => 1,
'multiple' => 2,
'relation' => 2,
'files' => 2,
'date' => 3,
'time' => 3,
'boolean' => 4,
......@@ -334,7 +332,6 @@ class QueryGenerator
}
break;
case 'group':
$this->fields[$fieldName]['type'] = 'files';
if ($this->fields[$fieldName]['internal_type'] === 'db') {
$this->fields[$fieldName]['type'] = 'relation';
}
......@@ -688,21 +685,6 @@ class QueryGenerator
}
$lineHTML[] = '</div>';
break;
case 'files':
$lineHTML[] = '<div class="form-inline">';
$lineHTML[] = $this->makeComparisonSelector($subscript, $fieldName, $conf);
if ($conf['comparison'] === 68 || $conf['comparison'] === 69) {
$lineHTML[] = '<select class="form-control" name="' . $fieldPrefix . '[inputValue]' . '[]" multiple="multiple">';
} else {
$lineHTML[] = '<select class="form-control t3js-submit-change" name="' . $fieldPrefix . '[inputValue]' . '">';
}
$lineHTML[] = '<option value=""></option>' . $this->makeOptionList($fieldName, $conf, $this->table);
$lineHTML[] = '</select>';
if ($conf['comparison'] === 66 || $conf['comparison'] === 67) {
$lineHTML[] = ' + <input class="form-control t3js-clearable" type="text" value="' . htmlspecialchars($conf['inputValue1']) . '" name="' . $fieldPrefix . '[inputValue1]' . '">';
}
$lineHTML[] = '</div>';
break;
case 'boolean':
$lineHTML[] = '<div class="form-inline">';
$lineHTML[] = $this->makeComparisonSelector($subscript, $fieldName, $conf);
......@@ -783,35 +765,6 @@ class QueryGenerator
$out = [];
$fieldSetup = $this->fields[$fieldName];
$languageService = $this->getLanguageService();
if ($fieldSetup['type'] === 'files') {
if ($conf['comparison'] === 66 || $conf['comparison'] === 67) {
$fileExtArray = explode(',', $fieldSetup['allowed']);
natcasesort($fileExtArray);
foreach ($fileExtArray as $fileExt) {
if (GeneralUtility::inList($conf['inputValue'], $fileExt)) {
$out[] = '<option value="' . htmlspecialchars($fileExt) . '" selected>.' . htmlspecialchars($fileExt) . '</option>';
} else {
$out[] = '<option value="' . htmlspecialchars($fileExt) . '">.' . htmlspecialchars($fileExt) . '</option>';
}
}
}
$d = dir(Environment::getPublicPath() . '/' . $fieldSetup['uploadfolder']);
while (false !== ($entry = $d->read())) {
if ($entry === '.' || $entry === '..') {
continue;
}
$fileArray[] = $entry;
}
$d->close();
natcasesort($fileArray);
foreach ($fileArray as $fileName) {
if (GeneralUtility::inList($conf['inputValue'], $fileName)) {
$out[] = '<option value="' . htmlspecialchars($fileName) . '" selected>' . htmlspecialchars($fileName) . '</option>';
} else {
$out[] = '<option value="' . htmlspecialchars($fileName) . '">' . htmlspecialchars($fileName) . '</option>';
}
}
}
if ($fieldSetup['type'] === 'multiple') {
foreach ($fieldSetup['items'] as $key => $val) {
if (strpos($val[0], 'LLL:') === 0) {
......
......@@ -17,7 +17,6 @@ namespace TYPO3\CMS\Core\Database;
use Doctrine\DBAL\DBALException;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\Database\Query\QueryHelper;
use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
use TYPO3\CMS\Core\Imaging\Icon;
......@@ -815,7 +814,6 @@ class QueryView
}
break;
case 'group':
$fields['type'] = 'files';
if ($fields['internal_type'] === 'db') {
$fields['type'] = 'relation';
}
......@@ -871,7 +869,6 @@ class QueryView
case 'boolean':
$out = $fieldValue ? 'True' : 'False';
break;
case 'files':
default:
$out = htmlspecialchars($fieldValue);
}
......@@ -938,25 +935,6 @@ class QueryView
{
$fieldSetup = $conf;
$out = '';
if ($fieldSetup['type'] === 'files') {
$d = dir(Environment::getPublicPath() . '/' . $fieldSetup['uploadfolder']);
while (false !== ($entry = $d->read())) {
if ($entry === '.' || $entry === '..') {
continue;
}
$fileArray[] = $entry;
}
$d->close();
natcasesort($fileArray);
foreach ($fileArray as $fileName) {
if (GeneralUtility::inList($fieldValue, $fileName) || $fieldValue == $fileName) {
if ($out !== '') {
$out .= $splitString;
}
$out .= htmlspecialchars($fileName);
}
}
}
if ($fieldSetup['type'] === 'multiple') {
foreach ($fieldSetup['items'] as $key => $val) {
if (strpos($val[0], 'LLL:') === 0) {
......
......@@ -1295,6 +1295,7 @@ The following features have been removed:
* TCA :php:`type='group'` with :php:`internal_type='file'` and :php:`internal_type='file_reference`
* Cache creation using :php:`\TYPO3\CMS\Cache\CacheManger` during :php:`ext_localconf.php` loading
* All install tool upgrade wizards upgrading from v7 to v8 have been removed
* The array key :php:`uploadfolder` in extensions :php:`ext_emconf.php` files is obsolete and ignored
The following database tables have been removed:
......
......@@ -5,7 +5,6 @@ $EM_CONF[$_EXTKEY] = [
'category' => '',
'version' => '10.0.0',
'state' => 'beta',
'uploadfolder' => 0,
'createDirs' => '',
'clearCacheOnLoad' => 0,
'author' => 'Christian Kuhn',
......
......@@ -5,7 +5,6 @@ $EM_CONF[$_EXTKEY] = [
'category' => 'example',
'version' => '10.0.0',
'state' => 'beta',
'uploadfolder' => 0,
'createDirs' => '',
'clearCacheOnLoad' => 0,
'author' => 'Christian Kuhn',
......
......@@ -5,7 +5,6 @@ $EM_CONF[$_EXTKEY] = [
'category' => 'example',
'version' => '10.0.0',
'state' => 'beta',
'uploadfolder' => 0,
'createDirs' => '',
'clearCacheOnLoad' => 0,
'author' => 'Oliver Hader',
......
......@@ -5,7 +5,6 @@ $EM_CONF[$_EXTKEY] = [
'category' => 'example',
'version' => '10.0.0',
'state' => 'beta',
'uploadfolder' => 0,
'createDirs' => '',
'clearCacheOnLoad' => 0,
'author' => 'Oliver Hader',
......
......@@ -5,7 +5,6 @@ $EM_CONF[$_EXTKEY] = [
'category' => 'example',
'version' => '10.0.0',
'state' => 'beta',
'uploadfolder' => 0,
'createDirs' => '',
'clearCacheOnLoad' => 0,
'author' => 'Oliver Hader',
......
......@@ -4,7 +4,6 @@ $EM_CONF[$_EXTKEY] = [
'description' => 'This is a fixture extension configuration file used for unit tests.',
'category' => '',
'state' => 'stable',
'uploadfolder' => 0,
'createDirs' => '',
'clearCacheOnLoad' => 0,
'author' => '',
......
......@@ -4,7 +4,6 @@ $EM_CONF[$_EXTKEY] = [
'description' => 'The core library of TYPO3.',
'category' => 'be',
'state' => 'stable',
'uploadfolder' => 0,
'createDirs' => '',
'clearCacheOnLoad' => 0,
'author' => 'TYPO3 Core Team',
......
......@@ -7,7 +7,6 @@ $EM_CONF[$_EXTKEY] = [
'author_company' => '',
'author_email' => '',
'state' => 'stable',
'uploadfolder' => 0,
'createDirs' => '',
'clearCacheOnLoad' => 1,
'version' => '10.0.0',
......
......@@ -7,7 +7,6 @@ $EM_CONF[$_EXTKEY] = [
'author_email' => 'typo3cms@typo3.org',
'author_company' => '',
'state' => 'stable',
'uploadfolder' => 0,
'createDirs' => '',
'clearCacheOnLoad' => 1,
'version' => '10.0.0',
......
......@@ -259,32 +259,15 @@ class FileHandlingUtility implements \TYPO3\CMS\Core\SingletonInterface
protected function getAbsolutePathsToConfiguredDirectories(array $extension)
{
$requestedDirectories = [];
$requestUploadFolder = isset($extension['uploadfolder']) ? (bool)$extension['uploadfolder'] : false;
if ($requestUploadFolder) {
$requestedDirectories[] = $this->getAbsolutePath($this->getPathToUploadFolder($extension));
}
$requestCreateDirectories = empty($extension['createDirs']) ? false : (string)$extension['createDirs'];
if ($requestCreateDirectories) {
foreach (GeneralUtility::trimExplode(',', $extension['createDirs']) as $directoryToCreate) {
$requestedDirectories[] = $this->getAbsolutePath($directoryToCreate);
}
}
return $requestedDirectories;
}
/**
* Upload folders always reside in “uploads/tx_[extKey-with-no-underscore]”
*
* @param array $extension
* @return string
*/
protected function getPathToUploadFolder($extension)
{
return 'uploads/tx_' . str_replace('_', '', $extension['key']) . '/';
}
/**
* Remove specified directory
*
......
......@@ -455,22 +455,6 @@ class FileHandlingUtilityTest extends UnitTestCase
return $fileHandlerMock;
}
/**
* @test
*/
public function uploadFolderIsNotCreatedIfNotRequested()
{
$fileHandlerMock = $this->getPreparedFileHandlingMockForDirectoryCreationTests();
$fileHandlerMock->expects($this->never())
->method('createNestedDirectory');
$fileHandlerMock->ensureConfiguredDirectoriesExist(
[
'key' => 'foo_bar',
'uploadfolder' => 0,
]
);
}
/**
* @test
*/
......@@ -487,23 +471,6 @@ class FileHandlingUtilityTest extends UnitTestCase
);
}
/**
* @test
*/
public function configuredUploadFolderIsCreatedIfRequested()
{
$fileHandlerMock = $this->getPreparedFileHandlingMockForDirectoryCreationTests();
$fileHandlerMock->expects($this->once())
->method('createNestedDirectory')
->with('uploads/tx_foobar/');
$fileHandlerMock->ensureConfiguredDirectoriesExist(
[
'key' => 'foo_bar',
'uploadfolder' => 1,
]
);
}
/**
* @test
*/
......@@ -533,7 +500,7 @@ class FileHandlingUtilityTest extends UnitTestCase
public function configuredDirectoriesAreNotCreatedIfTheyAlreadyExist()
{
$fileHandlerMock = $this->getPreparedFileHandlingMockForDirectoryCreationTests();
$fileHandlerMock->expects($this->exactly(3))
$fileHandlerMock->expects($this->exactly(2))
->method('directoryExists')
->will($this->returnValue(true));
$fileHandlerMock->expects($this->never())
......@@ -541,7 +508,6 @@ class FileHandlingUtilityTest extends UnitTestCase
$fileHandlerMock->ensureConfiguredDirectoriesExist(
[
'key' => 'foo_bar',
'uploadfolder' => 1,
'createDirs' => 'foo/bar, baz/foo',
]
);
......
......@@ -4,7 +4,6 @@ $EM_CONF[$_EXTKEY] = [
'description' => 'TYPO3 Extension Manager',
'category' => 'module',
'state' => 'stable',
'uploadfolder' => 0,
'createDirs' => '',
'clearCacheOnLoad' => 0,
'author' => 'TYPO3 Core Team',
......
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