2 namespace TYPO3\CMS\Extensionmanager\Utility\Connection;
55 public function fetchExtension($extensionKey, $version, $expectedMd5, $mirrorUrl)
58 !empty($this->configurationUtility->getCurrentConfiguration(
'extensionmanager')[
'offlineMode'][
'value'])
63 $extensionPath = \TYPO3\CMS\Core\Utility\GeneralUtility::strtolower($extensionKey);
64 $mirrorUrl .= $extensionPath[0] .
'/' . $extensionPath[1] .
'/' . $extensionPath .
'_' . $version .
'.t3x';
65 $t3x = \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($mirrorUrl, 0, array(TYPO3_user_agent));
68 throw new ExtensionManagerException(sprintf(
'The T3X file "%s" could not be fetched. Possible reasons: network problems, allow_url_fopen is off, cURL is not enabled in Install Tool.', $mirrorUrl), 1334426097);
70 if ($md5 === $expectedMd5) {
74 throw new ExtensionManagerException(
'Error: MD5 hash of downloaded file not as expected: ' . $md5 .
' != ' . $expectedMd5, 1334426098);
76 return $extensionData;
93 $parts = explode(
':', $externalData, 4);
94 $dat = base64_decode($parts[2]);
97 if (ltrim($parts[0]) == md5($dat)) {
98 if ($parts[1] ==
'gzcompress') {
99 if (function_exists(
'gzuncompress')) {
100 $dat = gzuncompress($dat);
102 throw new ExtensionManagerException(
'Decoding Error: No decompressor available for compressed content. gzuncompress() function is not available!', 1342859463);
105 $listArr = unserialize($dat);
106 if (!is_array($listArr)) {
125 $parts = explode(
':', $stream, 3);
126 if ($parts[1] ==
'gzcompress') {
127 if (function_exists(
'gzuncompress')) {
128 $parts[2] = gzuncompress($parts[2]);
130 throw new ExtensionManagerException(
'Decoding Error: No decompressor available for compressed content. gzcompress()/gzuncompress() ' .
'functions are not available!', 1344761814);
133 if (md5($parts[2]) === $parts[0]) {
134 $output = unserialize($parts[2]);
135 if (!is_array($output)) {
136 throw new ExtensionManagerException(
'Error: Content could not be unserialized to an array. Strange (since MD5 hashes match!)', 1344761938);
139 throw new ExtensionManagerException(
'Error: MD5 mismatch. Maybe the extension file was downloaded and saved as a text file by the ' .
'browser and thereby corrupted!? (Always select "All" filetype when saving extensions)', 1344761991);