Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] TYPO3 CMS v10 compatibility + resolve ../ in VERSION path #16

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ jobs:
- stage: test
php: 7.2
env: TYPO3_VERSION=9.5.7
- stage: test
php: 7.2
env: TYPO3_VERSION=10.4.12
- stage: test
php: 7.2
env: TYPO3_VERSION=dev-master
12 changes: 5 additions & 7 deletions Classes/Configuration/ExtensionConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
*/

use KamiYang\ProjectVersion\Enumeration\ProjectVersionModeEnumeration;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\StringUtility;
use TYPO3\CMS\Extbase\Utility\DebuggerUtility;

/**
* Class ExtensionConfiguration
Expand Down Expand Up @@ -64,7 +66,8 @@ final class ExtensionConfiguration implements SingletonInterface
*/
public static function getAbsVersionFilePath(): string
{
return GeneralUtility::getFileAbsFileName(self::getVersionFilePath());
$path = GeneralUtility::resolveBackPath(Environment::getPublicPath() . '/' . self::getVersionFilePath());
return GeneralUtility::getFileAbsFileName($path);
}

/**
Expand Down Expand Up @@ -114,12 +117,7 @@ public function __construct()
*/
private function getExtensionConfigurationFromGlobals(): array
{
$configuration = $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['project_version'];

if (is_string($configuration)) {
$configuration = @unserialize($configuration);
}

$configuration = $GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['project_version'];
return $configuration ?? [];
}

Expand Down
8 changes: 6 additions & 2 deletions Classes/Facade/SystemEnvironmentBuilderFacade.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* LICENSE file that was distributed with this source code.
*/

use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder;
use TYPO3\CMS\Core\Utility\GeneralUtility;

/**
* Class SystemEnvironmentBuilderFacade
Expand All @@ -34,6 +34,10 @@ class SystemEnvironmentBuilderFacade
*/
public function isFunctionDisabled($function): bool
{
return SystemEnvironmentBuilder::isFunctionDisabled($function);
$disabledFunctions = GeneralUtility::trimExplode(',', (string)ini_get('disable_functions'));
if (!empty($disabledFunctions)) {
return in_array($function, $disabledFunctions, true);
}
return false;
}
}
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ First make sure you match the requirements:

| Requirement | Version |
| --- | --- |
| TYPO3 | \>=8.7 <9.6 |
| TYPO3 | \>=9.5 <10.5 |
| php | \>= 7.0 |

### Composer
Expand Down Expand Up @@ -45,6 +45,7 @@ We assume that the web document root (`PATH_site`) is `/var/www/html`.
| MyVersion | /var/www/html/MyVersion |
| typo3conf/ | /var/www/html/typo3conf/VERSION |
| ./My/Custom/Version/File/In/Some/Nested/File/Structure | /var/www/html/./My/Custom/Version/File/In/Some/Nested/File/Structure|
| ../ | /var/www/VERSION|

### GIT
Since release 0.3.0 git is supported. This must be manually activated. In order to use git, make sure it's available!
Expand Down
2 changes: 1 addition & 1 deletion Tests/Unit/Service/ProjectVersionServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ protected function tearDown()

protected function setUpExtensionConfiguration()
{
$GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['project_version'] = serialize($this->extensionConfiguration);
$GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['project_version'] = $this->extensionConfiguration;

GeneralUtility::makeInstance(ExtensionConfiguration::class);
}
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
"kamiyang/project_version": "self.version"
},
"require": {
"typo3/cms-backend": "9.5.*",
"typo3/cms-extbase": "9.5.*",
"typo3/cms-extensionmanager": "9.5.*"
"typo3/cms-backend": "^9.5.0 || ^10.4.0",
"typo3/cms-extbase": "^9.5.0 || ^10.4.0",
"typo3/cms-extensionmanager": "^9.5.0 || ^10.4.0"
},
"require-dev": {
"nimut/testing-framework": "~4.1.1",
"phpunit/phpunit": "~6.5",
"nimut/testing-framework": "^4.1.1 || ^5.2.0",
"phpunit/phpunit": "^6.5",
"satooshi/php-coveralls": "^2.0"
},
"autoload": {
Expand Down
4 changes: 2 additions & 2 deletions ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
'version' => '2.0.0-dev',
'constraints' => [
'depends' => [
'php' => '7.0',
'typo3' => '9.5.0-9.5.99'
'php' => '^7.0',
'typo3' => '9.5.0-10.4.99'
],
'conflicts' => [
],
Expand Down