From e5950fc6b15e8010ec8f9bb3152d781eeaea757e Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 15 Apr 2008 10:11:57 +0000 Subject: [PATCH] Upated Workstation Startup -Fetch available kernel from si server git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10454 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../systems/goto/class_workstationStartup.inc | 86 ++++++++++++------- .../admin/systems/goto/workstationStartup.tpl | 2 +- 2 files changed, 57 insertions(+), 31 deletions(-) diff --git a/gosa-plugins/goto/admin/systems/goto/class_workstationStartup.inc b/gosa-plugins/goto/admin/systems/goto/class_workstationStartup.inc index 4bc7db796..ff5eb0c09 100644 --- a/gosa-plugins/goto/admin/systems/goto/class_workstationStartup.inc +++ b/gosa-plugins/goto/admin/systems/goto/class_workstationStartup.inc @@ -261,35 +261,35 @@ class workstartup extends plugin } } - /* Get list of boot kernels */ - if (isset($this->config->data['TABS'])){ - $command= $this->config->search(get_class($this), "KERNELS",array('tabs')); - if (!check_command($command)){ - $message[]= sprintf(_("Command '%s', specified as KERNELS hook for plugin '%s' doesn't seem to exist."), $command, - get_class($this)); - } else { - $fh= popen($command, "r"); - while (!feof($fh)) { - $buffer= trim(fgets($fh, 256)); - if(!empty($buffer)){ - $name=$value = $buffer; - if(preg_match("/:/",$buffer)){ - $name = preg_replace("/:.*$/","",$buffer); - $value= preg_replace("/^.*:/","",$buffer); - $this->gotoBootKernels[$name]= $name.":".$value; - }else{ - $this->gotoBootKernels[$name]= $value; - } - } - } - pclose($fh); - } - } - - /* Turn to default, if we've nothing to inherit */ - if (!isset($this->gotoBootKernels['default-inherited']) && $this->gotoBootKernel == "default-inherited"){ - $this->gotoBootKernel= "default"; - } +# /* Get list of boot kernels */ +# if (isset($this->config->data['TABS'])){ +# $command= $this->config->search(get_class($this), "KERNELS",array('tabs')); +# if (!check_command($command)){ +# $message[]= sprintf(_("Command '%s', specified as KERNELS hook for plugin '%s' doesn't seem to exist."), $command, +# get_class($this)); +# } else { +# $fh= popen($command, "r"); +# while (!feof($fh)) { +# $buffer= trim(fgets($fh, 256)); +# if(!empty($buffer)){ +# $name=$value = $buffer; +# if(preg_match("/:/",$buffer)){ +# $name = preg_replace("/:.*$/","",$buffer); +# $value= preg_replace("/^.*:/","",$buffer); +# $this->gotoBootKernels[$name]= $name.":".$value; +# }else{ +# $this->gotoBootKernels[$name]= $value; +# } +# } +# } +# pclose($fh); +# } +# } +# +# /* Turn to default, if we've nothing to inherit */ +# if (!isset($this->gotoBootKernels['default-inherited']) && $this->gotoBootKernel == "default-inherited"){ +# $this->gotoBootKernel= "default"; +# } } @@ -623,6 +623,16 @@ class workstartup extends plugin $smarty->assign("FAIrelease" , $this->FAIrelease); $smarty->assign("FAIclasses" , $this->selectable_classes()); + /* Get classes for release from cache. + * Or build cache + */ + if($this->FAIdebianMirror == "inherited"){ + $release = $this->InheritedFAIrelease; + }else{ + $release = $this->FAIrelease; + } + + $smarty->assign("gotoBootKernels",$this->cache['KERNELS'][$release]); $smarty->assign("InheritedFAIrelease",$this->InheritedFAIrelease); $div = new divSelectBox("WSFAIscriptClasses"); @@ -1182,7 +1192,23 @@ class workstartup extends plugin } } } -# echo sprintf("Took %.6f
",microtime(1) - $start); + + /* Get list of available kernel for this release + */ + if($force || !isset($this->cache['KERNELS'][$release])){ + $o_queue = new gosaSupportDaemon(); + $tmp = $o_queue->FAI_get_kernels($release); + $this->cache['KERNELS'][$release] = array(); + + foreach($this->gotoBootKernels as $name => $default){ + $this->cache['KERNELS'][$release][$name] = $default; + } + + foreach($tmp as $kernel){ + if(empty($kernel)) continue; + $this->cache['KERNELS'][$release][$kernel]=$kernel; + } + } } diff --git a/gosa-plugins/goto/admin/systems/goto/workstationStartup.tpl b/gosa-plugins/goto/admin/systems/goto/workstationStartup.tpl index 60fee23be..e50e8a402 100644 --- a/gosa-plugins/goto/admin/systems/goto/workstationStartup.tpl +++ b/gosa-plugins/goto/admin/systems/goto/workstationStartup.tpl @@ -10,7 +10,7 @@ {render acl=$gotoBootKernelACL} + {/render} -- 2.30.2