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

Add upgrade check #3095

Merged
merged 1 commit into from Mar 31, 2018
Merged

Add upgrade check #3095

merged 1 commit into from Mar 31, 2018

Conversation

mwjames
Copy link
Contributor

@mwjames mwjames commented Mar 31, 2018

This PR is made in reference to: #

This PR addresses or contains:

  • Whenever we change the DB schema (new field, altered index etc.) we need to ensure that users do actually run update.php or setupStore.php and in order to do that we introduce smwgUpgradeKey which contains an arbitrary identifier that is used to validate the status by comparing the local result of .smw.json against the upgrade key.
  • If .smw.json doesn't exist or contains an invalid key then the system stops before it can access any data or tables and shows a message to the user such as: "Error: The Semantic MediaWiki extension was enabled but the installation is incomplete ...".

This PR includes:

  • Tests (unit/integration)
  • CI build passed

Fixes #

@mwjames mwjames added the feature A new, or altered behaviour of an existing functionality that fundamentally impacts behaviour label Mar 31, 2018
@mwjames mwjames added this to the SMW 3.0.0 milestone Mar 31, 2018
@mwjames
Copy link
Contributor Author

mwjames commented Mar 31, 2018

@kghbln FYI

Just came across the issue during an API request on a different test wiki where I forgot to run the update.php.

[6c40097c18b75d7bb9b71940] /mw-29-00/index.php/Main_Page RuntimeException from line 303 of ...\extensions\SemanticMediaWiki\src\MediaWiki\Database.php: A database query error has occurred. Did you forget to run your application's database schema updater after upgrading?
Query: SELECT smw_id,smw_title,smw_namespace,smw_iw,smw_subobject,smw_sortkey,smw_sort FROM `smw_object_ids` WHERE smw_hash = '003b6a0985dc21e3dd947b1778cbbb63b75a4788'
Function: SMWSql3SmwIds::warmUpCache
Error: 1054 Unknown column 'smw_hash' in 'where clause' (localhost)

@mwjames mwjames merged commit a742ac8 into master Mar 31, 2018
@mwjames mwjames deleted the upgrade-key branch Mar 31, 2018
@kghbln kghbln added the wikidocu missing Code changes (mostly features) what have not yet been documented label Mar 31, 2018
@mwjames
Copy link
Contributor Author

mwjames commented Mar 31, 2018

Just as a note, the setting is only to be used by the project, a normal user should not override or manipulate the setting!

@kghbln
Copy link
Member

kghbln commented Mar 31, 2018

Just as a note, the setting is only to be used by the project, a normal user should not override or manipulate the setting!

Indeed.

@kghbln kghbln mentioned this pull request Apr 7, 2018
2 tasks
@kghbln kghbln removed the wikidocu missing Code changes (mostly features) what have not yet been documented label May 5, 2018
mwjames added a commit that referenced this pull request Jan 12, 2019
…ted DB writes (transaction from ...", refs #3095

[skip ci]
kghbln pushed a commit that referenced this pull request Jan 18, 2019
…ted DB writes (transaction from ...", refs #3095

[skip ci]
@mwjames mwjames mentioned this pull request Jan 25, 2020
2 tasks
@YOUR1
Copy link
Contributor

YOUR1 commented Apr 23, 2020

Isn't it better to rename the upgrade_key field in to upgrade_hash in .smw.json, since it doesn't contain security information?

I'm asking this because I was a bit confused whether or not to disallow public access to this file.

@mwjames
Copy link
Contributor Author

mwjames commented Apr 25, 2020

Isn't it better to rename the upgrade_key field in to upgrade_hash in .smw.json, since it doesn't contain security information?

I'm not sure whether changing the name would invertible imply security or not while the name itself is a key for the upgrade and contains a sha1.

In case it makes a difference to some, feel free to send a PR that introduces a different field name but you have to ensure that you provide a migration in [0] to avoid invaliding previous information.

I'm asking this because I was a bit confused whether or not to disallow public access to this file.

I'd say that you should apply the same policy as for the your LocalSettings.php and of course as mentioned in the documentation [1] the file "must be writable, persistent and accessible for Semantic MediaWiki throughout its operation".

[0] https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/src/SetupFile.php
[1] https://www.semantic-mediawiki.org/wiki/Help:Setup_information_file

@kghbln
Copy link
Member

kghbln commented Apr 26, 2020

I think this is a matter of documenting. I see the point but I do not think it is important enough if docu exists. EDIT: I added a note

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new, or altered behaviour of an existing functionality that fundamentally impacts behaviour
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants