From 5ccd0edbb923ef7b5a79381e0c3f3ca5a3956923 Mon Sep 17 00:00:00 2001 From: OpenXE <> Date: Mon, 12 Dec 2022 16:16:49 +0000 Subject: [PATCH] refresh githash.txt on login screen, removed cronjob githash.php part 2 --- cronjobs/githash.php | 22 ---------------------- database/struktur.sql | 3 +-- phpwf/plugins/class.acl.php | 20 +++++++++++++++++++- 3 files changed, 20 insertions(+), 25 deletions(-) delete mode 100755 cronjobs/githash.php diff --git a/cronjobs/githash.php b/cronjobs/githash.php deleted file mode 100755 index fd24d943..00000000 --- a/cronjobs/githash.php +++ /dev/null @@ -1,22 +0,0 @@ - diff --git a/database/struktur.sql b/database/struktur.sql index a18a4342..a2a03291 100755 --- a/database/struktur.sql +++ b/database/struktur.sql @@ -16798,8 +16798,7 @@ INSERT INTO `prozessstarter` (`id`, `bezeichnung`, `bedingung`, `art`, `startzei (6, 'Überzahlte Rechnungen', '', 'uhrzeit', '2015-10-25 23:00:00', '0000-00-00 00:00:00', '', 'cronjob', 'ueberzahlterechnungen', 0, 0, 0, 1, ''), (7, 'Umsatzstatistik', '', 'uhrzeit', '2015-10-25 23:30:00', '0000-00-00 00:00:00', '', 'cronjob', 'umsatzstatistik', 0, 0, 0, 1, ''), (8, 'Paketmarken Tracking Download', '', 'uhrzeit', '2015-10-25 14:00:00', '0000-00-00 00:00:00', '', 'cronjob', 'wgettracking', 0, 0, 0, 1, ''), -(9, 'Chat-Benachrichtigung', '', 'periodisch', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '60', 'cronjob', 'chat', 0, 0, 0, 1, ''), -(10, 'Git Revision einlesen', '', 'periodisch', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '120', 'cronjob', 'githash', 1, 0, 0, 1, ''); +(9, 'Chat-Benachrichtigung', '', 'periodisch', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '60', 'cronjob', 'chat', 0, 0, 0, 1, ''); INSERT INTO `user` (`id`, `username`, `password`, `repassword`, `description`, `settings`, `parentuser`, `activ`, `type`, `adresse`, `fehllogins`, `standarddrucker`, `firma`, `logdatei`, `startseite`, `hwtoken`, `hwkey`, `hwcounter`, `motppin`, `motpsecret`, `passwordmd5`, `externlogin`, `projekt_bevorzugen`, `email_bevorzugen`, `projekt`, `rfidtag`, `vorlage`, `kalender_passwort`, `kalender_ausblenden`, `kalender_aktiv`, `gpsstechuhr`, `standardetikett`, `standardfax`, `internebezeichnung`, `hwdatablock`, `standardversanddrucker`, `passwordsha512`, `salt`) VALUES (1, 'admin', 'qnvEQ1sFWNdIg', 0, 'Administrator', 'firstinstall', 0, 1, 'admin', 1, 0, 0, 1, '2016-08-05 08:34:59', NULL, NULL, NULL, NULL, NULL, NULL, '21232f297a57a5a743894a0e4a801fc3', 1, 0, 1, 0, '', NULL, NULL, 0, NULL, NULL, 0, 0, NULL, NULL, 0, '', ''); diff --git a/phpwf/plugins/class.acl.php b/phpwf/plugins/class.acl.php index 8ca0d0d6..ade66435 100644 --- a/phpwf/plugins/class.acl.php +++ b/phpwf/plugins/class.acl.php @@ -571,7 +571,7 @@ class Acl public function Login() { - include dirname(__DIR__).'/../cronjobs/githash.php'; + $this->refresh_githash(); include dirname(__DIR__).'/../version.php'; $this->app->Tpl->Set('XENTRALVERSION',"V.".$version_revision); @@ -1297,4 +1297,22 @@ Allow from all // HTACCESS SECURITY END } + function refresh_githash() { + $path = '../.git/'; + if (!is_dir($path)) { + return; + } + $head = trim(file_get_contents($path . 'HEAD')); + $refs = trim(substr($head,0,4)); + if ($refs == 'ref:') { + $ref = substr($head,5); + $hash = trim(file_get_contents($path . $ref)); + } else { + $hash = $head; + } + if (!empty($hash)) { + file_put_contents("../githash.txt", $hash); + } + } + }