UploadBaseTest: Use setMwGlobals() instead of juggling globals

Abstracts the logic for restoration into the built-in teardown()
handler.

Also purify the test configuration by setting wgHooks and
wgFileExtensions to otherwise empty arrays instead of extending
existing ones.

Change-Id: Ied65ee62f658dd650c603a54e72cd19965867a8f
Merge "UploadBaseTest: Use setMwGlobals() instead of juggling globals"