Replace all usage of $wgDBname with wfWikiId()

Change-Id: I1f3e4ccfbcba11b0745170691280a9a8724391b4