Skip to content
This repository was archived by the owner on Aug 15, 2023. It is now read-only.

Commit 084d43e

Browse files
author
Georg Ringer
committed
[FEATURE] Site createsysnews task
1 parent 37c83ed commit 084d43e

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

Classes/Command/SiteApiCommandController.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ public function infoCommand() {
5858
* @return void
5959
*/
6060
public function createSysNewsCommand($header, $text = '') {
61-
61+
/** @var $service Tx_Coreapi_Service_SiteApiService */
62+
$service = $this->objectManager->get('Tx_Coreapi_Service_SiteApiService');
63+
$service->createSysNews($header, $text);
6264
}
6365

6466
}

Classes/Service/SiteApiService.php

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@
3030
*/
3131
class Tx_Coreapi_Service_SiteApiService {
3232

33-
/*
34-
* site:sysNews Create a sys news, e.g. for new deployment
35-
*/
36-
3733
/**
3834
* Get some basic site information
3935
*
@@ -51,6 +47,22 @@ public function getSiteInfo() {
5147
return $data;
5248
}
5349

50+
/**
51+
* Create a sys news record
52+
*
53+
* @param string $header header
54+
* @param string $text text
55+
* @return void
56+
*/
57+
public function createSysNews($header, $text) {
58+
$GLOBALS['TYPO3_DB']->exec_INSERTquery('sys_news', array(
59+
'title' => $header,
60+
'content' => $text,
61+
'tstamp' => $GLOBALS['EXEC_TIME'],
62+
'crdate' => $GLOBALS['EXEC_TIME'],
63+
));
64+
}
65+
5466
/**
5567
* Get disku usage
5668
*

0 commit comments

Comments
 (0)