Skip to content

Commit

Permalink
RecursiveDirectoryIterator && mkdir
Browse files Browse the repository at this point in the history
  • Loading branch information
dgrammatiko committed Nov 28, 2021
1 parent ebff3bb commit 0b4ff1d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions administrator/components/com_admin/script.php
Original file line number Diff line number Diff line change
Expand Up @@ -8505,16 +8505,18 @@ protected function moveRemainingTemplateFiles()
{
if (Folder::exists(JPATH_ROOT . $oldFolder))
{
$oldPath = \realpath(JPATH_ROOT . $oldFolder);
$newPath = \realpath(JPATH_ROOT . $newFolder);
$oldPath = \realpath(JPATH_ROOT . $oldFolder);
$newPath = \realpath(JPATH_ROOT . $newFolder);
$directory = new \RecursiveDirectoryIterator($oldPath);
$iterator = new \RecursiveIteratorIterator($directory);

// Handle all files in this folder and all sub-folders
foreach (Folder::files($oldPath, '.*', true, true) as $oldFile)
foreach ($iterator as $oldFile)
{
$newFile = $newPath . substr($oldFile, strlen($oldPath));

// Create target folder and parent folders if they don't exist yet
if (Folder::create(\dirname($newFile)))
if (@mkdir(\dirname($newFile), 0755, true) !== false)
{
File::move($oldFile, $newFile);
}
Expand Down

0 comments on commit 0b4ff1d

Please sign in to comment.