This class is not stable to extend, nor does codesearch reveal
any classes extending it outside of core, so we can just evaluate
if $wgUser needs to be set for this class and subclasses in core.
TableCleanup is not set up to be run directly, it requires that it
be subclassed and the subclass run as a maintenance script. Within
TableCleanup itself, nothing depends on $wgUser. Looking at the
subclasses in core:
* CleanupCaps overrides the execute method, so the code to set
$wgUser in TableCleanup::execute() is not being run
* CleanupImages, TitleCleanup, and ClenupWatchlist do not
appear to have any code that relies on anything related to the
current user or context
Since nothing is using the user in any form, simply remove the
write to $wgUser, no need to replace it with setting the context
user
Bug: T243708
Change-Id: I1a22f2ebab028822e663ab1fdcbd6c7b02331fef