Extension talk:Bootstrap

Jump to navigation Jump to search

About this board

Nischayn22 (talkcontribs)

Your requirements could not be resolved to an installable set of packages.

 Problem 1
   - The requested package mediawiki/bootstrap could not be found in any version, there may be a typo in the package name.
F.trott (talkcontribs)
Kghbln (talkcontribs)

I believe this is how the "composer.json" file has to be set up:

{
        "require": {
                "php": ">=5.3.2",
                "mediawiki/bootstrap": "1.*@dev"
        },
	"minimum-stability" : "dev",
	"prefer-stable" : true
}

Hope that this is it. By the way, neither MediaWiki (alpha) nor Cameleon provide a "composer-example.json" file.

F.trott (talkcontribs)

Not any more. Instead MW now has a composer.json, that you have to modify. And remember on every pull to stash and unstash. :(

Kghbln (talkcontribs)

Oh my gosh! Indeed, this is really going to be fun. :(

Nischayn22 (talkcontribs)

That fixed it I guess. Thanks a lot!

Reply to "Error installing using Composer"

Install to GoDaddy Shared Hosting

1
173.239.198.49 (talkcontribs)

GoDaddy shared hosting has composer installed (version 1.7.2). My Mediawiki installation was done via cPanel installatron. The mediawiki installation folder is named "wiki". In the folder wiki/vendor resides the composer folder, the composer.json file, and the composer.lock file.

I created the composer.local.json file in the wiki folder as instructed. However whenever I run composer update --no-dev "mediawiki/bootstrap" in the wiki folder, I receive and error stating that "Composer could not find a composer.json file in path/wiki To initialize a project, please create a composer.json file as described in the --link to site-- "Getting Started" section"

I am not familiar with composer so any help would be greatly appreciated.

Reply to "Install to GoDaddy Shared Hosting"
SirLouen (talkcontribs)

Why Vector skin change significantly when loading this extension?

Example screenshot

Off: https://i.imgur.com/GQYi5hz.png

On: https://i.imgur.com/M9Gr7wW.png

As you may notice everything is a lot more little after applying settings. Also margins and paddings are shorter between images and texts for example.

I'm not using any specific CSS code for format. What it's more strange it's why everything it's way more little

Code used:

$wgHooks['SetupAfterCache'][]=function(){

        \Bootstrap\BootstrapManager::getInstance()->addAllBootstrapModules();

        return true;

};

$wgHooks['ParserAfterParse'][]=function( Parser &$parser, &$text, StripState &$stripState ){

        $parser->getOutput()->addModuleStyles( 'ext.bootstrap.styles' );

        $parser->getOutput()->addModuleScripts( 'ext.bootstrap.scripts' );

        return true;

};

F.trott (talkcontribs)

Bootstrap (the package, not the extension) contains some styles that are invoked even if no specific classes are used on the html elements, e.g. for normalization. If you want to find out about the styles on a specific element, use your browsers developer tools.

SirLouen (talkcontribs)

Thanks for the answer. I was supposing so. But I thought that the extension was prepared to manage Vector skin at least (without modifications).

So it's essentially common, that Vector skin by default with bootstrap extension changes the appearance that significantly?

I would like to see if someone can make a "fix" in the future, to maintain Vector appearance, despite of Bootstrap extension introduction.

F.trott (talkcontribs)

I am afraid so. This extension really only pulls the Bootstrap package in. It was originally developed as a basis for other skins and extensions (for the Chameleon skin, in particular), hence the rather complicated instructions to activate it stand-alone. However, if you want to use it with Vector it should be fairly easy to pull in additional Less files to get a similar look. You'd have to make sure of course, that any changes you introduce are still compatible with Bootstrap. E.g. I suspect that Vector might use a different box-sizing and you'd have to weigh the pros and cons of using either border-box or content-box. And you'd probably have to update that Less file whenever Vector is updated.

Another approach might be to not pull in all Bootstrap modules, but only the ones you need and hoping that Vector does not get too much out of shape. But I have to admit that I never got around to do this myself and so the methods are there, but I am not sure that they work as expected.

Finally there is also Extension:BootStrap (notice the different spelling), that claims to be "Designed and tested using the Vector Skin only", but I never tried it and I don't know if it is still maintained.

In any case, whatever solution you come up with in the end, it'd be great if you keep me updated.

SirLouen (talkcontribs)

Yes, I also checked that extension, but there is a problem. Download links are broken.

Reply to "Vector styles change significantly"
Manbu (talkcontribs)

I installed mw1.26.4 and tried to install chameleon-skin which required the bootstrap-extension. So i downloaded mw-bootstrap-1.2.1.zip into /extensions and unzipped it and renamed it to bootstrap .

After this i edited composer.json in the root and added behind "zordius/lightncandy": "0.21",

the line        "mediawiki/bootstrap:~1.0"

but i have no installation...

F.trott (talkcontribs)

What is the specific reason for not following the installation instructions of Chameleon?

Manbu (talkcontribs)

Only with require_once "$IP/skins/chameleon/Chameleon.php"; appears a line which request to install bootstrap : Error: The Chameleon skin depends on the Bootstrap extension. You need to install the Bootstrap extension first.

..... "zordius/lightncandy": "0.21",

        "mediawiki/chameleon-skin": "~1.0",

        "mediawiki/bootstrap:~1.0"

has no effect.

The problem is that i only have a provider and filezilla. I cannot execute composer.

Therefore i added the lines to composer.json but i have no installation.

If i add wfLoadExtension( 'Bootstrap' ); an error appears instead : Fatal error: Uncaught Exception: .....htdocs\mw1264/extensions/Bootstrap/extension.json does not exist! ...

(In the specific directory are composer.json and package.json) . To experimental rename composer.json to extension.json leads to Error: The Chameleon skin depends on the Bootstrap extension. You need to install the Bootstrap extension first.

F.trott (talkcontribs)

Adding the lines to composer.json does not install anything. You need to execute composer. This will download the Chameleon skin and all its dependencies (including Bootstrap) and install them in the correct location.

If your provider does not provide you with shell access you can not directly install Chameleon (or any other skin or extension requiring composer). In this case you should create a local MediaWiki installation with all skins and extensions and then upload that in its entirety to the server.

Manbu (talkcontribs)
  1. You dont see a possibility to add the wfLoadExtension-choice to the bootstrap-master ?

2. The problem will be the database. Many providers will not allow to access it from a pc. So one has to make an normal online installation and delete it with exception of localsettings.php)

(Another possibility would be to write a composer-modul-extension which can be put to 1 Minute and a very long cycle or even switched off completely)

F.trott (talkcontribs)

It's not that easy. You would need to include all dependencies in a downloadable package. To maintain installability with composer you would then have to add a switch to discover and use either the composer-installed dependencies or the ones installed with the downloadable package. Next you would have to add the activation by wfLoadExtension. At that point you would have a Bootstrap extension installable on its own. Next you would have to do all of the above steps with the skin. A better solution might be to not provide a separate package for the Bootstrap extension at all, but to somehow bundle Chameleon and the Bootstrap extension and all dependencies into one package. You'd have to come up with some plan of how to install everything in the correct place. Whatever that place might be. E.g. it might be an idea for the bundle to not install the Bootstrap extension in the /extensions folder, but in some subfolder of the skin.

Regarding the database I do not see the problem. You should be able to 1. git pull MediaWiki locally, 2. add all your (non-composer) extensions and skins, 3. modify composer.local.json and 4. run composer update. Then you upload the whole thing and install as usual.

Manbu (talkcontribs)

I liked to have an independent version of the skin which integrates bootstrap by #import because i can then exchange it with Yaml and import others.

Mediwiki should add a composer-tab after admin-login which presents a field with username and password (for ssh)

and a list of choosable composer - orders (inclusive update) and a run-button. But i dont know who is responsioble for that.

Reply to "Installation"

Fatal error: Call to a member function ucfirst() on a non-object

6
Egel (talkcontribs)

We get this error when we update to 1.29 from 1.27 with this extension enabled: "Fatal error: Call to a member function ucfirst() on a non-object in /srv/www/scoutwiki/htdocs-1.29/includes/user/User.php on line 1079"

Do you know why and how to fix that?

Egel (talkcontribs)

The error with ucfirst() is when loged in and the error is Fatal error: Call to a member function getCode() on a non-object in /srv/www/scoutwiki/htdocs-1.29/includes/user/User.php on line 1578 when loged out.

F.trott (talkcontribs)

Could be connected with the extension using $wgUser at a time when it is not yet initialized. Could be something else completely.

If you could open an issue at https://github.com/cmln/mw-bootstrap/issues including a stack trace, that would be very much appreciated.

Egel (talkcontribs)

Opened issue.

188.29.165.20 (talkcontribs)

I am getting this error. Anyone know how to fix?

F.trott (talkcontribs)
Reply to "Fatal error: Call to a member function ucfirst() on a non-object"

Bootstrap CSS directives won't apply

17
178.0.131.87 (talkcontribs)

At first, I want to thank you for your extension! It really spares me a lot of time not having to figure out how to get Bootstrap running with MediaWiki. Unfortunately, it's not working out-of-the-box for me. I've followed the installation instructions and your extension shows up on the Special:Version page, but the Bootstrap CSS directives fail to spawn.

I'm writing an extension that uses its own content model. In fillParserOutput, where I add all my resource loader modules, I retrieve the singleton and add all Bootstrap modules via addAllBootstrapModules. However, the Bootstrap CSS directives do still not seem to apply. Is there anything I am missing or do I need to add the Bootstrap modules at another point in time?

It may be worth noting that I can not see any Bootstrap CSS/LESS files in the directory of your extension - in case they are downloaded to this one, at all.

This post was hidden by F.trott (history)
F.trott (talkcontribs)

After addAllBootstrapModules you need to add the module 'ext.bootstrap' to the OutputPage.

Sebschlicht (talkcontribs)

(I've started this topic) Yeah, I'm doing exactly what the installation and the usage sections of the extension told me to. Today I've noticed that the extension actually is working if I'm in debug mode (appending 'debug=1' to the URL parameters). Is this a caching issue or what kind of sorcery is preventing the extension to work in normal mode?

F.trott (talkcontribs)

It could indeed be a caching issue. If the page is retrieved from the cache, it may be that the hook you are using is never called. If that is the case it might be better to work with the ParserOutput object instead of the OutputPage.

Sebschlicht (talkcontribs)

Wouldn't this mean that everything should work fine on new pages that could impossibly be cached before? The extension doesn't show on new pages as well...until switching to debug mode!

F.trott (talkcontribs)

Not necessarily. A page consists of several calls, each of which is cached separately. So if your new page uses the same styles as other pages these styles may come from the cache. Although I admit that it is sometimes not so easy to find out what is cached and what is not.

Sebschlicht (talkcontribs)

I've tried to add the Bootstrap module using the ParserOutput in the OutputPageParserOutput hook. Same results here.

Sebschlicht (talkcontribs)

Let's step back. What is the absolute minimum to get the extension running? (1) get BootstrapManager singleton and (2) add which modules are needed, e.g. all via addAllBootstrapModules. Then (3) add the Bootstrap modules, e.g. ext.bootstrap.style, via ParserOutput/OutputPage->addModuleStyles and (4) add the modules of my own extension in the same way. Are these all steps necessary and is the ordering correct?

F.trott (talkcontribs)

I think that should be it.

Sebschlicht (talkcontribs)

Okay, now I'm pretty sure that is not an issue with your extension: If I register module styles within the OutputPageParserOutput hook, both your extension's and my own extension's styles are applied in debug mode only. I have no idea what's going on here... Do you know which cache could cause this issue and/or how to clear it or all caches involved?

F.trott (talkcontribs)

Not sure. There is $wgParserCache, but I don't know if it is used by the Resource loader. It might also be worth seeing if the call to retrieve the styles is contained in the HTML of the page and if it returns valid styles.

Sebschlicht (talkcontribs)

The call to retrieve the styles is triggered in both normal and debug mode. However, in normal mode its response doesn't contain the Bootstrap style directives.

F.trott (talkcontribs)

Ok, I tried it and it turns out that the instructions are somewhat inaccurate. In fact, they are totally borked. :)

Here is what you need to add to LocalSettings.php to enable Bootstrap styles on all pages:

$wgHooks['SetupAfterCache'][]=function(){
	\Bootstrap\BootstrapManager::getInstance()->addAllBootstrapModules();
	return true;
};

$wgHooks['ParserAfterParse'][]=function( Parser &$parser, &$text, StripState &$stripState ){
	$parser->getOutput()->addModuleStyles( 'ext.bootstrap.styles' );
	$parser->getOutput()->addModuleScripts( 'ext.bootstrap.scripts' );
	return true;
};
92.73.1.231 (talkcontribs)

Thanks for looking into this issue, I really appreciate it! However, this doesn't work for me neither :D Again, in debug mode it works. In production mode it doesn't.

I've looked into this issue in more detail and here's what happens: In production mode, all modules are loaded in one or two requests. The request asks for your extension's module but its response doesn't contain any Bootstrap directives.

In debug mode, all modules are loaded in single requests. The request retrieving my extension's module returns the most recent version of my files. The request retrieving your extension's module returns a stylesheet containing the Bootstrap directives AND an old version of my own extension's stylesheet.

I remember to use addExternalModule like in the Chameleon skin and I guess the resource loader at some point decided to cache the response - including my module. However, this is really frustrating because in the resulting sheet these old directives are below my most recent ones and thus override all of them that don't have a higher cascade weight.

In production mode the response might have also be cached at a point in time when I didn't get your extension to fully work yet. However, I have no idea how to cope with this issue. Restarting the vagrant VM doesn't change anything. I've disabled caching wherever I could and cleared the central cache folder without success. Database tables like *cache are empty. And so is my browser cache.

I have no idea where it's being cached. Maybe on HTTP server level.

Sebschlicht (talkcontribs)

Okay, I have to revise my statement: Adding the hooks to the LocalSettings.php actually DOES work for both modes! However, this is not what I need because I want to use Bootstrap within my extension, I don't want to force the whole installation to use it :/

F.trott (talkcontribs)

Well then for ParserAfterParse you have to make sure it is only applied in case you need it. The SetupAfterCache hook does not hurt. It just registers the module without actually delivering it to the client.

Reply to "Bootstrap CSS directives won't apply"
Osnard (talkcontribs)

Hello F.trott,

would it be possible to make the 'localBasePath' and 'remoteBasePath' options that are passed to SetupAfterCache configurable? Background of this request is, that - even though installing the extension using the main composer.json file of MediaWiki has a lot of advantages - it is a little bit difficult to deploy the extension to places where composer is not available. This is for example the case with a lot of existing intranet wikis.

If I could run "composer install" from the extension directory and then just copy it to the destination it would be much easier.

Reply to "Configuration options"

Unexpected non-MediaWiki exception encountered, of type "RuntimeException"

4
Davisonio (talkcontribs)

Hi, I get this error once the plugin has been installed. I'm using the latest mediawiki version and extension version:

Unexpected non-MediaWiki exception encountered, of type "RuntimeException"

Anyone know what the problem is?

F.trott (talkcontribs)

How did you install the extension?

Gutesork (talkcontribs)

I had the same problem. Turned out that I had to allow "DROP" and "CREATE TEMPORARY TABLES" for the wiki's database user account in the SQL backend. It has to do with Semantic MediaWiki. See here.

Staplecrab (talkcontribs)

I encountered same issue recently while I used Mediawiki downloaded via yum command in CentOS. Using official Mediawiki will be OK.;->

Reply to "Unexpected non-MediaWiki exception encountered, of type "RuntimeException""

How can i use Bootstrap just with a SpecialPage?

1
139.30.103.216 (talkcontribs)

Hi,

i installed Bootstrap like it is stated in the tutorial and it seems to be running if i take a look at the Special:Version page.

I only want to use Bootstrap in one single special page, therefore i tried the $wgout method but the bootstrap css is not applied to the elements of the special page.

What am i doing wrong?

Reply to "How can i use Bootstrap just with a SpecialPage?"

Why wont bootstrap show up when i go to the the special:version page?

7
209.6.197.188 (talkcontribs)

I installed bootstrap using composer and added the files to the extensions folder in a folder called Bootsrap and did this require_once "$IP/extensions/Bootstrap/Bootstrap.php"; for localsettings. the roblem is it wont show as an installed extension.

F.trott (talkcontribs)
209.6.197.188 (talkcontribs)

ok. I removed the folder and the require once. I installed the files created using the command line to the extension folder in mediawiki, but it still wont show up.

F.trott (talkcontribs)

I'll see if I can reproduce this. You are on MW 1.25?

209.6.197.188 (talkcontribs)

1.24.0

209.6.197.188 (talkcontribs)

adding a require once for the bootstrap extesion in localsettings.php got it to show in the version page as installed.

F.trott (talkcontribs)

using the command line to the extension folder in mediawiki

The command has to be run from the MediaWiki installation directory.

Reply to "Why wont bootstrap show up when i go to the the special:version page?"