New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
simplecache regenerated incorrectly based on viewtype (Trac #2115) #2115
Comments
cash wrote on 40319224-06-08 The problem is that $oldview = get_input('view'); does not return the view parameter when the request goes through the rewrite rule. The request parameters get stripped out and get manually added back in page_handler(). Does anyone know why the rewrite rules do not end with &%{QUERY_STRING}? |
Title changed from |
brettp wrote on 40319515-07-13 I don't know why the rewrite rules drop the get params. This creates a bit of overhead on each page load because the request URI is parsed and any get params are extracted, and also creates bugs like this one. Off the top of my head I can't think of any good reasons for doing it in PHP instead of letting the server handle it. |
trac user milan wrote on 40319536-07-16 Not sure we're on the same thread here, but I'll go through what I think is wrong steap by step:
... and so on ... |
cash wrote on 40319606-04-26 milan - the first issue that needs to be solved is getting get_input() to work in start.php. Otherwise, the viewtype is being set to 'default' for rss views. |
cash wrote on 40319670-08-23 milan, the second problem is as you point out - the lastupdate needs to be viewtype specific: $lastupdate = datalist_get("simplecache_lastupdate_$oldview"); I guess these are separate but related problems. |
cash wrote on 40322475-09-13 To follow up on this, the fix is not as simple as just adding the viewtype to the simplecache_lastupdate parameter in /engine/start.php When an upgrade is performed or a plugin is enabled, the last update time is cleared and right now the datalist does not let you do something like clear simplecache_lastupdate* Either datalist needs to support an operation like that or you need to cycle through all viewtypes. Cycling through viewtypes is probably not possible since teh system does not know what viewtypes exist. |
brettp wrote on 40322485-01-17 Sometime later this week I plan to save all valid view types upon view discovery to solve a related problem. I think this easier than requiring plugins to register a new view type because we have the data for what view types exist already, and plugins are used to being able to create ad-hoc view types. |
cash wrote on 40358392-10-28 Fix to this will wait for Brett to add list of valid viewtypes. See #2185 for related issue of viewtype not being set correctly due to rewrite rules |
Title changed from |
cash wrote on 40406819-02-22 Brett - any progress on having a list of valid viewtypes for a system? I've been waiting on that before putting in the final fix for this - or do you want me to handle it? |
brettp wrote on 40406953-11-07 Sorry guys...this one totally slipped my mind. Cash - I had some prototype code for this that I can try to dig up. The basic approach was to pull out the info from $CONFIG->views->locations after all plugins had loaded and save it into $CONFIG somewhere. Core views never end up in there and I was pulled on to other things before I could check why. If you want to handle it, feel free. Else, I'll tackle this over the weekend. |
cash wrote on 40407019-07-07 I won't be able to touch this until Tuesday at the earliest. I came across the issue of core views not being loaded when writing the Elgg developer tools. Since the view system falls back to core views there was never a need to pre-load them. You would need to list /views/ to grab the viewtypes that the core provides. |
brettp wrote on 40407026-10-31 Not a difficult compromise then. I'll take care of this over the weekend. |
brettp wrote on 40407914-05-16 (In [svn:6274]) Refs #2115: Added elgg_is_valid_view_type(). Currently calculated at each load but will want to cache like view paths. |
cash wrote on 40417627-09-24 (In [svn:6305]) Refs #2115 - simplecache is now viewtype sensitive |
cash wrote on 40417636-10-27 Still to do:
|
cash wrote on 40420285-03-29 (In [svn:6319]) Closes #2115 - simplecache is viewtype specific and does not regenerate twice per reset |
ewinslow wrote on 40615116-04-04 Brett asked me to reopen this issue based on the following related problem: It's possible to insert rows into the datalists table simply by visiting ...?view=. doing so will generate 2 rows (on 1.7.2, 1 row on pre-1.7.2). simplecache_lastcache_ It doesn't matter what is. It could be a valid viewtype like "mobile" or an invalid one such as "". To a security scanner (which is how we found this), the behavior looks like SQL injection. Would be good if we checked that is a valid viewtype -- if we do already, then the function is broken, according to my tests. |
cash wrote on 40615218-01-27 The valid viewtypes are stored in $CONFIG->view_types A function could be added to test if a viewtype is valid and have Elgg automatically fallback to default if it is not valid. And to nitpick, this is a distinct issue from this ticket |
trac user milan wrote on 40615267-10-16 That would work, but $CONFIG->view_types isn't defined in Elgg 1.7.x, although it wouldn't be that difficult to back port that from 1.8 to 1.7.2 |
brettp wrote on 40615904-03-14 They're distinct, yes, but they're not unrelated. I asked Evan to reopen this one because I'm tired and confused it with a private discussion Milan and I had. Either way, I've opened a different ticket specific to this problem: #2406 |
Original ticket http://trac.elgg.org/ticket/2115 on 40319056-06-03 by trac user milan, assigned to unknown.
Elgg version: 1.7
After implementing 304 Not Modified for simplecache css/js views (http://trac.elgg.org/ticket/2002). I've noticed that there are certain conditions which invalidate the actual lastupdate value. If you take a look at this code (in engine/start.php):
If you notice that by default view is automatically set up 'default', but in other frequent cases i.e. http://www.example.com/?view=rss then that can cause a condition where simplecache is regenerated (really bad) and simplecache_lastupdate is reset (just bad). This causes the CSS and Javascript URL's to be reset and therefore force the browser (and proxies) to reload the files from the server.
The text was updated successfully, but these errors were encountered: