And I would need to have only dummy php files in my andra etc directory? Plus a real LocalSettings.php of course. Will they load the good json files etc?
Thanks for the tip.
Pascal
Brian Wolff a écrit, le Thursday 12 December 2019 à 21:37:36 :
If symlinks aren't an option (It would be weird for a hosting provider to disallow that), you can probably use dummy php files that just load the real version of themselves.
e.g. Have MediaWiki in a directory named mediawiki
then in a different directory named andra have a file named index.php containing only <?php require "../mediawiki/index.php";
And do similar for load.php, and any other files ending in .php that are top-level in MediaWiki (e.g. api.php, load.php,etc. But only the top level ones, don't worry about the subdirectories). Then do the same thing for the other wikis you want to install in other directories.
This should mostly just work (WMF wikis actually do something kind of like this, but for different reasons), although you will need to adjust $wgExtensionAssetsPath to be 'mediawiki/extensions'; If you enable uploads, you will need to make sure each wiki has a unique upload directory.
-- Brian On Thu, Dec 12, 2019 at 9:28 PM Pascal GREGIS grapos@free.fr wrote:
Thank you Brian for the explanations. I d'ont have the courage anymore to track down all the hardcoded index.php, and if you say it may be fragile, I think I have no other option but to lose 1GB of my available space copying mediawiki directory 4 or 5 times. It would be nice however if possible to have other options for multiwikis, as all hostings don't allow symlinks or subdomains / domain aliases.
For ereg_replace, I don't know why preg_replace gave horrible results on my server, but anyway, I should'nt need it anymore.
Pascal
Brian Wolff a écrit, le Thursday 12 December 2019 à 18:08:46 :
It would be much better if you could use separate directories instead of renaming index.php. Renaming index.php is not really a supported configuration. There's the obvious problem of how do other scripts, like load.php know what wiki is being referred to.
If you're really intent on doing this, You can try ensuring that
$wgScript
is set appropriately for each wiki (E.g. $wgScript = '/w/andra.php'; for the andra one). However, there are probably places (especially for extensions) where index.php is hardcoded, and as i mentioned before,
there
are other entry points then index.php like load.php and api.php which
will
be confused by this. I expect that this setup will break in subtle ways.
You would also have to ensure there are separate image directories for
each
wiki or mediawiki will get confused.
p.s. ereg_replace is being removed from php, you should use preg_replace instead.
-- bawolff
On Thu, Dec 12, 2019 at 5:54 PM Pascal GREGIS grapos@free.fr wrote:
Hello everyone,
I have troubles running several wikis on a same installation. In fact I cannot use neither symlinks nor subdomain redirections to do
it.
So I have tried a hand-mde solution with a copy of index.php. i.e. : I want to run 4 wikis, that I have called :
- andra
- anthony
- nita
- crep
To go to andra for example I type the address : pascal.lautre.net/w/andra.php
and I have created a LocalSettings-$wikiname.php for each of the 4
wikis,
setting a switch in the main LocalSettings.php to include the
appropriate
one. But I've got all my vairables and paths erased when the wiki
redirects, it
calls index.php/Accueil for example and I have no way to know what was
the
original call. I have even tried to use a hook, the BeforePageRedirect hook, but it worked only for loading the Accueil page (I guess it would be called
HOme
in english, or Welcome), after, I have the problem again when I try to connect, the link points to index.php instead of andra.php.
Here is the code of my LocalSettings.php:
<?php
$ppw = "/w"; if (! isset($pascal_request_uri)) { $pascal_request_uri = split("/", $_SERVER['REQUEST_URI'])[2]; }
$wgHooks['BeforePageRedirect'][] = function ($out, &$redirect, &$code)
{
GLOBAL $pascal_request_uri; GLOBAL $ppw;
$redirect = ereg_replace("/index.php", "/$pascal_request_uri", $redirect); return true; };
switch ($pascal_request_uri) { case "andra.php": case "anthony.php": case "nita.php": case "crep.php": require_once("LocalSettings-$pascal_request_uri"); break; default: echo "<p>NO wiki specified. please choose a wiki, ex: <br>\n"; echo $_SERVER['SERVER_NAME'] . "$ppw/idees.php<br>\n"; exit(1); }
Thank you for any help!
Pascal
MediaWiki-l mailing list To unsubscribe, go to: https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
MediaWiki-l mailing list To unsubscribe, go to: https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
MediaWiki-l mailing list To unsubscribe, go to: https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
MediaWiki-l mailing list To unsubscribe, go to: https://lists.wikimedia.org/mailman/listinfo/mediawiki-l