Repository navigation
Download menu plugin + some issues with download plugin #6525
Replies: 1 comment 1 reply
|
Ahoj Jana, All three points check out, @Jimmi08, and the first is worse than you found: the same ordering breaks the mirror page with no third-party plugin involved. Two tickets out of it, #6586 and #6587. Every line number in your write-up matched master. 1. The breadcrumb ordering. Traced and confirmed on master and release/v2.3.x. Swapping the two lines is the fix, exactly as you said. 2. The shared batch. Confirmed in the code: e107/e107_handlers/shortcode_handler.php Lines 451 to 464 in 483b4bc Saving and restoring around your render loop is the right move for a plugin, and 3. e107/e107_plugins/download/request.php Lines 503 to 508 in 483b4bc Which is why you found two behaviours rather than a mistake. The addons are the stricter side, and that costs something real: the same file can be listed on-site and missing from the feed, the sitemap and the search results for the same visitor. Both are defensible, as you said, and core has never chosen between them. The second ticket, #6587, came out of the same read of the mirror page: it fetches its download row with no active, visible or class condition at all, and its per-mirror download button targets the wrong script. Thanks for the plugin, and for a report I could follow straight into the code. |


Uh oh!
There was an error while loading. Please reload this page.
We have released a small community plugin that adds a latest downloads menu, a top downloads menu and an admin view of the
download_requestslog to the core Downloads plugin. It adds no tables and no columns — the request log it reports on already ships with core, it just has no UI.REPO: https://github.com/Jimako-e107-plugins/download_extended
This post is informational rather than a bug report. Two things came up while testing it that maintainers may want to know about. We may be wrong about either — please read them as observations.
First: the Downloads index can build its breadcrumb from stale shortcode data
In
e107_plugins/download/handlers/download_class.php,renderCategories()asks the shortcode batch for the breadcrumb before it hands over the query state:download_shortcodes::breadcrumb()switches onvarset($this->qry['action']), which is still unset at that point. The index therefore takes thedefaultbranch instead ofcase 'maincats', and thedefaultbranch reads$this->var. The same ordering appears inloadView()(lines 522-524), where it is masked becauserenderView()callsbreadcrumb()again once the vars are set.On a stock install nothing is visible:
$this->varis empty, thedefaultbranch produces one crumb with an emptytext, andform_handler::breadcrumb()drops empty entries. It only becomes visible once something else on the page has put a row into the same batch — which is what our menus did. The Downloads index then showed a breadcrumb for a file that is not on that page.Swapping the two lines seems to be enough:
case 'maincats'never touches$this->var, so the index becomes independent of whatever state the batch is in.Second: the shortcode batch is shared for the whole request
e107::getScBatch('download', true)returns a cached instance, andsetVars()is a plain assignment ($this->var = $eVars;). Anything that renders before the page controller — a menu, for instance — leaves its last row in the batch, and the controller inherits it.We fixed this on our side by saving and restoring the batch state around the render loop, and that alone makes our plugin well-behaved. We mention it only because the first point is what makes the leak visible, and a third-party plugin is the most likely way anyone will hit it.
On verification
The site where this was reproduced runs a 2.4-based fork, so we checked the plugin first.
handlers/download_class.phpanddownload_shortcodes.phpare byte-identical to upstreammaster; the only local differences in the Downloads plugin are ine_url.phpandrequest.php, neither of which touches the breadcrumb path. So the behaviour described above comes from upstream code, not from a local modification.Third: A side observation on class filtering
The Downloads plugin's own listings filter on
download_visibleanddownload_category_classonly —renderList()(lines 850-859) andloadView()(lines 540-541). Its addons filter ondownload_classas well:e_list.php:48,e_rss.php:104,e_gsitemap.php:48,e_search.php:62,e_tagwords.php:38. Both behaviours are defensible, but a plugin author reading the source has no way to tell which one is intended for a new listing. We went with the plugin's own pages, on the grounds that a site menu is closer to an on-site listing than to a feed.Line references — all verified against
e107inc/e107master, 2026-09-19$sc->breadcrumb()before$sc->qrydownload/handlers/download_class.phpdownload/handlers/download_class.phpbreadcrumb()switches on$this->qry['action']download/download_shortcodes.phpsetVars()is a plain assignmente107_handlers/shortcode_handler.phpgetVars()/setVars()are publice107_handlers/shortcode_handler.phpe107_handlers/form_handler.phpbreadcrumb()renderList()file query — nodownload_classdownload/handlers/download_class.phploadView()query — nodownload_classdownload/handlers/download_class.phpdownload_classdownload/e_list.phpdownload/e_rss.phpdownload/e_gsitemap.phpdownload/e_search.phpdownload/e_tagwords.phpAll reactions