Semanticmediawiki: Error from line 74 of "CountMapField.php": Class 'SMW\Maintenance\UpdateEntityCountMap' not found

Created on 5 Apr 2020  Â·  9Comments  Â·  Source: SemanticMediaWiki/SemanticMediaWiki

Setup and configuration

  • SMW version: 3.2.0-alpha (709aa35)
  • MW version: 1.33.2
  • PHP version: 7.3.15
  • MySQL version: 5.6.47-87.0

Issue

When updating with composer update --no-dev and php maintenance/update.php the following stack trace was produced. However, running php maintenance/update.php a second time, it passes without any problemas. I don't know if this is expected or not. I am just reporting in case of interest.

Error from line 74 of w/extensions/SemanticMediaWiki/src/SQLStore/TableBuilder/Examiner/CountMapField.php: Class 'SMW\Maintenance\UpdateEntityCountMap' not found

Stack trace

--- Post-creation examination ---------------------------------------------

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 the setup file key ...                                    ✓
   ... done.
Checking smw_sortkey, smw_sort fields ...
   ... done.
Checking smw_touched field ...
   ... done.
Checking smw_countmap field consistency ...
   ... adding incomplete task for `smw_countmap` conversion ...
[f132b5a3e7df841908bf487a] [no req]   Error from line 74 of w/extensions/SemanticMediaWiki/src/SQLStore/TableBuilder/Examiner/CountMapField.php: Class 'SMW\Maintenance\UpdateEntityCountMap' not found
Backtrace:
#0 w/extensions/SemanticMediaWiki/src/SQLStore/TableBuilder/TableBuildExaminer.php(161): SMW\SQLStore\TableBuilder\Examiner\CountMapField->check(array)
#1 w/extensions/SemanticMediaWiki/src/SQLStore/Installer.php(240): SMW\SQLStore\TableBuilder\TableBuildExaminer->checkOnPostCreation(SMW\SQLStore\TableBuilder\MySQLTableBuilder)
#2 w/extensions/SemanticMediaWiki/src/SQLStore/SQLStore.php(448): SMW\SQLStore\Installer->install(SMW\Options)
#3 w/extensions/SemanticMediaWiki/src/Store.php(489): SMW\SQLStore\SQLStore->setup(SMW\Options)
#4 w/includes/installer/DatabaseUpdater.php(489): SMW\Store::setupStore(boolean, SMW\Options)
#5 w/includes/installer/DatabaseUpdater.php(457): DatabaseUpdater->runUpdates(array, boolean)
#6 w/maintenance/update.php(203): DatabaseUpdater->doUpdates(array)
#7 w/maintenance/doMaintenance.php(96): UpdateMediaWiki->execute()
#8 w/maintenance/update.php(275): require_once(string)
#9 {main}

Steps to reproduce

Unfortunately I did not record wich SMW "revision" I was using before updating it, it was also 3.2.0-alpha.

UPDATE: I know I should not be using an alpha version. It is not in a production environment.

Most helpful comment

We have a similar case in [0] which requires the same treatment (use SMW\Maintenance\populateHashField as PopulateHashField;).

[0] https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/src/SQLStore/TableBuilder/Examiner/HashField.php#L7

All 9 comments

Class 'SMW\Maintenance\UpdateEntityCountMap' not found

Most likely caused by [0] and the renaming of UpdateEntityCountMap to updateEntityCountMap.

[0] https://github.com/SemanticMediaWiki/SemanticMediaWiki/commit/642402818736907a217f0a59e770f88c1383b296

Would changing of following lines help in CountMapField.php?

@@ -4,11 +4,11 @@ namespace SMW\SQLStore\TableBuilder\Examiner;

 use Onoi\MessageReporter\MessageReporterAwareTrait;
 use SMW\SQLStore\SQLStore;
 use SMW\SQLStore\TableBuilder;
 use SMW\SetupFile;
-use SMW\Maintenance\UpdateEntityCountMap;
+use SMW\Maintenance\updateEntityCountMap as UpdateEntityCountMap;
 use SMW\Utils\CliMsgFormatter;

The error is already gone when running update.php a second time.

The error is already gone when running update.php a second time.

The check for the count map and the access to the UpdateEntityCountMap::COUNTMAP_INCOMPLETE constant only appears once when it is a new field.

I'm on Windows so I cannot verify the issue. Now, best way the verify the issue is by removing the field smw_countmap from the ..._aux table and run setupStore.php again and see what happens.

Ok, I will try that.

Yes! It fixes the issue. Thanks @mwjames :+1:

We have a similar case in [0] which requires the same treatment (use SMW\Maintenance\populateHashField as PopulateHashField;).

[0] https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/src/SQLStore/TableBuilder/Examiner/HashField.php#L7

I wonder if this is the only maintenance script affected. Basically all class names for the maintenance script were changed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alex-mashin picture alex-mashin  Â·  4Comments

djoris picture djoris  Â·  4Comments

WolfgangFahl picture WolfgangFahl  Â·  3Comments

jaideraf picture jaideraf  Â·  3Comments

SteveRMann picture SteveRMann  Â·  4Comments