Ejemplo n.º 1
0
<?php

/* 
	Analyse YAKTRACK and create yaktag on user profile
	This batch access 2 dbs : yakwala and yaktrack
*/
echo "<!doctype html><html><head><meta charset='utf-8' /><title>YAKWALA BATCH</title></head><body>";
require_once "../LIB/conf.php";
$conf = new conf();
$db = $conf->mdb();
$dbTrack = $conf->mdbTrack();
$infoColl = $db->info;
$userColl = $db->user;
$yakcatColl = $db->yakcat;
$batchlogColl = $db->batchlog;
$statColl = $db->stat;
$trackColl = $dbTrack->tracks;
$q = empty($_GET['q']) ? "" : $_GET['q'];
if ($q != '') {
    $user = $userColl->find(array('_id' => new MongoId($q), "status" => 1));
} else {
    $user = $userColl->find(array("status" => 1));
}
$tsNow = gmmktime();
$tsLastWeek = $tsNow - 7 * 24 * 60 * 60;
// actionId=>score
$scoreMatrix = array(16 => -3, 5 => 1, 8 => 2, 14 => 2, 7 => 2, 6 => 3, 19 => 3, 15 => 5, 10 => 6, 11 => 7, 12 => 10, 0 => 15);
if (!empty($user)) {
    foreach ($user as $u) {
        $favTags = array("not tag" => 0);
        $favCats = array('no cat' => 0);