Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
services
t3o sites
extensions.typo3.org
extensions.typo3.org
Commits
a15b1d0b
Commit
a15b1d0b
authored
Aug 03, 2020
by
Thomas Löffler
Browse files
Move fetching documentation data in new command
The former task was deactivated and therefore the data is not up to date
parent
aaac0b23
Pipeline
#9357
passed with stages
in 8 minutes and 54 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
extensions/ter_fe2/Classes/Command/FetchDocumentationStatus.php
0 → 100644
View file @
a15b1d0b
<?php
namespace
T3o\TerFe2\Command
;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
use
Symfony\Component\Console\Command\Command
;
use
Symfony\Component\Console\Input\InputInterface
;
use
Symfony\Component\Console\Output\OutputInterface
;
use
Symfony\Component\Console\Style\SymfonyStyle
;
use
TYPO3\CMS\Core\Core\Environment
;
use
TYPO3\CMS\Core\Utility\GeneralUtility
;
class
FetchDocumentationStatus
extends
Command
{
/**
* @var string
*/
protected
$documentationFileName
=
'currentdocumentationdata.json'
;
/**
* @var string
*/
protected
$sourceUrl
=
'https://intercept.typo3.com/assets/docs/manuals.json'
;
protected
function
configure
()
{
$this
->
setDescription
(
'Fetches the current documentation JSON file for extensions that use intercept'
);
}
protected
function
execute
(
InputInterface
$input
,
OutputInterface
$output
)
{
$io
=
new
SymfonyStyle
(
$input
,
$output
);
$sourceData
=
GeneralUtility
::
getUrl
(
$this
->
sourceUrl
);
if
(
json_decode
(
$sourceData
,
true
)
!==
null
)
{
$targetFile
=
Environment
::
getPublicPath
()
.
'/'
.
$GLOBALS
[
'TYPO3_CONF_VARS'
][
'BE'
][
'fileadminDir'
]
.
$this
->
documentationFileName
;
if
(
GeneralUtility
::
writeFile
(
$targetFile
,
$sourceData
))
{
$io
->
success
(
'Documentation file has been updated'
);
}
else
{
$io
->
error
(
'Error during update of documentation file'
);
}
}
else
{
$io
->
warning
(
'Source file is not a valid JSON file'
);
}
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment