TYPO3 API  SVNRelease
StatusProvider.php
Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003  *  Copyright notice
00004  *
00005  *  (c) 2010-2011 Workspaces Team (http://forge.typo3.org/projects/show/typo3v4-workspaces)
00006  *  All rights reserved
00007  *
00008  *  This script is part of the TYPO3 project. The TYPO3 project is
00009  *  free software; you can redistribute it and/or modify
00010  *  it under the terms of the GNU General Public License as published by
00011  *  the Free Software Foundation; either version 2 of the License, or
00012  *  (at your option) any later version.
00013  *
00014  *  The GNU General Public License can be found at
00015  *  http://www.gnu.org/copyleft/gpl.html.
00016  *  A copy is found in the textfile GPL.txt and important notices to the license
00017  *  from the author is found in LICENSE.txt distributed with these scripts.
00018  *
00019  *
00020  *  This script is distributed in the hope that it will be useful,
00021  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023  *  GNU General Public License for more details.
00024  *
00025  *  This copyright notice MUST APPEAR in all copies of the script!
00026  ***************************************************************/
00027 
00028 /**
00029  * a status provider for the reports module to display whether only 
00030  * element version is used.
00031  * 
00032  * @author Workspaces Team (http://forge.typo3.org/projects/show/typo3v4-workspaces)
00033  * @package Workspaces
00034  * @subpackage Service
00035  */
00036 class Tx_Workspaces_Reports_StatusProvider implements tx_reports_StatusProvider {
00037 
00038     protected $reportList = 'ElementVersioningOnly';
00039 
00040     /**
00041      * Compiles a collection of system status checks as a status report.
00042      *
00043      * @return  array   List of statuses
00044      * @see typo3/sysext/reports/interfaces/tx_reports_StatusProvider::getStatus()
00045      */
00046     public function getStatus() {
00047         $reports = array();
00048         $reportMethods = explode(',', $this->reportList);
00049 
00050         foreach ($reportMethods as $reportMethod) {
00051             $reports[$reportMethod] = $this->{'get' . $reportMethod . 'Status'}();
00052         }
00053 
00054         return $reports;
00055     }
00056 
00057 
00058     /**
00059      * Checks if there are still updates to perform
00060      *
00061      * @return  tx_reports_reports_status_Status    An tx_reports_reports_status_Status object representing whether the element versioning is in use or not
00062      */
00063     protected function getElementVersioningOnlyStatus() {
00064         $severity = tx_reports_reports_status_Status::OK;
00065         $value    = 'Element Versioning is in use.';
00066         $message  = 'All Configuration options have been set correctly';
00067 
00068         if (!$GLOBALS['TYPO3_CONF_VARS']['BE']['elementVersioningOnly'] || $GLOBALS['TYPO3_CONF_VARS']['BE']['newPagesVersioningType'] != -1) {
00069             $severity = tx_reports_reports_status_Status::WARNING;
00070             $value    = 'System not configured correctly.';
00071             $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".';
00072         }
00073 
00074         return t3lib_div::makeInstance('tx_reports_reports_status_Status',
00075             'Workspaces: Ensure that Element Versioning is used.',
00076             $value,
00077             $message,
00078             $severity
00079         );
00080     }
00081 
00082 }
00083 
00084 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/workspaces/Classes/Reports/StatusProvider.php'])) {
00085     include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/workspaces/Classes/Reports/StatusProvider.php']);
00086 }
00087 
00088 ?>