Semanticmediawiki: Semantic MediaWiki was installed and enabled but is missing an appropriate upgrade key.

Created on 24 May 2020  Â·  28Comments  Â·  Source: SemanticMediaWiki/SemanticMediaWiki

Setup and configuration

  • SMW version: 3.1.6
  • MW version: 1.33.4
  • PHP version: PHP 7.3.19-1~deb10u1 (cli)
  • DB system (MySQL, Blazegraph, etc.) and version: 10.3.22-MariaDB-0+deb10u1

Issue

After getting the message Semantic MediaWiki was installed and enabled but is missing an appropriate upgrade key appeared I ran the update.php script as requested and now there is an upgrade key in .smw.json. Still the message appears. This is in context of a wiki farm so the .smw.json has multiple entries .. as of this time there are two entries like:

"openresearch": {
        "upgrade_key": "c3e82...554",
        "maintenance_mode": false,
        "populate.smw_hash_field_complete": true
    }

Steps to reproduce

This happened when trying to migrate https://www.openresearch.org to a newer SMW version for a test. The environment is a debian virtual machine.

All 28 comments

I am not sure how https://www.semantic-mediawiki.org/wiki/Help:Maintenance_script_setupStore.php should be used in this situation and what checks are possible.

@kghbln -thank you for looking into this I did not assume this would be relevant. This is a fresh debian VM with PHP installed with apt-get. From the trouble-shooting information i can not see how the CLI / CGI difference can be checked e.g. the link to https://electrictoolbox.com/determine-php-run-via-http-or-cli/: is broken. I'd expect that the SMW software does the check itself and displays an error and therefore consider this a bug and not a question. Even if the documentation is inappropriate it would be a bug and not a question. This is currently a showstopper which makes it an important bug and not a question.

After fixing the reference in the documentation
to:
https://electrictoolbox.com/determine-php-run-via-http-or-cli/

i created the one-line script phpsapi.php:

cat phpsapi.php
<?php 
echo php_sapi_name();
?>

running it:

php phpsapi.php 
cli

shows that cli is in use which i assumed is the default.

php extensions/SemanticMediaWiki/maintenance/setupStore.php -v

Storage engine: "SMWSQLStore3" (or an extension thereof)

Setting up the database tables ...

Checking table smw_object_ids ...
   Table already exists, checking structure ...
   ... field smw_id is fine.
   ... field smw_namespace is fine.
   ... field smw_title is fine.
   ... field smw_iw is fine.
   ... field smw_subobject is fine.
   ... field smw_sortkey is fine.
   ... field smw_sort is fine.
   ... field smw_proptable_hash is fine.
   ... field smw_hash is fine.
   ... field smw_rev is fine.
   ... field smw_touched is fine.
   ... done.
Checking index structures for table smw_object_ids ...
   ... index smw_id is fine.
   ... index smw_id,smw_sortkey is fine.
   ... index smw_iw is fine.
   ... index smw_title,smw_namespace,smw_iw,smw_subobject is fine.
   ... index smw_sortkey is fine.
   ... index smw_hash,smw_id is fine.
   ... index smw_iw,smw_id is fine.
   ... index smw_sort,smw_id is fine.
   ... index smw_namespace,smw_sortkey is fine.
   ... index smw_rev,smw_id is fine.
   ... index smw_touched,smw_id is fine.
   ... done.
Checking table smw_object_aux ...
   Table already exists, checking structure ...
   ... field smw_id is fine.
   ... field smw_seqmap is fine.
   ... done.
Checking index structures for table smw_object_aux ...
   ... index smw_id is fine.
   ... done.
Checking table smw_concept_cache ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_id is fine.
   ... done.
Checking index structures for table smw_concept_cache ...
   ... index o_id is fine.
   ... done.
Checking table smw_query_links ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_id is fine.
   ... done.
Checking index structures for table smw_query_links ...
   ... index s_id is fine.
   ... index o_id is fine.
   ... index s_id,o_id is fine.
   ... done.
Checking table smw_prop_stats ...
   Table already exists, checking structure ...
   ... field p_id is fine.
   ... field usage_count is fine.
   ... field null_count is fine.
   ... done.
Checking index structures for table smw_prop_stats ...
   ... index p_id is fine.
   ... index usage_count is fine.
   ... index null_count is fine.
   ... done.
Checking table smw_di_number ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field p_id is fine.
   ... field o_serialized is fine.
   ... field o_sortkey is fine.
   ... done.
Checking index structures for table smw_di_number ...
   ... index s_id,p_id is fine.
   ... index p_id,o_sortkey is fine.
   ... index o_sortkey is fine.
   ... index p_id,o_serialized is fine.
   ... index s_id,p_id,o_sortkey is fine.
   ... done.
Checking table smw_di_blob ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field p_id is fine.
   ... field o_blob is fine.
   ... field o_hash is fine.
   ... done.
Checking index structures for table smw_di_blob ...
   ... index s_id,p_id is fine.
   ... index p_id,o_hash is fine.
   ... index s_id,o_hash is fine.
   ... index o_hash is fine.
   ... done.
Checking table smw_di_bool ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field p_id is fine.
   ... field o_value is fine.
   ... done.
