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

Commit 66fcdd7

Browse files
committed
Merge branch 'master' into madsbrunn/master
Conflicts: Classes/Cli/Dispatcher.php Classes/Service/ExtensionApiService.php
2 parents 9f97ed3 + 5d53d78 commit 66fcdd7

File tree

9 files changed

+135
-11
lines changed

9 files changed

+135
-11
lines changed

.gitignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#########################
2+
# global ignore file
3+
########################
4+
# ignoring temporary files (left by e.g. vim)
5+
# ignoring by common IDE's used directories/files
6+
# dont ignore .rej and .orig as we want to see/clean files after conflict resolution
7+
#
8+
# for local exclude patterns please edit .git/info/exclude
9+
#
10+
*~
11+
*.bak
12+
*.idea
13+
*.project
14+
*.swp
15+
.buildpath
16+
.cache
17+
.project
18+
.session
19+
.settings
20+
.TemporaryItems
21+
.webprj
22+
nbproject
23+

Classes/Cli/Dispatcher.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,8 +479,22 @@ public function extensionImportCommand($file, $location='L', $overwrite = FALSE)
479479
$this->outputLine(sprintf('Extension "%s" has been imported!', $data['extKey']));
480480

481481
}
482-
483-
482+
483+
/**
484+
* Ensure upload folders of installed extensions exist
485+
* @return void
486+
*/
487+
public function extensionCreateuploadfolder() {
488+
$service = t3lib_div::makeInstance('Tx_Coreapi_Service_ExtensionApiService');
489+
$messages = $service->createUploadFolders();
490+
if (sizeof($messages)) {
491+
foreach ($messages as $message) {
492+
$this->outputLine($message);
493+
}
494+
} else {
495+
$this->outputLine('no uploadFolder created');
496+
}
497+
}
484498

485499
/**
486500
* Site info

Classes/Command/ExtensionApiCommandController.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ public function listInstalledCommand($type = '') {
113113
$description = wordwrap($description, self::MAXIMUM_LINE_LENGTH - 43, PHP_EOL . str_repeat(' ', 43), TRUE);
114114
$this->outputLine('%-2s%-40s %s', array(' ', $title, $description));
115115
}
116+
117+
$this->outputLine('%-2s%-40s', array(' ', str_repeat('-', self::MAXIMUM_LINE_LENGTH - 3)));
118+
$this->outputLine(' Total: ' . count($extensions) . ' extensions');
116119
}
117120

118121
/**
@@ -315,6 +318,25 @@ public function importCommand($file, $location='L', $overwrite = FALSE){
315318
}
316319

317320

321+
/**
322+
* createUploadFoldersCommand
323+
*
324+
* @return void
325+
*/
326+
public function createUploadFoldersCommand() {
327+
/** @var $service Tx_Coreapi_Service_ExtensionApiService */
328+
$service = $this->objectManager->get('Tx_Coreapi_Service_ExtensionApiService');
329+
$messages = $service->createUploadFolders();
330+
331+
if (sizeof($messages)) {
332+
foreach ($messages as $message) {
333+
$this->outputLine($message);
334+
}
335+
} else {
336+
$this->outputLine('no uploadFolder created');
337+
}
338+
}
339+
318340
}
319341

320342
?>

