Bug in isArchivingDisabled()


#1

public function isArchivingDisabled()
{
$processOneReportOnly = !$this->shouldProcessReportsAllPlugins($this->getSegment(), $this->period);
if($processOneReportOnly)
{
// When there is a segment, archiving is not necessary allowed
// If browser archiving is allowed, then archiving is enabled
// if browser archiving is not allowed, then archiving is disabled
if(!$this->getSegment()->isEmpty()
&& !$this->isRequestAuthorizedToArchive()
&& Zend_Registry::get(‘config’)->General->browser_archiving_disabled_enforce
)
{
Piwik::log(“Archiving is disabled because of config setting browser_archiving_disabled_enforce=1”);
return true;
}
return false;
}
$isDisabled = !$this->isRequestAuthorizedToArchive();
return $isDisabled;
}

Hallo to all,
I got to talk to you about this little function (from archive processing) again. It’s essential because if this function returns false archives will be processed. In most cases this is a good thing, but here is my case:
I have a little plugin in piwik 1.6 with some tables. I want to use auto archivieng, berause of performanceissues. The problem here is, some of my tables use segmantation and some not. Now the function above returns always false, if segmantation is used. This leads to inconsistency, because the tables with segmantation will be archived immediately while the tables without have to wait until the crontab triggers the archiving.
So in my eyes this is a bug. Whats your opinion?

I think the source for the problem is this line:
Zend_Registry::get(‘config’)->General->browser_archiving_disabled_enforce
When I disable browser_archiving, it returns ‘0’ never the less. But according to the comments it should return true. This would disable the archiving (like the comments say). Furthermore I already tested to negotiate the line like this:
!Zend_Registry::get(‘config’)->General->browser_archiving_disabled_enforce
and it works fine.
So if you agree with me that this is a bug, I would be glad if someone from the piwik team could fix it.
Thanks
Davud


#2

@matt:
Ok. I updated to piwik 1.7.1 (like you told me in your replay to my ticked) and just noticed to comment above the function saying:

  • Note that when a segment is passed to the function, archiving will always occur
  • (since segments are by default not pre-processed)

And basicly this is exactly my problem! I have tables with and tables without segments. Now that the tables with segments can be processed anytime, this gives me lots of inconsistencies.

So could you please explain to me why segments should not be pre-processed?
thx


(Matthieu Aubry) #3

You can specify a list of segment to pre-process if you know in advance which ones: http://dev.piwik.org/trac/browser/trunk/config/global.ini.php#L358

YOu can also use browser_archiving_disabled_enforce to do what you want maybe?


#4

still struggling with this issues. after several very frustrating hours it seems that piwik just doesn’t preprocess tables with segments. I even tried to force it by changing the core code. I set the function isArchivingDisabled() to return true and thought this should work in any case. But didn’t.
Can someone tell me why? Or give me some advise on how to preprocess tables with segments?


#5

äh I correct: I set the function isArchivingDisabled to return false so archiving will be launched


#6

@matt: using the list of segments to preprocess has the effect that all tables with segments disapear -> “no data in this report”.
thats not normal isn’t it?


(Matthieu Aubry) #7

davud, what exactly is the problem? data with segments don’t get pre-processed?

is there a bug we can replicate to fix your issue?


#8

yes, exactly! data with segments won’t get pre-processed. sorry, if I didn’t make that clear.

for example i won’t to display the “browser families” in a graph (can be found in visitors->settings) with some conditions. In the Api.php document of my plugin I have this function to do this:

public function getBrowserTypeData($idSite, $period, $date, $segment = false/, $expanded = false/) {
return Piwik_UserSettings_API::getInstance()->getBrowser( $idSite, $period, $date, Piwik_AB_Controller::getCustomSegment($segment)); //this one basicly returns something like ‘customVariableValue1==value’ with a changing value
}

This works fine but the data won’t be pre-processed.
Does this make it any clearer?


#9

*line 2 says “won’t to display” but should say “want to display”. sorry for my bad english :slight_smile:


#10

I think what my problem is, is that:
"(since segments are by default not pre-processed)" (line 929 ArchiveProcessing.php)

Why is that so? I can’t see any sense in that, since it leads to lots of inconsistencies in my reports.


(Matthieu Aubry) #11

This works fine but the data won’t be pre-processed.

Can you say what you see VS what you expect?
What is the expected behavior exactly? that your report should be processed during the archiving script?


#12

what I expect:
reports will processed only(!) during archiving script.
what I see:
reports (with segments) will be processed by browser triggering.


(Matthieu Aubry) #13

Thanks. What solution do you propose?


#14

sorry, but I really don’t have any idea how to fix this bug. I could fix my plugin by not using segmentation, but thats not very nice.
And I hoped that you or somebody from the piwik team could fix this. I mean this bug must be somewhere deep down in the piwik core code wouldn’t even know where to search. My first clue was of course the function isArchivingDisabled() but it’s not the source of the problem since I’ve already forced the output and still was not able to pre process reports with segmentation.

Maybe we should write a ticket about this issue?


(Matthieu Aubry) #15

davud, can you please create a ticket with the code snippet used to replicate the bug and the exact steps to reproduce? Thanks


#16

hi matt, I just created the ticket

I to make it as clear as possible. If you have problems reproducing, tell me.