Index: services/class.tx_caretakerinstance_TYPO3VersionTestService.php =================================================================== --- services/class.tx_caretakerinstance_TYPO3VersionTestService.php (revision 50769) +++ services/class.tx_caretakerinstance_TYPO3VersionTestService.php (working copy) @@ -50,17 +50,13 @@ class tx_caretakerinstance_TYPO3VersionTestService extends tx_caretakerinstance_RemoteTestServiceBase{ public function runTest() { - $minVersion = $this->checkForLatestVersion($this->getConfigValue('min_version')); - $maxVersion = $this->checkForLatestVersion($this->getConfigValue('max_version')); + $minVersion = $this->getConfigValue('min_version'); + $maxVersion = $this->getConfigValue('max_version'); if (!$minVersion && !$maxVersion) { return tx_caretaker_TestResult::create(tx_caretaker_Constants::state_undefined, 0, 'Cannot execute TYPO3 version test without min and max version'); } - if ($maxVersion === FALSE) { - return tx_caretaker_TestResult::create(tx_caretaker_Constants::state_undefined, 0, 'No TYPO3 version information available. Please add "TYPO3 Versionnumbers Update" to your scheduler queue.'); - } - $operation = array('GetTYPO3Version'); $operations = array($operation); @@ -78,6 +74,16 @@ return $this->getFailedOperationResultTestResult($operationResult); } + $minVersion = $this->checkForCurrentMinorVersion($minVersion, $version); + $maxVersion = $this->checkForCurrentMinorVersion($maxVersion, $version); + + $minVersion = $this->checkForLatestRevisionVersion($minVersion); + $maxVersion = $this->checkForLatestRevisionVersion($maxVersion); + + if ($maxVersion === FALSE) { + return tx_caretaker_TestResult::create(tx_caretaker_Constants::state_undefined, 0, 'Unsupported TYPO3 version, or no TYPO3 version information available. Please add "TYPO3 Versionnumbers Update" to your scheduler queue.'); + } + $checkResult = $this->checkVersionRange( $version, $minVersion, @@ -88,12 +94,16 @@ $testResult = tx_caretaker_TestResult::create(tx_caretaker_Constants::state_ok, 0, $message); } else { $message = 'TYPO3 version ' . $version . ' is installed, but'; - if ($minVersion) { - $message .= ' >= ' . $minVersion; + if ($minVersion && $maxVersion && $minVersion == $maxVersion) { + $message .= ' ' . $minVersion; + } else { + if ($minVersion) { + $message .= ' >= ' . $minVersion; + } + if ($maxVersion) { + $message .= ' <= ' . $maxVersion; + } } - if ($maxVersion) { - $message .= ' <= ' . $maxVersion; - } $message .= ' expected.'; $testResult = tx_caretaker_TestResult::create(tx_caretaker_Constants::state_error, 0, $message); } @@ -101,7 +111,7 @@ return $testResult; } - protected function checkForLatestVersion($versionString) { + protected function checkForLatestRevisionVersion($versionString) { if (strpos($versionString, '.latest') !== FALSE) { $versionDigits = explode('.', $versionString, 3); $latestVersions = t3lib_div::makeInstance('t3lib_Registry')->get('tx_caretaker', 'TYPO3versions'); @@ -117,9 +127,17 @@ return $versionString; } + + public function checkForCurrentMinorVersion($versionString, $baseVersionString) { + $versionDigits = explode('.', $versionString); + if ($versionDigits[1] == 'current') { + list(, $versionDigits[1], ) = explode('.', $baseVersionString); + } + return implode('.', $versionDigits); + } } if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/caretaker_instance/services/class.tx_caretaker_TYPO3VersionTestService.php']) { include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/caretaker_instance/services/class.tx_caretaker_TYPO3VersionTestService.php']); } -?> \ No newline at end of file +?> Index: tests/class.tx_caretakerinstance_TYPO3VersionTestService_testcase.php =================================================================== --- tests/class.tx_caretakerinstance_TYPO3VersionTestService_testcase.php (revision 50769) +++ tests/class.tx_caretakerinstance_TYPO3VersionTestService_testcase.php (working copy) @@ -46,5 +46,13 @@ ); $this->assertTrue($result); } + + public function testVersionCheckAgainstCurrent() { + $service = new tx_caretakerinstance_TYPO3VersionTestService(); + + $baseVersion = $service->checkForCurrentMinorVersion('4.current.8', '4.5.8'); + $this->assertEquals($baseVersion, '4.5.8'); + + } } -?> \ No newline at end of file +?>