}
sub init_auto_reload_resources_param {
- return sprintf('?rand=%d-%d-%d', Time::HiRes::gettimeofday(), int(rand 1000000000000)) if $::lx_office_conf{debug}->{auto_reload_resources};
+ if ($::lx_office_conf{debug}->{auto_reload_resources}) {
+ return sprintf('?rand=%d-%d-%d', Time::HiRes::gettimeofday(), int(rand 1000000000000));
+ }
+
+ if ($::lx_office_conf{debug}{git_commit_reload_resources}) {
+ my $git_dir = SL::System::Process::exe_dir() . '/.git';
- my $git_dir = SL::System::Process::exe_dir() . '/.git';
+ return '' unless -d $git_dir;
- return '' unless -d $git_dir;
+ my $content = eval { scalar(read_file($git_dir . '/HEAD')) };
- my $content = eval { scalar(read_file($git_dir . '/HEAD')) };
+ return '' unless ($content // '') =~ m{\Aref: ([^\r\n]+)};
- return '' unless ($content // '') =~ m{\Aref: ([^\r\n]+)};
+ $content = eval { scalar(read_file($git_dir . '/' . $1)) };
- $content = eval { scalar(read_file($git_dir . '/' . $1)) };
+ return '' unless ($content // '') =~ m{\A([0-9a-fA-F]+)};
- return '' unless ($content // '') =~ m{\A([0-9a-fA-F]+)};
+ return '?rand=' . $1;
+ }
- return '?rand=' . $1;
+ return '';
}
##########################################