Bug 19133 is a tracking bug to clean up the maintenance scripts (which are currently a gigantic mess). The maintenance-work branch was created to fix this.
Overall goals 
The overall goal of this project is to improve the overall situation of the maintenance directory. Right now, things are unorganized, undocumented and do not follow any real standard. As a result, scripts are hard to maintain and support. The maintenance-work branch aims to fill the following goals:
- Standardize - All supported maintenance scripts should follow the standards outlined in the official docs. In addition, scripts should follow MW coding conventions with variable naming
- Documentation - All maintenance scripts should have a proper description, as well as documentation of all parameters. In addition, appropriate code documentation needs to exist for the auto-generated code docs.
- Cleanup - Some scripts are outdated, these need to be clearly marked as such or removed.
- Bugfixing - There's a short list of filed bugs for maintenance scripts. Some of these can be easily fixed while we're already under the hood.
It would be nice at some point to have all of this clean & standardized to a point where an extension like Maintenance (not to be confused with Maintenance.php, the future framework...) can work without major drawbacks. In addition, the rewrite is not looking to work with any of the following:
- The update/install process. Tim was looking at a rewrite/cleanup here eventually, and I'm not looking to step on toes.
- Database abstraction. Where quick fixes can be done, they will be integrated. However, the maintainers of the different database ports should be on top of fixing broken SQL for their interfaces.
Future of commandLine.inc 
commandLine.inc will not be going away. Many third party sites may very well still depend on functionality that commandLine.inc does provide. As such, it will be kept as-is for backward compatibility. The file will be marked as deprecated and will not continue to see the same level of support/bug fixing as the newer Maintenance interface.
The following bugs will be marked FIXED when the maintenance-work branch is integrated to trunk:
19133 - Maintenance script cleanup 16322 - Allow maint scripts to accept DB user/pass over input or params if no AdminSettings.php 18768 - Remove AdminSettings.php from MediaWiki core 19157 - createAndPromote error on bad password 18855 - require commandLine.inc properly (will be INVALID, commandLine.inc will be phased out) 18930 - initStats does not refresh active_users count 14201 - Create AdminSettings.php during wiki installation, in the same way as LocalSettings.php
- Handle param validation at Maintenance level, rather than making subclasses control this
- Kinda in place? We do validate required params and make sure they have values, but we don't do type checking.
- Split WMF-specific scripts to an extension?
- Make help work for -help, not just --help and help as an arg.
- Need cleaner way to die without killing parent. Maybe actually fork the process?
- Need to make sure we're passing correct args, don't want to die over something so stupid.
Outstanding questions 
These are things that I still need Brion/Tim/somebody's input on, as I need info about how the WMF maintenance environment works
- Am I right in understanding that $wgUseNormalUser means to use the normal Wiki DB user, rather than the super user? Could this safely be deprecated in favor of a more OOP approach?
- Is $wgUseRootUser actually used anywhere in WMF? I can't find any usages in trunk or extensions.
- Brion says it's in their AdminSettings but it's kind of icky. Need to work on removing that if possible
- Some yes, some no.
Some scripts fit into specific categories.
To be ported 
- All of the TableCleanup/fiveUpgrade-related scripts. Kinda tied to the update stuff though? Needs more poking.
- All of the maint scripts in subdirs: language, gearman, storage
Removable .inc files 
- .inc files that were only helper functions - most can be deleted
- Exceptions: populateLogSearch, populateCategory, populateParentId - these are needed by updaters.inc still!
The following files had functionality merged into Maintenance.php