Page MenuHomePhabricator

Semantic Forms can't be properly installed through Composer autoloading
Closed, ResolvedPublic

Description

Semantic Forms cannot be installed properly.

No matter, how I do it: via Composer or git, and how I include it if it is installed with git: with require_once () or wfLoadExtension (), SemanticForms.php falsely thinks that Semantic Forms are alredy installed and returns from line 67. Of course, nothing is defined, which had to be defined by the extension, and MW fails miserably.

if I comment out return in line 67 and connect the extension with require_once (), Special:Version lists Semantic Forms, version 3.6 (641546f) twice, but, at least, MediaWiki works.

When I installed Semantic Forms by git, I did not forget to composer remove mediawiki/semantic-forms first.

Event Timeline

Does it work for you?

As said Nikerabbit, given Semantic Forms recently changed its loading, perhaps you need to clean up your installation.

If you want to install it with Composer, add it or let it in MediaWiki’s composer.json or composer.local.json, execute Composer, and add wfLoadExtension('SemanticForms'); in your LocalSettings.php.

If you want to install it with Git or with the tarball, remove any occurence in MediaWiki’s composer.json and composer.local.json, execute Composer, install the extension in the usual way and add wfLoadExtension('SemanticForms'); in your LocalSettings.php.

An important step is to execute Composer: given the autoloader changed (was removed), Composer must recompute the autoloader, else it will continue to load SemanticForms.php, which itself will load wfLoadExtension. I do not understand exactly what can fail, but a cleanup is probably required.

Seb35 triaged this task as Medium priority.Jul 26 2016, 8:56 PM

Installation with Composer by composer require --prefer-source mediawiki/semantic-forms "3.5.*" is broken totally:

Fatal error: Uncaught Error: Call to undefined method stdClass::getPropertyLabels() in /var/www/wiki/w/extensions/SemanticForms/includes/SF_Utils.php:257\nStack trace:\n#0 /var/www/wiki/w/includes/Hooks.php(195): SFUtils::initProperties()\n#1 /var/www/wiki/w/extensions/SemanticMediaWiki/src/PropertyRegistry.php(420): Hooks::run()\n#2 /var/www/wiki/w/extensions/SemanticMediaWiki/src/PropertyRegistry.php(79): SMW\\PropertyRegistry->registerPredefinedProperties()\n#3 /var/www/wiki/w/extensions/SemanticMediaWiki/includes/dataitems/SMW_DI_Property.php(412): SMW\\PropertyRegistry::getInstance()\n#4 /var/www/wiki/w/extensions/SemanticForms/includes/SF_Utils.php(187): SMW\\DIProperty::newFromUserLabel()\n#5 /var/www/wiki/w/extensions/SemanticForms/includes/SF_FormLinker.php(164): SFUtils::getSMWPropertyValues()\n#6 /var/www/wiki/w/extensions/SemanticForms/includes/SF_FormLinker.php(384): SFFormLinker::getFormsThatPagePointsTo()\n#7 /var/www/wiki/w/extensions/SemanticForms/includes/SF_FormEditAction.php(59): SFFormLinker::getDefaultFormsForPage()\n#8 /var/www/wiki/w/extensions/SemanticForms/includes/SF_FormEditAction.php(145): SFFormEditAction::displayTab()\n#9 /var/www/wiki/w/includes/Hooks.php(195): SFFormEditAction::displayTab2()\n#10 /var/www/wiki/w/includes/skins/SkinTemplate.php(1076): Hooks::run()\n#11 /var/www/wiki/w/includes/skins/SkinTemplate.php(474): SkinTemplate->buildContentNavigationUrls()\n#12 /var/www/wiki/w/includes/skins/SkinTemplate.php(247): SkinTemplate->prepareQuickTemplate()\n#13 /var/www/wiki/w/includes/OutputPage.php(2282): SkinTemplate->outputPage()\n#14 /var/www/wiki/w/includes/MediaWiki.php(756): OutputPage->output()\n#15 /var/www/wiki/w/includes/MediaWiki.php(520): MediaWiki->main()\n#16 /var/www/wiki/w/index.php(43): MediaWiki->run()\n#17 {main}

Installation with git, then composer update in extensions/SemanticForms, then wfLoadExtension( 'SemanticForms' ); in LocalSettings.php gives the same error. The same without composer update.

The same with require_once ("$wgExtensionsDirectory/SemanticForms/SemanticForms.php");, with or without composer update in extensions/SemanticForms.

Only if I comment out line 67 as I described above, MediaWiki works and Special:Version shows Semantic Forms—twice.

All installations were clean.

That line in Semantic Forms is meant to be called only if SMW is installed. Is SMW installed on your wiki? If not, do you have any idea why SF would think that it is?

Is SMW installed on your wiki?

Yes, it is.

Why version "3.5.*" for SF? "3.6.*" would be better anyway to solve this issue, since Yaron removed Composer autoloading for SF.

And which MediaWiki and Semantic MediaWiki versions?

Why version "3.5.*" for SF? "3.6.*" would be better anyway to solve this issue, since Yaron removed Composer autoloading for SF.

And which MediaWiki and Semantic MediaWiki versions?

MW 1.27.0, SMW 2.4.1, SF 3.6.

Semantic Forms 3.6 don't seem to be installable with Composer at all, that's why I tried 3.5 with it: composer require --prefer-source mediawiki/semantic-forms "3.6.*" results in:

./composer.json has been updated
> ComposerHookHandler::onPreUpdate
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for mediawiki/semantic-forms 3.6.* -> satisfiable by mediawiki/semantic-forms[3.6].
    - mediawiki/semantic-forms 3.6 requires mediawiki/open-layers dev-master -> satisfiable by mediawiki/open-layers[dev-master] but these conflict with your requirements or minimum-stability.


Installation failed, reverting ./composer.json to its original content.

I just tried, perhaps during 1 hour, to install SF with various ways: Composer with tarball, Composer with Git, Git alone; with MW 1.27, MW 1.28; with enableSemantics, without; with PHP7, 5.6; with wfLoadExtension, require_once; with wfLoadExtension before enableSemantics, after. And I cannot see heavy problems. Minor (normal) issues I can see are: SMW is not fully loaded without enableSemantics but it’s normal, I have some issues with the translation of the Form namespace when I don’t have enableSemantics but quite normal. So I fail at seeing what could create this issue.

Some remarks:

  • I’m pretty sure the error was on MW 1.28alpha: lines numbers MW 1.28’s, not 1.27’s, be sure you don’t mix two wikis if you have a special config (symbolic links, etc.)
  • Be sure to call enableSemantics installation #5
  • Be sure you have all dependencies for SMW
  • Be sure you ran "php maintenance/update.php"
  • I confirm the issue for SF 3.6 with Composer about dependency to dev version of open-layers
Yaron_Koren claimed this task.

I believe that this is no longer an issue, now that Composer autoloading has been removed in SF 3.7. (Though of course things are more annoying now for people who like to use Composer.) Feel free to re-open if there's still a problem.

Dereckson renamed this task from Semantic Forms totally broken to Semantic Forms can't be properly installed through Composer autoloading.Oct 7 2016, 8:02 PM