Пример #1
0
 * @author    Johan Cwiklinski <*****@*****.**>
 * @copyright 2010-2014 Remi Collet
 * @license   http://www.gnu.org/licenses/agpl-3.0-standalone.html AGPL License 3.0 or (at your option) any later version
 * @link      http://github.com/remicollet/rpmphp/
 * @since     The begining of times.
*/
require 'include/main.php';
$smarty->assign('ariane', $ariane);
$smarty->assign('page_title', 'Packages in Fedora / RHEL / CentOS / EPEL repositories');
try {
    $db = new PDO("mysql:dbname=" . MYBASE . ";host=" . MYHOST, MYUSER, MYPASS);
    $repo = new TableRpmRepo($db);
    $prev = false;
    $repositories = array();
    $crit = array('id' => '>0', 'ORDER' => 'id');
    if (!isset($_GET['eol']) || !$_GET['eol']) {
        $crit['active'] = 1;
    }
    foreach ($repo->request($crit) as $repo) {
        $repositories[] = array('repo_name' => $repo['main'] != $prev ? $repo['main'] : "&nbsp;", 'active' => $repo['main'] != $prev ? $repo['active'] ? "<strong>Yes</strong>" : "no" : "&nbsp;", 'sub_name' => $repo['sub'], 'url' => $repo['url'], 'date' => $repo['stamp'] ? date("r", $repo['stamp']) : '');
        $prev = $repo['main'];
    }
    $smarty->assign('repositories', $repositories);
} catch (PDOException $e) {
    $smarty->assign('error', sprintf("%s ERREUR : %s\n", date("r"), $e->getMessage()));
}
$smarty->assign('rpmphp_version', RPMPHP_VERSION);
$smarty->assign('fedcli_version', FedoraClient::VERSION);
$page_content = $smarty->fetch('index.tpl');
$smarty->assign('page_content', $page_content);
$smarty->display('main.tpl');
Пример #2
0
 /**
  * Parse the content of all RPM repository for Provides
  *
  * @param TableRpm      $rpmtable   the table to write to
  * @param TableRpmRepo  $rpmrepo    the table to read from
  * @param Array         $crit       array for repo selection
  *
  * @return integer number of parsed line
  */
 public static function readProvides(TablePackagist $pkgtable, TableRpmRepo $rpmrepo, array $crit)
 {
     $tot = 0;
     $result = array();
     foreach ($rpmrepo->request($crit) as $row) {
         self::readOneProv($rpmrepo, $row, $result);
     }
     if (count($result)) {
         $pkgtable->truncate();
         foreach ($result as $rpm => $pkg) {
             $input = array('rpmname' => $rpm, 'pkgname' => $pkg);
             try {
                 if ($pkgtable->add($input)) {
                     $tot++;
                 }
             } catch (Exception $e) {
                 # ignore duplicate key for now
                 # ex pimple/pimple provided by php-pimple1 and php-pimple
             }
         }
     }
     self::log("Write {$tot} packagist packages");
     return $tot;
 }