Checking index structures for table smw_di_bool ...
   ... index s_id,p_id is fine.
   ... index o_value is fine.
   ... done.
Checking table smw_di_uri ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field p_id is fine.
   ... field o_blob is fine.
   ... field o_serialized is fine.
   ... done.
Checking index structures for table smw_di_uri ...
   ... index s_id,p_id is fine.
   ... index p_id,o_serialized is fine.
   ... index o_serialized is fine.
   ... done.
Checking table smw_di_time ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field p_id is fine.
   ... field o_serialized is fine.
   ... field o_sortkey is fine.
   ... done.
Checking index structures for table smw_di_time ...
   ... index s_id,p_id is fine.
   ... index p_id,o_sortkey is fine.
   ... index o_sortkey is fine.
   ... index p_id,o_serialized is fine.
   ... index s_id,p_id,o_sortkey,o_serialized is fine.
   ... done.
Checking table smw_di_coords ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field p_id is fine.
   ... field o_serialized is fine.
   ... field o_lat is fine.
   ... field o_lon is fine.
   ... done.
Checking index structures for table smw_di_coords ...
   ... index s_id,p_id is fine.
   ... index p_id,o_serialized is fine.
   ... index o_lat,o_lon is fine.
   ... index o_serialized is fine.
   ... done.
Checking table smw_di_wikipage ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field p_id is fine.
   ... field o_id is fine.
   ... done.
Checking index structures for table smw_di_wikipage ...
   ... index s_id,p_id is fine.
   ... index o_id is fine.
   ... index p_id,s_id is fine.
   ... index s_id,o_id is fine.
   ... index s_id,p_id,o_id is fine.
   ... index o_id,s_id is fine.
   ... index o_id,p_id is fine.
   ... done.
Checking table smw_fpt_type ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_blob is fine.
   ... field o_serialized is fine.
   ... done.
Checking index structures for table smw_fpt_type ...
   ... index s_id is fine.
   ... index o_serialized is fine.
   ... done.
Checking table smw_fpt_uri ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_blob is fine.
   ... field o_serialized is fine.
   ... done.
Checking index structures for table smw_fpt_uri ...
   ... index s_id is fine.
   ... index o_serialized is fine.
   ... done.
Checking table smw_fpt_inst ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_id is fine.
   ... done.
Checking index structures for table smw_fpt_inst ...
   ... index s_id is fine.
   ... index o_id is fine.
   ... index s_id,o_id is fine.
   ... index o_id,s_id is fine.
   ... done.
Checking table smw_fpt_unit ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_blob is fine.
   ... field o_hash is fine.
   ... done.
Checking index structures for table smw_fpt_unit ...
   ... index s_id is fine.
   ... index o_hash is fine.
   ... index s_id,o_hash is fine.
   ... done.
Checking table smw_fpt_impo ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_blob is fine.
   ... field o_hash is fine.
   ... done.
Checking index structures for table smw_fpt_impo ...
   ... index s_id is fine.
   ... index o_hash is fine.
   ... index s_id,o_hash is fine.
   ... done.
Checking table smw_fpt_pplb ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_id is fine.
   ... done.
Checking index structures for table smw_fpt_pplb ...
   ... index s_id is fine.
   ... index o_id is fine.
   ... index s_id,o_id is fine.
   ... index o_id,s_id is fine.
   ... done.
Checking table smw_fpt_prec ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_serialized is fine.
   ... field o_sortkey is fine.
   ... done.
Checking index structures for table smw_fpt_prec ...
   ... index s_id is fine.
   ... index o_sortkey is fine.
   ... done.
Checking table smw_fpt_conv ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_blob is fine.
   ... field o_hash is fine.
   ... done.
Checking index structures for table smw_fpt_conv ...
   ... index s_id is fine.
   ... index o_hash is fine.
   ... index s_id,o_hash is fine.
   ... done.
Checking table smw_fpt_serv ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_blob is fine.
   ... field o_hash is fine.
   ... done.
Checking index structures for table smw_fpt_serv ...
   ... index s_id is fine.
   ... index o_hash is fine.
   ... index s_id,o_hash is fine.
   ... done.
Checking table smw_fpt_pval ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_blob is fine.
   ... field o_hash is fine.
   ... done.
Checking index structures for table smw_fpt_pval ...
   ... index s_id is fine.
   ... index o_hash is fine.
   ... index s_id,o_hash is fine.
   ... done.
Checking table smw_fpt_redi ...
   Table already exists, checking structure ...
   ... field s_title is fine.
   ... field s_namespace is fine.
   ... field o_id is fine.
   ... done.
Checking index structures for table smw_fpt_redi ...
   ... index s_title,s_namespace is fine.
   ... index o_id is fine.
   ... done.
Checking table smw_fpt_dtitle ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_blob is fine.
   ... field o_hash is fine.
   ... done.
Checking index structures for table smw_fpt_dtitle ...
   ... index s_id is fine.
   ... index o_hash is fine.
   ... index s_id,o_hash is fine.
   ... done.
Checking table smw_fpt_subp ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_id is fine.
   ... done.
