Skip to content
This repository has been archived by the owner on Dec 30, 2023. It is now read-only.

Counter 2.0.3 not working with piwik 2.2.0 #2

Closed
aureq opened this issue Apr 18, 2014 · 3 comments
Closed

Counter 2.0.3 not working with piwik 2.2.0 #2

aureq opened this issue Apr 18, 2014 · 3 comments
Labels

Comments

@aureq
Copy link

aureq commented Apr 18, 2014

Hi
Counter 2.0.3 doesn't seem to work with Piwik 2.2.0 (release 24 hours ago).
Instead of the usual generated javascript, I get the following:

<div style='word-wrap: break-word; border: 3px solid red; padding:4px; width:70%; background-color:#FFFF96;'>
        <strong>There is an error. Please report the message (Piwik 2.2.0)
        and full backtrace in the <a href='?module=Proxy&action=redirect&url=http://forum.piwik.org' target='_blank'>Piwik forums</a> (please do a Search first as it might have been reported already!).<br /><br/>
        Notice:</strong> <em>Undefined index: tpl_by_countries</em> in <strong>/usr/share/piwik/plugins/Counter/API.php</strong> on line <strong>209</strong>
<br /><br />Backtrace --&gt;<div style="font-family:Courier;font-size:10pt"><br />
#0  Piwik\Error::errorHandler(...) called at [/usr/share/piwik/plugins/Counter/API.php:209]<br />
#1  Piwik\Plugins\Counter\API->getCountersData(...) called at [/usr/share/piwik/plugins/Counter/API.php:523]<br />
#2  Piwik\Plugins\Counter\API->getLiveVisitorsCount(...) called at [/usr/share/piwik/plugins/Counter/Controller.php:160]<br />
#3  Piwik\Plugins\Counter\Controller->live(...) called at [:]<br />
#4  call_user_func_array(...) called at [/usr/share/piwik/core/FrontController.php:505]<br />
#5  Piwik\FrontController->doDispatch(...) called at [/usr/share/piwik/core/FrontController.php:85]<br />
#6  Piwik\FrontController->dispatch(...) called at [/usr/share/piwik/core/dispatch.php:34]<br />
#7  require_once(...) called at [/usr/share/piwik/index.php:47]<br />
</div><br />
 </pre></div><br />
var elem = "nbvisit", url = "http://stats.hidden.fr/index.php?module=Counter&action=live&id=3"; function createXHR(){var a;if(window.ActiveXObject){try{a=new ActiveXObject("Microsoft.XMLHTTP")}catch(b){document.getElementById(elem).innerHTML=b.message;a=null}}else{a=new XMLHttpRequest}return a}function sendRequest(){var a=createXHR();a.onreadystatechange=function(){if(a.readyState===4){document.getElementById(elem).innerHTML=a.responseText}};a.open("GET",url,true);a.send()}sendRequest();

Thanks

@aureq aureq changed the title Counter 2.0.3 not working with piwik 2.0 Counter 2.0.3 not working with piwik 2.2.0 Apr 18, 2014
@aureq
Copy link
Author

aureq commented Apr 18, 2014

As a side note, the .zip file I downloaded matches the master branch.

@Globulopolis
Copy link
Owner

From previous release I've been added some new for counter parameters. I'm too busy and lazy :) for create update script.
For update

  1. recreate counter
  2. update counter parameters via sql editor(phpmyadmin, sqlyog or something else)

in table "piwik_counter_sites"
found "params" field and add just before }
,"tpl_by_countries":"","tpl_by_countries_elem_id":""}

@aureq
Copy link
Author

aureq commented Apr 19, 2014

Hi @Globulopolis

Thanks for the update. To me, recreating 98 counters isn't really an option. So I came with a different approach. Feel free to include it in the README file.

  • Perform a mysqldump on the table piwik_counter_sites: mysqldump -h localhost -u piwik -pPassW0rd --create-options --complete-insert=false --extended-insert=false piwik piwik_counter_sites > piwik_counter_sites.sql
  • Copy the dump for backup purpose: cp piwik_counter_sites.sql piwik_counter_sites.sql.orig
  • Add the missing bits: cat piwik_counter_sites.sql | sed -e 's#nbvisit\"}#nbvisit\",\"tpl_by_countries\":\"\",\"tpl_by_countries_elem_id\":\"\"}#g' > piwik_counter_sites.fixed.sql
  • Inject the modified table dump into production: mysql -h localhost -u piwik -pPassW0rd piwik < piwik_counter_sites.fixed.sql

Make sure you have the double backslash before the double quotes (\")

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants