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

Add support for extension.json, refs #1367 #1732

Merged
merged 1 commit into from Mar 31, 2018

Conversation

Projects
None yet
5 participants
@mwjames
Copy link
Contributor

mwjames commented Jul 12, 2016

It is expected that:

Expected

extension.json should only be introduced by the time:

  • A major SMW release change (e.g. 3.x) occurs
  • requires section in extension.json is supported for extensions
  • MW 1.27 to be a minimum requirement

Requires

  • to update installation documentation
  • to update depending extension and CI environments

Usage

enableSemantics( 'example.org' );

Because wfLoadExtension only processes extension definition after the loading of the LocalSettings.php file, definitions such as SMW_NS_PROPERTY are not yet available by the time the LocalSettings.php makes a reference (as it depends on GLOBALS['smwgNamespaceIndex'] setting).

You need add enableSemantics( 'example.org' ); (as it contains a shortcut to have SMW_NS_PROPERTY defined as soon as it is included) to avoid the Use of undefined constant SMW_NS_PROPERTY - assumed 'SMW_NS_PROPERTY' in ...LocalSettings.php notice.

Since we require more control over the NS setup [0], enableSemantics is responsible to load wfLoadExtension( 'SemanticMediaWiki' ); leaving all setups as-is but it also means users should not add wfLoadExtension( 'SemanticMediaWiki' ); themselves and instead make sure that enableSemantics is added or removed.

[0] https://phabricator.wikimedia.org/T152582

@Nikerabbit

This comment has been minimized.

Copy link
Contributor

Nikerabbit commented Jul 12, 2016

How would even enableSemantics be available before the extension is loaded?

@mwjames

This comment has been minimized.

Copy link
Contributor

mwjames commented Jul 12, 2016

How would even enableSemantics be available before the extension is loaded?

Autoloading is done by Composer with GlobalFunctions.php containing enableSemantics and is therefore available outside of the wfLoadExtension invocation.

#2813 contains some extra information on that part.

@JeroenDeDauw JeroenDeDauw added this to the SMW 3.0 milestone Jul 12, 2016

@mwjames mwjames referenced this pull request Sep 2, 2016

Merged

Simplified initialization #105

@mwjames mwjames force-pushed the ext-json branch from cfe67a4 to 828a8da Nov 20, 2016

@mwjames mwjames force-pushed the ext-json branch 2 times, most recently from d33c989 to d60cf53 Mar 5, 2017

@mwjames mwjames force-pushed the ext-json branch from d60cf53 to 6e1e29e Apr 22, 2017

@mwjames mwjames force-pushed the ext-json branch from 6e1e29e to d6c2d2d May 13, 2017

@mwjames mwjames changed the title [DNM] Add extension.json, refs #1367 Add support for extension.json, refs #1367 May 13, 2017

@mwjames mwjames force-pushed the ext-json branch from d6c2d2d to b345ae7 Jul 8, 2017

@mwjames

This comment has been minimized.

Copy link
Contributor

mwjames commented Oct 14, 2017

To avoid any further misunderstandings from people resulting in comments like "... surely they're doing it wrong then? ..." [0] about the support of extension.json, I explained the requirements in length [1] on what the project requires so that extension.json support can become a reality.

This PR has been open for a year, and it will not be merged if the stated requirements aren't met to avoid jeopardizing the software or its stability.

[0] https://phabricator.wikimedia.org/T61872
[1] https://phabricator.wikimedia.org/T61872#3681772

@kghbln

This comment has been minimized.

Copy link
Member

kghbln commented Dec 12, 2017

If I understood correctly T173799 was a major blocker for this too (docu). This will now ship with MW 1.31+

@mwjames mwjames referenced this pull request Dec 30, 2017

Merged

Delay connection instantiation #2915

2 of 2 tasks complete

@mwjames mwjames referenced this pull request Mar 24, 2018

Merged

Support extension.json #103

1 of 2 tasks complete

@mwjames mwjames force-pushed the ext-json branch from b345ae7 to f6b7acc Mar 31, 2018

@mwjames mwjames force-pushed the ext-json branch from f6b7acc to 3eb510a Mar 31, 2018

@mwjames

This comment has been minimized.

Copy link
Contributor

mwjames commented Mar 31, 2018

I decided to merge this PR despite unresolved issues in order to tick it off my agenda and no longer occupies an argumentative position from certain user groups that push for its support.

@kghbln For the end-user nothing will change since enableSemantics remains the function that needs to be added via LocalSettings.php to ensure that:

  • $smwgNamespaceIndex is usable to modify the NS index before they are defined
  • Define NS numbers before any reference happens in LocalSettings.php
  • Defines the Export URL

What about?

// Meaningless because enableSemantics calls wfLoadExtension
wfLoadExtension( 'SemanticMediaWiki' );
enableSemantics( 'http://example.org/id/', true );
enableSemantics( 'http://example.org/id/', true );
// Meaningless because enableSemantics calls wfLoadExtension
wfLoadExtension( 'SemanticMediaWiki' );
wfLoadExtension( 'SemanticMediaWiki' );
$smwgNamespacesWithSemanticLinks[SMW_NS_PROPERTY] = true;

// no enableSemantics 
// Will cause "Use of undefined constant SMW_NS_PROPERTY - assumed 'SMW_NS_PROPERTY' in ...LocalSettings.php"

@mwjames mwjames merged commit ff930da into master Mar 31, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

kghbln added a commit to SemanticMediaWiki/SemanticInterlanguageLinks that referenced this pull request Apr 17, 2018

Update install-semantic-interlanguage-links.sh
Add `wfLoadExtension( "SemanticMediaWiki" )` to test 

