-3

I have a LAMP (CentOS) "shared" server environment on which I can't control Apache webserver fully but partially through .htaccess files;
I can SSH that environment and use Bash in my user partition.
On that environment I have a MediaWiki website.

MediaWiki core includes some features I would like to disable but doesn't allow the option to do so (for example, one cannot disable edit summary boxes or footer links).

As I am not a PHP programmer and don't want to change the massive core PHP, I thought to prevent such features from being parsed to client, somehow.

  • Disabling these through CSS and/or JavaScript isn't an option because a user can disable CSS and/or JS and then use these features

  • I thought to prevent the parsing of such features while PHP document still gets executed in a similar scenario: Some PHP function gets called before any PHP line or routine gets executed (for processing markup);
    Then, by some criterion (CSS class maybe), that function filters out that line or routine from being executed, thus the HTML structure that would otherwise be parsed by it, won't be parsed
    But PHP 7.3.11 doesn't have such a function.

Is there any tweak to prevent parsing of to-be-parsed HTML elements with Bash?

  • Are you sure you can't do what you want by changing your MediaWiki config? mediawiki.org/wiki/Manual:Configuration_settings – Mat Nov 30 '19 at 10:36
  • @Mat not all changes are available from there; in in any case I prefer to know such a way (as described in question). – JohnDoea Nov 30 '19 at 10:56
  • Someone that know MediaWiki would possibly be able to help you if you actually told them what features you are trying to disable. Are you only interested in the summary boxes and footer links? – Kusalananda Nov 30 '19 at 12:49
  • @Kusalananda not necessarily. I already consulted the MW community about these two matters; in both, as I recall, CSS/JS were mentioned... – JohnDoea Nov 30 '19 at 13:15
  • 1
    I'm not sure why you want to do this with bash; beyond the fact that it happens to be your webhost's default shell, it doesn't seem relevant in any way. In any case, shell scripting of any kind is almost certainly not a good way to achieve what you want. – Ilmari Karonen Dec 3 '19 at 10:16
1
+500

I have no idea why you would want to use bash or any other kind of shell scripting for this. That's just not what it's made for. For that matter, even if you used something that was designed for HTML manipulation, adding an extra transformation layer between MediaWiki and the user's browser just to avoid learning a small amount of PHP seems like a bad idea.

As an alternative solution, I would suggest configuring MediaWiki to generate the HTML you want directly. Besides a large number of configuration variables, MediaWiki also allows provides programmable hooks for modifying many parts of its operation. For example, the SkinTemplateOutputPageBeforeExec hook can be used to modify most of the inputs that go into the HTML template, including the footer links.

If the flexibility offered by the hooks is not enough for what you want to do, another option is to make your own MediaWiki skin. This will let you entirely replace the HTML template and customize it pretty much any way you want. There's a tutorial for making a new skin that you might want to take a look at, but basically the easiest way is to start by cloning an existing skin (such as the Example skin that comes with the tutorial, or the default built-in Vector skin) and tweaking it until it works the way you want.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.