Install spa from file into the tenant.

@param String $path
@param string $deleteFile
@throws Pluf_Exception
162041
public static function installFromFile($path, $deleteFile = false)
    {
        // crate spa
        $spa = new Tenant_SPA();
        $spa->path = 'not/set';
        $spa->name = 'spa-' . rand();
        $spa->create();
        try {
            return self::updateFromFile($spa, $path, $deleteFile);
        } catch (Exception $ex) {
            $spa->delete();
            throw $ex;
        }
    }
1062096
public function uploadFile($key, $filePath, $deleteAfterUpload = true)
    {
        if (is_dir($filePath) && false === is_dir($this->mediaDirectory)) {
            throw new BadFileException();
        }
        $targetFile = $this->computePath($key);
        $this->fileSystem->copy($filePath, $targetFile);

        if ($deleteAfterUpload) {
            $this->fileSystem->remove($filePath);
        }
    }
515190
private function _deleteEntity($path)
    {
        $method = Resources::HTTP_DELETE;
        $headers = [];
        $postParams = [];
        $queryParams = [];
        $statusCode = Resources::STATUS_NO_CONTENT;

        $this->sendHttp(
            $method,
            $headers,
            $queryParams,
            $postParams,
            $path,
            $statusCode
        );
    }
577593
public static function deleteIdentity($privateKeyFile) {
        if (!is_file($privateKeyFile)) {
            throw new \Exception('Private key file not found.');
        }
        exec('ssh-add -L | grep '. $privateKeyFile, $output);
        $tmpFile = tempnam(sys_get_temp_dir(), 'publickey_');
        file_put_contents($tmpFile, end($output));
        exec('ssh-add -d ' . $tmpFile . ' >/dev/null 2>&1', $output);
        unlink($tmpFile);
    }
1125543
public function rm( $path )
	{
		try {
			$this->fs->delete( $path );
		} catch( \Exception $e ) {
			throw new Exception( $e->getMessage(), 0, $e );
		}
	}
761474
protected function installFromFile()
    {
        if (!file_exists($path = base_path('components.json'))) {
            $this->error("File 'components.json' does not exist in your project root.");

            return;
        }

        $components = Json::make($path);

        $dependencies = $components->get('require', []);

        foreach ($dependencies as $component) {
            $component = collect($component);

            $this->install(
                $component->get('name'),
                $component->get('version'),
                $component->get('type')
            );
        }
    }
253210
public function makeDirectoryBeforeUpload($path, $cleanDirectory = false)
    {
        if (! $this->exists($path)) {
            $this->makeDirectory($path, 0775, true);
            return true;
        }

        // tamamen silip oluşturmak istendi ise
        if (($this->exists($path) && $cleanDirectory) || (isset($this->options['is_reset']) && $this->options['is_reset'])) {
            $this->deleteDirectory($path, true);
            $this->makeDirectory($path, 0775, true, true);
            return true;
        }

        if ($this->options['relation'] !== 'hasMany' && ( ! isset($this->options['is_reset']) ||  $this->options['is_reset']) ) {
            $this->cleanDirectory($path);
        }
        return true;
    }
689745
private function getFileToImport(UploadedFile $file, &$deleteFile)
    {
        $deleteFile = false;
        $post = $this->request->request;
        $dzuuid = $post->get('dzuuid');
        $dzIndex = $post->get('dzchunkindex');
        $dzTotalChunks = $post->get('dztotalchunkcount');
        if ($dzuuid !== null && $dzIndex !== null && $dzTotalChunks !== null) {
            $file->move($file->getPath(), $dzuuid . $dzIndex);
            if ($this->isFullChunkFilePresent($dzuuid, $file->getPath(), $dzTotalChunks)) {
                $deleteFile = true;

                return $this->combineFileChunks($dzuuid, $file->getPath(), $dzTotalChunks, $file);
            } else {
                return null;
            }
        } else {
            return $file;
        }
    }
90544
public static function addToQueue($path, $type)
    {
        if ($type != self::TYPE_DIR && $type != self::TYPE_FILE) {
            throw new \Exception(sprintf('Invalid $type parameter "%s"', $type));
        }

        self::$cleanupQueue[] = ['path' => $path, 'type' => $type];
    }
