コード例 #1
0
 /**
  * @param ProvisionServiceRequest $request
  *
  * @return \DreamFactory\Enterprise\Common\Provisioners\BaseResponse|void
  * @throws \Exception
  */
 protected function doProvision($request)
 {
     //  Wipe existing stuff
     $_instance = $request->getInstance();
     $_filesystem = $request->getStorage();
     $_paths = [];
     //******************************************************************************
     //* Directories are all relative to the request's storage file system
     //******************************************************************************
     //  The instance's base storage path
     $_instanceRootPath = trim($_instance->instance_id_text);
     //  The user's and instance's private path
     $_privateName = InstanceStorage::getPrivatePathName();
     $_ownerPrivatePath = $_privateName;
     $_privatePath = Disk::segment([$_instanceRootPath, $_privateName]);
     //  Make sure everything exists
     try {
         !$_filesystem->has($_privatePath) && $_filesystem->createDir($_privatePath);
         !$_filesystem->has($_ownerPrivatePath) && $_filesystem->createDir($_ownerPrivatePath);
         //  Now ancillary sub-directories
         foreach (config('provisioning.public-paths', []) as $_path) {
             $_paths[] = Disk::segment([$_instanceRootPath, $_path]);
         }
         foreach (config('provisioning.private-paths', []) as $_path) {
             $_paths[] = Disk::segment([$_privatePath, $_path]);
         }
         foreach (config('provisioning.owner-private-paths', []) as $_path) {
             $_paths[] = Disk::segment([$_ownerPrivatePath, $_path]);
         }
         foreach ($_paths as $_path) {
             !$_filesystem->has($_path) && $_filesystem->createDir($_path);
         }
         $this->debug('[provisioning:storage] structure built', $_paths);
     } catch (\Exception $_ex) {
         $this->error('[provisioning:storage] error creating directory structure: ' . $_ex->getMessage());
         throw $_ex;
     }
     //  Fire off a "storage.provisioned" event...
     \Event::fire('dfe.storage.provisioned', [$this, $request]);
     $this->info('[provisioning:storage] instance "' . $_instance->instance_id_text . '" complete');
     $this->privatePath = $_privatePath;
     $this->ownerPrivatePath = $_ownerPrivatePath;
 }
コード例 #2
0
ファイル: User.php プロジェクト: pkdevboxy/dfe-database
 /**
  * @param string|array|null $append
  * @param bool|true         $create
  * @param int               $mode
  * @param bool|true         $recursive
  *
  * @return string
  */
 public function getOwnerPrivatePath($append = null, $create = true, $mode = 0777, $recursive = true)
 {
     InstanceStorage::buildStorageMap($this->storage_id_text);
     return Disk::path([config('provisioning.storage-root', EnterpriseDefaults::STORAGE_ROOT), InstanceStorage::getStorageRootPath(), InstanceStorage::getPrivatePathName(), $append], $create, $mode, $recursive);
 }