File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 7171 'nav ' => $ nav ,
7272 'logout_url ' => $ auth ? Http::queryString ([], ['logout ' => 'yes ' ]) : null ,
7373 'version ' => Admin::VERSION ,
74+ 'repo ' => 'https://github.com/RobiNN1/phpCacheAdmin ' ,
75+ 'git ' => $ admin ->getGitInfo (),
7476 'back_url ' => $ back_url ?? null ,
7577 'panels ' => $ dashboard ->showPanels (),
7678 'dashboard ' => $ dashboard ->dashboard (),
Original file line number Diff line number Diff line change @@ -69,4 +69,34 @@ public function currentDashboard(): string {
6969
7070 return array_key_exists ($ current , $ this ->getDashboards ()) ? $ current : 'server ' ;
7171 }
72+
73+ /**
74+ * Get git info.
75+ *
76+ * @return ?array<string, string>
77+ */
78+ public function getGitInfo (): ?array {
79+ $ git_path = __DIR__ .'/../.git ' ;
80+ $ head_file = $ git_path .'/HEAD ' ;
81+
82+ if (!is_file ($ head_file )) {
83+ return null ;
84+ }
85+
86+ $ head_file_parts = explode ('/ ' , file_get_contents ($ head_file ));
87+ $ branch = isset ($ head_file_parts [2 ]) ? trim ($ head_file_parts [2 ]) : '' ;
88+ $ branch_file = $ git_path .'/refs/heads/ ' .$ branch ;
89+
90+ if (!is_file ($ branch_file )) {
91+ return null ;
92+ }
93+
94+ $ commit = trim (file_get_contents ($ branch_file ));
95+
96+ return [
97+ 'commit ' => $ commit ,
98+ 'short_sha ' => substr ($ commit , 0 , 7 ),
99+ 'branch ' => $ branch ,
100+ ];
101+ }
72102}
Original file line number Diff line number Diff line change 1818 </a >
1919 {% endfor %}
2020 <footer class =" my-4 text-center text-white" >
21-
2221 {% if logout_url %}
2322 <a class =" block py-2 text-white hover:text-gray-200" href =" {{ logout_url }}" >Logout</a >
2423 {% endif %}
2524
2625 <div class =" font-light" >
2726 © {{ ' now' | date (' Y' ) }}
28- <a class =" font-semibold text-white hover:text-gray-200" href =" https://github.com/RobiNN1/phpCacheAdmin" target =" _blank" rel =" noopener" >
29- phpCacheAdmin
30- </a >
27+ <a class =" font-semibold text-white hover:text-gray-200" href =" {{ repo }}" target =" _blank" rel =" noopener" >phpCacheAdmin</a >
28+ v{{ version }}
29+
30+ {% if git %}
31+ <div class =" text-xs" >
32+ Git revision:
33+ <a class =" font-semibold text-white hover:text-gray-200" href =" {{ repo }}/commit/{{ git .commit }}" target =" _blank" >{{ git .short_sha }}</a >,
34+ branch:
35+ <a class =" font-semibold text-white hover:text-gray-200" href =" {{ repo }}/tree/{{ git .branch }}" target =" _blank" >{{ git .branch }}</a >.
36+ </div >
37+ {% endif %}
3138 </div >
32- v{{ version }}
3339 </footer >
3440 </div >
3541 </nav >
You can’t perform that action at this time.
0 commit comments