488256
function buildCertificateConf($path, $url)
    {
        $config = str_replace('VALET_DOMAIN', $url, $this->files->get(__DIR__.'/../stubs/openssl.conf'));
        $this->files->putAsUser($path, $config);
    }
426391
protected function load(string $path): void
    {
        $namespace = $this->app->getNamespace();

        /** @var SplFileInfo[] $files */
        $files = (new Finder)->in($path)->files();

        foreach ($files as $file) {
            $file = $namespace.str_replace(
                    ['/', '.php'],
                    ['\\', ''],
                    Str::after($file->getPathname(), app_path().DIRECTORY_SEPARATOR)
                );

            if (is_subclass_of($file, Intent::class) && !(new ReflectionClass($file))->isAbstract()) {
                $this->app['conversation']->registerIntent($file);
            }
        }
    }
1055137
public function save($path, $file_name = '', $delete_source = false)
    {

        try {
            if (empty($path)) {
                throw new FileException("No path has been given : $path", Config::get('file_error'), Config::get('error_lvl_low'), __FILE__, __LINE__);
            }

            $save_name = "$path/" . (empty($file_name) ? $this->u_name : $file_name);
            $save_name = trim($save_name);
            $save_name = (strpos($save_name, '.') === false) ? trim($save_name) . "." . trim($this->file_extension) : trim($save_name);

            if (!copy($this->u_tmp_name, $save_name)) {
                throw new FileException("Copy operation wasn't possible: $this->u_tmp_name, $save_name", Config::get('file_error'), Config::get('error_lvl_low'), __FILE__, __LINE__);
            }

            if ($delete_source === true) {
                // delete the temporary file
                unlink($this->u_tmp_name);
            }

            return $this->open($save_name);

        } catch (FileException $e) {
            throw $e;
        }
    }
259916
function (deployPath) {
  const envFilePath = setupHelper.setupFolderAbsolutePath() + '/' + setupConfig.env_vars_file
    , clearCacheOfExpr = /(openst-platform\/config\/)|(openst-platform\/lib\/)|(openst-platform\/services\/)/;

  return new Promise(function (onResolve, onReject) {
    // source env
    shellSource(envFilePath, async function (err) {
      if (err) {
        throw err;
      }
      Object.keys(require.cache).forEach(function (key) {
        if (key.search(clearCacheOfExpr) !== -1) {
          delete require.cache[key];
        }
      });

      const setupHelper = require(deployPath);
      return onResolve(await setupHelper.perform());
    });
  });

}
835611
public function delete($path, $postData, $accept="")
    {
        return $this->request(
            'DELETE',
            $path,
            $accept,
            [
                CURLOPT_POSTFIELDS => $postData
            ]
        );

    }
1194090
protected function buildFileList( $path, $extraFilter = null )
    {
        $dirSep = preg_quote( DIRECTORY_SEPARATOR );
        $exclusionFilter = array( "@^{$path}{$dirSep}(var|settings|benchmarks|bin|autoload|port_info|update|templates|tmp|UnitTest|lib{$dirSep}ezc)@" );

        if ( !empty( $extraFilter ) and is_array( $extraFilter ) )
        {
            foreach( $extraFilter as $filter )
            {
                $exclusionFilter[] = $filter;
            }
        }

        if (!empty( $path ) )
        {
            return self::findRecursive( $path, array( '@\.php$@' ), $exclusionFilter, $this );
        }
        return false;
    }
445665
public function redirect($path, $type = 302, $end = true)
    {
        // $type should be one of the following:
        // 301 = Moved permanently
        // 302 = Temporary redirect
        // 303 = Perform GET at new location (instead of POST)

        if (headers_sent()) {
            if (self::$exceptOnHeaders) {
                throw new \Exception('Headers already sent. Redirect cannot be initiated.');
            } else {
                return;
            }
        }

        if (self::$outputBuffering) {
            $this->cleanBuffer();
        }

        $this->code($type);
        header('Location: '. $path);

        if ($end) {
            exit;
        }
    }
1347387
public void delete(String path) {
        OAuthRequest request = new OAuthRequest(Verb.GET, FILE_OPS_DELETE_URL);
        request.addQuerystringParameter("root", "dropbox");
        request.addQuerystringParameter("path", encode(path));

        service.signRequest(accessToken, request);
        checkDelete(request.send());
    }