예제 #1
0
 /**
  * Sets the content of a file object to that in
  * the given source file
  *
  * @param File $file
  * @param string $sourceFile
  */
 public function setFile(File $file, $sourceFile)
 {
     if (!$this->getConnection()) {
         return null;
     }
     ini_set('memory_limit', '64M');
     $node = $this->nodeFromFile($file);
     if (!$node) {
         return;
     }
     $content = new ContentData($node, NamespaceMap::getFullName("cm_content"));
     $mimeType = get_mime_content_type($sourceFile);
     $sourceContent = file_get_contents($sourceFile);
     $content->setContent($sourceContent);
     $content->setMimetype($mimeType);
     $node->cm_content = $content;
     $this->alfresco->save();
 }