Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
DirectoryHasher example
public
function
run
(
)
: void
{
ini_set
(
'zlib.output_compression', 'Off'
)
;
header
(
'Cache-Control: no-store'
)
;
header
(
'Content-Type: text/event-stream'
)
;
header
(
'Access-Control-Allow-Methods: GET'
)
;
ob_end_clean
(
)
;
set_time_limit
(
0
)
;
$hasher
=
new
DirectoryHasher
(
)
;
$appHash
=
$hasher
->
hash
(
)
;
while
(
true
)
{
if
(
connection_status
(
)
!== CONNECTION_NORMAL ||
connection_aborted
(
)
)
{
break
;
}
$currentHash
=
$hasher
->
hash
(
)
;
// If hash has changed, tell the browser to reload.
if
(
$currentHash
!==
$appHash
)
{