Checking index structures for table smw_fpt_subp ...
   ... index s_id is fine.
   ... index o_id is fine.
   ... index s_id,o_id is fine.
   ... index o_id,s_id is fine.
   ... done.
Checking table smw_fpt_subc ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_id is fine.
   ... done.
Checking index structures for table smw_fpt_subc ...
   ... index s_id is fine.
   ... index o_id is fine.
   ... index s_id,o_id is fine.
   ... index o_id,s_id is fine.
   ... done.
Checking table smw_fpt_conc ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field concept_txt is fine.
   ... field concept_docu is fine.
   ... field concept_features is fine.
   ... field concept_size is fine.
   ... field concept_depth is fine.
   ... field cache_date is fine.
   ... field cache_count is fine.
   ... done.
Checking index structures for table smw_fpt_conc ...
   ... index s_id is fine.
   ... done.
Checking table smw_fpt_list ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_blob is fine.
   ... field o_hash is fine.
   ... done.
Checking index structures for table smw_fpt_list ...
   ... index s_id is fine.
   ... index o_hash is fine.
   ... index s_id,o_hash is fine.
   ... done.
Checking table smw_fpt_ask ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_id is fine.
   ... done.
Checking index structures for table smw_fpt_ask ...
   ... index s_id is fine.
   ... index o_id is fine.
   ... index s_id,o_id is fine.
   ... index o_id,s_id is fine.
   ... done.
Checking table smw_fpt_askst ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_blob is fine.
   ... field o_hash is fine.
   ... done.
Checking index structures for table smw_fpt_askst ...
   ... index s_id is fine.
   ... index o_hash is fine.
   ... index s_id,o_hash is fine.
   ... done.
Checking table smw_fpt_askfo ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_blob is fine.
   ... field o_hash is fine.
   ... done.
Checking index structures for table smw_fpt_askfo ...
   ... index s_id is fine.
   ... index o_hash is fine.
   ... index s_id,o_hash is fine.
   ... done.
Checking table smw_fpt_asksi ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_serialized is fine.
   ... field o_sortkey is fine.
   ... done.
Checking index structures for table smw_fpt_asksi ...
   ... index s_id is fine.
   ... index o_sortkey is fine.
   ... done.
Checking table smw_fpt_askde ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_serialized is fine.
   ... field o_sortkey is fine.
   ... done.
Checking index structures for table smw_fpt_askde ...
   ... index s_id is fine.
   ... index o_sortkey is fine.
   ... done.
Checking table smw_fpt_askpa ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_blob is fine.
   ... field o_hash is fine.
   ... done.
Checking index structures for table smw_fpt_askpa ...
   ... index s_id is fine.
   ... index o_hash is fine.
   ... index s_id,o_hash is fine.
   ... done.
Checking table smw_fpt_lcode ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_blob is fine.
   ... field o_hash is fine.
   ... done.
Checking index structures for table smw_fpt_lcode ...
   ... index s_id is fine.
   ... index o_hash is fine.
   ... index s_id,o_hash is fine.
   ... done.
Checking table smw_fpt_text ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_blob is fine.
   ... field o_hash is fine.
   ... done.
Checking index structures for table smw_fpt_text ...
   ... index s_id is fine.
   ... index o_hash is fine.
   ... index s_id,o_hash is fine.
   ... done.
Checking table smw_fpt_sobj ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_id is fine.
   ... done.
Checking index structures for table smw_fpt_sobj ...
   ... index s_id is fine.
   ... index o_id is fine.
   ... index s_id,o_id is fine.
   ... index o_id,s_id is fine.
   ... done.
Checking table smw_fpt_askdu ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_serialized is fine.
   ... field o_sortkey is fine.
   ... done.
Checking index structures for table smw_fpt_askdu ...
   ... index s_id is fine.
   ... index o_sortkey is fine.
   ... done.
Checking table smw_fpt_mdat ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_serialized is fine.
   ... field o_sortkey is fine.
   ... done.
Checking index structures for table smw_fpt_mdat ...
   ... index s_id is fine.
   ... index o_sortkey is fine.
   ... done.
Checking table smw_fpt_cdat ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_serialized is fine.
   ... field o_sortkey is fine.
   ... done.
Checking index structures for table smw_fpt_cdat ...
   ... index s_id is fine.
   ... index o_sortkey is fine.
   ... done.
Checking table smw_fpt_newp ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_value is fine.
   ... done.
Checking index structures for table smw_fpt_newp ...
   ... index s_id is fine.
   ... index o_value is fine.
   ... done.
Checking table smw_fpt_ledt ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_id is fine.
   ... done.
Checking index structures for table smw_fpt_ledt ...
   ... index s_id is fine.
   ... index o_id is fine.
   ... index s_id,o_id is fine.
   ... index o_id,s_id is fine.
   ... done.
Checking table smw_fpt_media ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_blob is fine.
   ... field o_hash is fine.
   ... done.
Checking index structures for table smw_fpt_media ...
   ... index s_id is fine.
   ... index o_hash is fine.
   ... index s_id,o_hash is fine.
   ... done.
Checking table smw_fpt_mime ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_blob is fine.
   ... field o_hash is fine.
   ... done.
