[TASK] Categorize sys_file table by default

To be able to migrate from DAM, sys_files need to be
categorizable. The core is able to do so, but would
need to be configured manually. To ease migration
this is now activated by default.

If an upgrading installation already modified the
list of categorized tables in its localconf, the
step installer takes care of adding sys_file to
that list silently.

Resolves: #51554
Releases: 6.2
Change-Id: I5a12ddb2ab1da1e7a24b9bfe53af9b0ae33a04a1
Reviewed-on: https://review.typo3.org/23485
Reviewed-by: Frans Saris
Tested-by: Frans Saris
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
[TASK] Change list view delete icon if record is deleted in WS

If a record is deleted in a workspace the delete icon is still
displayed but the function is different. If you click on
the delete icon of a deleted record you will "restore"
the record (remove the deleted flag).
The icon should change if record is marked as deleted.

Resolves: #52554
Releases: 6.2, 6.1, 6.0, 4.5
Change-Id: I9bccc076d06525fad16f9f5ca4b3413e217f32f6
Reviewed-on: https://review.typo3.org/24413
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Timo Webler
Tested-by: Timo Webler
Reviewed-by: Thorsten Kahler
Tested-by: Thorsten Kahler
[FEATURE] Add TypoScript condition for ApplicationContext

The following condition is available in TypoScript and TSconfig
for testing the ApplicationContext:

[applicationContext = value1, value2, ...]

One of the given values matching the applicationContext.
Wildcards + and * are allowed, as well as regular expressions
delimited with /PREG_PATTERN/

Examples:

[applicationContext = Development/Debugging, Development/Profiling]
  # matching exactly "Development/Debugging" or "Development/Profiling"
[global]

[applicationContext = Production*]
  # matching any applicationContext with a rootContext of "Production",
  # for example "Production/Live" or "Production/Staging"
[global]

[applicationContext = /^Production\/Staging\/Server\d+$/]
  # matching "Production/Staging/Server1", "Production/Staging/Server2"
  # and so on
[global]

Resolves: #50132
Documentation: #52701
Releases: 6.2
Change-Id: I4f0f69ca4208d36d8eb8966ec9ef034f6b703b34
Reviewed-on: https://review.typo3.org/22412
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
Reviewed-by: Markus Klein
Tested-by: Markus Klein
[FEATURE] Control visibility of modules in the BE

Currently there is no way for controlling the visibility
of a module in the BE. The patch introduces User TSconfig
which can be used to hide modules from the main menu.

options.hideModules = file, help

options.hideModules.web := addToList(func,info)

options.hideModules.system = BelogLog

The change only influences the visibility of modules in the menu
and does not control the access (permission) which still must be
done in the ACL of a BE User / Group as usually.

Change-Id: I6c2ec2c389a154440932afa16f9ca3a2cb4b8116
Releases: 6.2
Resolves: #52482
Documentation: #52692
Reviewed-on: https://review.typo3.org/24274
Reviewed-by: Steffen Müller
Tested-by: Steffen Müller
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
[TASK] FAL-Drivers: Make getFileInfo more versatile and performant

If a storage needs information about a file, it always has
to retrieve all information about the file from the driver.
This can be very expensive - especially if only the modification
timestamp would be relevant, but sha1 content hash as well
as creation time, access time, size, mimetype ... are detected.
This patch extends the interface with a possibility to only
retrieve a subset of these information. As drivers are only
accessible through an ResourceStorage and the new parameters
are optional this patch does not change behaviour or break
backwards compatiblity.

Releases: 6.2
Resolves: #51515
Change-Id: I45dec41e3f6cfa2d6c8902b795dc224c729296f8
Reviewed-on: https://review.typo3.org/23464
Tested-by: Oliver Hader
Reviewed-by: Oliver Hader
[BUGFIX] Delete modified record in WS just deletes WS version

If you edit a record in a workspace and then you try to
delete the record, the record it not deleted but the
version (workspace-change record) is.

Resolves: #52530
Releases: 6.2, 6.1, 6.0
Change-Id: I6a77f9a398276af98c41d841053641f3e07b2e33
Reviewed-on: https://review.typo3.org/24366
Reviewed-by: Thorsten Kahler
Tested-by: Thorsten Kahler
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
[BUGFIX] Improve message for the RedirectLoopException