Refs: SemanticMediaWiki/SemanticMediaWiki#1732

kghbln added a commit to SemanticMediaWiki/SemanticCompoundQueries that referenced this pull request Apr 17, 2018

Update install-semantic-compound-queries.sh
Add `wfLoadExtension( "SemanticMediaWiki" )` to test 

Refs: SemanticMediaWiki/SemanticMediaWiki#1732

kghbln added a commit to SemanticMediaWiki/SemanticBreadcrumbLinks that referenced this pull request Apr 17, 2018

Update install-semantic-breadcrumb-links.sh
Add `wfLoadExtension( "SemanticMediaWiki" )` to test 

Refs: SemanticMediaWiki/SemanticMediaWiki#1732

kghbln added a commit to SemanticMediaWiki/SemanticMetaTags that referenced this pull request Apr 17, 2018

Update install-semantic-meta-tags.sh
Add `wfLoadExtension( "SemanticMediaWiki" )` to test 

Refs: SemanticMediaWiki/SemanticMediaWiki#1732

kghbln added a commit to SemanticMediaWiki/SemanticExternalQueryLookup that referenced this pull request Apr 17, 2018

Update install-semantic-external-query-lookup.sh
Add `wfLoadExtension( "SemanticMediaWiki" )` to test 

Refs: SemanticMediaWiki/SemanticMediaWiki#1732

kghbln added a commit to SemanticMediaWiki/SemanticNotifications that referenced this pull request Apr 17, 2018

Update install-semantic-notifications.sh
Add `wfLoadExtension( "SemanticMediaWiki" )` to test 

Refs: SemanticMediaWiki/SemanticMediaWiki#1732

kghbln added a commit to SemanticMediaWiki/SemanticGlossary that referenced this pull request Apr 17, 2018

Update install-semantic-glossary.sh
Add `wfLoadExtension( "SemanticMediaWiki" )` to test 

Refs: SemanticMediaWiki/SemanticMediaWiki#1732
@cicalese

This comment has been minimized.

Copy link
Contributor

cicalese commented Apr 23, 2018

Is this a solution for the problem of Semantic MediaWiki being automatically enabled? In the absence of enableSemantics, would Semantic MediaWiki classes still be autoloaded? This would indeed be a welcome new feature if it would prevent any Semantic MediaWiki code from being autoloaded or executed if enableSemantics() is not present.

@kghbln

This comment has been minimized.

Copy link
Member

kghbln commented Apr 23, 2018

As I have understood it:

Is this a solution for the problem of Semantic MediaWiki being automatically enabled?

Yes, and moreover it introduces the extension registration system of MediaWiki without the need to adapt your "LocalSettings.php" if one is upgrading.

In the absence of enableSemantics, would Semantic MediaWiki classes still be autoloaded?

No, in this case the code would sit on the server but SMW will be unavailable for the respective wiki.

@cicalese

This comment has been minimized.

Copy link
Contributor

cicalese commented Apr 23, 2018

Excellent!! Thank you @mwjames for adding this functionality! Thank you @kghbln for your response!

Will the other Semantic* extensions be following suit? Unfortunately, since they do not already have a function akin to enableSemantics included in LocalSettings.php, changing them will require a change to LocalSettings.php to add wfLoadExtension.

@kghbln

This comment has been minimized.

Copy link
Member

kghbln commented Apr 23, 2018

Will the other Semantic* extensions be following suit?

I believe so. Some already do, however only SESP, SG and SR as part of the most popular ones. You can always look at the sandbox setup to see which extensions already use extension registration, at least on master.

Unfortunately, since they do not already have a function akin to enableSemantics included in LocalSettings.php, changing them will require a change to LocalSettings.php to add wfLoadExtension.

This is indeed true.

@kghbln

This comment has been minimized.

Copy link
Member

kghbln commented Apr 28, 2018

Already documented.

@mwjames

This comment has been minimized.

Copy link
Contributor

mwjames commented Apr 28, 2018

Already documented.

One last thing I'd like to have confirmed before we declare victory, could we create a tarball release for the current master and see if it still works. I hate to be surprised by any issue late in the release process.

@kghbln

This comment has been minimized.

Copy link
Member

kghbln commented Apr 28, 2018

One last thing I'd like to have confirmed before we declare victory, could we create a tarball release for the current master and see if it still works.

Looks good to me: https://gist.github.com/kghbln/382eb01dcf4eef0e564660612077b457

@mwjames

This comment has been minimized.

Copy link
Contributor

mwjames commented Apr 28, 2018

Looks good to me: https://gist.github.com/kghbln/382eb01dcf4eef0e564660612077b457

So, when following the tarball installation and activation instructions it still works?

@kghbln

This comment has been minimized.

Copy link
Member

kghbln commented Apr 28, 2018

So, when following the tarball installation and activation instructions it still works?

No idea. Have not done this in years. I will have to find a wiki to do this.

@kghbln

This comment has been minimized.

Copy link
Member

kghbln commented Apr 28, 2018

OMG. Extracting to /extensions/ and adding enableSemantics( 'example.org' ); results in PHP Fatal error: Uncaught Error: Call to undefined function enableSemantics() in /../w/LocalSettings.php I guess this is what you have to do. Apparently I only have 5 minutes for this today so I may have done something wrong. Hmm, I'd rather drop support for tarballs than reverting.

s7eph4n added a commit to SemanticMediaWiki/SemanticGlossary that referenced this pull request Jul 26, 2018

Update install-semantic-glossary.sh (#39)
Add `wfLoadExtension( "SemanticMediaWiki" )` to test 

Refs: SemanticMediaWiki/SemanticMediaWiki#1732
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment