I would like to throw my 2p into the argument.
I think distributing route filters with add-ons has a valid use case. I'm actually doing it with Xen Media Gallery 2.0.
PHP:
$filterExists = $db->fetchRow('
SELECT *
FROM xf_route_filter
WHERE find_route = ?
', 'xengallery/');
if (!$filterExists)
{
$routeFilterWriter = XenForo_DataWriter::create('XenForo_DataWriter_RouteFilter');
$routeFilterWriter->bulkSet(array(
'route_type' => 'public',
'prefix' => 'xengallery',
'find_route' => 'xengallery',
'replace_route' => 'media',
'enabled' => 1,
'url_to_route_only' => 0
));
$routeFilterWriter->save();
}
Why?
Simple. When I first created Xen Media Gallery, the default route of the add-on was "media". Straight away it became apparent that this would:
inadvertently screw up users sites.
It would clash with other add-ons using the same route. I could have changed it to gallery. But no doubt one day that would clash too. If XenForo released an official gallery, that may cause issues too.
So I made the change so that my add-on was shipped with the route "xengallery".
I implemented my own route changer type system so that it was easy to change "xengallery" to "media" and I shipped that with the default option.
Since the Route Filters came along, I can use the above code in the installer to create the route filter if it doesn't exist and later remove it during uninstall. I'm happy to carry on doing this, but I'd much rather that process be handled by XenForo and be more closely tied with the add-on system. As well as creating and removing the route filter, I'd like to see that being upgraded by an add-on upgrade and disabling it if the add-on is disabled.
The latter in itself goes some way to mitigate the issue of a site being screwed up by an add-on or causing problems with others. But, of course, they can be disabled in the Admin CP easily enough anyway. And there's just as much chance of someone screwing up an install using my code above, as there is if a route filter was added using an add-on XML.
So, hopefully, this might still be considered when the time is right