TYPO3 CMS  TYPO3_6-2
AutoPublishService.php
Go to the documentation of this file.
1 <?php
3 
22 
31  public function autoPublishWorkspaces() {
32  global $TYPO3_CONF_VARS;
33  // Temporarily set admin rights
34  // FIXME: once workspaces are cleaned up a better solution should be implemented
35  $currentAdminStatus = $GLOBALS['BE_USER']->user['admin'];
36  $GLOBALS['BE_USER']->user['admin'] = 1;
37  // Select all workspaces that needs to be published / unpublished:
38  $workspaces = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid,swap_modes,publish_time,unpublish_time', 'sys_workspace', 'pid=0
39  AND
40  ((publish_time!=0 AND publish_time<=' . (int)$GLOBALS['EXEC_TIME'] . ')
41  OR (publish_time=0 AND unpublish_time!=0 AND unpublish_time<=' . (int)$GLOBALS['EXEC_TIME'] . '))' . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('sys_workspace'));
42  $workspaceService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Workspaces\\Service\\WorkspaceService');
43  foreach ($workspaces as $rec) {
44  // First, clear start/end time so it doesn't get select once again:
45  $fieldArray = $rec['publish_time'] != 0 ? array('publish_time' => 0) : array('unpublish_time' => 0);
46  $GLOBALS['TYPO3_DB']->exec_UPDATEquery('sys_workspace', 'uid=' . (int)$rec['uid'], $fieldArray);
47  // Get CMD array:
48  $cmd = $workspaceService->getCmdArrayForPublishWS($rec['uid'], $rec['swap_modes'] == 1);
49  // $rec['swap_modes']==1 means that auto-publishing will swap versions, not just publish and empty the workspace.
50  // Execute CMD array:
51  $tce = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler');
52  $tce->stripslashes_values = 0;
53  $tce->start(array(), $cmd);
54  $tce->process_cmdmap();
55  }
56  // Restore admin status
57  $GLOBALS['BE_USER']->user['admin'] = $currentAdminStatus;
58  }
59 
60 }
$TYPO3_CONF_VARS['SYS']['contentTable']
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
static deleteClause($table, $tableAlias='')