I am trying to copy the files from a folder.
I have this function:
private function rec_copy ($source, $dest) {
foreach (
$iterator = new \RecursiveIteratorIterator(
new \RecursiveDirectoryIterator($source, \RecursiveDirectoryIterator::SKIP_DOTS),
\RecursiveIteratorIterator::SELF_FIRST) as $item
) {
if ($item->isDir()) {
mkdir($dest . DIRECTORY_SEPARATOR . $iterator->getSubPathName());
} else {
copy($item, $dest . DIRECTORY_SEPARATOR . $iterator->getSubPathName());
}
}
}
This function works perfectly with this one:
protected function copy_translation($directory,$value)
{
$directorio = $directory;
$newfolder = '/var/www/vhosts/something/modules/'.$value;
$newfolder_translation = $newfolder.'/translations/';
mkdir($newfolder);
mkdir($newfolder_translation);
$this->rec_copy( $directorio,$newfolder_translation);
}
However, it fails when I try with this one:
public function otherfunction($language){
foreach ($this->list as $key => $value){
$directory = '/var/www/vhosts/something/modules/'.$value.'/translations/';
if (is_dir($directory)){
$source = $directory.'de/';
$destination = $directory . $language . '/';
mkdir($destination);
$this->rec_copy($source,$destination);
}
}
}
They are all in the same class. The function otherfunction
actually creates the directories with mkdir($destination)
, so the path and the permission of the folder cannot be the problem.
There is nothing in the log and no error display. If I execute $this->rec_copy($source,$destination);
in the third function, it shows "shop is offline" up but works fine with the second, as I mentioned before.
I am using oxid 4.9.7 if that helps, but the platform itself doesn't seem to be the problem to me.