@param string $path
@param int $owner

@return bool

@throws \Icicle\File\Exception\FileException
344846
private function chown(string $path, int $owner): bool
    {
        if (!@chown($path, $owner)) {
            $message = 'Could not change file owner.';
            if ($error = error_get_last()) {
                $message .= sprintf(' Errno: %d; %s', $error['type'], $error['message']);
            }
            throw new FileException($message);
        }

        return true;
    }
95784
public static function delete($path)
    {
        @set_time_limit(ini_get('max_execution_time'));
    
        // Sanity check
        if (!rtrim($path, '/\\'))
        {
            // Bad programmer! Bad Bad programmer!
            throw new \Exception(__METHOD__ . ': You can not delete a base directory.');
        }
    
        // Check to make sure the path valid and clean
        $path = FileHelper::cleanPath($path);
    
        // Is this really a folder?
        if (!is_dir($path))
        {
            throw new \UnexpectedValueException(sprintf('%1$s: Path is not a folder. Path: %2$s', __METHOD__, $path));
        }
    
        // Remove all the files in folder if they exist; disable all filtering
        $files = FileHelper::files($path, true, true);
    
        if (!empty($files)) {
            File::delete($files);
        }
    
        // Remove sub-folders of folder; disable all filtering
        $folders = FileHelper::dirs($path, false, true);
        
        foreach ($folders as $folder) 
        {
            if (is_link($folder))
            {
                // Don't descend into linked directories, just delete the link.
                File::delete($folder);
            }
            else
            {
                static::delete($folder);
            }
        }
    
        // In case of restricted permissions we zap it one way or the other
        // as long as the owner is either the webserver or the ftp.
        if (@rmdir($path))
        {
            return true;
        }
        else
        {
            throw new \Exception(sprintf('%1$s: Could not delete folder. Path: %2$s', __METHOD__, $path));
        }
    }
1341672
private static function dirReady($path) {
    if (!file_exists($path)) {
      $parent = preg_replace("/\/[^\/]+\/?$/", '', $path);
      if (!self::dirReady($parent)) {
        return FALSE;
      }

      mkdir($path, 0777, true);
    }

    if (!is_dir($path)) {
      trigger_error('Path is not a directory ' . $path, E_USER_WARNING);
      return FALSE;
    }

    if (!is_writable($path)) {
      trigger_error('Unable to write to ' . $path . ' – check directory permissions –', E_USER_WARNING);
      return FALSE;
    }

    return TRUE;
  }
726870
public function isOwnedBy(CanBeOwnerContract $owner)
    {
        if (!$this->hasOwner()) {
            return false;
        }

        return $owner->getKey() === $this->getOwner()->getKey() && $owner->getMorphClass() === $this->getOwner()->getMorphClass();
    }
1259172
public function removeOwner($owner)
    {
        if (!$this->owners->extract($owner)) {
            $this->resetStats(array($this->_mixer));
        }
    }
1351173
protected function accessPathAccessFileManager($path)
    {
        $role_id = $this->getUser('role_id');
        $settings = $this->module->getSettings('file_manager');

        if (empty($settings['access'][$role_id])) {
            return true;
        }

        foreach ($settings['access'][$role_id] as $pattern) {
            if (gplcart_path_match($path, $pattern)) {
                return true;
            }
        }

        return false;
    }
682840
public function fileExists($container, $path)
    {
        if ($this->containerExists($container)) {
            if ($this->blobExists($container, $path)) {
                return true;
            }
        }

        return false;
    }
1090483
protected function _inpath($path, $parent) {
		return $path == $parent
			? true
			: in_array($parent, $this->getParents($path));
	}
