Commit 4c15ae09 authored by Wouter Wolters's avatar Wouter Wolters Committed by Oliver Hader
Browse files

[TASK] Cleanup "belog" sysext

Reformats the code, fixes indents and removes extra empty lines. This is
not a functional change but a visual clean up.

Change-Id: I0d11dd7c43eee5d181c4bc0565c85d651c5c29e1
Resolves: #45392
Releases: 6.0, 6.1
Reviewed-on: https://review.typo3.org/18207
Reviewed-by: Stefan Neufeind
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader
parent 9ef16014
...@@ -25,6 +25,7 @@ namespace TYPO3\CMS\Belog\Controller; ...@@ -25,6 +25,7 @@ namespace TYPO3\CMS\Belog\Controller;
* *
* This copyright notice MUST APPEAR in all copies of the script! * This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/ ***************************************************************/
/** /**
* Abstract class to show log entries from sys_log * Abstract class to show log entries from sys_log
* *
...@@ -36,39 +37,46 @@ abstract class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\Acti ...@@ -36,39 +37,46 @@ abstract class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\Acti
* @var integer * @var integer
*/ */
const TIMEFRAME_THISWEEK = 0; const TIMEFRAME_THISWEEK = 0;
/** /**
* @var integer * @var integer
*/ */
const TIMEFRAME_LASTWEEK = 1; const TIMEFRAME_LASTWEEK = 1;
/** /**
* @var integer * @var integer
*/ */
const TIMEFRAME_LASTSEVENDAYS = 2; const TIMEFRAME_LASTSEVENDAYS = 2;
/** /**
* @var integer * @var integer
*/ */
const TIMEFRAME_THISMONTH = 10; const TIMEFRAME_THISMONTH = 10;
/** /**
* @var integer * @var integer
*/ */
const TIMEFRAME_LASTMONTH = 11; const TIMEFRAME_LASTMONTH = 11;
/** /**
* @var integer * @var integer
*/ */
const TIMEFRAME_LAST31DAYS = 12; const TIMEFRAME_LAST31DAYS = 12;
/** /**
* @var integer * @var integer
*/ */
const TIMEFRAME_CUSTOM = 30; const TIMEFRAME_CUSTOM = 30;
/** /**
* whether plugin is running in page context (sub module of Web > Info) * Whether plugin is running in page context (sub module of Web > Info)
* *
* @var boolean * @var boolean
*/ */
protected $isInPageContext = FALSE; protected $isInPageContext = FALSE;
/** /**
* page ID in page context * Page ID in page context
* *
* @var integer * @var integer
*/ */
...@@ -174,7 +182,7 @@ abstract class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\Acti ...@@ -174,7 +182,7 @@ abstract class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\Acti
* *
* [pid][dayTimestamp][items] * [pid][dayTimestamp][items]
* *
* @param \TYPO3\CMS\Extbase\Persistence\QueryResultInterface<TYPO3\CMS\Belog\Domain\Model\LogEntry> $logEntries * @param \TYPO3\CMS\Extbase\Persistence\QueryResultInterface<\TYPO3\CMS\Belog\Domain\Model\LogEntry> $logEntries
* @param boolean $groupByPage Whether or not log entries should be grouped by page * @param boolean $groupByPage Whether or not log entries should be grouped by page
* @return array * @return array
*/ */
...@@ -304,48 +312,48 @@ abstract class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\Acti ...@@ -304,48 +312,48 @@ abstract class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\Acti
$endTime = $GLOBALS['EXEC_TIME']; $endTime = $GLOBALS['EXEC_TIME'];
// @TODO: Refactor this construct // @TODO: Refactor this construct
switch ($constraint->getTimeFrame()) { switch ($constraint->getTimeFrame()) {
case self::TIMEFRAME_THISWEEK: case self::TIMEFRAME_THISWEEK:
// This week // This week
$week = (date('w') ?: 7) - 1; $week = (date('w') ?: 7) - 1;
$startTime = mktime(0, 0, 0) - $week * 3600 * 24; $startTime = mktime(0, 0, 0) - $week * 3600 * 24;
break; break;
case self::TIMEFRAME_LASTWEEK: case self::TIMEFRAME_LASTWEEK:
// Last week // Last week
$week = (date('w') ?: 7) - 1; $week = (date('w') ?: 7) - 1;
$startTime = mktime(0, 0, 0) - ($week + 7) * 3600 * 24; $startTime = mktime(0, 0, 0) - ($week + 7) * 3600 * 24;
$endTime = mktime(0, 0, 0) - $week * 3600 * 24; $endTime = mktime(0, 0, 0) - $week * 3600 * 24;
break; break;
case self::TIMEFRAME_LASTSEVENDAYS: case self::TIMEFRAME_LASTSEVENDAYS:
// Last 7 days // Last 7 days
$startTime = mktime(0, 0, 0) - 7 * 3600 * 24; $startTime = mktime(0, 0, 0) - 7 * 3600 * 24;
break; break;
case self::TIMEFRAME_THISMONTH: case self::TIMEFRAME_THISMONTH:
// This month // This month
$startTime = mktime(0, 0, 0, date('m'), 1); $startTime = mktime(0, 0, 0, date('m'), 1);
break; break;
case self::TIMEFRAME_LASTMONTH: case self::TIMEFRAME_LASTMONTH:
// Last month // Last month
$startTime = mktime(0, 0, 0, date('m') - 1, 1); $startTime = mktime(0, 0, 0, date('m') - 1, 1);
$endTime = mktime(0, 0, 0, date('m'), 1); $endTime = mktime(0, 0, 0, date('m'), 1);
break; break;
case self::TIMEFRAME_LAST31DAYS: case self::TIMEFRAME_LAST31DAYS:
// Last 31 days // Last 31 days
$startTime = mktime(0, 0, 0) - 31 * 3600 * 24; $startTime = mktime(0, 0, 0) - 31 * 3600 * 24;
break; break;
case self::TIMEFRAME_CUSTOM: case self::TIMEFRAME_CUSTOM:
if ($constraint->getManualDateStart() instanceof \DateTime) { if ($constraint->getManualDateStart() instanceof \DateTime) {
$startTime = $constraint->getManualDateStart()->format('U'); $startTime = $constraint->getManualDateStart()->format('U');
if ($constraint->getManualDateStop() instanceof \DateTime) { if ($constraint->getManualDateStop() instanceof \DateTime) {
$manualEndTime = $constraint->getManualDateStop()->format('U'); $manualEndTime = $constraint->getManualDateStop()->format('U');
if ($manualEndTime > $startTime) { if ($manualEndTime > $startTime) {
$endTime = $manualEndTime; $endTime = $manualEndTime;
}
} else {
$endTime = $GLOBALS['EXEC_TIME'];
} }
} else {
$endTime = $GLOBALS['EXEC_TIME'];
} }
} break;
break; default:
default:
} }
$constraint->setStartTimestamp($startTime); $constraint->setStartTimestamp($startTime);
...@@ -354,5 +362,4 @@ abstract class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\Acti ...@@ -354,5 +362,4 @@ abstract class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\Acti
} }
?> ?>
\ No newline at end of file
...@@ -25,6 +25,7 @@ namespace TYPO3\CMS\Belog\Controller; ...@@ -25,6 +25,7 @@ namespace TYPO3\CMS\Belog\Controller;
* *
* This copyright notice MUST APPEAR in all copies of the script! * This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/ ***************************************************************/
/** /**
* Show log entries from table sys_log * Show log entries from table sys_log
* *
...@@ -32,8 +33,6 @@ namespace TYPO3\CMS\Belog\Controller; ...@@ -32,8 +33,6 @@ namespace TYPO3\CMS\Belog\Controller;
*/ */
class ToolsController extends \TYPO3\CMS\Belog\Controller\AbstractController { class ToolsController extends \TYPO3\CMS\Belog\Controller\AbstractController {
} }
?> ?>
\ No newline at end of file
...@@ -25,6 +25,7 @@ namespace TYPO3\CMS\Belog\Controller; ...@@ -25,6 +25,7 @@ namespace TYPO3\CMS\Belog\Controller;
* *
* This copyright notice MUST APPEAR in all copies of the script! * This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/ ***************************************************************/
/** /**
* Controller for log entry listings in Web->Info module * Controller for log entry listings in Web->Info module
* *
...@@ -44,5 +45,4 @@ class WebInfoController extends \TYPO3\CMS\Belog\Controller\AbstractController { ...@@ -44,5 +45,4 @@ class WebInfoController extends \TYPO3\CMS\Belog\Controller\AbstractController {
} }
?> ?>
\ No newline at end of file
...@@ -25,6 +25,7 @@ namespace TYPO3\CMS\Belog\Domain\Model; ...@@ -25,6 +25,7 @@ namespace TYPO3\CMS\Belog\Domain\Model;
* *
* This copyright notice MUST APPEAR in all copies of the script! * This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/ ***************************************************************/
/** /**
* Constraints for log entries * Constraints for log entries
* *
...@@ -40,7 +41,7 @@ class Constraint extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity { ...@@ -40,7 +41,7 @@ class Constraint extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
protected $userOrGroup = '0'; protected $userOrGroup = '0';
/** /**
* number of log rows to show * Number of log rows to show
* *
* @var integer * @var integer
*/ */
...@@ -54,70 +55,70 @@ class Constraint extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity { ...@@ -54,70 +55,70 @@ class Constraint extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
protected $workspaceUid = \TYPO3\CMS\Belog\Domain\Model\Workspace::UID_ANY_WORKSPACE; protected $workspaceUid = \TYPO3\CMS\Belog\Domain\Model\Workspace::UID_ANY_WORKSPACE;
/** /**
* selected time frame * Selected time frame
* *
* @var integer * @var integer
*/ */
protected $timeFrame = 0; protected $timeFrame = 0;
/** /**
* selected action * Selected action
* *
* @var integer * @var integer
*/ */
protected $action = 0; protected $action = 0;
/** /**
* whether rows should be grouped by page * Whether rows should be grouped by page
* *
* @var boolean * @var boolean
*/ */
protected $groupByPage = FALSE; protected $groupByPage = FALSE;
/** /**
* manual date start * Manual date start
* *
* @var \DateTime * @var \DateTime
*/ */
protected $manualDateStart = NULL; protected $manualDateStart = NULL;
/** /**
* manual date stop * Manual date stop
* *
* @var \DateTime * @var \DateTime
*/ */
protected $manualDateStop = NULL; protected $manualDateStop = NULL;
/** /**
* calculated start timestamp * Calculated start timestamp
* *
* @var integer * @var integer
*/ */
protected $startTimestamp = 0; protected $startTimestamp = 0;
/** /**
* calculated end timestamp * Calculated end timestamp
* *
* @var integer * @var integer
*/ */
protected $endTimestamp = 0; protected $endTimestamp = 0;
/** /**
* whether the plugin is called in page context (submodule of Web > Info) * Whether the plugin is called in page context (submodule of Web > Info)
* *
* @var boolean * @var boolean
*/ */
protected $isInPageContext = FALSE; protected $isInPageContext = FALSE;
/** /**
* selected page ID in page context * Selected page ID in page context
* *
* @var integer * @var integer
*/ */
protected $pageId = 0; protected $pageId = 0;
/** /**
* page level depth * Page level depth
* *
* @var integer * @var integer
*/ */
...@@ -379,5 +380,4 @@ class Constraint extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity { ...@@ -379,5 +380,4 @@ class Constraint extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
} }
?> ?>
\ No newline at end of file
...@@ -25,6 +25,7 @@ namespace TYPO3\CMS\Belog\Domain\Model; ...@@ -25,6 +25,7 @@ namespace TYPO3\CMS\Belog\Domain\Model;
* *
* This copyright notice MUST APPEAR in all copies of the script! * This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/ ***************************************************************/
/** /**
* Stub model for sys history - only properties required for belog module are added currently * Stub model for sys history - only properties required for belog module are added currently
* *
...@@ -33,7 +34,7 @@ namespace TYPO3\CMS\Belog\Domain\Model; ...@@ -33,7 +34,7 @@ namespace TYPO3\CMS\Belog\Domain\Model;
class HistoryEntry extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity { class HistoryEntry extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
/** /**
* list of changed fields * List of changed fields
* *
* @var string * @var string
*/ */
...@@ -61,5 +62,4 @@ class HistoryEntry extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity { ...@@ -61,5 +62,4 @@ class HistoryEntry extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
} }
?> ?>
\ No newline at end of file
...@@ -25,17 +25,18 @@ namespace TYPO3\CMS\Belog\Domain\Model; ...@@ -25,17 +25,18 @@ namespace TYPO3\CMS\Belog\Domain\Model;
* *
* This copyright notice MUST APPEAR in all copies of the script! * This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/ ***************************************************************/
/** /**
* A sys log entry * A sys log entry
* This model is 'complete': All current database properties are in there. * This model is 'complete': All current database properties are in there.
* *
* @TODO : This should be stuffed to some more central place * @todo : This should be stuffed to some more central place
* @author Christian Kuhn <lolli@schwarzbu.ch> * @author Christian Kuhn <lolli@schwarzbu.ch>
*/ */
class LogEntry extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity { class LogEntry extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
/** /**
* storage page ID of the log entry * Storage page ID of the log entry
* *
* @var integer * @var integer
*/ */
...@@ -53,7 +54,7 @@ class LogEntry extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity { ...@@ -53,7 +54,7 @@ class LogEntry extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
protected $backendUserUid = 0; protected $backendUserUid = 0;
/** /**
* action ID of the action that happened, for example 3 was a file action * Action ID of the action that happened, for example 3 was a file action
* *
* @var integer * @var integer
*/ */
...@@ -67,7 +68,7 @@ class LogEntry extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity { ...@@ -67,7 +68,7 @@ class LogEntry extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
protected $recordUid = 0; protected $recordUid = 0;
/** /**
* table name * Table name
* *
* @var string * @var string
*/ */
...@@ -81,7 +82,7 @@ class LogEntry extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity { ...@@ -81,7 +82,7 @@ class LogEntry extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
protected $recordPid = 0; protected $recordPid = 0;
/** /**
* error code * Error code
* *
* @var integer * @var integer
*/ */
...@@ -95,21 +96,21 @@ class LogEntry extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity { ...@@ -95,21 +96,21 @@ class LogEntry extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
protected $details = ''; protected $details = '';
/** /**
* timestamp when the log entry was written * Timestamp when the log entry was written
* *
* @var integer * @var integer
*/ */
protected $tstamp = 0; protected $tstamp = 0;
/** /**
* type code * Type code
* *
* @var integer * @var integer
*/ */
protected $type = 0; protected $type = 0;
/** /**
* details number * Details number
* *
* @var integer * @var integer
*/ */
...@@ -130,7 +131,7 @@ class LogEntry extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity { ...@@ -130,7 +131,7 @@ class LogEntry extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
protected $logData = ''; protected $logData = '';
/** /**
* event PID * Event PID
* *
* @var integer * @var integer
*/ */
...@@ -144,7 +145,7 @@ class LogEntry extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity { ...@@ -144,7 +145,7 @@ class LogEntry extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
protected $workspaceUid = 0; protected $workspaceUid = 0;
/** /**
* new ID * New ID
* *
* @var string * @var string
*/ */
...@@ -463,5 +464,4 @@ class LogEntry extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity { ...@@ -463,5 +464,4 @@ class LogEntry extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
} }
?> ?>
\ No newline at end of file
...@@ -25,10 +25,11 @@ namespace TYPO3\CMS\Belog\Domain\Model; ...@@ -25,10 +25,11 @@ namespace TYPO3\CMS\Belog\Domain\Model;
* *
* This copyright notice MUST APPEAR in all copies of the script! * This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/ ***************************************************************/
/** /**
* Stub model for workspaces - only properties required for belog module are added currently * Stub model for workspaces - only properties required for belog module are added currently
* *
* @TODO : This should be extended and put at some more central place