Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maintainence scripts don't work when plugin installed! #5

Open
ajquick opened this issue Jan 15, 2019 · 2 comments
Open

Maintainence scripts don't work when plugin installed! #5

ajquick opened this issue Jan 15, 2019 · 2 comments

Comments

@ajquick
Copy link
Contributor

ajquick commented Jan 15, 2019

Occasionally the Mediawiki Maintenance scripts will error out.

Warning: require(./../forum/common.php): failed to open stream: No such file or directory in /home/user/public_html/wiki/extensions/Phpbbauth/PhpbbAuth.php on line 31

Fatal error: require(): Failed opening required './../forum/common.php' (include_path='/home/user/public_html/wiki/vendor/pear/console_getopt:/home/user/public_html/wiki/vendor/pear/mail:/home/user/public_html/wiki/vendor/pear/mail_mime:/home/user/public_html/wiki/vendor/pear/net_smtp:/home/user/public_html/wiki/vendor/pear/net_socket:/home/user/public_html/wiki/vendor/pear/pear-core-minimal/src:/home/user/public_html/wiki/vendor/pear/pear_exception:.:/opt/cpanel/ea-php72/root/usr/share/pear') in /home/user/public_html/wiki/extensions/Phpbbauth/PhpbbAuth.php on line 31

This will be fixed in the next version.

@ajquick
Copy link
Contributor Author

ajquick commented Jan 18, 2019

This is a tricky thing to fix given the range of various different possible installs. Maintenance scripts DO work if accessed from the root MW directory.

This works:

php maintenance/script.php

This does not (from maintenance directory):

php script.php

@ajquick
Copy link
Contributor Author

ajquick commented Jan 18, 2019

MediaWiki's extension page describes a potential fix: https://www.mediawiki.org/wiki/Manual:Extensions#Installing_an_extension

Some extensions can conflict with maintenance scripts, for example if they directly access $_SERVER (not recommended).
In this case they can be wrapped in the conditional so maintenance scripts can still run.

//for mw.v 1.24.x or less
if ( !$wgCommandLineMode ) {
   require_once "$IP/extensions/extension_name/extension_name.php";
}
//for mw.v 1.25.x or above
if ( !$wgCommandLineMode ) {
   wfLoadExtension ( '<extension-name>' );
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant