TYPO3 CMS  TYPO3_7-6
FalStatus.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
18 
23 {
29  public function getStatus()
30  {
31  $statuses = [
32  'MissingFiles' => $this->getMissingFilesStatus(),
33  ];
34  return $statuses;
35  }
36 
42  protected function getMissingFilesStatus()
43  {
44  $value = $GLOBALS['LANG']->getLL('status_none');
45  $count = 0;
46  $maxFilesToShow = 100;
47  $message = '';
49 
51  $storageRepository = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\StorageRepository::class);
52  $storageObjects = $storageRepository->findAll();
53  $storages = [];
54 
56  foreach ($storageObjects as $storageObject) {
57 
58  // We only check missing files for storages that are online
59  if ($storageObject->isOnline()) {
60  $storages[$storageObject->getUid()] = $storageObject;
61  }
62  }
63 
64  if (!empty($storages)) {
65  $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows(
66  '*',
67  'sys_file',
68  'missing=1 AND storage IN (' . implode(',', array_keys($storages)) . ')'
69  );
70  }
71 
72  if ($count) {
73  $value = sprintf($GLOBALS['LANG']->getLL('status_missingFilesCount'), $count);
75 
76  $files = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
77  'identifier,storage',
78  'sys_file',
79  'missing=1 AND storage IN (' . implode(',', array_keys($storages)) . ')',
80  '',
81  '',
82  $maxFilesToShow
83  );
84 
85  $message = '<p>' . $GLOBALS['LANG']->getLL('status_missingFilesMessage') . '</p>';
86  foreach ($files as $file) {
87  $message .= $storages[$file['storage']]->getName() . ' ' . $file['identifier'] . '<br />';
88  }
89 
90  if ($count > $maxFilesToShow) {
91  $message .= '...<br />';
92  }
93  }
94 
95  return GeneralUtility::makeInstance(\TYPO3\CMS\Reports\Status::class, $GLOBALS['LANG']->getLL('status_missingFiles'), $value, $message, $severity);
96  }
97 }
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']