Commit ff4fb8d8 authored by Thomas Löffler's avatar Thomas Löffler

Merge branch 'updated-manuals-json' into 'develop'

[TASK] Migrate documentation link generation to new structure of manuals.json

See merge request !421
parents 465b57f8 835c66d7
Pipeline #7185 passed with stages
in 3 minutes and 36 seconds
......@@ -58,7 +58,7 @@ class UpdateCurrentVersionListTask extends \TYPO3\CMS\Extbase\Scheduler\Task
{
$result = false;
$targetFile = PATH_site . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'] . 'currentdocumentationdata.json';
$sourceData = GeneralUtility::getUrl('https://docs.typo3.org/typo3cms/extensions/manuals.json');
$sourceData = GeneralUtility::getUrl('https://intercept.typo3.com/assets/docs/manuals.json');
if (json_decode($sourceData, true) !== null) {
$result = GeneralUtility::writeFile($targetFile, $sourceData);
}
......
......@@ -21,12 +21,6 @@ namespace T3o\TerFe2\Service;
*/
class DocumentationService implements \TYPO3\CMS\Core\SingletonInterface
{
/**
* @var string
*/
protected $baseUrl = '';
/**
* @var array
*/
......@@ -42,7 +36,6 @@ class DocumentationService implements \TYPO3\CMS\Core\SingletonInterface
*/
public function __construct()
{
$this->baseUrl = 'https://docs.typo3.org/typo3cms/extensions/';
$this->availableFormats = [
'sxw',
'html',
......@@ -68,13 +61,13 @@ class DocumentationService implements \TYPO3\CMS\Core\SingletonInterface
throw new \Exception('Extension key and version string are required to build a documentation url');
}
$manualExists = isset($this->docsInformation->$extensionKey);
$manualExists = isset($this->docsInformation->{$extensionKey}['docs'][$versionString]);
$documentationLink = null;
$url = null;
if ($manualExists) {
// link to extension to get the latest manual
$url = $this->baseUrl . $extensionKey . '/';
$url = $this->docsInformation->{$extensionKey}['docs'][$versionString]['url'];
// check if link is not broken
// need to remove the 200 response check due to change in header for docs.typo3.org
$documentationLink = '<a href="' . $url . '">Extension Manual</a>';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment