From @Tgr's email
To set up a per-wiki flag, you need to add a confiuguration variable to the extension, then edit wmf-config/InitialiseSettings.php and wmf-config/CommonSettings.php in operations/mediawiki-config - set the wiki list in InitialiseSettings and use it to set the config var in CommonSettings.php. wikitech:Configuration_files has details. The heavyweight way for this is to add a new dblist (MediaViewer example), then you only need to edit it afterwards; or you can just use an ad hoc list.
In the extension, if the flag is set to beta, register the beta features hook and use BetaFeatures::isFeatureEnabled to determine whether the extension should activate; if the flag is set to non-beta, register a preference hook instead and use that preference. MediaViewer patch (note that using 'betafeatures' for the section in wgExtensionCredits was not a good idea in that patch).