[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class FileUploadHashConduitAPIMethod extends FileConduitAPIMethod { 4 5 public function getAPIMethodName() { 6 return 'file.uploadhash'; 7 } 8 9 public function getMethodDescription() { 10 return 'Upload a file to the server using content hash.'; 11 } 12 13 public function defineParamTypes() { 14 return array( 15 'hash' => 'required nonempty string', 16 'name' => 'required nonempty string', 17 ); 18 } 19 20 public function defineReturnType() { 21 return 'phid or null'; 22 } 23 24 public function defineErrorTypes() { 25 return array( 26 ); 27 } 28 29 protected function execute(ConduitAPIRequest $request) { 30 $hash = $request->getValue('hash'); 31 $name = $request->getValue('name'); 32 $user = $request->getUser(); 33 34 $file = PhabricatorFile::newFileFromContentHash( 35 $hash, 36 array( 37 'name' => $name, 38 'authorPHID' => $user->getPHID(), 39 )); 40 41 if ($file) { 42 return $file->getPHID(); 43 } 44 return $file; 45 } 46 47 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |