Last week’s php2shell PHP vulnerability and breakneck updates caused the WMF to turn off all tools on Toolforge and cloud infrastructure. As the first updates came in, non-PHP tools were reactivated first; for me, that was basically my Rust-based tools. PHP-based tools were reactivated later, but only for PHP 8.x, with tools written for previous versions requiring updates.
I took this as an opportunity to take some stock. Some of my PHP tools are single-purpose, but a few are “collections” with small sub-tools. First and foremost among those is (or was) magnustools, which serves as a landing page for all my tools, and also hosts “meta-tools”, to check on the state of my other tools, manage bug reposts etc.. But it also contained several “sub-tools”, in various states of breakage; written for older PHP versions, accessing the wrong Wikidata or Commons database replicas (which had tables moved to other databases), and general bitrot had rendered many of them fully or partially broken.
So I decided to do some triage, rescue what I can, and put the dead ones to rest in PHP^W peace. I also wanted to update them visually, give them a more consistent and modern look-and-feel. But the key piece of this transformation was stability and security, and that could only mean Rust. I worked with an LLM, which is surprisingly good at “translating” between programming languages, especially for the relatively small tool scripts, and targeting Rust.
When that work was completed, and I had successfully deployed the Rust version as a drop-in replacement, I added the (rescue-able) tools from the “magnus-toolserver” sub-tool group, which are even older and in worse state; some had not been worked on since the original Toolserver was shut down. When PHP-based tools were allowed on Toolforge again, I found several standalone tools (missingtopics, add-information, makeref, and templator, to be specific) that could not be easily upgraded to PHP 8, so I migrated them as sub-tools in the same manner. They are now Rust as well, using the same UI style. All the sub-tools have a drop-down with the others, so you can have a look what else is there. As a side effect, some tools have gained considerable speed, thanks to the fearless concurrency of Rust. If there are problems with these tools (from the rewrite or otherwise), the issue tracker is linked in the footer.
The next candidate for rewrite would be wikidata-todo, which also hosts many sub-tools. If you have thoughts about this, or other tools that should be RIIRed (“Rewrite It In Rust”), please let me know on the usual channels!
Post a Comment