TYPO3  7.6
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CleanerTask Class Reference
Inheritance diagram for CleanerTask:
AbstractTask

Public Member Functions

 execute ()
 
 getAdditionalInformation ()
 
 setPeriod ($period)
 
 getPeriod ()
 
 getPeriodAsTimestamp ()
 
 setTcaTables ($tcaTables=array())
 
 getTcaTables ()
 
 setDatabaseConnection ($databaseConnection)
 
- Public Member Functions inherited from AbstractTask
 __construct ()
 
 execute ()
 
 getAdditionalInformation ()
 
 setTaskUid ($id)
 
 getTaskUid ()
 
 getTaskTitle ()
 
 getTaskDescription ()
 
 getTaskClassName ()
 
 isDisabled ()
 
 setDisabled ($flag)
 
 setExecutionTime ($timestamp)
 
 getTaskGroup ()
 
 setTaskGroup ($taskGroup)
 
 getExecutionTime ()
 
 setDescription ($description)
 
 getDescription ()
 
 setScheduler ()
 
 unsetScheduler ()
 
 setExecution (\TYPO3\CMS\Scheduler\Execution $execution)
 
 getExecution ()
 
 getNextDueExecution ()
 
 areMultipleExecutionsAllowed ()
 
 isExecutionRunning ()
 
 markExecution ()
 
 unmarkExecution ($executionID,\Exception $failure=null)
 
 unmarkAllExecutions ()
 
 save ()
 
 stop ()
 
 remove ()
 

Protected Member Functions

 cleanTable ($tableName)
 
 checkFileResourceFieldsBeforeDeletion ($table, $where)
 
 deleteFilesForTable ($table, $where, array $fieldList)
 
 getFileResourceFields ($table)
 
 getDatabaseConnection ()
 
 getLanguageService ()
 

Protected Attributes

 $period = 0
 
 $tcaTables = array()
 
 $databaseConnection = null
 
- Protected Attributes inherited from AbstractTask
 $scheduler
 
 $taskUid
 
 $disabled = false
 
 $execution
 
 $executionTime = 0
 
 $description = ''
 
 $taskGroup
 

Detailed Description

A task that should be run regularly that deletes deleted datasets from the DB.

Definition at line 22 of file CleanerTask.php.

Member Function Documentation

checkFileResourceFieldsBeforeDeletion (   $table,
  $where 
)
protected

Checks if the table has fields for uploaded files and removes those files.

Parameters
string$table
string$where
Returns
void

Definition at line 170 of file CleanerTask.php.

References CleanerTask\deleteFilesForTable(), and CleanerTask\getFileResourceFields().

Referenced by CleanerTask\cleanTable().

cleanTable (   $tableName)
protected

Executes the delete-query for the given table

Parameters
string$tableName
Returns
bool

Definition at line 64 of file CleanerTask.php.

References $GLOBALS, CleanerTask\checkFileResourceFieldsBeforeDeletion(), CleanerTask\getDatabaseConnection(), and CleanerTask\getPeriodAsTimestamp().

Referenced by CleanerTask\execute().

deleteFilesForTable (   $table,
  $where,
array  $fieldList 
)
protected

Removes all files from the given field list in the table.

Parameters
string$table
string$where
array$fieldList
Returns
void

Definition at line 186 of file CleanerTask.php.

References $GLOBALS, CleanerTask\getDatabaseConnection(), and GeneralUtility\trimExplode().

Referenced by CleanerTask\checkFileResourceFieldsBeforeDeletion().

execute ( )

The main method of the task. Iterates through the tables and calls the cleaning function

Returns
bool Returns TRUE on successful execution, FALSE on error

Definition at line 45 of file CleanerTask.php.

References CleanerTask\cleanTable(), and CleanerTask\getTcaTables().

getAdditionalInformation ( )

Returns the information shown in the task-list

Returns
string Information-text fot the scheduler task-list

Definition at line 88 of file CleanerTask.php.

References CleanerTask\getLanguageService(), CleanerTask\getPeriod(), and CleanerTask\getTcaTables().

getDatabaseConnection ( )
protected
Returns

Definition at line 229 of file CleanerTask.php.

References CleanerTask\$databaseConnection, and $GLOBALS.

Referenced by CleanerTask\cleanTable(), and CleanerTask\deleteFilesForTable().

getFileResourceFields (   $table)
protected

Checks the $TCA for fields that can list file resources.

Parameters
string$table
Returns
array

Definition at line 210 of file CleanerTask.php.

References $GLOBALS.

Referenced by CleanerTask\checkFileResourceFieldsBeforeDeletion().

getLanguageService ( )
protected
Returns

Definition at line 240 of file CleanerTask.php.

References $GLOBALS.

Referenced by CleanerTask\getAdditionalInformation().

getPeriod ( )

Returns the period after which a row is deleted

Returns
int

Definition at line 122 of file CleanerTask.php.

References CleanerTask\$period.

Referenced by CleanerTask\getAdditionalInformation(), and CleanerTask\getPeriodAsTimestamp().

getPeriodAsTimestamp ( )
Returns
int

Definition at line 130 of file CleanerTask.php.

References CleanerTask\getPeriod().

Referenced by CleanerTask\cleanTable().

getTcaTables ( )

Returns the TCA-tables which are cleaned

Returns
array

Definition at line 150 of file CleanerTask.php.

References CleanerTask\$tcaTables.

Referenced by CleanerTask\execute(), and CleanerTask\getAdditionalInformation().

setDatabaseConnection (   $databaseConnection)
Parameters
\TYPO3\CMS\Core\Database\DatabaseConnection

Definition at line 158 of file CleanerTask.php.

References CleanerTask\$databaseConnection.

setPeriod (   $period)

Sets the period after which a row is deleted

Parameters
int$period

Definition at line 112 of file CleanerTask.php.

References CleanerTask\$period.

setTcaTables (   $tcaTables = array())

Sets the TCA-tables which are cleaned

Parameters
array$tcaTables

Definition at line 140 of file CleanerTask.php.

References CleanerTask\$tcaTables.

Member Data Documentation

$databaseConnection = null
protected
$period = 0
protected

Definition at line 27 of file CleanerTask.php.

Referenced by CleanerTask\getPeriod(), and CleanerTask\setPeriod().

$tcaTables = array()
protected

Definition at line 32 of file CleanerTask.php.

Referenced by CleanerTask\getTcaTables(), and CleanerTask\setTcaTables().