4784f23368bcb1dc8ead11ce88645c1b0d2b8bf7
[Packages/TYPO3.CMS.git] / typo3 / sysext / workspaces / Classes / Reports / StatusProvider.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2010-2011 Workspaces Team (http://forge.typo3.org/projects/show/typo3v4-workspaces)
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
18 *
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27
28 /**
29 * a status provider for the reports module to display whether only
30 * element version is used.
31 *
32 * @author Workspaces Team (http://forge.typo3.org/projects/show/typo3v4-workspaces)
33 * @package Workspaces
34 * @subpackage Service
35 */
36 class Tx_Workspaces_Reports_StatusProvider implements tx_reports_StatusProvider {
37
38 protected $reportList = 'ElementVersioningOnly';
39
40 /**
41 * Compiles a collection of system status checks as a status report.
42 *
43 * @return array List of statuses
44 * @see typo3/sysext/reports/interfaces/tx_reports_StatusProvider::getStatus()
45 */
46 public function getStatus() {
47 $reports = array();
48 $reportMethods = explode(',', $this->reportList);
49
50 foreach ($reportMethods as $reportMethod) {
51 $reports[$reportMethod] = $this->{'get' . $reportMethod . 'Status'}();
52 }
53
54 return $reports;
55 }
56
57
58 /**
59 * Checks if there are still updates to perform
60 *
61 * @return tx_reports_reports_status_Status An tx_reports_reports_status_Status object representing whether the element versioning is in use or not
62 */
63 protected function getElementVersioningOnlyStatus() {
64 $severity = tx_reports_reports_status_Status::OK;
65 $value = 'Element Versioning is in use.';
66 $message = 'All Configuration options have been set correctly';
67
68 if (!$GLOBALS['TYPO3_CONF_VARS']['BE']['elementVersioningOnly'] || $GLOBALS['TYPO3_CONF_VARS']['BE']['newPagesVersioningType'] != -1) {
69 $severity = tx_reports_reports_status_Status::WARNING;
70 $value = 'System not configured correctly.';
71 $message = 'This TYPO3 installation is configured to use Element versioning. Page and Branch versioning are deprecated since TYPO3 4.4.<br />If you are sure that you don\'t use the Workspaces functionality right now (or if you don\'t have any versionized records right now), you can safely change these options in the Install Tool by setting ["BE"]["newPagesVersioningType"] = -1 and ["BE"]["elementVersioningOnly"] = 1 under "All Configuration".';
72 }
73
74 return t3lib_div::makeInstance('tx_reports_reports_status_Status',
75 'Workspaces: Ensure that Element Versioning is used.',
76 $value,
77 $message,
78 $severity
79 );
80 }
81
82 }
83
84 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/workspaces/Classes/Reports/StatusProvider.php'])) {
85 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/workspaces/Classes/Reports/StatusProvider.php']);
86 }
87
88 ?>