-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[6.1] Update robot detection logic and add new user agents #46413
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
base: 6.1-dev
Are you sure you want to change the base?
Conversation
|
The list is massively out of date See #45323 |
|
Agree I was wondering about the best way forward. See comment I've added to #45323 Would moving this big list into a plugin be a first start? e.g. plg_browserbot_legacy Can then investigate other bot detectors like this. plg_browserbot_fingerprint Up to site admin to enable the one(s) they want to use. |
Add plugin support for robot detection in isRobot method.
|
Added support for isrobot event in browserbot plugin folder. In future can add browserbot plugins whenever convenient. Install and enable this plugin to test: Invocation: And to emulate a robot Legacy isRobot behaviour |
Refactor isRobot method to check for null return from importPlugin and improve readability.
|
Could you use in_array()? How would it compare for speed? This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46413. |
|
As I wrote in the referenced issue we should not be trying to maintain a list of robots ourselves and should be using a well maintained library instead |
Bizarre how they got lost!
... The plugin solution opens up the possibility to use any number of free / freemium / paid for libraries. Maybe one plugin could be distributed with Joomla Project like Google Captcha is incluided. Other possibilities left to 3rd party developers. Not an intended outcome of this pull request I have a long-standing use case of the Browser class where it looks like using this plugin approach is worth investigating. |
Now uses strpos instead of preg_match.
Summary of Changes
In isRobot() use strpos() instead of preg_match() as that is faster.
See https://www.php.net/manual/en/function.preg-match.php#refsect1-function.preg-match-notes
Testing Instructions
A simple test available in this plugin.
bfisrobottest.zip
Install and on enabling the front-end displays the following on success:
Test (false):
Test (true):1
Test (true):1
Actual result BEFORE applying this Pull Request
Robots detected.
Expected result AFTER applying this Pull Request
Robots detected.
Its a big list of robots - possibly a detectable performance improvement,
Link to documentations
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed