Do not hack MediaWiki core/fr

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.

Pourquoi vous ne devriez pas modifier le core
resistez à la tentation, quelle que soit la facilité avec laquelle vous pouvez modifier MediaWiki pour lui faire faire ce que vous voulez.


 * Le faire rendra impossible, compliqué ou quasiment impossible d'appliquer les mises à jours au site, comme les corrections de bogues ou de trou de sécurité.
 * 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.

Problèmes rencontrés par les wikis qui modifient leur coeur

 * Les mises à jours MediaWiki peuvent durer de 30 minutes à 6 heures ou même 6 semaines si votre  diff montre que 13650 lignes ont été modifiées.
 * Augmentation du spam et d'autres attaques à cause des trous de sécurité
 * Perte de fonctionnalité à cause de hacks en conflit dans les fichiers du coeur
 * Impossibilité d'utiliser de manière fiable la doc de MediaWiki.org - tout est écrit avec la supposition que vous n'avez pas modifié les fichiers du coeur (sauf bien sur si vous vous chargez vous même de la documentation de ce hack)
 * Repetition of the original problem - as a bug report is a for 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
 * Complaining to developers about your core files not working - and not finding much sympathy - if you hack core files - effective technical support is all but impossible

Exceptions
Y a-t-il des exceptions ?

Non.

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.

Extensions
Note that most of this page also applies to important extensions. It's a bad idea to directly start hacking the Semantic MediaWiki extensions, or any of the extensions used on Wikipedia and other Wikimedia sites.

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.

Que faire à la place
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 MediaWiki:Sidebar and many many others, see also other pages on this wiki for e.g. JavaScript and CSS additions and changes.
 * 2) Developpez une extension pour accomplir les fonctionnalité de votre hack.
 * 3) Soumettre un rapport de bogue
 * 4) Contribuez au dépot de code du coeur pour que d'autres puissent bénéficier de vos améliorations