Exemplo n.º 1
0
<?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);
Exemplo n.º 2
0
 /**
  * Parse the content of all PEAR repository
  *
  * @param TableUpstream $uptable the table to write to
  * @param TablePearRepo $pear    the table to read from
  *
  * @return integer number of parsed line
  */
 public static function readPear(TableUpstream $uptable, TablePearRepo $pear)
 {
     $tot = 0;
     self::log("PEAR reading channels");
     $channels = $pear->getAllRepo(true);
     foreach ($channels as $channelname => $channelurl) {
         $tot += self::readOnePear($uptable, $channelname, $channelurl);
     }
     self::log("Write {$tot} packages in all channels");
     return $tot;
 }