You are here

public static function HudtInternal::readFileToString in Hook Update Deploy Tools 8

Same name and namespace in other branches
  1. 7 src/HudtInternal.php \HookUpdateDeployTools\HudtInternal::readFileToString()

Read the contents of a file into a string for the entire contents.

Parameters

string $filename: The filename of the file.

string $storage_type: The type of storage (menu, panel, rule...).

Return value

string The contents of the file read.

3 calls to HudtInternal::readFileToString()
PageManager::import in src/PageManager.php
Imports Page Manager pages using the panels module & template.
Redirects::import in src/Redirects.php
Imports a set of redirects from an import csv file.
Rules::import in src/Rules.php
Imports rules using the rule_import module & template.

File

src/HudtInternal.php, line 83

Class

HudtInternal
Methods for processes internal to Hook Deploy Update Tools.

Namespace

HookUpdateDeployTools

Code

public static function readFileToString($filename, $storage_type) {
  $path = self::getStoragePath($storage_type);
  $file = "{$path}{$filename}";
  if (self::canReadFile($filename, $storage_type)) {

    // Get the contents as one string.
    $file_contents = file_get_contents($file);
  }
  else {

    // Should not reach here due to exception from canReadFile.
    $file_contents = FALSE;
  }
  return $file_contents;
}