summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--class/CommonTable.php8
-rw-r--r--class/TableIterator.php1
-rw-r--r--class/TablePearRepo.php67
-rw-r--r--class/TableRRepo.php9
-rw-r--r--refresh.php4
5 files changed, 66 insertions, 23 deletions
diff --git a/class/CommonTable.php b/class/CommonTable.php
index e049188..8fd0471 100644
--- a/class/CommonTable.php
+++ b/class/CommonTable.php
@@ -194,13 +194,15 @@ abstract class CommonTable
*
* @param string $fieldkey name of the field to use as index
* @param string $fieldvalue name of the field to use as value
+ * @param array $crit for request
*
* @return hashtable
*/
- public function getHashtable($fieldkey, $fieldvalue)
+ public function getHashtable($fieldkey, $fieldvalue, array $crit=array())
{
- $crit = array('FIELDS' => array($fieldkey, $fieldvalue),
- 'ORDER' => $fieldkey);
+ $crit['FIELDS'] = array($fieldkey, $fieldvalue);
+ $crit['ORDER'] = $fieldkey;
+
$tab = array();
foreach ($this->request($crit) as $data) {
$tab[$data[$fieldkey]] = $data[$fieldvalue];
diff --git a/class/TableIterator.php b/class/TableIterator.php
index 5c42d24..0903f37 100644
--- a/class/TableIterator.php
+++ b/class/TableIterator.php
@@ -115,7 +115,6 @@ class TableIterator implements Iterator
}
// WHERE criteria list
if (!empty($crit)) {
- print_r($crit);
$this->sql .= " WHERE ".$this->_analyseCrit($crit);
}
// ORDER BY
diff --git a/class/TablePearRepo.php b/class/TablePearRepo.php
index 6ff3eaa..34a0c17 100644
--- a/class/TablePearRepo.php
+++ b/class/TablePearRepo.php
@@ -58,38 +58,77 @@ class TablePearRepo extends CommonTable
`id` int(11) NOT NULL AUTO_INCREMENT,
`alias` varchar(30) NOT NULL,
`url` varchar(255) NOT NULL,
+ `active` tinyint NOT NULL default 1,
PRIMARY KEY (`id`),
- UNIQUE KEY `alias` (`alias`)
+ UNIQUE KEY `alias` (`alias`),
+ KEY `active` (`active`)
) DEFAULT CHARSET=utf8";
$this->exec($sql);
// Some known repo, other could be add manually
- // no reply from "phpdb" => "pear.phpdb.org"
+ // no reply from "" => ""
$channels = array(
- "pear" => "pear.php.net"
- ,"doctrine" => "pear.phpdoctrine.org"
- ,"ezc" => "components.ez.no"
- ,"pdepend" => "pear.pdepend.org"
- ,"phing" => "pear.phing.info"
- ,"phpmd" => "pear.phpmd.org"
- ,"phpunit" => "pear.phpunit.de"
- ,"swift" => "pear.swiftmailer.org"
- ,"symphony" => "pear.symfony-project.com"
+ array(
+ 'alias' => 'pear',
+ 'url' => 'pear.php.net'
+ ),
+ array(
+ 'alias' => 'doctrine',
+ 'url' => 'pear.phpdoctrine.org'
+ ),
+ array(
+ 'alias' => 'ezc',
+ 'url' => 'components.ez.no'
+ ),
+ array(
+ 'alias' => 'pdepend',
+ 'url' => 'pear.pdepend.org'
+ ),
+ array(
+ 'alias' => 'phing',
+ 'url' => 'pear.phing.info'
+ ),
+ array(
+ 'alias' => 'phpmd',
+ 'url' => 'pear.phpmd.org'
+ ),
+ array(
+ 'alias' => 'phpunit',
+ 'url' => 'pear.phpunit.de'
+ ),
+ array(
+ 'alias' => 'swift',
+ 'url' => 'pear.swiftmailer.org'
+ ),
+ array(
+ 'alias' => 'symphony',
+ 'url' => 'pear.symfony-project.com'
+ ),
+ array(
+ 'alias' => 'phpdb',
+ 'active' => 0,
+ 'url' => 'pear.phpdb.org'
+ )
);
- foreach ($channels as $alias => $url) {
- $this->add(array('alias'=>$alias, 'url'=>$url));
+ foreach ($channels as $channel) {
+ $this->add($channel);
}
}
/**
* Retrieve all the known repository
*
+ * @param boolean $active true for only active repo (false for all)
+ *
* @return hastable of alias => url
*/
- function getAllRepo()
+ function getAllRepo($active=true)
{
+ if ($active) {
+ return $this->getHashtable('alias', 'url', array('active'=>1));
+ }
return $this->getHashtable('alias', 'url');
}
}
diff --git a/class/TableRRepo.php b/class/TableRRepo.php
index 75570c3..884b4e3 100644
--- a/class/TableRRepo.php
+++ b/class/TableRRepo.php
@@ -61,7 +61,8 @@ class TableRRepo extends CommonTable
`url` varchar(255) NOT NULL,
`active` tinyint NOT NULL default 1,
PRIMARY KEY (`id`),
- UNIQUE KEY `name_state` (`name`,`state`)
+ UNIQUE KEY `name_state` (`name`,`state`),
+ KEY `active` (`active`)
) DEFAULT CHARSET=utf8";
$this->exec($sql);
@@ -109,11 +110,13 @@ class TableRRepo extends CommonTable
/**
* Retrieve all the known repository
*
+ * @param boolean $active true for only active repo (false for all)
+ *
* @return hastable of alias => url
*/
- function getAllRepo()
+ function getAllRepo($active=true)
{
- return $this->getArray(array('active'=>1));
+ return $this->getArray($active ? array('active'=>1) : '');
}
}
diff --git a/refresh.php b/refresh.php
index 7547883..e839e93 100644
--- a/refresh.php
+++ b/refresh.php
@@ -510,8 +510,8 @@ try {
if ($_SERVER['argc']==1 || in_array('R', $_SERVER['argv'])) {
//
$tottot=0;
- $pear = new TableRRepo($db);
- foreach ($pear->request() as $repo) {
+ $rrepo = new TableRRepo($db);
+ foreach ($rrepo->request() as $repo) {
echo date("r : ") . "Reading " . $repo["name"] . " (" .
$repo["state"] . ")\n";
$index = @file_get_contents($repo["url"]);