mirror of
https://github.com/optim-enterprises-bv/control-pane.git
synced 2025-11-01 02:17:52 +00:00
@@ -1,105 +1,86 @@
|
|||||||
<?php
|
<?php
|
||||||
$html='';
|
|
||||||
|
|
||||||
$db=new Db('base','nodes');
|
$db = new Db('base','nodes');
|
||||||
$nodes=$db->select('select nodename,ip from nodelist order by nodename desc', []);
|
$nodes = $db->select('select nodename,ip from nodelist order by nodename desc', []);
|
||||||
$nodes[]=array('nodename'=>'local');
|
$nodes[] = ['nodename'=>'local'];
|
||||||
$nodes=array_reverse($nodes);
|
$nodes = array_reverse($nodes);
|
||||||
|
|
||||||
$ids=array();
|
$ids = [];
|
||||||
$nth=0;
|
$nth = 0;
|
||||||
$hres=$this->getTableChunk('srcslist','tbody');
|
$html = '';
|
||||||
if(!empty($nodes))foreach($nodes as $node)
|
$html_tpl = '';
|
||||||
{
|
|
||||||
$db1=new Db('base',$node['nodename']);
|
$hres = $this->getTableChunk('srcslist','tbody');
|
||||||
if($db1!==false)
|
$hres_set = ($hres !== false);
|
||||||
{
|
|
||||||
$bases=$db1->select("SELECT idx,name,platform,ver,rev,date FROM bsdsrc ORDER BY CAST(ver AS int)", []);
|
foreach($nodes as $node){
|
||||||
|
|
||||||
$num=$nth & 1;
|
$db1 = new Db('base', $node['nodename']);
|
||||||
if(!empty($bases)) foreach($bases as $base)
|
if($db1->error !== false){
|
||||||
{
|
|
||||||
$idle=1;
|
$bases = $db1->select("SELECT idx,name,platform,ver,rev,date FROM bsdsrc ORDER BY CAST(ver AS int)", []);
|
||||||
//print_r($node);exit;
|
$num = $nth & 1;
|
||||||
if($node['nodename']!='local')
|
|
||||||
{
|
foreach($bases as $base){
|
||||||
$idle=$this->check_locktime($node['ip']);
|
$idle = 1;
|
||||||
|
if($node['nodename'] != 'local'){
|
||||||
|
$idle = $this->check_locktime($node['ip']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($hres!==false)
|
if($hres_set){
|
||||||
{
|
$html_tpl = $hres[1];
|
||||||
$html_tpl=$hres[1];
|
$vers = (preg_match('#\.\d#',$base['ver']))?'release':'stable';
|
||||||
$vers=(preg_match('#\.\d#',$base['ver']))?'release':'stable';
|
$vars = [
|
||||||
$vars=array(
|
'nth-num' => 'nth'.$num,
|
||||||
'nth-num'=>'nth'.$num,
|
'node' => $node['nodename'],
|
||||||
'node'=>$node['nodename'],
|
'name' => $base['name'],
|
||||||
'name'=>$base['name'],
|
'platform' => $base['platform'],
|
||||||
'platform'=>$base['platform'],
|
'version' => $base['ver'],
|
||||||
'version'=>$base['ver'],
|
'version1' => $vers,
|
||||||
'version1'=>$vers,
|
'rev' => $base['rev'],
|
||||||
'rev'=>$base['rev'],
|
'date' => $base['date'],
|
||||||
'date'=>$base['date'],
|
'jstatus' => '',
|
||||||
'jstatus'=>'',
|
'icon' => '',
|
||||||
'icon'=>'',
|
'maintenance' => ($idle==0) ? ' maintenance' : '',
|
||||||
'maintenance'=>($idle==0)?' maintenance':'',
|
'deltitle' => $this->translate('Delete'),
|
||||||
'deltitle'=>$this->translate('Delete'),
|
'updtitle' => $this->translate('Update')
|
||||||
'updtitle'=>$this->translate('Update'),
|
];
|
||||||
);
|
|
||||||
|
foreach($vars as $var => $val){
|
||||||
foreach($vars as $var=>$val)
|
$html_tpl = str_replace('#'.$var.'#', $val, $html_tpl);
|
||||||
$html_tpl=str_replace('#'.$var.'#',$val,$html_tpl);
|
}
|
||||||
|
$html .= $html_tpl;
|
||||||
$html.=$html_tpl;
|
|
||||||
}
|
}
|
||||||
$ids[]='#src'.$base['ver'];
|
$ids[] = '#src'.$base['ver'];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$nth++;
|
$nth++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$html=str_replace(array("\n","\r","\t"),'',$html);
|
if(!empty($ids)){
|
||||||
|
$tasks = $this->getRunningTasks($ids);
|
||||||
|
$html_tpl = str_replace(["\n","\r","\t"], '', $hres[1]);
|
||||||
|
$vars = [
|
||||||
|
'nth-num' => 'nth0',
|
||||||
|
'status' => '',
|
||||||
|
'jstatus' => $this->translate('Updating'),
|
||||||
|
//'icon' => 'spin6 animate-spin',
|
||||||
|
'desktop' => ' s-off',
|
||||||
|
'maintenance' => ' maintenance busy',
|
||||||
|
'updtitle' => $this->translate('Update'),
|
||||||
|
'deltitle' => $this->translate('Delete')
|
||||||
|
];
|
||||||
|
|
||||||
$tasks='';
|
foreach($vars as $var => $val) {
|
||||||
if(!empty($ids))
|
$html_tpl = str_replace('#'.$var.'#', $val, $html_tpl);
|
||||||
{
|
}
|
||||||
$tasks=$this->getRunningTasks($ids);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$html_tpl=str_replace(array("\n","\r","\t"),'',$hres[1]);
|
$included_result_array = [
|
||||||
if($hres!==false)
|
'tbody' => str_replace(["\n","\r","\t"], '', $html),
|
||||||
{
|
'error' => false,
|
||||||
$vars=array(
|
'func' => 'fillTable',
|
||||||
'nth-num'=>'nth0',
|
'id' => 'srcslist',
|
||||||
'status'=>'',
|
'tasks' => $tasks,
|
||||||
'jstatus'=>$this->translate('Updating'),
|
'template' => $html_tpl
|
||||||
//'icon'=>'spin6 animate-spin',
|
];
|
||||||
'desktop'=>' s-off',
|
|
||||||
'maintenance'=>' maintenance busy',
|
|
||||||
'updtitle'=>$this->translate('Update'),
|
|
||||||
'deltitle'=>$this->translate('Delete'),
|
|
||||||
);
|
|
||||||
|
|
||||||
foreach($vars as $var=>$val)
|
|
||||||
$html_tpl=str_replace('#'.$var.'#',$val,$html_tpl);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
echo json_encode(array(
|
|
||||||
'tbody'=>$html,
|
|
||||||
'error'=>false,
|
|
||||||
'func'=>'fillTable',
|
|
||||||
'id'=>'srcslist',
|
|
||||||
'tasks'=>$tasks,
|
|
||||||
'template'=>$html_tpl,
|
|
||||||
));
|
|
||||||
*/
|
|
||||||
$included_result_array=array(
|
|
||||||
'tbody'=>$html,
|
|
||||||
'error'=>false,
|
|
||||||
'func'=>'fillTable',
|
|
||||||
'id'=>'srcslist',
|
|
||||||
'tasks'=>$tasks,
|
|
||||||
'template'=>$html_tpl,
|
|
||||||
);
|
|
||||||
Reference in New Issue
Block a user