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

Command line processing causing exception #12

Closed
jesperavot opened this issue Jun 27, 2015 · 9 comments · Fixed by #17
Closed

Command line processing causing exception #12

jesperavot opened this issue Jun 27, 2015 · 9 comments · Fixed by #17

Comments

@jesperavot
Copy link

Hi,

I'm running into an issue with the current version of the plugin. I configured Piwik 2.14.0-rc1 and QueuedTracking version 0.1.6, setup Redis and the plugin configuration and noticed that everything is being collected perfectly. However, once I switch Process during tracking request off and try to process the queue using the console, I get the following exception:

[Piwik\Container\ContainerDoesNotExistException] The root container has not been created yet.

Looking at the code, it seems it is caused in Factory.php (StaticContainer::get('Piwik\Plugins\QueuedTracking\Settings');) because all the other commands work as expected like queuedtracking:monitor

Cheers,
Jesper

@centminmod
Copy link

same experience as well

@ldidry
Copy link

ldidry commented Jul 9, 2015

Migrated to Piwik 2.14 right now: same error. 😦

@mattab mattab added this to the Current sprint milestone Jul 9, 2015
@mattab
Copy link
Member

mattab commented Jul 9, 2015

Hi @tsteur! could you take a look at this issue?

@tsteur
Copy link
Member

tsteur commented Jul 13, 2015

Or maybe @diosmosis has an idea why it maybe fails around here https://github.com/piwik/plugin-QueuedTracking/blob/master/Commands/Process.php#L43 ? This is - I think - the only difference to the monitor command

@diosmosis
Copy link
Member

@tsteur recreateEagerCacheInstanceWhichChangesOnceTrackerModeIsEnabled() will clear the container but doesn't initiate a new environment. Which you shouldn't do either. Instead of loading the tracker plugins / environment explicitly, should create and init a new Environment('tracker'); instance.

I might be able to fix it today, not sure if there are tests for this though.

@ldidry
Copy link

ldidry commented Jul 19, 2015

@diosmosis any news on your fix ?

@samgabriel
Copy link

For those of you who are still stranded after this bug. Add these two lines to the recreateEagerCacheInstanceWhichChangesOnceTrackerModeIsEnabled
after

     StaticContainer::clearContainer();
        Log::unsetInstance();

add

        $environment = new \Piwik\Application\Environment('tracker');
        $environment->init();

The full function should look like this:

private function recreateEagerCacheInstanceWhichChangesOnceTrackerModeIsEnabled()
    {
        StaticContainer::clearContainer();
        Log::unsetInstance();
        $environment = new \Piwik\Application\Environment('tracker');
        $environment->init();

        $key = 'Piwik\Cache\Eager';
        $container = StaticContainer::getContainer();
        $container->set($key, $container->make($key));
    }

@ldidry
Copy link

ldidry commented Jul 21, 2015

@samgabriel Unfortunately this is not working (well, at least, on my installation (up-to-date piwik and QueuedTracking plugin):

PHP Fatal error:  Call to undefined method Piwik\Plugins\QueuedTracking\Queue\Manager::shouldRecordStatistics() in /var/www/piwik/plugins/QueuedTracking/Queue/Processor.php on line 68

@diosmosis
Copy link
Member

I created a fix in #17, but I'm not setup to test it. Hopefully @tsteur will verify soon whether it works

@innocraft-automation innocraft-automation removed this from the Current sprint milestone Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
8 participants