? ? Pending

User tests: Successful: Unsuccessful:

avatar oe1tkt
oe1tkt
11 May 2017

Pull Request for Issue #15554 .

Summary of Changes

removed the odd calculation line in the helper file

     $this->size = number_format((float) $this->size + (float) $size, 2, JText::_('DECIMALS_SEPARATOR'), JText::_('THOUSANDS_SEPARATOR'));

which is:

  1. A formatting string within a calculation
  2. Language dependent
  3. Incorrect in en-GB when size is > 1 MB, because of the THOUSANDS_SEPARATOR

and several files with a division through 1024, resulting in floating calculation

Testing Instructions

  1. Run a website with caching enabled

  2. Backend > Clear Cache, do only list the cached directories

  3. Either install German language for backend or use a huge site with cache sizes > 1MB
    Believe it or not, I tested this on a site with about 3164 articles, 1530 menus, 6 languages i.e. en-US, de-DE, fr-FR, zh-CN, zh-TW, and ja-JP, 13654 users registered.

  4. Set error reporting to a maximum

  5. Set cache time to 150 or so (just to keep cached entries long enough for tests and checks

  6. Try to make traffic on the site to generate as much cache as possible

  7. Go to "System > Cache leeren" (= Clear/Purge cache).
    => Same warnings like described in Issue #15554

  8. Compare the shown cache size with the associated directory on your file system, e.g.

    Cache Group 0 Size 477.86 kB

    File System: [..]/cache/0

Expected result

  1. Sum of files should be the same size as displayed.
  2. No Warnings

Actual result

  1. Sum of files are different in size when the size is > 1MB or if backend language is e.g. de-DE

  2. Notices are shown, like:
    Notice: A non well formed numeric value encountered in /administrator/components/com_cache/views/cache/tmpl/default.php on line 70
    759,00 kB

    Notice: A non well formed numeric value encountered in /www/htdocs/w00f7959/relaunch-bs3.ghsvs.de/administrator/components/com_cache/views/cache/tmpl/default.php on line 70
    24,00 kB

Documentation Changes Required

Any other files who uses this updateSize function, this is e.g. virtuemart extension will show
factor 1024 too less cache size for now; i.e. vmfile.php -> changes to:

 //$item->updateSize(filesize($path . '/' . $folder . '/' . $file) / 1024);
 $item->updateSize(filesize($path . '/' . $folder . '/' . $file));

Please test patch and any feedback welcome! ?

PS. I have rewritten the test instructions to make it even clearer. (2017-05-12 20:17 UTC) thanks to you @bertmert

avatar oe1tkt oe1tkt - open - 11 May 2017
avatar oe1tkt oe1tkt - change - 11 May 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 11 May 2017
Category Administration com_cache Libraries
avatar oe1tkt oe1tkt - change - 11 May 2017
The description was changed
avatar oe1tkt oe1tkt - edited - 11 May 2017
avatar oe1tkt oe1tkt - edited - 11 May 2017
avatar bertmert
bertmert - comment - 11 May 2017

I have tested this item successfully on fc48eef

Solved my issue #15554 .


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

avatar bertmert bertmert - test_item - 11 May 2017 - Tested successfully
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 12 May 2017

On a clean 3.7.1-dev got without PR no Warnings and similar Size in Folders and Cache Groups.

avatar bertmert
bertmert - comment - 12 May 2017

On a clean 3.7.1-dev got without PR no Warnings and similar Size in Folders and Cache Groups.

With backend language German?

I've tested with 3.7.0, BTW.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 12 May 2017

@bertmert Backend Lang.: English, no Difference if Error-Reporting set on "Developement" or "Maximum".

avatar bertmert
bertmert - comment - 12 May 2017

Try German. The error (if still exists) becomes earlier obvious then.

avatar bertmert
bertmert - comment - 12 May 2017

@franz-wohlkoenig
I've tested now also with current Staging. The error still exists without patch.

  • Install German language.

  • Set backend language to German (Client: Administrator).

  • Set error reporting to maximum in Joomla configuration.

  • Activate Cache in configuration and cache plugin (just to collect enough "stuff").

  • Set Cache time to 150 or so (just to keep cached entries long enough for tests and checks.

  • Clicki-di-click around in frontend to get enough "stuff" in cache.

  • Go to "System > Cache leeren" (= Clear/Purge cache).
    => Same warnings like described in Issue #15554
    => Wrong sizes like described by @oe1tkt (e.g. mod_menu 170 kByte or so instead of measured ~3MB).

  • Applied patch: All fine.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 12 May 2017

Using Instructions above got without Warning:
bildschirmfoto 2017-05-12 um 16 42 01
bildschirmfoto 2017-05-12 um 16 42 32

avatar oe1tkt oe1tkt - change - 12 May 2017
The description was changed
avatar oe1tkt oe1tkt - edited - 12 May 2017
avatar oe1tkt
oe1tkt - comment - 12 May 2017

@franz-wohlkoenig Please be so friendly and test again with more cache or in the backend language German.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 13 May 2017

@oe1tkt Backend Language was set on German (you see in first Screenshot Table-Heads in German).

avatar oe1tkt
oe1tkt - comment - 13 May 2017

@franz-wohlkoenig As you see com_content has in real 51kB and shown 44kB, i.e. because german comma is a , - so it ignores the numbers after that comma. Or at your mod_menu, it shows 15kB instead of 26kB. But when you create much more cache e.g. > 1 MB per item, you will see extremly strange amounts. Here are my results without patch:
image
image

and with my patch:

image
image

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 23 May 2017

@oe1tkt missed your Answer – will test Today.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 23 May 2017

@oe1tkt without PR Cache-Size is after "Comma" always ",00" (463,00), with PR they are like "463,69".

Didn't get Warnings so i cannot test PR succesfully.

avatar jsubri
jsubri - comment - 25 May 2017

I have tested this item successfully on fc48eef

I didn't managed to get the notice but the cache size is wrong, easy to demonstrate when you toggle the back-end in various languages (English, German, French), the patch fix it. Extensions relying on updateSize are anyway suffering from the language formatting.
I'm posting results below.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/15964.
avatar jsubri jsubri - test_item - 25 May 2017 - Tested successfully
avatar jsubri
jsubri - comment - 25 May 2017

Before the patch English & German (or French)
15964-before-english

15964-before-german

After the patch English & German (or French)
15964-after-english

15964-after-german

On disk
15964-ondisk

avatar brianteeman
brianteeman - comment - 25 May 2017

Extensions relying on updateSize are anyway suffering from the language formatting.

I cant see how a presumably they are accessing the size directly and not with formatting

avatar franz-wohlkoenig franz-wohlkoenig - change - 25 May 2017
Status Pending Ready to Commit
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 25 May 2017

RTC after two successful tests.

avatar rdeutz rdeutz - change - 27 May 2017
Labels Added: ?
avatar rdeutz rdeutz - change - 27 May 2017
Labels Added: ?
avatar rdeutz rdeutz - change - 6 Jun 2017
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2017-06-06 19:18:42
Closed_By rdeutz
avatar rdeutz rdeutz - close - 6 Jun 2017
avatar rdeutz rdeutz - merge - 6 Jun 2017

Add a Comment

Login with GitHub to post a comment