X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FLayout%2FBase.pm;h=8e6acfc74df77aad58e15a073ee14228d3921be6;hb=6ceacc682f9c760e654f5aacde9b8480760d8b36;hp=df9c00852bf0a46fb12cc78331d170175dea1a01;hpb=67fbdebe2d7c000e51b84d2f3eba8a9a0cd3db26;p=kivitendo-erp.git diff --git a/SL/Layout/Base.pm b/SL/Layout/Base.pm index df9c00852..8e6acfc74 100644 --- a/SL/Layout/Base.pm +++ b/SL/Layout/Base.pm @@ -3,6 +3,7 @@ package SL::Layout::Base; use strict; use parent qw(Rose::Object); +use File::Slurp qw(read_file); use List::MoreUtils qw(uniq); use Time::HiRes qw(); @@ -19,6 +20,7 @@ use Rose::Object::MakeMethods::Generic ( use SL::Menu; use SL::Presenter; +use SL::System::Process; my %menu_cache; @@ -42,8 +44,21 @@ sub get { } sub init_auto_reload_resources_param { - return '' unless $::lx_office_conf{debug}->{auto_reload_resources}; - return sprintf('?rand=%d-%d-%d', Time::HiRes::gettimeofday(), int(rand 1000000000000)); + return sprintf('?rand=%d-%d-%d', Time::HiRes::gettimeofday(), int(rand 1000000000000)) if $::lx_office_conf{debug}->{auto_reload_resources}; + + my $git_dir = SL::System::Process::exe_dir() . '/.git'; + + return '' unless -d $git_dir; + + my $content = eval { scalar(read_file($git_dir . '/HEAD')) }; + + return '' unless ($content // '') =~ m{\Aref: ([^\r\n]+)}; + + $content = eval { scalar(read_file($git_dir . '/' . $1)) }; + + return '' unless ($content // '') =~ m{\A([0-9a-fA-F]+)}; + + return '?rand=' . $1; } ##########################################