summaryrefslogtreecommitdiffstats
path: root/testdb.php
blob: 263a0c99b5241f1cba5abdcbcbf2dfadab7cf636 (plain)
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?php
require "include/main.php";
require "class/CommonTable.php";

date_default_timezone_set('Europe/Paris');

$db = new PDO ("mysql:dbname=" . MYBASE . ";host=" . MYHOST, MYUSER, MYPASS);

$pear = new TableRRepo($db);
print_r($pear->getAllRepo());

echo "PEAR\n";

$pear = new TablePearRepo($db);
print_r($pear->getAllRepo());

$pear = new TablePearRepo($db);
print_r($pear->getAllRepo(false));

$a=$pear->add(array('alias'=>'test', 'url'=>'testurl'));
echo "Ajout : $a\n";

$b=$pear->delete(array('id'=>$a));
echo "Del : $b\n";

echo "RPM:";
$rpm = new TableRpmRepo($db);

if ($rpm->update(999, array('stamp'=>1)))
{
    echo "Update 1 ok\n";
}
print_r($rpm->getAllRepo());
if ($rpm->update(999, array('stamp'=>2)))
{
    echo "Update 2 ok\n";
}
$all = $rpm->getAllRepo();
print_r(array_pop($all));

echo "find(devel):";
if ($row = $rpm->find(array('main'=>'devel'))) {
    print_r($row);
} else {
    echo "not found\n";
}
echo "find(rawhide):";
if ($row = $rpm->find(array('main'=>'rawhide'))) {
    print_r($row);
} else {
    echo "not found\n";
}
echo "find():";
if ($row = $rpm->find(array())) {
    print_r($row);
} else {
    echo "not found\n";
}
echo "get(999):";
if ($row = $rpm->get(999)) {
    print_r($row);
} else {
    echo "not found\n";
}
echo "get(888):";
if ($row = $rpm->get(888)) {
    print_r($row);
} else {
    echo "not found\n";
}
echo "Last update : ".date("r", $rpm->getMaxStamp())."\n";

$up = new TableUpstream($db);
$up->delete(array('name'=>'foo','type'=>'test'));
$rec = $up->record('test','bar','foo','1.0',true);
echo "record(foo-1.0) : $rec\n";
echo "find(foo,test):";
if ($row = $up->find(array('name'=>'foo','type'=>'test'))) {
    print_r($row);
} else {
    echo "not found\n";
}
$up->record('test','bar','foo','1.2',false,'beta');
echo "record(foo-1.2) : $rec\n";
echo "find(foo,test):";
if ($row = $up->find(array('name'=>'foo','type'=>'test'))) {
    print_r($row);
} else {
    echo "not found\n";
}
echo "request(test) : ";
foreach($up->request(array('type'=>'test', 'ORDER'=>'name')) as $upstr) {
    print_r($upstr);
}

$rpm = new TableRpm($db);
$acl = new TableAcls($db);
echo "Acls number : ".$acl->getCount()."\n";
$res = $acl->optimize();
echo "Acls optimization : ".$res[0]['Msg_type'].'='.$res[0]['Msg_text']."\n";

echo "PHP owner:";
print_r($acl->getOwners('php'));
echo "PECL owner:";
print_r($acl->getOwners('php-pecl-%'));
echo "PEAR channels:";
print_r($up->getChannels('pear'));
?>