Do not hack MediaWiki core/ja

While hacking MediaWiki core is often a solution proposed on other MediaWiki support forums, it is not an ideal solution. Generally, it will cause you more problems than it solves and will only make future upgrades more difficult to install.

For the purposes of this essay, "core" is meant to include all files that belong to the original MediaWiki installation. That is to say all files except LocalSettings.php, the ones in your "extensions" folder, or other folders which you have added since your installation.

コアのファイルを変更すべきではない理由
No matter how easy it is to modify core files to make MediaWiki do what you want it to do, resist the temptation.


 * Doing so will make it complicated, difficult or near impossible to apply site updates such as security and bug fixes.
 * You will make it difficult for those that come after to maintain the site.
 * You could possibly leave your site vulnerable to exploits.
 * Other developers are less inclined to help you if you have hacked your core - if for no other reason than it is difficult for them to know what has been done.

The MediaWiki core has been designed to be modular, so there should be no reason to hack it. If there is a feature you want and it cannot be accomplished outside of modifying core, consider developing an extension or submitting your hack as a patch. Submit a bug report and tell the community the feature you want to accomplish. It will then be tested and your feature may become a part of the MediaWiki core.

コアをハックしたウィキで遭遇する問題点

 * 変更箇所が 13560 行ある (ことが diff で分かった) 場合、MediaWiki のアップグレードに要する時間が、30 分だったものが 6 時間になったり、6 週間になることさえあります.
 * セキュリティ ホールにより、スパムやその他の迷惑な攻撃を受ける機会が増加します
 * コアのファイルへのハックと衝突してしまうため、新機能を使用する機会を失います
 * MediaWiki.org にある説明文書を使用できません - 説明文書はすべて、コアのファイルをハックしていないことを想定して記述されています (もちろん、MediaWiki に特定のハックを使用している場合の運用する方法を説明する文書をあなたが記述した場合を除きます).
 * Repetition of the original problem - as a bug report is a far more reliable way to solve a problem than a core hack - if for no other reason than a group of developers will be looking into the problem and may discover necessary code changes you missed.
 * コアのファイルが動作しないことについて開発者に申し立てても、コアのファイルをハックした場合はあまり共感を得られず、効果的な技術サポートはほとんど不可能になります.

例外
この規則に例外はありますか?

いいえ.

Okay, very very rarely. But this is generally for specific wikis or implementations by people who are extremely familiar with the MediaWiki code base, development practices and security model. Those who properly document their changes and practice proper revision control with their code. If you have to ask, chances are you shouldn't.

拡張機能
このページの大部分は重要な拡張機能にも適用されることにご注意ください. Semantic MediaWiki 拡張機能や、ウィキペディアやその他のウィキメディア・サイト群で使用されている拡張機能のいずれも、直接ハックしてはいけません.

An exception could be if an extension is mainly installed by copying its code from this wiki (instead of getting it from a software repository). It means it's not very seriously maintained.

代わりにすべきこと
Rather than hacking MediaWiki core, there are several alternative solutions to consider, more or less in this order:


 * 1) MediaWiki is a powerful beast out of the box, you can do a lot with MediaWiki's interface messages such as   and many many others, see also other pages on this wiki for e.g. JavaScript and CSS additions and changes.
 * 2) Develop an extension to accomplish what your hack was intended to do, or simply use one of the existing hooks
 * 3) Submit a bug report
 * 4) Contribute your improvement to core to the code repository so others can benefit from your fix