function AbstractOperation::makeWritable

Same name and namespace in other branches
  1. main composer/Plugin/Scaffold/Operations/AbstractOperation.php \Drupal\Composer\Plugin\Scaffold\Operations\AbstractOperation::makeWritable()

Adds the owner write permission bit to the path.

Parameters

string $filepath: Path to the file or directory.

Return value

bool TRUE on success, FALSE if the path does not exist or chmod failed.

1 call to AbstractOperation::makeWritable()
ReplaceOp::process in composer/Plugin/Scaffold/Operations/ReplaceOp.php
Process this scaffold operation.

File

composer/Plugin/Scaffold/Operations/AbstractOperation.php, line 62

Class

AbstractOperation
Provides default behaviors for operations.

Namespace

Drupal\Composer\Plugin\Scaffold\Operations

Code

protected function makeWritable(string $filepath) : bool {
  if (!file_exists($filepath)) {
    return FALSE;
  }
  $mod = fileperms($filepath);
  if ($mod === FALSE) {
    return FALSE;
  }
  return @chmod($filepath, $mod & 0777 | 0200);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.