joomla-cms icon indicating copy to clipboard operation
joomla-cms copied to clipboard

[4.4] Cache: Fix for counting the Number of Files correctly

Open pe7er opened this issue 1 year ago • 1 comments

Issue: The Maintenance: Clear Cache page does not display the correct number + size of cached files.

This PR corrects the Number of Files on the Maintenance: Clear Cache page.

Summary of Changes

When using Joomla's System - Page Cache plugin, an /administrator/cache/page folder with index.html file is created. When you visit one page on the front-end, you will cache one page. However, the Maintenance: Clear Cache page shows 2 files under Number of Files because it also counts the index.html file (which is not a cached file). It's confusing to see that number.

Testing Instructions

  1. Switch on Joomla's System - Page Cache plugin

system-page-cache

  1. Goto the front-end and open one page. The Maintenance: Clear Cache counts 2 files.
  2. Open the website files, e.g. using an FTP client like FileZilla. You'll see just one cached file and the index.html.

files

Actual result BEFORE applying this Pull Request

You'll see too many cached files under Number of Files (and Size) because it includes the index.html:

maintenance-clear-cache

Expected result AFTER applying this Pull Request

You'll see the real number of cached files + size because the index.html is not counted as cache anymore:

after-pr

Link to documentations

Please select:

  • [ ] Documentation link for docs.joomla.org:

  • [x] No documentation changes for docs.joomla.org needed

  • [ ] Pull Request link for manual.joomla.org:

  • [x] No documentation changes for manual.joomla.org needed

pe7er avatar Aug 26 '24 15:08 pe7er

This is not correct.

When you turn on the cache plugin a pages folder is not created.

When you visit a page on the site then the folder is created with an index.html and any other cache files

When you delete the cache using the system menu the entire cache folder is deleted. That includes the index.hmtl file. Therefore the number of cached files includes the index.html file

brianteeman avatar Aug 26 '24 16:08 brianteeman

This pull request has been automatically rebased to 5.2-dev.

HLeithner avatar Nov 15 '24 13:11 HLeithner

We create the index.html file because we don't want to have the files in the directory listed. So the index.html is not created as cached file. I think the PR is correct, even it doesn't makes a big difference.

rdeutz avatar Jan 19 '25 10:01 rdeutz

I have tested this item :white_check_mark: successfully on 683a10fa6140857abf109b9f3c2910022a49641e


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43986.

rdeutz avatar Jan 19 '25 10:01 rdeutz

We create the index.html file because we don't want to have the files in the directory listed. So the index.html is not created as cached file. I think the PR is correct, even it doesn't makes a big difference.

I remember the requirement to have index.html file in each folder was removed from long time ago, so I think the right solution if really needed would be not creating that file. Anyway, as you say, it doesn't makes a big difference, I don't really care if this PR is closed or merged.

joomdonation avatar Jan 19 '25 10:01 joomdonation

We still need an index.html in any folder that would otherwise be distributed as an empty folder. The folder is not created on some systems if it is empty but in this case you are correct as these folders are not distributed so they do not need the index.html file, In other words the correct fix is not to create the file in the first place - not to exclude it from the count

brianteeman avatar Jan 19 '25 14:01 brianteeman

I have tested this item :white_check_mark: successfully on 683a10fa6140857abf109b9f3c2910022a49641e


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43986.

Hackwar avatar Feb 03 '25 09:02 Hackwar

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43986.

Hackwar avatar Feb 03 '25 09:02 Hackwar