You are here

function _google_tag_is_writable in GoogleTagManager 7

Same name and namespace in other branches
  1. 8 google_tag.module \_google_tag_is_writable()
  2. 7.2 google_tag.module \_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.

3 calls to _google_tag_is_writable()
google_tag_requirements in ./google_tag.install
Implements hook_requirements().
_file_prepare_directory in includes/admin.inc
Checks that the directory exists and is writable.
_google_tag_directory_prepare in includes/admin.inc
Prepares directory for base or realm specific snippet files.

File

includes/admin.inc, line 445
Contains the administrative page and form callbacks.

Code

function _google_tag_is_writable($uri) {

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