User:Catrope/Extension review/Translate/old

Base revision: r95391

Translate.php

 * The  global functions should be in a static class, e.g.
 * ✅ 95755
 * What does  do? The way it interacts with the   is not really documented or intuitive
 * isn't exactly a good memcached key. It should be something unique and descriptive, e.g.
 * ✅ Method was removed in 95754

translate.sql

 * The index on  is completely useless given that the primary key is
 * Can I just remove it?
 * What is this table for?
 * Stores the extracted sections for translatable pages.

TranslateUtils.php

 * Line 49: can't you just use  or something along those lines?
 * It doesn't necessarily return array with two elements.
 * Line 132: you're mixing ASC and DESC in an ORDER BY, and one of the fields you're ordering by is a derivative field (result of a function). That in combination with the large size of the recentchanges table on most WMF wikis (5M rows on enwiki) means this feature will have to be behind $wgMiserMode or otherwise disableable
 * Let's say target wikis are mediawiki.org, meta and commons. How does this hold up then? At translatewiki we have an RC table that is about 2.5M rows.
 * Doesn't the namespace and timestamp conditions filter the resultset to small enough?
 * Anyway, this code is only callable from command line scripts, so it should be safe.
 * Line 136: what batch existence query?
 * ✅ No longer used as of 95759. Preparing for deletion of this code.
 * Line 139: you can also use
 * ✅ I didn't know it exists. 95758
 * Line 170: you may want to use a strict comparison here, otherwise  will produce strange results
 * ✅ Fixed in 95760
 * Line 202, 207: ZOMG, hardcoded English. Of all extensions... :)
 * ✅ Broken code removed in 95761
 * Line 256, 280: what is so performance-sensitive here that you have to factor out a simple function call? That makes little sense to me
 * ✅ Simplified in 95760

TranslateTasks.php

 * Line 361:  is not escaped
 * ✅ 95762.
 * Line 462-468: can't you just use  here?
 * ✅ 95765.

TranslateEditAddons.php

 * Generally, you should mention what hook each function is hooked into in a doc comment, that makes understanding the code easier without having to go back to look up the $wgHooks assignments each time
 * ✅ 95769.
 * Line 44, 49: you're using strtr here to replace spaces/underscores and str_replace elsewhere. Also, don't you have a function lying around that does lowercasing and space/underscore stuff?
 * strtr/str replace do the same in this case, right? Function: no I don't think so.
 * Line 53: -666 ?!?!?
 * Any index which doesn't exist and which doesn't have existing neighbours.
 * Line 98: why would $next equal true?
 * No idea, removed. I don't think anything will break, but we will find out. 95769
 * Line 111: what is SkinChihuahua?
 * Clarified in 95752
 * Line 122: $object seems to be an EditPage, document that
 * ✅ 95769.
 * Line 193: eww, onclick
 * I don't know how to fix in the best way
 * Line 254-258: what does this logic do and why? There are no comments
 * It tries to figure when it can replace the contents of the editing area with stuff from elsewhere. MediaWiki doesn't make it easy.
 * Line 294: don't pass an array as the second parameter to . The function supports this by accident only
 * ✅ 95769.
 * Line 296: don't you really just mean to check that the second query didn't return zero results? If you meant it, say it, with something like ,   ,   or whatever. As currently written this function will return true in the (admittedly strange) case where 'fuzzy' isn't in the revtag_type table because   is true
 * ✅ 95769.

utils/TranslationHelpers.php

 * Line 1224: ??? makeVariablesScript shouldn't be used this way. You should export variables through a MakeGlobalVariablesScript hook, and you shouldn't just export the return value of wfMsg, use the normal message exporting system instead
 * Do you mean resource loader? This code was written way before RL.