Extension:BetaFeatures/id

Ekstensi BetaFeatures (bahasa Indonesia: Fitur Beta) memungkinkan ekstensi MediaWiki lainnya untuk mendaftarkan fitur beta ke daftar preferensi pengguna di wiki. Ekstensi ini menggunakan arsitektur preferensi pengguna yang sudah ada dan beberapa halaman spesial untuk mencapai fungsinya.

Menggunakan hook baru di ekstensi Anda
Menggunakan ekstensi ini untuk mendukung fitur beta Anda itu mudah. Daftarkan hook bertipe "" di berkas Anda — sintaksnya nyaris sama persis dengan hook, dengan perubahan kecil untuk mendukung tipe preferensi yang kita butuhkan dalam kasus ini.

Di :

Di :

Lalu, Anda bisa menggunakan fungsi kenyamanan yang disediakan oleh BetaFeatures untuk memeriksa apakah fitur dinyalakan.

Anda bisa juga menggunakan mengecek preferensi biasa, tetapi jangan mengecek nilai benar atau salah - menggunakan nilai dari kelas HTMLFeatureField.

Because the BetaFeatures class should be present everywhere, you could use the convenience function in any hook, special page, or anything else you wanted. Just be aware of potential performance or caching issues you may introduce with those changes.

If you want to also use your extension without BetaFeatures, you should also check for its existence, e.g.:

Configuration
The  config variable can be used to limit which beta features are shown in preferences. By default it is empty, and all beta features are shown.

If it is used then in order for a beta feature to show up in the preferences it needs to be listed in the whitelist. This config variable accepts an array of strings. Each string should be the name of a beta feature as specified in the preference definition passed to. For example, in the code given above, the name of the beta feature is, so you would need to add that string to the   array in your wiki's configuration:

Advanced usage
Want to see something really cool?

Auto-enroll groups
With this example, we register a preference that's an "auto-enroll" one - if a user checks this, and new features come out that are in a particular group, the user will be automatically enrolled in those features.

Dependency management
Next up, we can actually define dependency management per-feature. To do this we first register the name of a hook that we want to use for this with the hook "GetBetaFeatureDependencyHooks", then we register a hook of that type that checks some dependency, and returns true if it's met or false if not.

You can abuse use this feature to do per-wiki disabling of features, if they're marked as dependent. But that sounds really hacky. You probably shouldn't. I can hear you thinking about it right now, just stop it.

Database stuff
There's a database table defined, and used, by BetaFeatures. But you might get confused by it if you try to use it locally.

We use the job queue to run updates for this table, when the cache expires (30 minutes TTL). If your wiki is configured to run jobs on each request, this will make about one request every 30 minutes reeeeeeally slow, but the rest will be relatively fast. If you configure your wiki to run jobs via cron, things will work much better.

Lihat juga

 * Beta Features
 * Roadmap
 * Rollout plan