Project

General

Profile

Feature #32215 ยป 32215.diff

Timo Webler, 2012-01-30 11:09

View differences:

Classes/Service/CleanupPreviewLinkTask.php
<?php
/***************************************************************
* Copyright notice
*
* (c) 2010-2011 Workspaces Team (http://forge.typo3.org/projects/show/typo3v4-workspaces)
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* This class provides a task to cleanup ol preview links.
*
* @author Timo Webler <timo.webler@dkd.de>
* @package Workspaces
* @subpackage Service
*/
class Tx_Workspaces_Service_CleanupPreviewLinkTask extends tx_scheduler_Task {
/**
* Cleanup old preview links.
* endtime < $GLOBALS['EXEC_TIME']
*
* @return boolean
*/
public function execute() {
$GLOBALS['TYPO3_DB']->exec_DELETEquery(
// table
'sys_preview',
// where
'endtime < ' . intval($GLOBALS['EXEC_TIME'])
);
return TRUE;
}
}
if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/workspaces/Classes/Service/CleanupPreviewLinkTask.php'])) {
include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/workspaces/Classes/Service/CleanupPreviewLinkTask.php']);
}
?>
Resources/Private/Language/locallang_mod.xlf
<trans-unit id="autopublishTask.description" xml:space="preserve">
<source>This tasks checks any workspace that has a publication date set in the past and automatically publishes it.</source>
</trans-unit>
<trans-unit id="cleanupPreviewLinkTask.name" xml:space="preserve">
<source>Workspaces cleanup preview links</source>
</trans-unit>
<trans-unit id="cleanupPreviewLinkTask.description" xml:space="preserve">
<source>This task delete old preview links</source>
</trans-unit>
<trans-unit id="stage_ready_to_publish" xml:space="preserve">
<source>Ready to publish</source>
</trans-unit>
ext_autoload.php
'tx_workspaces_reports_statusprovider' => $extensionPath . 'Classes/Reports/StatusProvider.php',
'tx_workspaces_service_autopublish' => $extensionPath . 'Classes/Service/AutoPublish.php',
'tx_workspaces_service_autopublishtask' => $extensionPath . 'Classes/Service/AutoPublishTask.php',
'tx_workspaces_service_cleanuppreviewlinktask' => $extensionPath . 'Classes/Service/CleanupPreviewLinkTask.php',
'tx_workspaces_service_befunc' => $extensionPath . 'Classes/Service/Befunc.php',
'tx_workspaces_service_griddata' => $extensionPath . 'Classes/Service/GridData.php',
'tx_workspaces_service_stages' => $extensionPath . 'Classes/Service/Stages.php',
ext_localconf.php
'title' => 'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang_mod.xml:autopublishTask.name',
'description' => 'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang_mod.xml:autopublishTask.description'
);
// Register the cleanup preview links task
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['Tx_Workspaces_Service_CleanupPreviewLinkTask'] = array(
'extension' => $_EXTKEY,
'title' => 'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang_mod.xml:cleanupPreviewLinkTask.name',
'description' => 'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang_mod.xml:cleanupPreviewLinkTask.description'
);
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass']['workspaces'] = 'EXT:workspaces/Classes/Service/Tcemain.php:Tx_Workspaces_Service_Tcemain';
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['viewOnClickClass']['workspaces'] = 'EXT:workspaces/Classes/Service/Befunc.php:Tx_Workspaces_Service_Befunc';
    (1-1/1)