Strict Standards: Declaration of action_plugin_jquery::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /membri/only4mods/lib/plugins/jquery/action.php on line 14

Strict Standards: Declaration of action_plugin_captcha::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /membri/only4mods/lib/plugins/captcha/action.php on line 137

Strict Standards: Declaration of action_plugin_wikistatistics::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /membri/only4mods/lib/plugins/wikistatistics/action.php on line 51

Strict Standards: Declaration of action_plugin_codehighlight::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /membri/only4mods/lib/plugins/codehighlight/action.php on line 225

Strict Standards: Declaration of action_plugin_ipban::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /membri/only4mods/lib/plugins/ipban/action.php on line 60
counterize_ii_mod:en:archive - Ema's plugins (WP, DW)

Unfortunately, some of the pages are now read-only, this because in the last few months some spammers decided to “contribute” to the wiki…
I'm trying to lock only the interested pages.


Strict Standards: Declaration of Doku_Renderer_metadata::table_open() should be compatible with Doku_Renderer::table_open($maxcols = NULL, $numrows = NULL, $pos = NULL) in /membri/only4mods/inc/parser/metadata.php on line 24

Strict Standards: Declaration of Doku_Renderer_metadata::table_close() should be compatible with Doku_Renderer::table_close($pos = NULL) in /membri/only4mods/inc/parser/metadata.php on line 24

Archive function

Development on going!!

Considerations

  • First of all the list of statistics that I would like to save:
    1. total hits → counterize_getamount()
    2. hits from unique IPs → counterize_getuniqueamount()
    3. visits based on day of month → counterize_getdailystats()
    4. visits based on day of week → counterize_getweeklystats()
    5. visits based on month → counterize_getmonthlystats()
    6. visits based on day of hour of day → counterize_gethourlystats()


  • Second why I didn't talk about “most visited IPs”. 1) Consider this statistic means to have a final “archive” with at least one third of the original records in the “wp_counterize” table; yes, this doesn't means to have also an equivalent amount of bits space used, but in any case the final gain in term of space will be smaller. So, at least for now, I will not consider these data. 2) In my country the number of people with a static IP Address is trifling, this means that the IP is useful only to detect spiders and spammers, not to identify unique visitors in the long-period.


  • Third why I didn't mention most visited pages and so on. That's easy: because at the moment I don't want to archive them.
  • Fourth what do the functions return?
function return string data type
counterize_getamount return $wpdb->get_var($sql); number
counterize_getuniqueamount return $wpdb->get_var($sql); number
counterize_getdailystats return $wpdb->get_results($sql); matrix 1)
counterize_getweeklystats return $wpdb->get_results($sql); matrix 2)
counterize_getmonthlystats return $wpdb->get_results($sql); matrix 3)
counterize_gethourlystats return $wpdb->get_results($sql); matrix 4)

So, the functions are all ready, the only thing is to think about the table structure…
Here it is my first attempt:

archID time type value

archID => an incremental number
time => timestamp of the day/hour/minutes when the archive function is executed
type => a string that represent the information stored (total hits, hits from unique IPs, ecc.)

function string type description
counterize_getamount amount
counterize_getuniqueamount uniqueamount
counterize_getdailystats dailystats_[$row→label]
counterize_getweeklystats weeklystats_[$row→label]
counterize_getmonthlystats monthlystats_[$row→label] 5)
counterize_gethourlystats hourlystats_[$row→label]

value => the value of the information stored (number of total hits, number of hits from unique IPs, ecc.), in other words the value returned from the functions counterize_getamount(), counterize_getuniqueamount(), ecc.

  • Fifth and final consideration: I can develop this as a stand-alone plugin. No, I'll use the modified version to keep everything in the same package.

Let's code!

I'm working in local to test the code, you can find the on-going version here, in development page of Mod 2.0 version.

Done:

  • Data are now correctly saved in the correct table.
  • The data in 'wp_counterize' are dropped (and the table optimized)
  • I prepared the functions that retrieve data from the DB

Todo:

  • correct the rendering functions 6)
1) , 2) , 3) , 4) Used as:
foreach($rows as $row)
{
...
   $row->amount;
   $row->label;
...
}
Check function “counterize_renderstats”
5) In this case the values returned by $row→label are formatted like “mmm YY”, where “mmm” is an abbreviation of the month name (i.e. “Jan”, “Feb”, “Mar”), and “YY” is a two digit numerical representation of the year the data were collected (i.e. “06”, “07”, and so on). For this reason in this case the value must be processed in order to obtain only the “mmm” part. I think that something like: $label = split(” ”, $row→label) is enough, and after use only $label[0] instead of $row→label. WRONG:!: The stats are not grouped by month/year, but are kept separated month by month, year by year (e.g. Nov 07, Dec 07, Gen 08, …, Nov 08, Dec 08, ecc.). That means I've to keep everything
6) up to now I wrote functions like 'archive_counterize_amount()' in order to substitute the original counterize's functions, now I'll invert the procedure: I'll modify the original counterize functions in order to call new functions that will return the “archived” value/s…easier to do than to write…

Tools personali