Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Local.php

function Local::chmodJailed

Overrides ChmodInterface::chmodJailed

File

core/lib/Drupal/Core/FileTransfer/Local.php, line 115

Class

Local
Defines the local connection class for copying files as the httpd user.

Namespace

Drupal\Core\FileTransfer

Code

public function chmodJailed($path, $mode, $recursive) {
    if ($recursive && is_dir($path)) {
        foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $filename => $file) {
            if (@(!chmod($filename, $mode))) {
                throw new FileTransferException('Cannot chmod %path.', 0, [
                    '%path' => $filename,
                ]);
            }
        }
    }
    elseif (@(!chmod($path, $mode))) {
        throw new FileTransferException('Cannot chmod %path.', 0, [
            '%path' => $path,
        ]);
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal