Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Core-ify "Random Keywords" plugin #2367
This is still WIP, don't merge yet. In particular, the check desired in #1877 for whether the standalone plugin is active doesn't do anything/might even crash the whole plugin (I've not tested it yet).
Mostly I'm looking for feedback on whether or not it's worth keeping the commit history of the original plugin. I did this with a merge using
Whatever the way forward, it's clear that having this functionality as a core plugin will (hopefully) reduce the number of issues/comments asking how to avoid sequential shorturls.
Using str_shuffle means that each character can only occur once in the generated string. This reduces the number of permutations possible. For example, using base 36, and 4 characters, there are 36^4 = 1.68M, but the current function can only generate 36*35*34*33 = 1.41M of these. This alternative will use the whole range of possible strings.
* Rename plugin and its functions * Update README with new name * Update license with current year * Make plugin refuse to activate if the old 'Normal plugin' version is still active.
So I had a bit of time tonight after all. There's already a "conflict preventer" function that checks if the old plugin is active. It might not actually prevent loading this one in that case; I haven't had a chance to test it. (Honestly, I've been unable to find much useful documentation about how hooks are supposed to work. Do I just
But I noticed there was a merged PR in the other repo and pulled in those changes (tiny one-liner), and implemented a settings page which should work.
Nope, won't work ...
There's a missing
Plus, I think checking with
Also, it's hooked onto
Maybe a simple way would be something like:
I was going to actually do some of this now, but I've run out of time.
The idea was to block activating the plugin entirely, but it looks like there's no hook capable of doing that. All of the plugin activation hooks run after the activation itself is already finalized. So, I'll have to overwrite that (stub) implementation with a different approach—probably based on detecting the old plugin's function name, yes.
I'm spending too much time in Python these days…