43 throw new \TYPO3\CMS\Install\FolderStructure\Exception\InvalidArgumentException(
44 'File node must have parent',
51 if (strstr($structure[
'name'],
'/') !== FALSE) {
52 throw new \TYPO3\CMS\Install\FolderStructure\Exception\InvalidArgumentException(
53 'File name must not contain forward slash',
57 $this->name = $structure[
'name'];
59 if (isset($structure[
'targetPermission'])) {
63 if (isset($structure[
'targetContent']) && isset($structure[
'targetContentFile'])) {
64 throw new \TYPO3\CMS\Install\FolderStructure\Exception\InvalidArgumentException(
65 'Either targetContent or targetContentFile can be set, but not both',
70 if (isset($structure[
'targetContent'])) {
71 $this->targetContent = $structure[
'targetContent'];
73 if (isset($structure[
'targetContentFile'])) {
74 if (!is_readable($structure[
'targetContentFile'])) {
75 throw new \TYPO3\CMS\Install\FolderStructure\Exception\InvalidArgumentException(
76 'targetContentFile ' . $structure[
'targetContentFile'] .
' does not exist or is not readable',
80 $this->targetContent = file_get_contents($structure[
'targetContentFile']);
96 $status->setMessage(
'By using "Try to fix errors" we can try to create it');
126 if ($resultCreateFile instanceof \
TYPO3\CMS\Install\Status\
OkStatus 127 && !is_null($this->targetContent)
134 } elseif (!$this->
isFile()) {
141 ' but is of type ' . $fileType .
'. This cannot be fixed automatically. Please investigate.' 146 ' but is of unknown type, probably because an upper level directory does not exist. Please investigate.' 177 'The target file could not be created. There is probably a' .
178 ' group or owner permission problem on the parent directory.' 219 'File content is not identical to default content. This file may have been changed manually.' .
220 ' The Install Tool will not overwrite the current version!' 227 'Is a file with the default content and configured permissions of ' . $this->
getTargetPermission()
242 if (is_link($absolutePath) || !is_file($absolutePath)) {
244 'File ' . $absolutePath .
' must exist',
249 if (is_null($this->targetContent)) {
252 $targetContentHash = md5($this->targetContent);
253 $currentContentHash = md5(file_get_contents($absolutePath));
254 if ($targetContentHash === $currentContentHash) {
269 if (is_link($absolutePath) || !is_file($absolutePath)) {
271 'File ' . $absolutePath .
' must exist',
275 if (is_null($this->targetContent)) {
277 'Target content not defined for ' . $absolutePath,
281 $result = @file_put_contents($absolutePath, $this->targetContent);
288 $status->setMessage(
'Setting content of the file failed for unknown reasons.');
300 return (!is_link($path) && is_file($path));
setTargetPermission($permission)
__construct(array $structure, NodeInterface $parent=NULL)
if($list_of_literals) if(!empty($literals)) if(!empty($literals)) $result
Analyse literals to prepend the N char to them if their contents aren't numeric.
getRelativePathBelowSiteRoot($path=NULL)