Classes/Service/CacheApiService.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,16 @@ class Tx_Coreapi_Service_CacheApiService {
3939
*
4040
*/
4141
public function initializeObject() {
42+
// Create a fake admin user
43+
$adminUser = new t3lib_beUserAuth();
44+
$adminUser->user['uid'] = $GLOBALS['BE_USER']->user['uid'];
45+
$adminUser->user['username'] = '_CLI_lowlevel';
46+
$adminUser->user['admin'] = 1;
47+
$adminUser->workspace = 0;
48+
4249
$this->tce = t3lib_div::makeInstance('t3lib_TCEmain');
4350
$this->tce->start(Array(), Array());
51+
$this->tce->start(Array(), Array(), $adminUser);
4452
}
4553

4654
/**

Classes/Service/DatabaseApiService.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,19 +183,21 @@ protected function getRequestKeys(array $update, array $remove) {
183183

184184
foreach ($updateActions as $updateAction) {
185185
if (isset($update[$updateAction]) && is_array($update[$updateAction])) {
186-
$tmpKeys += array_keys($update[$updateAction]);
186+
$tmpKeys[] = array_keys($update[$updateAction]);
187187
}
188188
}
189189

190190
foreach ($removeActions as $removeAction) {
191191
if (isset($remove[$removeAction]) && is_array($remove[$removeAction])) {
192-
$tmpKeys += array_keys($remove[$removeAction]);
192+
$tmpKeys[] = array_keys($remove[$removeAction]);
193193
}
194194
}
195195

196196
$finalKeys = array();
197-
foreach ($tmpKeys as $key) {
198-
$finalKeys[$key] = TRUE;
197+
foreach ($tmpKeys as $keys) {
198+
foreach ($keys as $key) {
199+
$finalKeys[$key] = TRUE;
200+
}
199201
}
200202
return $finalKeys;
201203
}

Classes/Service/ExtensionApiService.php

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,46 @@ public function updateMirrors() {
9999
$emTask = t3lib_div::makeInstance('tx_em_Tasks_UpdateExtensionList');
100100
$emTask->execute();
101101
}
102-
103-
102+
103+
/**
104+
* createUploadFolders
105+
*
106+
* @return array
107+
*/
108+
public function createUploadFolders() {
109+
$extensions = $this->getInstalledExtensions();
110+
111+
// 6.0 creates also Dirs
112+
if (class_exists('\TYPO3\CMS\Extensionmanager\Utility\FileHandlingUtility')) {
113+
$fileHandlingUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Extensionmanager\Utility\FileHandlingUtility');
114+
foreach ($extensions AS $key => $extension) {
115+
$extension['key'] = $key;
116+
$fileHandlingUtility->ensureConfiguredDirectoriesExist($extension);
117+
}
118+
return array('done with \TYPO3\CMS\Extensionmanager\Utility\FileHandlingUtility->ensureConfiguredDirectoriesExist');
119+
}
120+
121+
// < 6.0 creates no Dirs
122+
$messages = array();
123+
124+
foreach ($extensions as $extKey => $extInfo) {
125+
$uploadFolder = PATH_site . tx_em_Tools::uploadFolder($extKey);
126+
if ($extInfo['uploadfolder'] && ! @is_dir($uploadFolder)) {
127+
t3lib_div::mkdir($uploadFolder);
128+
$messages[] = 'mkdir ' . $uploadFolder;
129+
$indexContent = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
130+
<HTML>
131+
<HEAD>
132+
<TITLE></TITLE>
133+
<META http-equiv=Refresh Content="0; Url=../../">
134+
</HEAD>
135+
</HTML>';
136+
t3lib_div::writeFile($uploadFolder . 'index.html', $indexContent);
137+
}
138+
}
139+
return $messages;
140+
}
141+
104142

105143
/**
106144
* Install (load) an extension
@@ -611,6 +649,7 @@ public function exist($key){
611649
return $exist;
612650
}
613651

652+
614653
}
615654

616655
?>

Classes/Service/SiteApiService.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public function getSiteInfo() {
4343

4444
$this->getDiskUsage($data);
4545
$this->getDatabaseInformation($data);
46+
$this->getCountOfExtensions($data);
4647

4748
return $data;
4849
}
@@ -64,6 +65,7 @@ public function createSysNews($header, $text) {
6465
'content' => $text,
6566
'tstamp' => $GLOBALS['EXEC_TIME'],
6667
'crdate' => $GLOBALS['EXEC_TIME'],
68+
'cruser_id' => $GLOBALS['BE_USER']->user['uid']
6769
));
6870
}
6971

@@ -95,6 +97,19 @@ protected function getDatabaseInformation(&$data) {
9597
$data['Database size'] = $value;
9698
}
9799

100+
/**
101+
* Get count of local installed extensions
102+
*
103+
* @param array $data
104+
* @return void
105+
*/
106+
protected function getCountOfExtensions(&$data) {
107+
/** @var Tx_Coreapi_Service_ExtensionApiService $extensionService */
108+
$extensionService = t3lib_div::makeInstance('Tx_Coreapi_Service_ExtensionApiService');
109+
$extensions = $extensionService->getInstalledExtensions('L');
110+
$data['Count local installed extensions'] = count($extensions);
111+
}
112+
98113
}
99114

100115
?>

ext_autoload.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
'tx_coreapi_command_siteapicommandcontroller' => $extensionClassesPath . 'Command/SiteApiCommandController.php',
1010
'tx_coreapi_command_cacheapicommandcontroller' => $extensionClassesPath . 'Command/CacheApiCommandController.php',
1111
'tx_coreapi_service_cacheapiservice' => $extensionClassesPath . 'Service/CacheApiService.php',
12+
'tx_coreapi_service_siteapiservice' => $extensionClassesPath . 'Service/SiteApiService.php',
1213
'tx_coreapi_service_databaseapiservice' => $extensionClassesPath . 'Service/DatabaseApiService.php',
1314
'tx_coreapi_service_extensionapiservice' => $extensionClassesPath . 'Service/ExtensionApiService.php',
1415
);

ext_emconf.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
'version' => '0.0.1',
2121
'constraints' => array(
2222
'depends' => array(
23-
'cms' => '',
24-
'extbase' => '',
25-
'fluid' => '',
23+
'typo3' => '4.5.0-6.1.99',
24+
'extbase' => '1.3.0-6.1.99',
25+
'fluid' => '1.3.0-6.1.99',
2626
),
2727
'conflicts' => array(
2828
),

0 commit comments

Comments
 (0)