diff --git a/typo3/sysext/core/Classes/Resource/AbstractRepository.php b/typo3/sysext/core/Classes/Resource/AbstractRepository.php index c80dbc94ee82..53838405864d 100644 --- a/typo3/sysext/core/Classes/Resource/AbstractRepository.php +++ b/typo3/sysext/core/Classes/Resource/AbstractRepository.php @@ -133,10 +133,11 @@ public function getRemovedObjects() { */ public function findAll() { $itemList = array(); - $whereClause = 'deleted = 0'; + $whereClause = '1=1'; if ($this->type != '') { - $whereClause .= ' AND ' . $this->typeField . ' = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->type, $this->table); + $whereClause .= ' AND ' . $this->typeField . ' = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->type, $this->table) . ' '; } + $whereClause .= $this->getWhereClauseForEnabledFields(); $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $this->table, $whereClause); while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $itemList[] = $this->createDomainObject($row); @@ -189,13 +190,32 @@ public function findByUid($uid) { if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($uid)) { throw new \InvalidArgumentException('uid has to be integer.', 1316779798); } - $row = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*', $this->table, 'uid=' . intval($uid) . ' AND deleted=0'); + $row = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*', $this->table, 'uid=' . intval($uid) . $this->getWhereClauseForEnabledFields()); if (empty($row) || !is_array($row)) { throw new \RuntimeException('Could not find row with uid "' . $uid . '" in table ' . $this->table, 1314354065); } return $this->createDomainObject($row); } + /** + * get the WHERE clause for the enabled fields of this TCA table + * depending on the context + * + * @return string the additional where clause, something like " AND deleted=0 AND hidden=0" + */ + protected function getWhereClauseForEnabledFields() { + if ($this->getEnvironmentMode() === 'FE') { + // frontend context + $whereClause = $GLOBALS['TSFE']->sys_page->enableFields($this->table); + $whereClause .= $GLOBALS['TSFE']->sys_page->deleteClause($this->table); + } else { + // backend context + $whereClause = \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields($this->table); + $whereClause .= \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($this->table); + } + return $whereClause; + } + /** * Sets the property names to order the result by per default. * Expected like this: diff --git a/typo3/sysext/core/Classes/Resource/ResourceFactory.php b/typo3/sysext/core/Classes/Resource/ResourceFactory.php index 6a5b8a0c8076..951c488dc541 100644 --- a/typo3/sysext/core/Classes/Resource/ResourceFactory.php +++ b/typo3/sysext/core/Classes/Resource/ResourceFactory.php @@ -338,7 +338,7 @@ public function getFileObject($uid, array $fileData = array()) { // Fetches data in case $fileData is empty if (empty($fileData)) { /** @var $GLOBALS['TYPO3_DB'] \TYPO3\CMS\Core\Database\DatabaseConnection */ - $fileData = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*', 'sys_file', 'uid=' . intval($uid) . ' AND deleted=0'); + $fileData = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*', 'sys_file', 'uid=' . intval($uid)); if (!is_array($fileData)) { throw new \TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException('No file found for given UID.', 1317178604); } diff --git a/typo3/sysext/core/Classes/Resource/Service/IndexerService.php b/typo3/sysext/core/Classes/Resource/Service/IndexerService.php index 41307a64daf6..d60ec6dc4f9f 100644 --- a/typo3/sysext/core/Classes/Resource/Service/IndexerService.php +++ b/typo3/sysext/core/Classes/Resource/Service/IndexerService.php @@ -97,7 +97,6 @@ public function indexFile(\TYPO3\CMS\Core\Resource\File $fileObject, $updateObje // If the file is already indexed, then the file information will // be updated on the existing record if ($fileObject->isIndexed()) { - $fileInfo['deleted'] = 0; $fileInfo['missing'] = 0; $GLOBALS['TYPO3_DB']->exec_UPDATEquery('sys_file', sprintf('uid = %d', $fileObject->getUid()), $fileInfo); } else { @@ -110,7 +109,6 @@ public function indexFile(\TYPO3\CMS\Core\Resource\File $fileObject, $updateObje if (!$otherFile->exists()) { // @todo: create a log entry $movedFile = TRUE; - $fileInfo['deleted'] = 0; $fileInfo['missing'] = 0; $otherFile->updateProperties($fileInfo); $this->getRepository()->update($otherFile); diff --git a/typo3/sysext/core/Classes/Resource/StorageRepository.php b/typo3/sysext/core/Classes/Resource/StorageRepository.php index ea07d20558e0..027e9e1246ee 100644 --- a/typo3/sysext/core/Classes/Resource/StorageRepository.php +++ b/typo3/sysext/core/Classes/Resource/StorageRepository.php @@ -199,25 +199,6 @@ protected function createDomainObject(array $databaseRow) { return $this->factory->getStorageObject($databaseRow['uid'], $databaseRow); } - /** - * get the WHERE clause for the enabled fields of this TCA table - * depending on the context - * - * @return string the additional where clause, something like " AND deleted=0 AND hidden=0" - */ - protected function getWhereClauseForEnabledFields() { - if ($this->getEnvironmentMode() === 'FE') { - // frontend context - $whereClause = $GLOBALS['TSFE']->sys_page->enableFields($this->table); - $whereClause .= $GLOBALS['TSFE']->sys_page->deleteClause($this->table); - } else { - // backend context - $whereClause = \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields($this->table); - $whereClause .= \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($this->table); - } - return $whereClause; - } - /** * Function to return the current TYPO3_MODE. * This function can be mocked in unit tests to be able to test frontend behaviour. diff --git a/typo3/sysext/core/Configuration/TCA/sys_file.php b/typo3/sysext/core/Configuration/TCA/sys_file.php index 91689d7b1ec8..cccc9c8a7bf3 100644 --- a/typo3/sysext/core/Configuration/TCA/sys_file.php +++ b/typo3/sysext/core/Configuration/TCA/sys_file.php @@ -12,7 +12,6 @@ 'versioningWS' => TRUE, 'origUid' => 't3_origuid', 'default_sortby' => 'ORDER BY crdate DESC', - 'delete' => 'deleted', 'dividers2tabs' => TRUE, 'typeicon_column' => 'type', 'typeicon_classes' => array( diff --git a/typo3/sysext/core/ext_tables.sql b/typo3/sysext/core/ext_tables.sql index 3b9efba99eb6..81c43cf0d11d 100644 --- a/typo3/sysext/core/ext_tables.sql +++ b/typo3/sysext/core/ext_tables.sql @@ -284,7 +284,6 @@ CREATE TABLE sys_file ( tstamp int(11) DEFAULT '0' NOT NULL, crdate int(11) DEFAULT '0' NOT NULL, cruser_id int(11) DEFAULT '0' NOT NULL, - deleted tinyint(4) DEFAULT '0' NOT NULL, missing tinyint(4) DEFAULT '0' NOT NULL, # Versioning fields