Do not hack MediaWiki core/mr
This is an essay. It expresses the opinions and ideas of some mediawiki.org users, but may not have wide support. Feel free to update this page as needed, or use the discussion page to propose major changes. |
![]() | This page in a nutshell: सर्व डेव्हलपर्सना मीडियाविकीच्या कोरमध्ये सुधारणा सादर करण्यासाठी कोड रेपॉजिटरी मध्ये प्रोत्साहित केले जाते — परंतु एखाद्या वैयक्तिक विकी इंस्टॉलेशनच्या कोर मीडियाविकी फाइल्स संपादित करणे अनेकदा अधिक समस्यांना जन्म देते. एक्स्टेन्शनचा वापर करणे किंवा तुमची सुधारणा कोड रेपॉजिटरीमध्ये सादर करणे ही अधिक प्राधान्य आणि स्थिर उपाय आहेत. |
जरी मीडियाविकी कोरमध्ये हॅकिंग करणे हे इतर मीडियाविकी समर्थन मंचांवर सुचवलेले एक उपाय असले तरी, हे आदर्श उपाय नाही. सामान्यतः, हे तुम्हाला सोडवण्यापेक्षा अधिक समस्या निर्माण करेल आणि भविष्यातील अपग्रेड्स स्थापित करणे अधिक कठीण करेल.
"या निबंधाच्या उद्देशाने, 'कोर' मध्ये मूळ मीडियाविकी इंस्टॉलेशनमधील सर्व फाइल्स समाविष्ट आहेत. म्हणजेच, LocalSettings.php, docker-compose.override.yml, तुमच्या 'एक्स्टेन्शन्स' किंवा 'स्किन्स' फोल्डरमधील फाइल्स किंवा इंस्टॉलेशन नंतर तुम्ही जोडलेल्या इतर फोल्डर वगळता सर्व फाइल्स."
कोर फाइल्स का बदलू नयेत
मीडियाविकीला तुमच्या अपेक्षेनुसार कार्य करण्यासाठी कोर फाइल्स बदलणे कितीही सोपे असले तरी, या प्रलोभनाला बळी पडू नका.
- Doing so will make it complicated, difficult or near impossible to apply site updates such as security and bug fixes.
तुम्ही तुमच्यानंतर येणाऱ्यांसाठी साइटची देखभाल करणे अवघड बनवाल. तुम्ही तुमच्या साइटला गैरफायदा घेण्यासाठी असुरक्षित ठेवू शकता.
- 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.
Problems faced by wikis which hack their core
- MediaWiki upgrade times go from 30 minutes to 6 hours or even 6 weeks if your
diff
shows 13650 lines have been changed.
- Increase in spam and other unwanted attacks due to security holes.
- Missing out on new features due to conflicting hacks to core files.
- Inability to use MediaWiki.org documentation — all of which has been written under the assumption that you have not hacked your core files (unless of course you write documentation specifically for how to operate MediaWiki when that particular hack is being used).
- 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.
- 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
Are there exceptions to this rule?
Nope.
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.
What to do instead
Rather than hacking MediaWiki core, there are several alternative solutions to consider, more or less in this order:
- 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.
- Develop an extension to accomplish what your hack was intended to do, or simply use one of the existing hooks
See also
- {{Extension by patch warning }} — template to add to the pages of extensions that require modifications to MediaWiki core.