AbuseFilter let people test rules against old filter hits, but this has a cost: while checking filters for an ongoing action, we save variables in the DB. Nowadays we save an array with native data types (PHP's ones), but in the past we used to serialize a whole AbuseFilterVariableHolder object, which in turn included AFPData objects and AFComputedVariable object. The latter could include even bigger stuff, for instance a whole Article object! This was a poor choice (and led to, for instance, T187153) and the behaviour has been changed in 2013, but old entries still hold serialized classes. This is why we need a maintenance script to clean all those entries and convert them to the current format.
Since we need a script to change old dumps, we should seize the opportunity to do several improvements at the same time. Including the above, we have:
- Check the afl_var_dump table, and if the column contains an AbuseFilterVariableHolder (it did before rEABFf94f42b506714023570bf26cf42775287f82b515) move it to the text table (via storeVarDump)
- Remove the first if inside AbuseFilter::loadVarDump (back-compat code)
- Check the text table, and if the serialized value is an AbuseFilterVariableHolder re-store it using storeVarDump. For every row, remove the 'nativeDataArray' flag and add 'utf-8' (T34478)
- Remove other back-compat code from loadVarDump and storeVarDump (everything related to 'nativeDataArray': the flag shouldn't be applied anymore, and all data will be native)
- Since all dumps will be in the text table, change the afl_var_dump column to only hold the text id, and also perform a schema change to make it hold a bigint (or whatever the long integer data type is called)
- Stop adding the "stored-text" prefix
- Remove meta-variables ('context', 'logged_local_ids' and 'logged_global_ids') from code (patch1, patch2)
- Remove them from logs using the script
- Rename old variables to use the new names (T204236) inside all old logs
- Remove AbuseFilterVariableHolder::mVarsVersion and its uses
- Use JSON serialization instead of PHP's serialize per T161647
- Fix empty afl_var_dump (T110854)
- Ensure that variable names are saved lowercase (goes with this patch, although we already lcase the names and I don't know whether we saved uppercase names in the past)
- Handle corrupted/non-unserializable rows (T214193)
And maybe there's even more: I think that reasonably any other change related to stored var dumps should be included in this list.