hallowelt / mwstake-mediawiki-component-processmanager

0 stars 1 forks source link

Cant save bpmn in CognitiveProcessDesigner, fails to get the service #11

Open tlhosep opened 9 months ago

tlhosep commented 9 months ago

I am trying to save a bmpn diagram using the CognitiveProcessDesigner. The diagram gets saved somehow but at the step where the app tries to save the elements it fails currently: I have added some output to SaveDiagramElementsApi to get it working: First: I needed to add an include:

include(dirname(__FILE__).'/../../vendor/mwstake/mediawiki-component-processmanager/src/ManagedProcess.php');

Otherwise the Class could not be found... Then I have made some debugging in SaveDiagramElementsApi:

        public function execute() {
error_log("Execute called\n",3, "/var/log/mediawiki/tlu.log");
                $params = $this->extractRequestParams();
error_log("Params\n",3, "/var/log/mediawiki/tlu.log");

                $elements = json_decode( $params['elements'], true );
error_log("Elements\n",3, "/var/log/mediawiki/tlu.log");

                $actorName = $this->getContext()->getUser()->getName();
error_log("Actor\n",3, "/var/log/mediawiki/tlu.log");
                $process = new ManagedProcess( [
                        'save-elements-step' => [
                                'class' => SaveDiagramElementsStep::class,
                                'args' => [
                                        $elements,
                                        $actorName
                                ]
                        ]
                ], 300 );
error_log("MgtPrc\n",3, "/var/log/mediawiki/tlu.log");
                /** @var \MWStake\MediaWiki\Component\ProcessManager\ProcessManager $processManager */
$mwservice = MediaWikiServices::getInstance();
error_log("MgtPrc2\n",3, "/var/log/mediawiki/tlu.log");
        $processManager = $mwservice->getService( 'ProcessManager' );
error_log("Fetched Processmanager\n" ,3, "/var/log/mediawiki/tlu.log");

I can't reach the last log-entry ("Fetched Processmanager"), and I would expect that the service could not be found.... How has your code to be deployed to get it running?

I also had problems with the background task: php extensions/CognitiveProcessDesigner/vendor/mwstake/mediawiki-component-processmanager/maintenance/processRunner.php maintenance/Maintenance.php --wait 1) Database had not been updated 2) Some includes had to be inserted in order to find the classes

require_once dirname(__FILE__)."/../src/ProcessInfo.php";
require_once dirname(__FILE__)."/../src/ProcessManager.php";
require_once dirname(__FILE__)."/../../../symfony/process/Process.php";
require_once dirname(__FILE__)."/../../../symfony/process/InputStream.php";

3) getRunnerId faced a problem:

    private function getRunnerId(): string {
        // Path to mainenance script
        $id = md5( $this->parameters->getArg( 0 ) );

Was wrong, needs being corrected in my eyes:

        private function getRunnerId(): string {
                // Path to mainenance script
                $id = md5( $this->getArg( 0 ) );

This all seems mostly related to a bad deployment, as the functionalities seem to be there...

Any help would be appreciated. I am running this mediawiki:

MediaWiki | 1.35.13 PHP | 7.4.33 (apache2handler) MariaDB | 10.5.21-MariaDB-0+deb11u1

NB: Yes, I had run composer install in the root of the processmanager but that did not help I guess :(

Thanks, Thomas

it-spiderman commented 2 months ago

it doesnt work this way. You need to add it to your composer.local.json and run composer update to get it into composer autoloader

tlhosep commented 3 weeks ago

Thanks it-spiderman, I tried but…

ComposerHookHandler::onPreUpdate Loading composer repositories with package information Updating dependencies Your requirements could not be resolved to an installable set of packages.

Problem 1

What would be the correct statement to get it running? Why has this not been included in the documentation?