public function Updater::makeWorldReadable

public Updater::makeWorldReadable(&$filetransfer, $path, $recursive = TRUE)

Ensures that a given directory is world readable.

Parameters

\Drupal\Core\FileTransfer\FileTransfer $filetransfer: Object which is a child of FileTransfer.

string $path: The file path to make world readable.

bool $recursive: If the chmod should be applied recursively.

File

core/lib/Drupal/Core/Updater/Updater.php, line 349

Class

Updater
Defines the base class for Updaters used in Drupal.

Namespace

Drupal\Core\Updater

Code

public function makeWorldReadable(&$filetransfer, $path, $recursive = TRUE) {
  if (!is_executable($path)) {
    // Set it to read + execute.
    $new_perms = substr(sprintf('%o', fileperms($path)), -4, -1) . "5";
    $filetransfer->chmod($path, intval($new_perms, 8), $recursive);
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Updater!Updater.php/function/Updater::makeWorldReadable/8.1.x