Checking index structures for table smw_fpt_mime ...
   ... index s_id is fine.
   ... index o_hash is fine.
   ... index s_id,o_hash is fine.
   ... done.
Checking table smw_fpt_sci_cite_key ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_blob is fine.
   ... field o_hash is fine.
   ... done.
Checking index structures for table smw_fpt_sci_cite_key ...
   ... index s_id is fine.
   ... index o_hash is fine.
   ... index s_id,o_hash is fine.
   ... done.
Checking table smw_fpt_sci_cite_reference ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_blob is fine.
   ... field o_hash is fine.
   ... done.
Checking index structures for table smw_fpt_sci_cite_reference ...
   ... index s_id is fine.
   ... index o_hash is fine.
   ... index s_id,o_hash is fine.
   ... done.
Checking table smw_fpt_sci_cite_text ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_blob is fine.
   ... field o_hash is fine.
   ... done.
Checking index structures for table smw_fpt_sci_cite_text ...
   ... index s_id is fine.
   ... index o_hash is fine.
   ... index s_id,o_hash is fine.
   ... done.
Checking table smw_fpt_sci_cite ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_id is fine.
   ... done.
Checking index structures for table smw_fpt_sci_cite ...
   ... index s_id is fine.
   ... index o_id is fine.
   ... index s_id,o_id is fine.
   ... index o_id,s_id is fine.
   ... done.
Checking table smw_fpt_sci_doi ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_blob is fine.
   ... field o_hash is fine.
   ... done.
Checking index structures for table smw_fpt_sci_doi ...
   ... index s_id is fine.
   ... index o_hash is fine.
   ... index s_id,o_hash is fine.
   ... done.
Checking table smw_fpt_sci_pmcid ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_blob is fine.
   ... field o_hash is fine.
   ... done.
Checking index structures for table smw_fpt_sci_pmcid ...
   ... index s_id is fine.
   ... index o_hash is fine.
   ... index s_id,o_hash is fine.
   ... done.
Checking table smw_fpt_sci_pmid ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_blob is fine.
   ... field o_hash is fine.
   ... done.
Checking index structures for table smw_fpt_sci_pmid ...
   ... index s_id is fine.
   ... index o_hash is fine.
   ... index s_id,o_hash is fine.
   ... done.
Checking table smw_fpt_sci_oclc ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_blob is fine.
   ... field o_hash is fine.
   ... done.
Checking index structures for table smw_fpt_sci_oclc ...
   ... index s_id is fine.
   ... index o_hash is fine.
   ... index s_id,o_hash is fine.
   ... done.
Checking table smw_fpt_sci_viaf ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_blob is fine.
   ... field o_hash is fine.
   ... done.
Checking index structures for table smw_fpt_sci_viaf ...
   ... index s_id is fine.
   ... index o_hash is fine.
   ... index s_id,o_hash is fine.
   ... done.
Checking table smw_fpt_sci_olid ...
   Table already exists, checking structure ...
   ... field s_id is fine.
   ... field o_blob is fine.
   ... field o_hash is fine.
   ... done.
Checking index structures for table smw_fpt_sci_olid ...
   ... index s_id is fine.
   ... index o_hash is fine.
   ... index s_id,o_hash is fine.
   ... done.

Post-creation examination tasks ...

Checking selected fixed properties IDs ...
   ... done.
Checking internal properties border ...
   ... space for internal properties allocated ...
   ... done.
Checking predefined properties ...
   ... initialize predefined properties ...
   ... done.
Checking smw_hash field consistency ...
   ... updating `populate.smw_hash_field_complete` status ... 
   ... done.
Checking smw_sortkey, smw_sort fields ...
   ... done.
Checking smw_touched field ...
   ... done.

Table optimization task ...

Checking table smw_object_ids ...
   ... analyze, optimize done.
Checking table smw_object_aux ...
   ... analyze, optimize done.
Checking table smw_concept_cache ...
   ... analyze, optimize done.
Checking table smw_query_links ...
   ... analyze, optimize done.
Checking table smw_prop_stats ...
   ... analyze, optimize done.
Checking table smw_di_number ...
   ... analyze, optimize done.
Checking table smw_di_blob ...
   ... analyze, optimize done.
Checking table smw_di_bool ...
   ... analyze, optimize done.
Checking table smw_di_uri ...
   ... analyze, optimize done.
Checking table smw_di_time ...
   ... analyze, optimize done.
Checking table smw_di_coords ...
   ... analyze, optimize done.
Checking table smw_di_wikipage ...
   ... analyze, optimize done.
Checking table smw_fpt_type ...
   ... analyze, optimize done.
Checking table smw_fpt_uri ...
   ... analyze, optimize done.
Checking table smw_fpt_inst ...
   ... analyze, optimize done.
Checking table smw_fpt_unit ...
   ... analyze, optimize done.
Checking table smw_fpt_impo ...
   ... analyze, optimize done.
Checking table smw_fpt_pplb ...
   ... analyze, optimize done.
Checking table smw_fpt_prec ...
   ... analyze, optimize done.
Checking table smw_fpt_conv ...
   ... analyze, optimize done.