If any RedirectLoopException is raised there should be a mention that
for any restart the redirectCount parameter has to be removed or the
install tool has to be restarted from backend.

Resolves: #52703
Releases: 6.2
Change-Id: I766a036db261376e978d1ff51bb2c69ee34fff82
Reviewed-on: https://review.typo3.org/24565
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
[BUGFIX] BackendUtility::viewOnClick() called with non-integer

The origin is in DatabaseRecordList::makeControl() that
tries to create a preview link with the page id "243#33163"
- more strict checks will deny this request because it's not
the expected integer value. Thus, BackendUtility::viewOnClick()
is called with a string instead of an integer.
This happens in the regular list module in the TYPO3 backend.
It's not critical if hooks and further processors use intval() on the
argument, but is bad if methods expect the defined integer value.

Change-Id: Ib66c1ee219b67e51d534f11fbf1eaa330476ca93
Fixes: #50912
Releases: 4.5, 6.0, 6.1, 6.2
Reviewed-on: https://review.typo3.org/22951
Reviewed-by: Sascha Egerer
Tested-by: Sascha Egerer
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
[TASK] Performance: Use cache_hash with "mixed" data

The cache-frontend is VariableFrontendCache that already uses
serialize() or (if available) igbinary_serialie() itself.
No need to additionally serialize data.

Change-Id: I8c3cfd2a279f8a38bc5c4d860329f2333f1304a5
Resolves: #52648
Releases: 6.2
Reviewed-on: https://review.typo3.org/24512
Reviewed-by: Philipp Gampe
Tested-by: Philipp Gampe
Reviewed-by: Stefan Neufeind
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
[BUGFIX] WS preview shows pages changes from all WS

In workspace preview the query condition for pages records has to be
enhanced to restrict to live WS and current WS.

Change-Id: Ib271b9bb435b50f2777621707728a74ba5de4187
Fixes: #37209
Releases: 6.2, 6.1, 6.0
Reviewed-on: https://review.typo3.org/11252
Reviewed-by: Sascha Egerer
Tested-by: Sascha Egerer
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
[BUGFIX] Migrate workspaces tries to upgrade non existing tables

The migrate workspaces update wizard task tries to upgrade non
existing tables. Check if table exists before executing the query.

Change-Id: I57855c079a8485537888345b61c9b3f0a17ca492
Resolves: #34246
Releases: 6.2
Reviewed-on: https://review.typo3.org/23796
Reviewed-by: Sascha Egerer
Tested-by: Sascha Egerer
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
[BUGFIX] Add workspace overlay for fetched records.

Call workspace overlay to resolve the right uid for
move-placeholder.

Change-Id: I6af65fcda1b1fffe72dfbc314976e42f30120d71
Fixes: #36573
Releases: 6.2, 6.1, 6.0, 4.7, 4.5
Reviewed-on: https://review.typo3.org/10759
Reviewed-by: Sascha Egerer
Tested-by: Sascha Egerer
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
[BUGFIX] Create workspace placeholder with processed field content

The field content that is used for the workspace placeholder records
is not processed through the field configuration.

This produces annoying error messages to the user.

Resolves: #17551
Releases: 6.2, 6.1, 6.0

Change-Id: I79823cc2bd0d26a03b0850045c08999ebdbc1a9b
Reviewed-on: https://review.typo3.org/22940
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
[BUGFIX] Copy records to target page before origin page is deleted

When a deletion of a page is published, all moved records
have to be copied to their new location before they get deleted.

Resolves: #52636
Releases: 6.2, 6.1, 6.0
Change-Id: Ide471b4f25c0350a1df57af3d92283310a76cac9
Reviewed-on: https://review.typo3.org/24513
Reviewed-by: Sascha Egerer
Tested-by: Sascha Egerer
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
[BUGFIX] Clear_cache() must not consider page ids lower than 0

DataHandler::clear_cache() is called with a table and an uid that
has been modified to trigger the clear cache commands. To find
siblings, children, parents, etc. the pid value is directly used
to find the affected pages. However, in a workspace context, the
pid is always "-1" which leads to a selection of all page
records of all workspaces. This amount is used to flush all
defined caches by a given tag name and might result in execution
time outs.

To avoid these superfluous cache flushes, page ids lower than 0
are ignored now in this section.