191475
public function tocAction($owner, $ownerId)
    {
        /** @var BlockProviderInterface $provider */
        $provider = $this->get('opifer.content.block_provider_pool')->getProvider($owner);
        $object = $provider->getBlockOwner($ownerId);

        /** @var Environment $environment */
        $environment = $this->get('opifer.content.block_environment');
        $environment->setDraft(true)->setObject($object);
        $environment->setBlockMode('manage');

        $twigAnalyzer = $this->get('opifer.content.twig_analyzer');

        $parameters = [
            'environment' => $environment,
            'analyzer' => $twigAnalyzer,
            'object' => $environment->getObject(),
        ];

        return $this->render('OpiferContentBundle:Content:toc.html.twig', $parameters);
    }
689643
public function isOwnedBy(CanBeOwnerContract $owner)
    {
        if (!$this->hasOwner()) {
            return false;
        }

        return $owner->getKey() === $this->getOwner()->getKey();
    }
437727
public static function owner(String $file)
    {
        $file = self::rpath($file);

        if( ! file_exists($file) )
        {
            throw new Exception\FileNotFoundException(NULL, $file);
        }

        $owner = fileowner($file);

        if( function_exists('posix_getpwuid') )
        {
            return posix_getpwuid($owner);
        }
        else
        {
            return $owner;
        }
    }
951188
public function fileExists($path) {

        $ch = curl_init($this->hostUrl . "/" . $this->siteFolder . $path);

        curl_setopt($ch, CURLOPT_NOBODY, true);

        $result = curl_exec($ch);
        $ret = false;

        if($result !== false) {
        $status = curl_getinfo($ch, CURLINFO_HTTP_CODE);

        if($status == 200) {
            $ret = true;
        }
        }

        curl_close($ch);

        return $ret;
    }
515905
public function tryPath($path, $flags = 0x000000) {
    $flags |= self::VALIDATE;
    try {
      return $this->getPath($path, $flags);
    } catch (Exception $e) {
      if ($e->getCode() === self::VALIDATE) {
        return FALSE;
// @codeCoverageIgnoreStart
      } else {
        throw $e;
      }
// @codeCoverageIgnoreEnd
    }
  }
278767
def set_owner(self, path, **kwargs):
        
        response = self._put(path, 'SETOWNER', **kwargs)
        assert not response.content
1158112
public static function remove($path, $deleteDir = true)
    {
        // minimum security check
        if ($path == '' || $path == '/' || $path == DIRECTORY_SEPARATOR) {
            throw new \InvalidArgumentException('The root cannot be removed !!');
        }

        if (!file_exists($path)) {
            return true;
        }

        $dir = new \DirectoryIterator($path);
        foreach ($dir as $dirContent) {
            // file deletion
            if ($dirContent->isFile() || $dirContent->isLink()) {
                unlink($dirContent->getPathName());
            } else {
                // recursive directory deletion
                if (!$dirContent->isDot() && $dirContent->isDir()) {
                    self::remove($dirContent->getPathName());
                }
            }
        }
        unset($dir);
        unset($dirContent);

        // removes the parent directory
        if ($deleteDir) {
            rmdir($path);
        }
    }
1289889
public function isEmpty($owner, $type = 'default')
    {
        $owner_id = spl_object_id($owner);

        if (!isset($this->_pool[$owner_id][$type])) {
            throw new NotExistsException(['`:type` pool of `:owner` is not exists', 'type' => $type, 'owner' => get_class($owner)]);
        }

        $queue = $this->_pool[$owner_id][$type];

        return $queue->isEmpty();
    }
46029
public function chmod($path, $perm)
	{
		if ( ! $this->_is_conn())
		{
			return false;
		}

		// Permissions can only be set when running PHP 5
		if ( ! function_exists('ftp_chmod'))
		{
			if ($this->_debug == true)
			{
				throw new \FtpFileAccessException('CHMOD function does not exist');
			}
			return false;
		}

		$result = @ftp_chmod($this->_conn_id, $perm, $path);

		if ($result === false)
		{
			if ($this->_debug == true)
			{
				throw new \FtpFileAccessException('Unable to CHMOD');
			}
			return false;
		}

		return true;
	}