コード例 #1
0
ファイル: Folder.php プロジェクト: ajaboa/crmpuan
 public function copyContentsFrom(Folder $sourceFolder, $mergeFolders = false)
 {
     //make sure database is in sync with filesystem.
     $sourceFolder->syncFilesystem(true);
     $stmt = $sourceFolder->folders();
     while ($subfolder = $stmt->fetch()) {
         $subfolder->systemSave = true;
         if (!$mergeFolders) {
             $subfolder->copy($this);
         } else {
             if ($existingFolder = $this->hasFolder($subfolder->name)) {
                 $existingFolder->copyContentsFrom($subfolder, true);
             } else {
                 $subfolder->copy($this);
             }
         }
     }
     $stmt = $sourceFolder->files();
     while ($file = $stmt->fetch()) {
         $file->copy($this, false, true);
     }
 }