Ejemplo n.º 1
0
 /**
  * @NoAdminRequired
  * @NoCSRFRequired
  *
  * Start delta sync upload
  *
  * @param string $path
  * @param int $size the new size of the file
  */
 public function start($path, $size)
 {
     $np = $path . '.new';
     $npf = $this->userFolder->getFullPath($np);
     try {
         $node = $this->userFolder->get($path);
     } catch (\OCP\Files\NotFoundException $exception) {
         return new JSONResponse([], Http::STATUS_NOT_FOUND);
     }
     $node->copy($npf);
     $node = $this->userFolder->get($np);
     $file = $node->fopen('r+');
     $res = ftruncate($file, $size);
     if (!$res) {
         //Truncate failed
     }
     fclose($file);
     return new JSONResponse($size);
 }
Ejemplo n.º 2
0
	/**
	 * copies the skeleton to the users /files
	 *
	 * @param \OC\User\User $user
	 * @param \OCP\Files\Folder $userDirectory
	 */
	public static function copySkeleton(\OC\User\User $user, \OCP\Files\Folder $userDirectory) {

		$skeletonDirectory = \OCP\Config::getSystemValue('skeletondirectory', \OC::$SERVERROOT . '/core/skeleton');

		if (!empty($skeletonDirectory)) {
			\OCP\Util::writeLog(
				'files_skeleton',
				'copying skeleton for '.$user->getUID().' from '.$skeletonDirectory.' to '.$userDirectory->getFullPath('/'),
				\OCP\Util::DEBUG
			);
			self::copyr($skeletonDirectory, $userDirectory);
			// update the file cache
			$userDirectory->getStorage()->getScanner()->scan('', \OC\Files\Cache\Scanner::SCAN_RECURSIVE);
		}
	}