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
48
49
50
51
52
53
54
55
56
|
<?
require_once 'header.php';
$sql = "INSERT INTO znurt (action) VALUES ('start_import');";
$db->query($sql);
ini_set('memory_limit', -1);
$verbose = true;
if(in_array("-cron", $argv))
$verbose = false;
// print_r($argv); die;
$base = true;
$packages = true;
$ebuilds = true;
$metadata = true;
$use = true;
$final = true;
$arr_import['base'] = array('arches', 'eclasses', 'herds', 'licenses');
$arr_import['packages'] = array('categories', 'packages', 'bugzilla');
$arr_import['ebuilds'] = array('ebuilds');
$arr_import['metadata'] = array('ebuild_metadata', 'ebuild_arch', 'ebuild_homepage', 'ebuild_license', 'package_mask', 'ebuild_mask', 'ebuild_ev', 'use_global', 'use_local', 'use_expand', 'ebuild_use', 'ebuild_depend');
$arr_import['final'] = array('final');
foreach($arr_import as $key => $arr) {
if($$key) {
foreach($arr as $file) {
if($verbose)
echo "[import] $file\n";
include "import.$file.php";
}
}
}
function memory_usage() {
$mem_usage = memory_get_usage(true);
if ($mem_usage < 1024)
$str = $mem_usage."b";
else
$str = round($mem_usage/1024,2)."kb";
// else
// $str = round($mem_usage/1048576,2)." megabytes";
return $str;
}
?>
|