Permalink
Browse files

lightweight app history

  • Loading branch information...
1 parent 2e33b8b commit cf07e4a35ae9f9c26c6f7607078ee95090b3fa5c @feri feri committed Mar 19, 2012
Showing with 23 additions and 22 deletions.
  1. +23 −22 controllers/content.php
View
@@ -314,6 +314,7 @@ public function get_data(array $args)
$packageids = array();
$localpackages = array();
$packages = $q->list_objects();
+ $done = array();
foreach ($packages as $package)
{
@@ -457,31 +458,31 @@ public function get_data(array $args)
}
}
- //get history
- $args = array(
- 'os' => $package->repoos,
- 'version' => $package->repoosversion,
- 'ux' => $package->repoosux,
- 'packagename' => $package->packagename
- );
-
- $package->history = null;
-
- // set $this->data['packages']
- com_meego_packages_controllers_application::get_history($args);
-
- if ( array_key_exists('packages', $this->data)
- && is_array($this->data['packages'][$package->packagename]['all'])
- && count($this->data['packages'][$package->packagename]['all']))
+ if ($package->packagename != '')
{
- $packagehistory = array();
+ //get history
+ $args = array(
+ 'os' => $package->repoos,
+ 'version' => $package->repoosversion,
+ 'ux' => $package->repoosux,
+ 'packagename' => $package->packagename
+ );
- foreach ($this->data['packages'][$package->packagename]['all'] as $item)
+ if (! isset($done[$package->packagename]))
{
- $packagehistory[$item['type']][$item['released'] . ':' . $item['version']] = $item['packageid'];
+ $packagehistory = com_meego_packages_controllers_application::get_lightweight_history($args);
+ if (count($packagehistory))
+ {
+ $package->history = serialize($packagehistory);
+ $done[$package->packagename] = $package->history;
+ //die;
+ }
+ }
+ else
+ {
+ // just copy the history
+ $package->history = $done[$package->packagename];
}
-
- $package->history = serialize($packagehistory);
}
$localpackages[] = $package;
@@ -491,7 +492,7 @@ public function get_data(array $args)
// write the xml content
$ocs->writeMeta($total, $this->pagesize);
$ocs->writeContent(array_values($localpackages));
- unset($packageids, $localpackages);
+ unset($done, $packageids, $localpackages);
}
else
{

0 comments on commit cf07e4a

Please sign in to comment.