summaryrefslogtreecommitdiffstats
path: root/class/Parser.php
diff options
context:
space:
mode:
Diffstat (limited to 'class/Parser.php')
-rw-r--r--class/Parser.php49
1 files changed, 49 insertions, 0 deletions
diff --git a/class/Parser.php b/class/Parser.php
index 31a000a..cdb984f 100644
--- a/class/Parser.php
+++ b/class/Parser.php
@@ -463,6 +463,55 @@ class Parser
}
/**
+ * Parse the content of all Packagist repository
+ *
+ * @param TableUpstream $uptable the table to write to
+ * @param TablePackagist $pktable the table to read from
+ *
+ * @return integer number of parsed line
+ */
+ static public function readPackagist(TableUpstream $uptable, TablePackagist $pktable)
+ {
+ self::log("Packagist search releases");
+ $pk = new PackagistClient();
+
+ $nb = $uptable->delete(array('type'=>'composer', 'channel'=>'packagist'));
+ self::log("Delete $nb packages");
+
+ $tot = 0;
+ foreach($pktable->request(array('ORDER'=>'rpmname')) as $rec) {
+ if ($rep = $pk->getPackage($rec['pkgname'])) {
+ $id = false;
+ if ($rep['stable']) {
+ $id = $uptable->record(
+ 'composer',
+ 'packagist',
+ $rec['rpmname'],
+ $rep['stable'],
+ true
+ );
+ }
+ if ($rep['unstable']) {
+ $id = $uptable->record(
+ 'composer',
+ 'packagist',
+ $rec['rpmname'],
+ $rep['unstable'],
+ false,
+ $rep['state']
+ );
+ }
+ if ($id) {
+ $tot++;
+ }
+ }
+ }
+ self::log("Write $tot packages");
+
+ return $tot;
+ }
+
+ /**
* Parse the content of all PEAR repository
*
* @param TableUpstream $uptable the table to write to