Joomla! Programmierung/Framework/JFolder/copy
Aus Joomla! Dokumentation
JFolder/copy Kopiert einen Ordner.
Inhaltsverzeichnis |
[Bearbeiten] Syntax
static copy($src, $dest, [$path], [$force])
[Bearbeiten] Beispiel
JFolder::copy('quelle', 'ziel', JPATH_COMPONENT, true);
Kopiert den Ordner
quelle in den Ordner
ziel Im Verzeichnis Ihrer Komponente und überschreibt ihn falls er schon vorhanden ist.
[Bearbeiten] Siehe auch
- JFolder->copy() auf api.joomla.org
[Bearbeiten] Quellcode
{ // Initialise variables. if ($path) { } // Eliminate trailing directory separators, if any if (!self::exists($src)) { } if (self::exists($dest) && !$force) { } // Make sure the destination exists if (!self::create($dest)) { } // If we're using ftp and don't have streams enabled if ($FTPOptions['enabled'] == 1 && !$use_streams) { // Connect the FTP client jimport('joomla.client.ftp'); $ftp = JFTP::getInstance($FTPOptions['host'], $FTPOptions['port'], null, $FTPOptions['user'], $FTPOptions['pass']); { } // Walk through the directory copying files and recursing into folders. { $sfid = $src . '/' . $file; $dfid = $dest . '/' . $file; { case 'dir': if ($file != '.' && $file != '..') { if ($ret !== true) { return $ret; } } break; case 'file': // Translate path for the FTP account if (!$ftp->store($sfid, $dfid)) { } break; } } } else { { } // Walk through the directory copying files and recursing into folders. { $sfid = $src . '/' . $file; $dfid = $dest . '/' . $file; { case 'dir': if ($file != '.' && $file != '..') { if ($ret !== true) { return $ret; } } break; case 'file': if ($use_streams) { if (!$stream->copy($sfid, $dfid)) { } } else { { } } break; } } } return true; }