1<?php
2if(!defined('DOKU_INC')) define('DOKU_INC', realpath(dirname(__FILE__) .'/../../../../') . '/');
3//if(!defined('QS_META')) define ('QS_META', DOKU_INC . 'data/meta/quickstats/12_2011/');
4if(!defined('QS_META')) define ('QS_META', DOKU_INC . 'data/meta/quickstats/');
5
6
7 function qs_pages_search_i ($needle = null,$month)
8 {
9
10   $pages = unserialize(file_get_contents(QS_META . $month .'/pages.ser'));
11    $ret_ar = array();
12    foreach($pages['page'] as $key => $val)
13    {
14
15        if(stristr($key, $needle) !== false) {
16             $ret_ar[$key] = $val;
17         }
18
19    }
20
21    return $ret_ar;
22
23 }
24
25 function qs_process_pages ($page,$month) {
26    $file = QS_META . $month . '/page_users.ser';
27    $page_users = unserialize(file_get_contents($file));
28
29   $found = qs_pages_search_i($page,$month);
30   if(!$found) { echo "no data\n"; exit; }
31
32   foreach($found as $page=>$accesses) {
33      echo "$page=>$accesses\n";
34      print_r($page_users[md5($page)]);
35   }
36  }
37  qs_process_pages ($argv[1],'12_2011') ;
38?>
39
40