Checking table smw_fpt_serv ...
   ... analyze, optimize done.
Checking table smw_fpt_pval ...
   ... analyze, optimize done.
Checking table smw_fpt_redi ...
   ... analyze, optimize done.
Checking table smw_fpt_dtitle ...
   ... analyze, optimize done.
Checking table smw_fpt_subp ...
   ... analyze, optimize done.
Checking table smw_fpt_subc ...
   ... analyze, optimize done.
Checking table smw_fpt_conc ...
   ... analyze, optimize done.
Checking table smw_fpt_list ...
   ... analyze, optimize done.
Checking table smw_fpt_ask ...
   ... analyze, optimize done.
Checking table smw_fpt_askst ...
   ... analyze, optimize done.
Checking table smw_fpt_askfo ...
   ... analyze, optimize done.
Checking table smw_fpt_asksi ...
   ... analyze, optimize done.
Checking table smw_fpt_askde ...
   ... analyze, optimize done.
Checking table smw_fpt_askpa ...
   ... analyze, optimize done.
Checking table smw_fpt_lcode ...
   ... analyze, optimize done.
Checking table smw_fpt_text ...
   ... analyze, optimize done.
Checking table smw_fpt_sobj ...
   ... analyze, optimize done.
Checking table smw_fpt_askdu ...
   ... analyze, optimize done.
Checking table smw_fpt_mdat ...
   ... analyze, optimize done.
Checking table smw_fpt_cdat ...
   ... analyze, optimize done.
Checking table smw_fpt_newp ...
   ... analyze, optimize done.
Checking table smw_fpt_ledt ...
   ... analyze, optimize done.
Checking table smw_fpt_media ...
   ... analyze, optimize done.
Checking table smw_fpt_mime ...
   ... analyze, optimize done.
Checking table smw_fpt_sci_cite_key ...
   ... analyze, optimize done.
Checking table smw_fpt_sci_cite_reference ...
   ... analyze, optimize done.
Checking table smw_fpt_sci_cite_text ...
   ... analyze, optimize done.
Checking table smw_fpt_sci_cite ...
   ... analyze, optimize done.
Checking table smw_fpt_sci_doi ...
   ... analyze, optimize done.
Checking table smw_fpt_sci_pmcid ...
   ... analyze, optimize done.
Checking table smw_fpt_sci_pmid ...
   ... analyze, optimize done.
Checking table smw_fpt_sci_oclc ...
   ... analyze, optimize done.
Checking table smw_fpt_sci_viaf ...
   ... analyze, optimize done.
Checking table smw_fpt_sci_olid ...
   ... analyze, optimize done.

Optimization completed.

Adding supplement jobs ...
   ... property statistics rebuild job ...
   ... entity disposer job ...
   ... done.

Import tasks ...

Importing from smw.groups.json ...
   ... replacing smw/schema:Group:Schema properties
       importer was last editor ...
   ... done.

Importing from smw.vocab.json ...
   ... skipping MediaWiki:Smw import skos
       already exists ...
   ... skipping MediaWiki:Smw import foaf
       already exists ...
   ... skipping MediaWiki:Smw import owl
       already exists ...
   ... skipping Property:Foaf:knows
       already exists ...
   ... skipping Property:Foaf:name
       already exists ...
   ... skipping Property:Foaf:homepage
       already exists ...
   ... skipping Property:Owl:differentFrom
       already exists ...
   ... done.

Import processing completed.

Database and table setup completed ...
   ... MediaWiki                                             1.31.7
   ... Semantic MediaWiki                                     3.1.6
   ... Execution report ...
       ... create-tables .............................. 0.05 (sec.)
       ... post-creation-check ........................ 0.03 (sec.)
       ... table-optimization ......................... 8.74 (sec.)
       ... supplement-jobs ............................ 0.01 (sec.)
       ... hook-execution (import) .................... 0.08 (sec.)
   ... done.

In a non - farm environment i was able to get things working if i set ownership to my user before running the update.php script. In the farm environment i am using group ownership. There is no error message so I am not sure what file might be missing / inaccessible in the farm environment. How can this be further debugged?

In a similar environment using SMW 3.1.0 there is no such issue e.g. that is 12 different wikis share the same .smw.json file:

grep upgrade_key .smw.json | wc -l
12

Please have a look at the $smwgConfigFileDir parameter. It lets you specify the location to put the ".smw.json" file. This location however needs to be writable.

I'll try it out. For the time being i have used a workaround calling setupStore.php

I had a reference to #4679 in my configuration like this:

# see https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues/4679
$smwgConfigFileDir = $IP;

so i must have run into a similar issue in the past - I am now trying different settings ...

The error message:

ERROR: /var/www/wikifarm/code/extensions/SemanticMediaWiki/.smw.json is not writable.

       The "smwgConfigFileDir" setting should point to a
       directory that is persistent and writable!

is helpful - it was missing when i first filed this issue.

Even if I set a hardcoded path like

$smwgConfigFileDir = "/var/www/wikifarm/sites";

the problem persists

This does mit help?
https://www.semantic-mediawiki.org/wiki/Help:Installation/Troubleshooting/Semantic_MediaWiki_was_installed_and_enabled_but_is_missing_an_appropriate_upgrade_key