Fixes: #51051
Releases: 6.0, 6.1, 6.2
Change-Id: I03987bbd8c5d3526fb4dfda75b0dd0316fe1d836
Reviewed-on: https://review.typo3.org/23078
Reviewed-by: Sascha Egerer
Tested-by: Sascha Egerer
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader
[BUGFIX] Select available page when changing WS

When changing to another workspaces the currently selected page is not
always available.
This change selects the next available page from the rootline for page
tree and submodules of web module when the current page does not exist
in the workspace.

Change-Id: I0502fea3c21515421586403a41f5c696ffc0d762
Fixes: #37611
Releases: 6.2, 6.1, 6.0, 4.7, 4.5
Reviewed-on: https://review.typo3.org/21110
Reviewed-by: Sascha Egerer
Tested-by: Sascha Egerer
Reviewed-by: Timo Webler
Tested-by: Timo Webler
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
[BUGFIX] DataMapFactory::resolveTableName must remove leading backslashes

Currently the method just splits the given class name
by backslashes to detect the proper vendor name. If using
a leading backslash the algorithm of this function causes
a wrong result. Therefore all leading backslashes must be
removed first.

Releases: 6.2, 6.1, 6.0
Fixes: #52708
Change-Id: Icdc46facf66260bf528994964fb713d3dd24b3c6
Reviewed-on: https://review.typo3.org/24596
Reviewed-by: Xavier Perseguers
Tested-by: Xavier Perseguers
Reviewed-by: Stefan Froemken
Tested-by: Stefan Froemken
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
[TASK] Clean-up responsibilities of FAL classes

The FileRepository, ResourceStorage and ResourceFactory all somehow
take care of creating files, managing files and their data.  Getting a
file from ResourceStorage->getFile never involves the index-Records and
even if index records exists the driver always needs to query all file
information out of the filesystem to create FileObject.

As we always expect the index-record to be up to date we can rely on
that and must not query the file-system for every bit of information.
In addition creating objects without looking for the record first
renders the FAL API useless. This patch introduces a
FileIndexRepository which only deals with these kind of records and
deprecates the methods within the FileRepository.

In addition it moves around the "file-object creation logic" so this is
dealt with at a central place: The Resource Factory. Finally the
ResourceFactory always uses to get an IndexRecord from the newly
introduced Repository. If the FileInfo is not present, it queries the
Storage for the fileInfo (from the Driver).

Releases: 6.2
Resolves: #51528
Change-Id: I6ceeb8db4dd4e470e7c72dcfbc2121093411da75
Reviewed-on: https://review.typo3.org/23839
Reviewed-by: Ernesto Baschny
Tested-by: Ernesto Baschny
Reviewed-by: Frans Saris
Tested-by: Frans Saris
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter
[FEATURE] Fallback paths (backport from Flow)

With this change it will be possible to define multiple values
for the 'template', 'partial' and 'layout' root path configuration.
Each of the respective options will now have a corresponding setter
that enables configuration of multiple paths to look up when loading a
Fluid template file:
	$view->setTemplateRootPaths(array('first/path', 'second/path', …));
The old setters will be kept and they overrule the fallback paths. So:
	$view->setTemplateRootPath('some/path');
would disable the fallback paths of the previous example. The same is true
for 'setPartialRootPath()' and 'setLayoutRootPath()'.
The rootPath-getters have been deprecated in favor of
'getTemplateRootPaths()', 'getPartialRootPaths()' and
'getLayoutRootPaths()'.

This is a backport of the Flow feature applied in
Change-Id: I530e9a1fadbbd210c980c62cf2022c38fa81bb56 issue #39870

Resolves: #39868
Releases: 6.2
Change-Id: Id5a768ae834c53cd20fd59e762c2acf2ea9e6356
Reviewed-on: https://review.typo3.org/23950
Reviewed-by: Frans Saris
Tested-by: Frans Saris
Reviewed-by: Philipp Gampe
Tested-by: Philipp Gampe
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
[FEATURE] Description-field for scheduler-jobs

Adds a description-textfield for tasks. This will be displayed
in the scheduler-list. The description can either be shown as
hover (default) or below the job-name, configurable through
the extension-settings for "scheduler".

Change-Id: If0191da43677fc261cb73257e3ede848a5375d69
Resolves: #52696
Releases: 6.2
Reviewed-on: https://review.typo3.org/24610
Reviewed-by: Philipp Gampe
Tested-by: Philipp Gampe
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring