-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcron.php
More file actions
47 lines (41 loc) · 1.04 KB
/
cron.php
File metadata and controls
47 lines (41 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/**
* @author Carlos García Gómez neorazorx@gmail.com
* @copyright 2015, Carlos García Gómez. All Rights Reserved.
*/
require_model('comm3_comment.php');
require_model('comm3_item.php');
require_model('comm3_stat.php');
require_model('comm3_stat_item.php');
class cron_comm3
{
public function __construct()
{
$item = new comm3_item();
foreach($item->all() as $it)
{
$it->num_comentarios();
$it->save();
}
$stat = new comm3_stat();
$stat_item = new comm3_stat_item();
foreach($stat_item->agrupado() as $value)
{
$st0 = $stat->get($value['fecha'], $value['version']);
if($st0)
{
$st0->activos = $value['activos'];
$st0->save();
}
else
{
$st0 = new comm3_stat();
$st0->fecha = $value['fecha'];
$st0->version = $value['version'];
$st0->activos = $value['activos'];
$st0->save();
}
}
}
}
new cron_comm3();