No - see how i tried to check this above - the issue might just be with the permissions of the .smw.json file. Not only the directory needs to be writeable but also the file itself. The message that the file is not writeable doesn't appear if the directory is writeable but the file is not. It would be good to fix this. I one of my farms changing the permission made the error go away.

In another wikifarm setup even fixing the permissions does not help again ... all farm parts show up in .swm.json just fine but all show the same error messsage. There is just not enough debug information for the message to get this issue fixed easily. Almost similar environments show different behavior and it's unclear why.

I know did a "poor mans's debugger" approach and added:

    private function schemaError() {
            // get trace
        // https://stackoverflow.com/a/7039409/1497139
        //
        $e = new \Exception;
        $content ='<pre>'.$e->getTraceAsString().'</pre>';
        $content .='PHP_SAPI: '.PHP_SAPI;
        $content .= 

to the setupCheck.php culprit function.
This gives:

#0 /var/www/wikifarm/code/extensions/SemanticMediaWiki/src/SetupCheck.php(134): SMW\SetupCheck->schemaError()
#1 /var/www/wikifarm/code/extensions/SemanticMediaWiki/src/SetupCheck.php(158): SMW\SetupCheck->getError(false)
#2 /var/www/wikifarm/code/extensions/SemanticMediaWiki/src/Setup.php(90): SMW\SetupCheck->showErrorAndAbort(false)
#3 /var/www/wikifarm/code/extensions/SemanticMediaWiki/SemanticMediaWiki.php(108): SMW\Setup->init(Array, '/var/www/wikifa...')
#4 /var/www/wikifarm/code/includes/Setup.php(905): SemanticMediaWiki::onExtensionFunction()
#5 /var/www/wikifarm/code/includes/WebStart.php(81): require_once('/var/www/wikifa...')
#6 /var/www/wikifarm/code/index.php(41): require('/var/www/wikifa...')
#7 {main}

PHP_SAPI: apache2handler

The brute-force work-around:

SetupFile.php:

    public static function isGoodSchema( $isCli = false ) {
        return true;

immediately works ... i'll dig a bit deeper once i get the wikifarm working ...

Modifying SetupFile.php do get more detailed information with getSchemaState...

When using this to debug in SetupCheck.php:

    private function schemaError() {
            // get trace
        // https://stackoverflow.com/a/7039409/1497139
        //
        $e = new \Exception;
        $content ='<pre>'.$e->getTraceAsString().'</pre>';
        $content .='PHP_SAPI: '.PHP_SAPI."<br>";
        $isCli=$this->isCli();
        $schemaState=SetupFile::getSchemaState($isCli);
        $content.='Schema state: '.$schemaState."<br>";
        $content .= 

i get:
schema state: error: expected upgradeKey ee63352aa3f035bdf9edf17a448243dd66e96ce2 for rqwiki but found aaaf57e8ed35bf17cae2941f54fd475bca9b56ca
So there is something in the key-calculation that creates a difference ...
SetupFile.php modifications

    /**
     * @since 3.1
     *
     * @param boolean $isCli
     *
     * @return boolean
     */
    public static function isGoodSchema( $isCli = false ) {
        // get the schema State as a  human readable description
        $schemaState=SetupFile::getSchemaState($isCli);
        // check that it starts with "ok:" and not "error:"
        $result=SetupFile::strStartsWith($schemaState,"ok:");
        return $result;
    }

    /**
     * @since 3.1.7
     *
     * see https://stackoverflow.com/a/6513929/1497139
     *
     * @param string $haystack
     * @param string $needle
     *
     * return boolean
     */
    public static function strStartsWith($haystack, $needle) {
           return (strpos($haystack, $needle) === 0);
        }

    /**
     * @since 3.1.7
     *
     * @param boolean $isCli
     *
     * @return string 
     */
    public static function getSchemaState( $isCli = false ) {

        if ( $isCli && defined( 'MW_PHPUNIT_TEST' ) ) {
            return "ok: CLI with PHP Unit Test active";
        }

        if ( $isCli === false && ( PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg' ) ) {
            return "ok: isCli is true and PHP_SAPI cli/phpdbg=".PHP_SAPI;
        }

        // #3563, Use the specific wiki-id as identifier for the instance in use
        $id = Site::id();

        if ( !isset( $GLOBALS['smw.json'][$id]['upgrade_key'] ) ) {
            return "error: smw.json for ".$id." upgrade key missing";
        }

        $upgradeKey = self::makeUpgradeKey( $GLOBALS );
        $expected   =$GLOBALS['smw.json'][$id]['upgrade_key'];
        if ( $upgradeKey === $expected ) 
            $schemaState= "ok: found upgradeKey.".$upgradeKey;
        else
            $schemaState= "error: expected upgradeKey ".$expected." for ".$id." but found ".$upgradeKey;

        if (
            isset( $GLOBALS['smw.json'][$id][self::MAINTENANCE_MODE] ) &&
            $GLOBALS['smw.json'][$id][self::MAINTENANCE_MODE] !== false ) {
            $schemaState= "error: upgradeKey ".$upgradeKey." is ok but maintainance is active";
        }

        return $schemaState;
    }

As a workaround i put aaaf57e8ed35bf17cae2941f54fd475bca9b56ca as the upgrade key into .smw.json ... and the error message disappears✓

I found the following commented code in
SetupFile.php and commented it out:

        // Log the base elements used for computing the key
    $vars['smw.json'][$id]['upgrade_key_base'] = self::makeKey(
        $vars
    );

which gives:

 "upgrade_key_base": "{\"0\":\"smw:2019-09-23\",\"1\":\"SMWSQLStore3\",\"2\":[],\"3\":false,\"4\":[\"_MDAT\"],\"smwgFieldTypeFeatures\":2}",

so in fact the problem might be linked to #4787 that the CLI way of the farm handling code and the apache2handler code are not giving the same results. I suspect the handling of global variables e.g. via GLOBAL is different in these cases and that might have something todo with the PHP version ...

Further debugging by adding:

    private function schemaError() {
            // get trace
        // https://stackoverflow.com/a/7039409/1497139
        //
        $e = new \Exception;
        $content ='<pre>'.$e->getTraceAsString().'</pre>';
        $content .='PHP_SAPI: '.PHP_SAPI."<br>";
        $isCli=$this->isCli();
        $schemaState=SetupFile::getSchemaState($isCli);
        $content.='Schema state: '.$schemaState."<br>";
        $upgradeKeyBase=SetupFile::makeKey($GLOBALS);
        $content.='upgrade key base: '.$upgradeKeyBase;
...

showed:

upgrade key base: ["smw:2019-09-23","SMWSQLStore3",[],false,["_MDAT"]]

so the difference seems to be in:

https://www.semantic-mediawiki.org/wiki/Help:$smwgFieldTypeFeatures

using

global $smwgFieldTypeFeatures;

makes a difference - but why do i have to use global only for selected variables then - how does the scoping work in the LocalSettings case for $smwg ... Variables?

I suggest adding the above changes SetupFile.php and schemaError() to make the debug information available and show the different reasons why there might be an upgrade problem in detail.

It's a shame that this page cannot be switched off by an SMW configuration variable.

I am hit again with this problem in MediaWiki 1.35.0 LTS and SMW 3.2.0. I'll have to patch things again for better debugging.

rcsdiff -r1.1 SetupFile.php SetupCheck.php
===================================================================
RCS file: RCS/SetupFile.php,v
retrieving revision 1.1
diff -r1.1 SetupFile.php
111a112,131
>       // get the schema State as a  human readable description
>       $schemaState=SetupFile::getSchemaState($isCli);
>       // check that it starts with "ok:" and not "error:"
>       $result=SetupFile::strStartsWith($schemaState,"ok:");
>       return $result;
>   }
> 
>   /**
>    * @since 3.1.7
>    *
>    * see https://stackoverflow.com/a/6513929/1497139
>    *
>    * @param string $haystack
>    * @param string $needle
>    *
>    * return boolean
>    */
>   public static function strStartsWith($haystack, $needle) {
>            return (strpos($haystack, $needle) === 0);
>   }
112a133,141
>   /**
>    * @since 3.1.7
>    *
>    * @param boolean $isCli
>    *
>    * @return string 
>    */
>   public static function getSchemaState( $isCli = false ) {
>           
114c143
<           return true;
---
>           return "ok: CLI with PHP Unit Test active";
118c147
<           return true;
---
>           return "ok: isCli is true and PHP_SAPI cli/phpdbg=".PHP_SAPI;
124,125c153,155
<       if ( !isset( $GLOBALS['smw.json'][$id]['upgrade_key'] ) ) {
<           return false;
---
>     if ( !isset( $GLOBALS['smw.json'][$id]['upgrade_key'] ) ) {
>       global $smwgConfigFileDir;
>           return "error: smw.json for ".$id." upgrade key missing - you might want to check \$smwgConfigFileDir:".$smwgConfigFileDir;
128c158,163
<       $isGoodSchema = self::makeUpgradeKey( $GLOBALS ) === $GLOBALS['smw.json'][$id]['upgrade_key'];
---
>       $upgradeKey = self::makeUpgradeKey( $GLOBALS );
>       $expected   =$GLOBALS['smw.json'][$id]['upgrade_key'];
>       if ( $upgradeKey === $expected ) 
>           $schemaState= "ok: found upgradeKey.".$upgradeKey;
>       else
>           $schemaState= "error: expected upgradeKey ".$expected." for ".$id." but found ".$upgradeKey;
133c168
<           $isGoodSchema = false;
---
>           $schemaState= "error: upgradeKey ".$upgradeKey." is ok but maintainance is active";
136c171
<       return $isGoodSchema;
---
>       return $schemaState;
482,484c517,519
<       // $vars['smw.json'][$id]['upgrade_key_base'] = self::makeKey(
<       //  $vars
<       // );
---
>       $vars['smw.json'][$id]['upgrade_key_base'] = self::makeKey(
>           $vars
>       );
516c551
<   private static function makeKey( $vars ) {
---
>   public static function makeKey( $vars ) {
===================================================================
RCS file: RCS/SetupCheck.php,v
retrieving revision 1.1
diff -r1.1 SetupCheck.php
381c381,396
<   }
---
>   }
> 
>   private function schemaError() {
>     // get trace
>       // https://stackoverflow.com/a/7039409/1497139
>       //
>       $e = new \Exception;
>       $content ='<pre>'.$e->getTraceAsString().'</pre>';
>       $content .='PHP_SAPI: '.PHP_SAPI."<br>";
>       $isCli=$this->isCli();
>       $schemaState=SetupFile::getSchemaState($isCli);
>       $content.='Schema state: '.$schemaState."<br>";
>       $upgradeKeyBase=SetupFile::makeKey($GLOBALS);
>     $content.='upgrade key base: '.$upgradeKeyBase;
>     return $content;
>   }
387c402,406
<       $content = '';
---
>     $content = '';
> 
>     if ($type==self::ERROR_SCHEMA_INVALID_KEY) {
>       $content.=$this->schemaError($this->isCli());
>     }

helped. A symlink to .smw.json was all this time. The CLI setup doesn't pick up the settings the same way as the web based one does. These things are hard to debug if the software doesn't give any clues. Why is the upgradekey handling implemented as if this was all something secret or security related? Outputting the current settings, keys and how the key was calculated helps solving this issue.

Relevant code:

  • make makeKey function public
  • uncomment
// Log the base elements used for computing the key
    $vars['smw.json'][$id]['upgrade_key_base'] = self::makeKey(
        $vars
    );

to make the upgrade_key_base information available for debugging.

refactor:

/**
     * @since 3.1
     *
     * @param boolean $isCli
     *
     * @return boolean
     */
    public static function isGoodSchema( $isCli = false ) {
        // get the schema State as a  human readable description
        $schemaState=SetupFile::getSchemaState($isCli);
        // check that it starts with "ok:" and not "error:"
        $result=SetupFile::strStartsWith($schemaState,"ok:");
        return $result;
    }

    /**
     * @since 3.1.7
     *
     * see https://stackoverflow.com/a/6513929/1497139
     *
     * @param string $haystack
     * @param string $needle
     *
     * return boolean
     */
    public static function strStartsWith($haystack, $needle) {
           return (strpos($haystack, $needle) === 0);
  }

    /**
     * @since 3.1.7
     *
     * @param boolean $isCli
     *
     * @return string 
     */
    public static function getSchemaState( $isCli = false ) {

        if ( $isCli && defined( 'MW_PHPUNIT_TEST' ) ) {
            return "ok: CLI with PHP Unit Test active";
        }

        if ( $isCli === false && ( PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg' ) ) {
            return "ok: isCli is true and PHP_SAPI cli/phpdbg=".PHP_SAPI;
        }

        // #3563, Use the specific wiki-id as identifier for the instance in use
        $id = Site::id();

    if ( !isset( $GLOBALS['smw.json'][$id]['upgrade_key'] ) ) {
      global $smwgConfigFileDir;
            return "error: smw.json for ".$id." upgrade key missing - you might want to check \$smwgConfigFileDir:".$smwgConfigFileDir;
        }

        $upgradeKey = self::makeUpgradeKey( $GLOBALS );
        $expected   =$GLOBALS['smw.json'][$id]['upgrade_key'];
        if ( $upgradeKey === $expected ) 
            $schemaState= "ok: found upgradeKey.".$upgradeKey;
        else
            $schemaState= "error: expected upgradeKey ".$expected." for ".$id." but found ".$upgradeKey;

        if (
            isset( $GLOBALS['smw.json'][$id][self::MAINTENANCE_MODE] ) &&
            $GLOBALS['smw.json'][$id][self::MAINTENANCE_MODE] !== false ) {
            $schemaState= "error: upgradeKey ".$upgradeKey." is ok but maintainance is active";
        }

        return $schemaState;
    }

in SetupFile.php to not only give true/false but the reason why a schema might be good or not.

add

private function schemaError() {
      // get trace
        // https://stackoverflow.com/a/7039409/1497139
        //
        $e = new \Exception;
        $content ='<pre>'.$e->getTraceAsString().'</pre>';
        $content .='PHP_SAPI: '.PHP_SAPI."<br>";
        $isCli=$this->isCli();
        $schemaState=SetupFile::getSchemaState($isCli);
        $content.='Schema state: '.$schemaState."<br>";
        $upgradeKeyBase=SetupFile::makeKey($GLOBALS);
    $content.='upgrade key base: '.$upgradeKeyBase;
    return $content;
  }

to SetupCheck.php and use it when displaying the error e.g. as a workaround in function createErrorContent like this:

  $content = '';

     if ($type==self::ERROR_SCHEMA_INVALID_KEY) {
      $content.=$this->schemaError($this->isCli());
     }

Problem hit me again today.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SteveRMann picture SteveRMann  Â·  4Comments

plegault3397 picture plegault3397  Â·  3Comments

Larivact picture Larivact  Â·  4Comments

jaideraf picture jaideraf  Â·  3Comments

WolfgangFahl picture WolfgangFahl  Â·  3Comments