You are here

function _google_tag_is_writable in GoogleTagManager 8

Same name and namespace in other branches
  1. 7.2 google_tag.module \_google_tag_is_writable()
  2. 7 includes/admin.inc \_google_tag_is_writable()

Determines whether a directory is writable.

Remove this if PHP is_writable() is changed to respect ACLS on a 'local' stream wrapper other than the local file wrapper provided by PHP.

Parameters

string $uri: A directory path or stream wrapper URI.

Return value

bool Whether the directory is writable.

4 calls to _google_tag_is_writable()
ContainerManager::createAssets in src/Entity/ContainerManager.php
Prepares directory for and saves snippet files for a container.
ContainerTrait::validateFormValues in src/Form/ContainerTrait.php
google_tag_requirements in ./google_tag.install
Implements hook_requirements().
_file_prepare_directory in ./google_tag.module
Checks that the directory exists and is writable.

File

./google_tag.module, line 154
Provides primary Drupal hook implementations.

Code

function _google_tag_is_writable($uri) {

  // Use the local path, if applicable, since PHP only checks ACLs on its local
  // file wrapper.
  $realpath = \Drupal::service('file_system')
    ->realpath($uri);
  return is_writable($realpath ? $realpath : $uri);
}