}
// Change the permissions only if the file has just been created
if ($changePermissions) {
- self::fixPermissions($file);
+ static::fixPermissions($file);
}
return true;
}
}
$result = false;
// Make path absolute
- if (!self::isAbsPath($path)) {
- $path = self::getFileAbsFileName($path, false);
+ if (!static::isAbsPath($path)) {
+ $path = static::getFileAbsFileName($path, false);
}
- if (self::isAllowedAbsPath($path)) {
+ if (static::isAllowedAbsPath($path)) {
if (@is_file($path)) {
$targetFilePermissions = isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['fileCreateMask'])
? octdec($GLOBALS['TYPO3_CONF_VARS']['SYS']['fileCreateMask'])
$recursionResult = null;
if ($file !== '.' && $file !== '..') {
if (@is_file(($path . '/' . $file))) {
- $recursionResult = self::fixPermissions($path . '/' . $file);
+ $recursionResult = static::fixPermissions($path . '/' . $file);
} elseif (@is_dir(($path . '/' . $file))) {
- $recursionResult = self::fixPermissions($path . '/' . $file, true);
+ $recursionResult = static::fixPermissions($path . '/' . $file, true);
}
if (isset($recursionResult) && !$recursionResult) {
$result = false;
$fI = pathinfo($filepath);
$fI['dirname'] .= '/';
// Check parts:
- if (!self::validPathStr($filepath) || !$fI['basename'] || strlen($fI['basename']) >= 60) {
+ if (!static::validPathStr($filepath) || !$fI['basename'] || strlen($fI['basename']) >= 60) {
return 'Input filepath "' . $filepath . '" was generally invalid!';
}
// Setting main temporary directory name (standard)
if (!@is_dir($dirName)) {
return 'PATH_site + "typo3temp/" was not a directory!';
}
- if (!self::isFirstPartOfStr($fI['dirname'], $dirName)) {
+ if (!static::isFirstPartOfStr($fI['dirname'], $dirName)) {
return '"' . $fI['dirname'] . '" was not within directory PATH_site + "typo3temp/"';
}
// Checking if the "subdir" is found:
if (preg_match('/^[[:alnum:]_]+\\/$/', $subdir) || preg_match('/^[[:alnum:]_]+\\/[[:alnum:]_]+\\/$/', $subdir)) {
$dirName .= $subdir;
if (!@is_dir($dirName)) {
- self::mkdir_deep(PATH_site . 'typo3temp/', $subdir);
+ static::mkdir_deep(PATH_site . 'typo3temp/', $subdir);
}
} else {
return 'Subdir, "' . $subdir . '", was NOT on the form "[[:alnum:]_]/" or "[[:alnum:]_]/[[:alnum:]_]/"';
// Checking dir-name again (sub-dir might have been created):
if (@is_dir($dirName)) {
if ($filepath == $dirName . $fI['basename']) {
- self::writeFile($filepath, $content);
+ static::writeFile($filepath, $content);
if (!@is_file($filepath)) {
return 'The file was not written to the disk. Please, check that you have write permissions to the typo3temp/ directory.';
}
{
$result = @mkdir($newFolder, octdec($GLOBALS['TYPO3_CONF_VARS']['SYS']['folderCreateMask']));
if ($result) {
- self::fixPermissions($newFolder);
+ static::fixPermissions($newFolder);
}
return $result;
}
// Ensure there is only one slash
$fullPath = rtrim($directory, '/') . '/' . ltrim($deepDirectory, '/');
if ($fullPath !== '' && !is_dir($fullPath)) {
- $firstCreatedPath = self::createDirectoryPath($fullPath);
+ $firstCreatedPath = static::createDirectoryPath($fullPath);
if ($firstCreatedPath !== '') {
- self::fixPermissions($firstCreatedPath, true);
+ static::fixPermissions($firstCreatedPath, true);
}
}
}
if ($file == '.' || $file == '..') {
continue;
}
- $OK = self::rmdir($path . '/' . $file, $removeNonEmpty);
+ $OK = static::rmdir($path . '/' . $file, $removeNonEmpty);
}
closedir($handle);
}
GeneralUtility::makeInstance(OpcodeCacheService::class)->clearAllActive($directory);
}
if ($keepOriginalDirectory) {
- self::mkdir($directory);
+ static::mkdir($directory);
}
clearstatcache();
- $result = self::rmdir($temporaryDirectory, true);
+ $result = static::rmdir($temporaryDirectory, true);
}
}
if ((string)$extKey !== '' && ExtensionManagementUtility::isLoaded($extKey) && (string)$local !== '') {
$filename = ExtensionManagementUtility::extPath($extKey) . $local;
}
- } elseif (!self::isAbsPath($filename)) {
+ } elseif (!static::isAbsPath($filename)) {
// relative. Prepended with $relPathPrefix
$filename = $relPathPrefix . $filename;
- } elseif ($onlyRelative && !self::isFirstPartOfStr($filename, $relPathPrefix)) {
+ } elseif ($onlyRelative && !static::isFirstPartOfStr($filename, $relPathPrefix)) {
// absolute, but set to blank if not allowed
$filename = '';
}
- if ((string)$filename !== '' && self::validPathStr($filename)) {
+ if ((string)$filename !== '' && static::validPathStr($filename)) {
// checks backpath.
return $filename;
}
public static function isAllowedAbsPath($path)
{
$lockRootPath = $GLOBALS['TYPO3_CONF_VARS']['BE']['lockRootPath'];
- return self::isAbsPath($path) && self::validPathStr($path)
- && (self::isFirstPartOfStr($path, PATH_site)
- || $lockRootPath && self::isFirstPartOfStr($path, $lockRootPath));
+ return static::isAbsPath($path) && static::validPathStr($path)
+ && (static::isFirstPartOfStr($path, PATH_site)
+ || $lockRootPath && static::isFirstPartOfStr($path, $lockRootPath));
}
/**
* The TYPO3 project - inspiring people to share!
*/
+use TYPO3\CMS\Core\Tests\Unit\Utility\Fixtures\GeneralUtilityFilesystemFixture;
use TYPO3\CMS\Core\Tests\Unit\Utility\Fixtures\GeneralUtilityFixture;
use TYPO3\CMS\Core\Tests\Unit\Utility\Fixtures\GeneralUtilityMinifyJavaScriptFixture;
use TYPO3\CMS\Core\Tests\Unit\Utility\Fixtures\OriginalClassFixture;
return $isConnected;
}
+ /**
+ * Helper method to create a random directory in the virtual file system
+ * and return the path.
+ *
+ * @param string $prefix
+ * @return string
+ */
+ protected function getVirtualTestDir($prefix = 'root_')
+ {
+ $root = vfsStream::setup();
+ $path = $root->url() . '/typo3temp/' . $this->getUniqueId($prefix);
+ GeneralUtility::mkdir_deep($path);
+ return $path;
+ }
+
///////////////////////////
// Tests concerning _GP
///////////////////////////
$this->markTestSkipped('The fixPermissionsSetsGroup() is not available on Mac OS because posix_getegid() always returns -1 on Mac OS.');
}
// Create and prepare test file
- $filename = PATH_site . 'typo3temp/' . $this->getUniqueId('test_');
- GeneralUtility::writeFileToTypo3tempDir($filename, '42');
- $this->testFilesToDelete[] = $filename;
+ $filename = $this->getVirtualTestDir() . '/' . $this->getUniqueId('test_');
+ GeneralUtilityFilesystemFixture::writeFileToTypo3tempDir($filename, '42');
$currentGroupId = posix_getegid();
// Set target group and run method
$GLOBALS['TYPO3_CONF_VARS']['SYS']['createGroup'] = $currentGroupId;
- GeneralUtility::fixPermissions($filename);
+ GeneralUtilityFilesystemFixture::fixPermissions($filename);
clearstatcache();
$this->assertEquals($currentGroupId, filegroup($filename));
}
*/
public function fixPermissionsSetsPermissionsToFile()
{
- if (TYPO3_OS == 'WIN') {
+ if (TYPO3_OS === 'WIN') {
$this->markTestSkipped('fixPermissions() tests not available on Windows');
}
// Create and prepare test file
- $filename = PATH_site . 'typo3temp/' . $this->getUniqueId('test_');
- GeneralUtility::writeFileToTypo3tempDir($filename, '42');
- $this->testFilesToDelete[] = $filename;
+ $filename = $this->getVirtualTestDir() . '/' . $this->getUniqueId('test_');
+ GeneralUtilityFilesystemFixture::writeFileToTypo3tempDir($filename, '42');
chmod($filename, 482);
// Set target permissions and run method
$GLOBALS['TYPO3_CONF_VARS']['SYS']['fileCreateMask'] = '0660';
- $fixPermissionsResult = GeneralUtility::fixPermissions($filename);
+ $fixPermissionsResult = GeneralUtilityFilesystemFixture::fixPermissions($filename);
clearstatcache();
$this->assertTrue($fixPermissionsResult);
$this->assertEquals('0660', substr(decoct(fileperms($filename)), 2));
*/
public function fixPermissionsSetsPermissionsToHiddenFile()
{
- if (TYPO3_OS == 'WIN') {
+ if (TYPO3_OS === 'WIN') {
$this->markTestSkipped('fixPermissions() tests not available on Windows');
}
// Create and prepare test file
- $filename = PATH_site . 'typo3temp/' . $this->getUniqueId('.test_');
- GeneralUtility::writeFileToTypo3tempDir($filename, '42');
- $this->testFilesToDelete[] = $filename;
+ $filename = $this->getVirtualTestDir() . '/' . $this->getUniqueId('test_');
+ GeneralUtilityFilesystemFixture::writeFileToTypo3tempDir($filename, '42');
chmod($filename, 482);
// Set target permissions and run method
$GLOBALS['TYPO3_CONF_VARS']['SYS']['fileCreateMask'] = '0660';
- $fixPermissionsResult = GeneralUtility::fixPermissions($filename);
+ $fixPermissionsResult = GeneralUtilityFilesystemFixture::fixPermissions($filename);
clearstatcache();
$this->assertTrue($fixPermissionsResult);
$this->assertEquals('0660', substr(decoct(fileperms($filename)), 2));
*/
public function fixPermissionsSetsPermissionsToDirectory()
{
- if (TYPO3_OS == 'WIN') {
+ if (TYPO3_OS === 'WIN') {
$this->markTestSkipped('fixPermissions() tests not available on Windows');
}
// Create and prepare test directory
- $directory = PATH_site . 'typo3temp/' . $this->getUniqueId('test_');
- GeneralUtility::mkdir($directory);
- $this->testFilesToDelete[] = $directory;
+ $directory = $this->getVirtualTestDir() . '/' . $this->getUniqueId('test_');
+ GeneralUtilityFilesystemFixture::mkdir($directory);
chmod($directory, 1551);
// Set target permissions and run method
$GLOBALS['TYPO3_CONF_VARS']['SYS']['folderCreateMask'] = '0770';
- $fixPermissionsResult = GeneralUtility::fixPermissions($directory);
+ $fixPermissionsResult = GeneralUtilityFilesystemFixture::fixPermissions($directory);
clearstatcache();
$this->assertTrue($fixPermissionsResult);
$this->assertEquals('0770', substr(decoct(fileperms($directory)), 1));
*/
public function fixPermissionsSetsPermissionsToDirectoryWithTrailingSlash()
{
- if (TYPO3_OS == 'WIN') {
+ if (TYPO3_OS === 'WIN') {
$this->markTestSkipped('fixPermissions() tests not available on Windows');
}
// Create and prepare test directory
- $directory = PATH_site . 'typo3temp/' . $this->getUniqueId('test_');
- GeneralUtility::mkdir($directory);
- $this->testFilesToDelete[] = $directory;
+ $directory = $this->getVirtualTestDir() . '/' . $this->getUniqueId('test_');
+ GeneralUtilityFilesystemFixture::mkdir($directory);
chmod($directory, 1551);
// Set target permissions and run method
$GLOBALS['TYPO3_CONF_VARS']['SYS']['folderCreateMask'] = '0770';
- $fixPermissionsResult = GeneralUtility::fixPermissions($directory . '/');
+ $fixPermissionsResult = GeneralUtilityFilesystemFixture::fixPermissions($directory . '/');
// Get actual permissions and clean up
clearstatcache();
$this->assertTrue($fixPermissionsResult);
*/
public function fixPermissionsSetsPermissionsToHiddenDirectory()
{
- if (TYPO3_OS == 'WIN') {
+ if (TYPO3_OS === 'WIN') {
$this->markTestSkipped('fixPermissions() tests not available on Windows');
}
// Create and prepare test directory
- $directory = PATH_site . 'typo3temp/' . $this->getUniqueId('.test_');
- GeneralUtility::mkdir($directory);
- $this->testFilesToDelete[] = $directory;
+ $directory = $this->getVirtualTestDir() . '/' . $this->getUniqueId('test_');
+ GeneralUtilityFilesystemFixture::mkdir($directory);
chmod($directory, 1551);
// Set target permissions and run method
$GLOBALS['TYPO3_CONF_VARS']['SYS']['folderCreateMask'] = '0770';
- $fixPermissionsResult = GeneralUtility::fixPermissions($directory);
+ $fixPermissionsResult = GeneralUtilityFilesystemFixture::fixPermissions($directory);
// Get actual permissions and clean up
clearstatcache();
$this->assertTrue($fixPermissionsResult);
*/
public function fixPermissionsCorrectlySetsPermissionsRecursive()
{
- if (TYPO3_OS == 'WIN') {
+ if (TYPO3_OS === 'WIN') {
$this->markTestSkipped('fixPermissions() tests not available on Windows');
}
// Create and prepare test directory and file structure
- $baseDirectory = PATH_site . 'typo3temp/' . $this->getUniqueId('test_');
- GeneralUtility::mkdir($baseDirectory);
- $this->testFilesToDelete[] = $baseDirectory;
+ $baseDirectory = $this->getVirtualTestDir() . '/' . $this->getUniqueId('test_');
+ GeneralUtilityFilesystemFixture::mkdir($baseDirectory);
chmod($baseDirectory, 1751);
- GeneralUtility::writeFileToTypo3tempDir($baseDirectory . '/file', '42');
+ GeneralUtilityFilesystemFixture::writeFileToTypo3tempDir($baseDirectory . '/file', '42');
chmod($baseDirectory . '/file', 482);
- GeneralUtility::mkdir($baseDirectory . '/foo');
+ GeneralUtilityFilesystemFixture::mkdir($baseDirectory . '/foo');
chmod($baseDirectory . '/foo', 1751);
- GeneralUtility::writeFileToTypo3tempDir($baseDirectory . '/foo/file', '42');
+ GeneralUtilityFilesystemFixture::writeFileToTypo3tempDir($baseDirectory . '/foo/file', '42');
chmod($baseDirectory . '/foo/file', 482);
- GeneralUtility::mkdir($baseDirectory . '/.bar');
+ GeneralUtilityFilesystemFixture::mkdir($baseDirectory . '/.bar');
chmod($baseDirectory . '/.bar', 1751);
// Use this if writeFileToTypo3tempDir is fixed to create hidden files in subdirectories
// \TYPO3\CMS\Core\Utility\GeneralUtility::writeFileToTypo3tempDir($baseDirectory . '/.bar/.file', '42');
// Set target permissions and run method
$GLOBALS['TYPO3_CONF_VARS']['SYS']['fileCreateMask'] = '0660';
$GLOBALS['TYPO3_CONF_VARS']['SYS']['folderCreateMask'] = '0770';
- $fixPermissionsResult = GeneralUtility::fixPermissions($baseDirectory, true);
+ $fixPermissionsResult = GeneralUtilityFilesystemFixture::fixPermissions($baseDirectory, true);
// Get actual permissions
clearstatcache();
$resultBaseDirectoryPermissions = substr(decoct(fileperms($baseDirectory)), 1);
*/
public function fixPermissionsDoesNotSetPermissionsToNotAllowedPath()
{
- if (TYPO3_OS == 'WIN') {
+ if (TYPO3_OS === 'WIN') {
$this->markTestSkipped('fixPermissions() tests not available on Windows');
}
// Create and prepare test file
$filename = PATH_site . 'typo3temp/../typo3temp/' . $this->getUniqueId('test_');
- touch($filename);
- chmod($filename, 482);
// Set target permissions and run method
$GLOBALS['TYPO3_CONF_VARS']['SYS']['fileCreateMask'] = '0660';
$fixPermissionsResult = GeneralUtility::fixPermissions($filename);
- clearstatcache();
- $this->testFilesToDelete[] = $filename;
$this->assertFalse($fixPermissionsResult);
}
*/
public function fixPermissionsSetsPermissionsWithRelativeFileReference()
{
- if (TYPO3_OS == 'WIN') {
+ if (TYPO3_OS === 'WIN') {
$this->markTestSkipped('fixPermissions() tests not available on Windows');
}
$filename = 'typo3temp/' . $this->getUniqueId('test_');
*/
public function fixPermissionsSetsDefaultPermissionsToFile()
{
- if (TYPO3_OS == 'WIN') {
+ if (TYPO3_OS === 'WIN') {
$this->markTestSkipped('fixPermissions() tests not available on Windows');
}
- $filename = PATH_site . 'typo3temp/' . $this->getUniqueId('test_');
- GeneralUtility::writeFileToTypo3tempDir($filename, '42');
- $this->testFilesToDelete[] = $filename;
+ $filename = $this->getVirtualTestDir() . '/' . $this->getUniqueId('test_');
+ GeneralUtilityFilesystemFixture::writeFileToTypo3tempDir($filename, '42');
chmod($filename, 482);
unset($GLOBALS['TYPO3_CONF_VARS']['SYS']['fileCreateMask']);
- $fixPermissionsResult = GeneralUtility::fixPermissions($filename);
+ $fixPermissionsResult = GeneralUtilityFilesystemFixture::fixPermissions($filename);
clearstatcache();
$this->assertTrue($fixPermissionsResult);
$this->assertEquals('0644', substr(decoct(fileperms($filename)), 2));
*/
public function fixPermissionsSetsDefaultPermissionsToDirectory()
{
- if (TYPO3_OS == 'WIN') {
+ if (TYPO3_OS === 'WIN') {
$this->markTestSkipped('fixPermissions() tests not available on Windows');
}
- $directory = PATH_site . 'typo3temp/' . $this->getUniqueId('test_');
- GeneralUtility::mkdir($directory);
- $this->testFilesToDelete[] = $directory;
+ $directory = $this->getVirtualTestDir() . '/' . $this->getUniqueId('test_');
+ GeneralUtilityFilesystemFixture::mkdir($directory);
chmod($directory, 1551);
unset($GLOBALS['TYPO3_CONF_VARS']['SYS']['folderCreateMask']);
- $fixPermissionsResult = GeneralUtility::fixPermissions($directory);
+ $fixPermissionsResult = GeneralUtilityFilesystemFixture::fixPermissions($directory);
clearstatcache();
$this->assertTrue($fixPermissionsResult);
$this->assertEquals('0755', substr(decoct(fileperms($directory)), 1));
*/
public function mkdirCreatesDirectory()
{
- $directory = PATH_site . 'typo3temp/' . $this->getUniqueId('test_');
- $mkdirResult = GeneralUtility::mkdir($directory);
- $this->testFilesToDelete[] = $directory;
+ $directory = $this->getVirtualTestDir() . '/' . $this->getUniqueId('test_');
+ $mkdirResult = GeneralUtilityFilesystemFixture::mkdir($directory);
clearstatcache();
$this->assertTrue($mkdirResult);
$this->assertTrue(is_dir($directory));
*/
public function mkdirCreatesHiddenDirectory()
{
- $directory = PATH_site . 'typo3temp/' . $this->getUniqueId('.test_');
- $mkdirResult = GeneralUtility::mkdir($directory);
- $this->testFilesToDelete[] = $directory;
+ $directory = $this->getVirtualTestDir() . '/' . $this->getUniqueId('.test_');
+ $mkdirResult = GeneralUtilityFilesystemFixture::mkdir($directory);
clearstatcache();
$this->assertTrue($mkdirResult);
$this->assertTrue(is_dir($directory));
*/
public function mkdirCreatesDirectoryWithTrailingSlash()
{
- $directory = PATH_site . 'typo3temp/' . $this->getUniqueId('test_') . '/';
- $mkdirResult = GeneralUtility::mkdir($directory);
- $this->testFilesToDelete[] = $directory;
+ $directory = $this->getVirtualTestDir() . '/' . $this->getUniqueId('test_') . '/';
+ $mkdirResult = GeneralUtilityFilesystemFixture::mkdir($directory);
clearstatcache();
$this->assertTrue($mkdirResult);
$this->assertTrue(is_dir($directory));
*/
public function mkdirSetsPermissionsOfCreatedDirectory()
{
- if (TYPO3_OS == 'WIN') {
+ if (TYPO3_OS === 'WIN') {
$this->markTestSkipped('mkdirSetsPermissionsOfCreatedDirectory() test not available on Windows');
}
- $directory = PATH_site . 'typo3temp/' . $this->getUniqueId('test_');
+ $directory = $this->getVirtualTestDir() . '/' . $this->getUniqueId('test_');
$oldUmask = umask(19);
$GLOBALS['TYPO3_CONF_VARS']['SYS']['folderCreateMask'] = '0772';
- GeneralUtility::mkdir($directory);
- $this->testFilesToDelete[] = $directory;
+ GeneralUtilityFilesystemFixture::mkdir($directory);
clearstatcache();
$resultDirectoryPermissions = substr(decoct(fileperms($directory)), 1);
umask($oldUmask);
*/
public function mkdirSetsGroupOwnershipOfCreatedDirectory()
{
- if (!function_exists('posix_getegid')) {
- $this->markTestSkipped('Function posix_getegid() not available, mkdirSetsGroupOwnershipOfCreatedDirectory() tests skipped');
- }
- if (posix_getegid() === -1) {
- $this->markTestSkipped('The mkdirSetsGroupOwnershipOfCreatedDirectory() is not available on Mac OS because posix_getegid() always returns -1 on Mac OS.');
- }
$swapGroup = $this->checkGroups(__FUNCTION__);
if ($swapGroup !== false) {
$GLOBALS['TYPO3_CONF_VARS']['SYS']['createGroup'] = $swapGroup;
- $directory = $this->getUniqueId('mkdirtest_');
- GeneralUtility::mkdir(PATH_site . 'typo3temp/' . $directory);
- $this->testFilesToDelete[] = PATH_site . 'typo3temp/' . $directory;
+ $directory = $this->getVirtualTestDir() . '/' . $this->getUniqueId('mkdirtest_');
+ GeneralUtilityFilesystemFixture::mkdir($directory);
clearstatcache();
- $resultDirectoryGroupInfo = posix_getgrgid(filegroup(PATH_site . 'typo3temp/' . $directory));
- $resultDirectoryGroup = $resultDirectoryGroupInfo['name'];
+ $resultDirectoryGroup = filegroup($directory);
$this->assertEquals($resultDirectoryGroup, $swapGroup);
}
}
* Check if test on filesystem group ownership can be done in this environment
* If so, return second group of webserver user
*
- * @param string calling method name
- * @return mixed FALSE if test cannot be run, string name of the second group of webserver user
+ * @param string $methodName calling method name
+ * @return mixed FALSE if test cannot be run, int group id of the second group of webserver user
*/
private function checkGroups($methodName)
{
- if (TYPO3_OS == 'WIN') {
+ if (TYPO3_OS === 'WIN') {
$this->markTestSkipped($methodName . '() test not available on Windows.');
return false;
}
+ if (!function_exists('posix_getegid')) {
+ $this->markTestSkipped('Function posix_getegid() not available, ' . $methodName . '() tests skipped');
+ return false;
+ }
+ if (posix_getegid() === -1) {
+ $this->markTestSkipped('Function posix_getegid() returns -1, ' . $methodName . '() tests skipped');
+ return false;
+ }
if (!function_exists('posix_getgroups')) {
$this->markTestSkipped('Function posix_getgroups() not available, ' . $methodName . '() tests skipped');
+ return false;
}
$groups = posix_getgroups();
if (count($groups) <= 1) {
$this->markTestSkipped($methodName . '() test cannot be done when the web server user is only member of 1 group.');
return false;
}
- $uname = strtolower(php_uname());
- $groupOffset = 1;
- if (strpos($uname, 'darwin') !== false) {
- // We are on OSX and it seems that the first group needs to be fetched since Mavericks
- $groupOffset = 0;
- }
- $groupInfo = posix_getgrgid($groups[$groupOffset]);
- return $groupInfo['name'];
+ $secondaryGroups = array_diff($groups, [posix_getegid()]);
+ return array_shift($secondaryGroups);
}
///////////////////////////////
*/
public function mkdirDeepCreatesDirectory()
{
- $directory = 'typo3temp/' . $this->getUniqueId('test_');
- GeneralUtility::mkdir_deep(PATH_site, $directory);
- $this->testFilesToDelete[] = PATH_site . $directory;
- $this->assertTrue(is_dir(PATH_site . $directory));
+ $directory = $this->getVirtualTestDir() . '/' . $this->getUniqueId('test_');
+ GeneralUtility::mkdir_deep($directory);
+ $this->assertTrue(is_dir($directory));
}
/**
*/
public function mkdirDeepCreatesSubdirectoriesRecursive()
{
- $directory = 'typo3temp/' . $this->getUniqueId('test_');
+ $directory = $this->getVirtualTestDir() . '/typo3temp/' . $this->getUniqueId('test_');
$subDirectory = $directory . '/foo';
- GeneralUtility::mkdir_deep(PATH_site, $subDirectory);
- $this->testFilesToDelete[] = PATH_site . $directory;
- $this->assertTrue(is_dir(PATH_site . $subDirectory));
+ GeneralUtility::mkdir_deep($subDirectory);
+ $this->assertTrue(is_dir($subDirectory));
}
/**
*/
public function mkdirDeepFixesPermissionsOfCreatedDirectory()
{
- if (TYPO3_OS == 'WIN') {
+ if (TYPO3_OS === 'WIN') {
$this->markTestSkipped('mkdirDeepFixesPermissionsOfCreatedDirectory() test not available on Windows.');
}
$directory = $this->getUniqueId('mkdirdeeptest_');
*/
public function mkdirDeepFixesPermissionsOnNewParentDirectory()
{
- if (TYPO3_OS == 'WIN') {
+ if (TYPO3_OS === 'WIN') {
$this->markTestSkipped('mkdirDeepFixesPermissionsOnNewParentDirectory() test not available on Windows.');
}
$directory = $this->getUniqueId('mkdirdeeptest_');
*/
public function mkdirDeepDoesNotChangePermissionsOfExistingSubDirectories()
{
- if (TYPO3_OS == 'WIN') {
+ if (TYPO3_OS === 'WIN') {
$this->markTestSkipped('mkdirDeepDoesNotChangePermissionsOfExistingSubDirectories() test not available on Windows.');
}
$baseDirectory = PATH_site . 'typo3temp/';
GeneralUtility::mkdir_deep(PATH_site . 'typo3temp/', $directory);
$this->testFilesToDelete[] = PATH_site . 'typo3temp/' . $directory;
clearstatcache();
- $resultDirectoryGroupInfo = posix_getgrgid(filegroup(PATH_site . 'typo3temp/' . $directory));
- $resultDirectoryGroup = $resultDirectoryGroupInfo['name'];
+ $resultDirectoryGroup = filegroup(PATH_site . 'typo3temp/' . $directory);
$this->assertEquals($resultDirectoryGroup, $swapGroup);
}
}
GeneralUtility::mkdir_deep(PATH_site . 'typo3temp/', $subDirectory);
$this->testFilesToDelete[] = PATH_site . 'typo3temp/' . $directory;
clearstatcache();
- $resultDirectoryGroupInfo = posix_getgrgid(filegroup(PATH_site . 'typo3temp/' . $directory));
- $resultDirectoryGroup = $resultDirectoryGroupInfo['name'];
+ $resultDirectoryGroup = filegroup(PATH_site . 'typo3temp/' . $directory);
$this->assertEquals($resultDirectoryGroup, $swapGroup);
}
}
GeneralUtility::mkdir_deep(PATH_site . 'typo3temp/', $subDirectory);
$this->testFilesToDelete[] = PATH_site . 'typo3temp/' . $directory;
clearstatcache();
- $resultDirectoryGroupInfo = posix_getgrgid(filegroup(PATH_site . 'typo3temp/' . $subDirectory));
- $resultDirectoryGroup = $resultDirectoryGroupInfo['name'];
+ $resultDirectoryGroup = filegroup(PATH_site . 'typo3temp/' . $directory);
$this->assertEquals($resultDirectoryGroup, $swapGroup);
}
}
*/
public function syslogFixesPermissionsOnFileIfUsingFileLogging()
{
- if (TYPO3_OS == 'WIN') {
+ if (TYPO3_OS === 'WIN') {
$this->markTestSkipped('syslogFixesPermissionsOnFileIfUsingFileLogging() test not available on Windows.');
}
// Fake all required settings
*/
public function deprecationLogFixesPermissionsOnLogFile()
{
- if (TYPO3_OS == 'WIN') {
+ if (TYPO3_OS === 'WIN') {
$this->markTestSkipped('deprecationLogFixesPermissionsOnLogFile() test not available on Windows.');
}
$filePath = PATH_site . GeneralUtilityFixture::DEPRECATION_LOG_PATH;