ILIAS
release_8 Revision v8.23
◀ ilDoc Overview
info.php
Go to the documentation of this file.
1
<?php
2
/* Copyright (c) 2019 ILIAS open source, Extended GPL, see docs/LICENSE */
3
10
define(
"HASH_ALGO"
,
"sha1"
);
11
define(
"COMPOSER_LOCK_PATH"
, __DIR__.
"/composer.lock"
);
12
define(
"VENDOR_PATH"
, __DIR__.
"/vendor"
);
13
14
header(
"Content-Type: text/plain"
);
15
16
echo
"composer.lock: "
.composer_lock_hash().
"\n"
;
17
echo
"vendor: "
.vendor_hash().
"\n"
;
18
19
function
composer_lock_hash
() {
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
}
25
26
function
vendor_hash
() {
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
}
32
33
function
hash_directory
($algo,
$path
, $exclude = []) {
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
}
VENDOR_PATH
const VENDOR_PATH
Definition:
info.php:12
$path
$path
Definition:
ltiservices.php:32
composer_lock_hash
composer_lock_hash()
Definition:
info.php:19
HASH_ALGO
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
hash_directory
hash_directory($algo, $path, $exclude=[])
Definition:
info.php:33
vendor_hash
vendor_hash()
Definition:
info.php:26
COMPOSER_LOCK_PATH
const COMPOSER_LOCK_PATH
Definition:
info.php:11
libs
composer
info.php
Generated on Sun Aug 31 2025 22:01:12 for ILIAS by
1.8.13 (using
Doxyfile
)