? Success

User tests: Successful: Unsuccessful:

avatar maxvalentini77
maxvalentini77
23 Oct 2014

I found three issues:

1: In some cases, call an invalid URL, resulting in a response with code 404. (still refresh the session)
2: Update the article hits counter.
3: Work in different ways with "Search Engine Friendly URLs" enabled or disabled.

How to reproduce number 1

  • Enable "Search Engine Friendly URLs"
  • Set "Session Lifetime" to 1 (not required but useful to test faster!)
  • Create a menu of type "Menu Heading" and call it "heading"
  • Create a menu that point to an article and add it as child of "heading"
  • Create a Login module and put it some where in the page (add the "behavior.keepalive")
  • Use the article menu (you will be redirected to a page with an URL like "www.host.net/index.php/heading/article")
  • Wait some "Session Lifetime" minutes and an ajax call to the URL "www.host.net/index.php/heading/" will be executed but ends with a 404 error

The session is refreshed but it isn't nice to generate a 404 error that, for example, ends up in the apache logs.

How to reproduce number 2

  • Set "Session Lifetime" to 1 (not required but useful to test faster!)
  • Create a menu that point to an article and set it as default
  • Create a Login module and put it some where in the page (add the "behavior.keepalive")
  • Go to the homepage of the site, the article will be displayed with a counter hits = C
  • Wait some "Session Lifetime" minutes and an ajax call to the homepage will be executed (increasing the hits counter)
  • Refresh the page

The counter was increased by 1+X where X is the number of ajax calls.

How to reproduce number 3

  • Disable "Search Engine Friendly URLs"
  • Set "Session Lifetime" to 1 (not required but useful to test faster!)
  • Create a menu of type "Menu Heading" and call it "heading"
  • Create a menu that point to an article and add it as child of "heading"
  • Create a Login module and put it some where in the page (add the "behavior.keepalive")
  • Use the article menu (you will be redirected to a page with an URL like "www.host.net/index.php?option=com_content&view=article&id=12&Itemid=160")
  • Wait some "Session Lifetime" minutes and an ajax call to the URL "www.host.net/" will be executed.

This is the same procedure to reproduce number 1 but ends with a different behavior that, if the homepage display an article, generate the same issue of number 2.
(This because the homepage of the site has been called.)

Proposed solution

I modified the URL of the ajax call from "./" to:

JRoute::_("index.php?option=com_ajax&format=json", false)

This call refresh the session without generate any html and/or call model methods that can lead to unexpected/unwanted behaviors (for example in an increased article hits counter).
This call is available on both site and administrator applications.

To test it in the administrator application (for example) go to the edit category page that include the "behavior.keepalive" and wait for the ajax call.

avatar maxvalentini77 maxvalentini77 - open - 23 Oct 2014
avatar jissues-bot jissues-bot - change - 23 Oct 2014
Labels Added: ?
avatar jissues-bot jissues-bot - change - 23 Oct 2014
Labels Added: ?
avatar maxvalentini77 maxvalentini77 - change - 23 Oct 2014
The description was changed
avatar Fedik
Fedik - comment - 10 Apr 2015

thanks @maxvalentini77
I had similar idea, and found this is already suggested couple months ago :smile:

couple note:
you do not need to call JRoute as it useless here, enough:
JUri::base(true) . 'index.php?option=com_ajax&format=json';

and can you please make $refreshTime fixed, example 1 minute , so we could solve also that issue #6730

something like:

JFactory::getDocument()->addScriptDeclaration('
!window.setInterval(function(){
var r; try{ r = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP")}catch(e){};if(r){r.open("GET","'.$url.'",true);r.send(null)}
}, 60000);
');
avatar maxvalentini77
maxvalentini77 - comment - 10 Apr 2015

Hi @Fedik
I made the changes.

Thank you

avatar Fedik
Fedik - comment - 10 Apr 2015

I am sorry, I missed slash in my example, for url:
JUri::base(true) . '/index.php?option=com_ajax&format=json';

and thanks for this, I try test tomorrow

avatar maxvalentini77
maxvalentini77 - comment - 10 Apr 2015

Added the slash and tested, seems to work well.
Time is now fixed to 60 seconds, I don't know if also solves the #6730.

avatar Fedik
Fedik - comment - 11 Apr 2015

test works for me good, also fix #6730 issue for me
thanks!

avatar zero-24 zero-24 - change - 11 Apr 2015
Easy No Yes
avatar Fedik Fedik - test_item - 11 Apr 2015 - Tested successfully
avatar zero-24 zero-24 - change - 11 Apr 2015
Category Libraries
avatar JonasAtZwetschke JonasAtZwetschke - test_item - 14 Apr 2015 - Tested successfully
avatar Fedik
Fedik - comment - 14 Apr 2015

test
still works good :smile:

avatar Fedik
Fedik - comment - 13 May 2015

it is ready to "RTC" or? :smiley:


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

avatar demis-palma
demis-palma - comment - 13 May 2015

@test successful
@Fedik I guess that your test has not been notified because it lacks the (at) symbol.

avatar Fedik
Fedik - comment - 13 May 2015

the (at) symbol useless here :wink:
people use it as quick way to make "test" word bold :smile:

avatar zero-24 zero-24 - alter_testresult - 13 May 2015 - demis-palma: Tested successfully
avatar zero-24 zero-24 - change - 13 May 2015
Status Pending Ready to Commit
avatar zero-24
zero-24 - comment - 13 May 2015

Thanks for the bump and the tests @Fedik and @demis-palma

RTC'ing now!


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

avatar zero-24 zero-24 - change - 13 May 2015
Labels Added: ?
avatar zero-24 zero-24 - change - 13 May 2015
Labels Added: ?
avatar maxvalentini77
maxvalentini77 - comment - 15 May 2015

I notice that the session not always be refreshed if the session lifetime is set to 1 minute.
@Fedik and @demis-palma can check again that continue to works well to you too?
(sorry for the inconveniente)

I also noticed that the session lifetime can be set a zero or negative value in the configuration page.
Zero behavior is equals to default of 15 minutes.
Negative value cause the impossibility to use the application!
(created the issue #6954 for this)

avatar Fedik
Fedik - comment - 15 May 2015

@maxvalentini77 I already use this on my sites, where default session handler is File or APC,
and refresh session each minute works good, if compare with original

session lifetime 1 minute I think have not much sense, not sure that we need to worry about it :wink:
but maybe someone has better arguments :smile:

avatar Kubik-Rubik
Kubik-Rubik - comment - 6 Jul 2015

Thank you @maxvalentini77! Merged.

avatar Kubik-Rubik Kubik-Rubik - change - 6 Jul 2015
Status Ready to Commit Closed
Closed_Date 0000-00-00 00:00:00 2015-07-06 15:03:22
Closed_By Kubik-Rubik
avatar Kubik-Rubik Kubik-Rubik - close - 6 Jul 2015

Add a Comment

Login with GitHub to post a comment