You are here

public static function Storage::checkFilePermissions in Configuration Management 7.2

Returns TRUE if the current user has write permissions for a configuration file in the config:// directory.

4 calls to Storage::checkFilePermissions()
ConfigurationManagement::stopTracking in lib/Drupal/configuration/Config/ConfigurationManagement.php
Removes a record of each configuration that is not tracked anymore and deletes the configuration file in the DataStore.
ConfigurationManagement::updateTrackingFile in lib/Drupal/configuration/Config/ConfigurationManagement.php
This function save into config://tracked.inc file the configurations that are currently tracked.
StoragePhp::delete in lib/Drupal/configuration/Storage/StoragePhp.php
StoragePhp::save in lib/Drupal/configuration/Storage/StoragePhp.php
Saves the configuration object into the DataStore.

File

lib/Drupal/configuration/Storage/Storage.php, line 45
Definition of Drupal\configuration\Storage\Storage.

Class

Storage

Namespace

Drupal\configuration\Storage

Code

public static function checkFilePermissions($filename) {
  $dir_path = ConfigurationManagement::getStream();
  $full_path = $dir_path . '/' . $filename;
  if (static::checkDirectory($dir_path)) {
    if (file_exists($full_path)) {
      if (is_writable($full_path) || drupal_chmod($full_path)) {
        return TRUE;
      }
      else {
        drupal_set_message(t('The current user does not have permissions to edit the file %file.', array(
          '%file' => $full_path,
        )), 'error');
      }
    }
    else {
      return TRUE;
    }
  }
  return FALSE;
}