ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
info.php File Reference

Go to the source code of this file.

Functions

 composer_lock_hash ()
 
 vendor_hash ()
 
 hash_directory ($algo, $path, $exclude=[])
 

Variables

const HASH_ALGO "sha1"
 This script can be used to quickly compare the state of the vendor directory with some reference. More...
 
const COMPOSER_LOCK_PATH __DIR__."/composer.lock"
 
const VENDOR_PATH __DIR__."/vendor"
 

Function Documentation

◆ composer_lock_hash()

composer_lock_hash ( )

Definition at line 19 of file info.php.

References COMPOSER_LOCK_PATH, and HASH_ALGO.

19  {
20  if (!file_exists(COMPOSER_LOCK_PATH)) {
21  return "composer.lock does not exist";
22  }
23  return hash_file(HASH_ALGO, COMPOSER_LOCK_PATH);
24 }
const HASH_ALGO
This script can be used to quickly compare the state of the vendor directory with some reference...
Definition: info.php:10
const COMPOSER_LOCK_PATH
Definition: info.php:11

◆ hash_directory()

hash_directory (   $algo,
  $path,
  $exclude = [] 
)

Definition at line 33 of file info.php.

References $path, and HASH_ALGO.

Referenced by vendor_hash().

33  {
34  $content = scandir($path);
35  sort($content);
36  return hash(
37  HASH_ALGO,
38  implode(
39  "",
40  array_map(
41  function($o) use ($algo, $path, $exclude) {
42  if ($o === "." || $o === ".." || $o === ".git") {
43  return "";
44  }
45  $o = "$path/$o";
46  if (is_link($o) || in_array($o, $exclude)) {
47  return "";
48  }
49  if (is_dir($o)) {
50  return hash_directory($algo, $o);
51  }
52  return hash_file($algo, $o);
53  },
54  $content
55  )
56  )
57  );
58 }
$path
Definition: ltiservices.php:32
const HASH_ALGO
This script can be used to quickly compare the state of the vendor directory with some reference...
Definition: info.php:10
hash_directory($algo, $path, $exclude=[])
Definition: info.php:33
+ Here is the caller graph for this function:

◆ vendor_hash()

vendor_hash ( )

Definition at line 26 of file info.php.

References HASH_ALGO, hash_directory(), and VENDOR_PATH.

26  {
27  if(!file_exists(VENDOR_PATH)) {
28  return "vendor directory does not exist";
29  }
30  return hash_directory(HASH_ALGO, VENDOR_PATH, [VENDOR_PATH."/autoload.php", VENDOR_PATH."/composer"]);
31 }
const VENDOR_PATH
Definition: info.php:12
const HASH_ALGO
This script can be used to quickly compare the state of the vendor directory with some reference...
Definition: info.php:10
hash_directory($algo, $path, $exclude=[])
Definition: info.php:33
+ Here is the call graph for this function:

Variable Documentation

◆ COMPOSER_LOCK_PATH

const COMPOSER_LOCK_PATH __DIR__."/composer.lock"

Definition at line 11 of file info.php.

Referenced by composer_lock_hash().

◆ HASH_ALGO

const HASH_ALGO "sha1"

This script can be used to quickly compare the state of the vendor directory with some reference.

It simply outputs a hash of the composer lock and a combined hash of all files in vendor.

Definition at line 10 of file info.php.

Referenced by composer_lock_hash(), hash_directory(), and vendor_hash().

◆ VENDOR_PATH

const VENDOR_PATH __DIR__."/vendor"

Definition at line 12 of file info.php.

Referenced by vendor_hash().