File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -337,7 +337,12 @@ aside nav ul li a:hover {
337337 table-layout : fixed;
338338}
339339
340+ .cs-table-overview table {
341+ table-layout : auto;
342+ }
343+
340344.tabs > section > table tr > td ,
345+ .tabs > section > div .cs-table-overview > table tr > td ,
341346# status-tabs .data-block td {
342347 padding : 15px 0 ;
343348 border-bottom : 1px solid # eee ;
@@ -406,17 +411,19 @@ aside nav ul li a:hover {
406411 text-align : left;
407412}
408413
409- # cached-scripts-tabs table table tbody td {
414+ # cached-scripts-tabs table table tbody td , # cached-scripts-tabs . cs-table-overview table tbody td {
410415 font-size : 13px ;
411416 padding : 10px 5px ;
412417}
413418
414- # cached-scripts-tabs table table tbody tr : last-child td {
419+ # cached-scripts-tabs table table tbody tr : last-child td , # cached-scripts-tabs . cs-table-overview table tbody tr : last-child td {
415420 border-bottom : 0 ;
416421}
417422
418423# cached-scripts-tabs table table thead th : last-child ,
419- # cached-scripts-tabs table table tbody td : last-child {
424+ # cached-scripts-tabs table table tbody td : last-child ,
425+ # cached-scripts-tabs .cs-table-overview table thead th : last-child ,
426+ # cached-scripts-tabs .cs-table-overview table tbody td : last-child {
420427 text-align : center;
421428}
422429
Original file line number Diff line number Diff line change @@ -273,6 +273,57 @@ public function getCachedScripts()
273273 return $ scripts ;
274274 }
275275
276+ public function getCachedScriptsForOverview ()
277+ {
278+ $ scripts = $ this ->getCachedScripts ();
279+ $ prefix = $ this ->getCommonPrefix ($ scripts );
280+
281+ foreach ($ scripts as $ index => $ script ) {
282+ $ scripts [$ index ]['full_path ' ] = mb_substr ($ script ['full_path ' ], $ prefix );
283+ }
284+
285+ return $ scripts ;
286+ }
287+
288+ private function getCommonPrefix (array $ scripts )
289+ {
290+ $ prefix = null ;
291+
292+ foreach ($ scripts as $ script ) {
293+ if ($ prefix === null ) {
294+ $ prefix = $ script ['full_path ' ];
295+
296+ continue ;
297+ }
298+
299+ if ($ prefix === '' ) {
300+ return 0 ;
301+ }
302+
303+ if (strpos ($ script ['full_path ' ], $ prefix ) === 0 ) {
304+ continue ;
305+ }
306+
307+ $ prefix = $ this ->findLongestPrefix ($ prefix , $ script ['full_path ' ]);
308+ }
309+
310+ return mb_strlen ($ prefix );
311+ }
312+
313+ private function findLongestPrefix ($ prefix , $ path )
314+ {
315+ $ prefixChars = str_split ($ prefix );
316+ $ pathChars = str_split ($ path );
317+
318+ foreach ($ prefixChars as $ index => $ char ) {
319+ if ($ char !== $ pathChars [$ index ]) {
320+ return mb_substr ($ prefix , 0 , $ index );
321+ }
322+ }
323+
324+ return $ prefix ;
325+ }
326+
276327 /**
277328 * Sorts the lists of cached scripts
278329 *
Original file line number Diff line number Diff line change @@ -63,4 +63,36 @@ foreach($status->getCachedScripts() as $data) {
6363 </table>
6464 <?php } ?>
6565 </section>
66+ <section data-content="overview-scripts">
67+ <div class="cs-data-table show-cs-table cs-table-overview">
68+ <table>
69+ <thead>
70+ <tr>
71+ <th><?= $ this ->translator ->translate ('scripts.full_path ' ); ?> </th>
72+ <th><?= $ this ->translator ->translate ('scripts.hits ' ); ?> </th>
73+ <th><?= $ this ->translator ->translate ('scripts.memory_consumption ' ); ?> </th>
74+ <th><?= $ this ->translator ->translate ('scripts.last_used_timestamp ' ); ?> </th>
75+ <th><?= $ this ->translator ->translate ('scripts.actions ' ); ?> </th>
76+ </tr>
77+ </thead>
78+ <tbody>
79+ <?php foreach ($ status ->getCachedScriptsForOverview () as $ script ) { ?>
80+ <tr>
81+ <td><?= htmlspecialchars ($ script ['full_path ' ]); ?> </td>
82+ <td><?= $ script ['hits ' ]; ?> </td>
83+ <td><?= $ script ['memory_consumption ' ]; ?> </td>
84+ <td><?= $ script ['last_used_timestamp ' ]; ?> </td>
85+ <td>
86+ <form action="<?= $ this ->url ->get ('invalidate ' ); ?> " method="post">
87+ <input type="hidden" name="csrfToken" value="<?= $ this ->csrfToken ->get (); ?> ">
88+ <input type="hidden" name="key" value="<?= $ script ['full_path ' ]; ?> ">
89+ <button type="submit" name="submit" value="Invalidate" class="cnfbtn cnfbtn--fn js-confirm inv" title="<?= $ this ->translator ->translate ('script.invalidate ' ); ?> "><?= $ this ->translator ->translate ('script.invalidate ' ); ?> </button>
90+ </form>
91+ </td>
92+ </tr>
93+ <?php } ?>
94+ </tbody>
95+ </table>
96+ </div>
97+ </section>
6698</section>
Original file line number Diff line number Diff line change 9696 'blacklist.empty ' => 'Es befindet sich keine Datei auf der Negativliste. ' ,
9797
9898 'scripts.title ' => 'Dateien im Cache ' ,
99+ 'scripts.overview.title ' => 'Überblick ' ,
99100 'scripts.empty ' => 'Es befindet sich keine Datei im Cache. ' ,
100101 'scripts.directory.script_count ' => ' (<i class="count">%s</i> Dateien) ' ,
101102 'scripts.full_path ' => 'Dateiname ' ,
Original file line number Diff line number Diff line change 9696 'blacklist.empty ' => 'No scripts are blacklisted ' ,
9797
9898 'scripts.title ' => 'Cached Scripts ' ,
99+ 'scripts.overview.title ' => 'Overview ' ,
99100 'scripts.empty ' => 'No scripts are cached ' ,
100101 'scripts.directory.script_count ' => ' (<i class="count">%s</i> files) ' ,
101102 'scripts.full_path ' => 'Filename ' ,
Original file line number Diff line number Diff line change 9696 'blacklist.empty ' => 'Er zijn geen scripts geblacklist ' ,
9797
9898 'scripts.title ' => 'Cached Scripts ' ,
99+ 'scripts.overview.title ' => 'Overzicht ' ,
99100 'scripts.empty ' => 'Er zijn geen scripts gecached ' ,
100101 'scripts.directory.script_count ' => ' (<i class="count">%s</i> bestanden) ' ,
101102 'scripts.full_path ' => 'Bestandnaam ' ,
You can’t perform that action at this time.
0 commit comments