Changeset 7269385


Ignore:
Timestamp:
08/14/14 11:00:46 (4 months ago)
Author:
Kris Moore <kris@…>
Branches:
master, releng/10.0.3, releng/10.1
Children:
864393a, 4c0bcfb5
Parents:
801e204
Message:

Load data on AppInfo? pages quicker, fix loading data for non-pbi
apps (pkgng), some code cleanup

Location:
src-webui/appweb/share/html
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src-webui/appweb/share/html/include/functions.php

    r337281a r7269385  
    11<? 
     2 
     3// Set the error string syscache returns if a particular request 
     4// isn't available 
     5$SCERROR="[ERROR] Information not available"; 
    26 
    37function hideurl($newurl = "") 
     
    105109 
    106110  $cmd="pbi app $pbiorigin"; 
    107   exec("$sc ". escapeshellarg("$cmd name") . " " . escapeshellarg("pkg $jail remote $pbiorigin version") . " " . escapeshellarg("$cmd comment") . " " . escapeshellarg("$cmd confdir"). " " . escapeshellarg("pkg $jail remote $pbiorigin name") . " " . escapeshellarg("pkg $jail remote $pbiorigin version"), $pbiarray); 
     111  exec("$sc ". escapeshellarg("$cmd name") 
     112    . " " . escapeshellarg("pkg $jail remote $pbiorigin version")  
     113    . " " . escapeshellarg("$cmd comment")  
     114    . " " . escapeshellarg("$cmd confdir") 
     115    . " " . escapeshellarg("pkg $jail remote $pbiorigin name")  
     116    . " " . escapeshellarg("pkg $jail remote $pbiorigin version") 
     117    . " " . escapeshellarg("pkg $jail remote $pbiorigin comment") 
     118    , $pbiarray); 
    108119 
    109120  $pbiname = $pbiarray[0]; 
     
    115126  if ( empty($pbiver) or $pbiver == "[ERROR] Information not available" ) 
    116127    $pbiver = $pbiarray[5]; 
     128  if ( empty($pbicomment) or $pbicomment == "[ERROR] Information not available" ) 
     129    $pbicomment = $pbiarray[6]; 
    117130 
    118131  if ( $col == 1 ) 
  • src-webui/appweb/share/html/pages/appinfo.php

    rf15f12b r7269385  
    33function display_app_link($pbilist) 
    44{ 
     5  global $jailName; 
     6  if ( empty($jailName) ) 
     7     $jail="#system"; 
     8  else 
     9     $jail="#" . $jailName; 
     10 
     11 
    512  $rlist = explode(" ", $pbilist); 
    613  $totalCols = 2; 
     
    2734} 
    2835 
    29    if ( empty($_GET['app']) ) 
    30       die("Missing app="); 
    31  
    32    // Get the current work queue status of the dispatcher 
    33    $dStatus = getDispatcherStatus(); 
    34  
    35    $pbiorigin = $_GET['app']; 
    36  
    37    // Load the PBI details page 
    38    $cmd="pbi app $pbiorigin"; 
    39    exec("$sc ". escapeshellarg("$cmd name") . " " . escapeshellarg("pkg #system local $pbiorigin version") . " " . escapeshellarg("$cmd author") . " " . escapeshellarg("$cmd website") . " " . escapeshellarg("$cmd comment") . " " . escapeshellarg("$cmd confdir") . " " . escapeshellarg("$cmd description") . " " . escapeshellarg("$cmd screenshots"), $pbiarray); 
     36  // Start the main script now 
     37  if ( empty($_GET['app']) ) 
     38     die("Missing app="); 
     39 
     40  if ( empty($jailName) ) 
     41     $jail="#system"; 
     42  else 
     43     $jail="#" . $jailName; 
     44 
     45  // Get the current work queue status of the dispatcher 
     46  $dStatus = getDispatcherStatus(); 
     47 
     48  $pbiorigin = $_GET['app']; 
     49 
     50  // Check if this app is installed 
     51  $pkgoutput = syscache_ins_pkg_list(); 
     52  $pkglist = explode(", ", $pkgoutput[0]); 
     53  if ( array_search($pbiorigin, $pkglist) !== false) 
     54     $pbiinstalled=true; 
     55  else 
     56     $pbiinstalled=false; 
     57 
     58  // If this app is installed, pulled from local repo, otherwise rquery 
     59  if ( $pbiinstalled ) 
     60     $repo="local"; 
     61  else 
     62     $repo="remote"; 
     63 
     64  // Load the PBI details page 
     65  $cmd="pbi app $pbiorigin"; 
     66  exec("$sc ". escapeshellarg("$cmd name")  
     67     . " " . escapeshellarg("pkg $jail $repo $pbiorigin version")  
     68     . " " . escapeshellarg("$cmd author") 
     69     . " " . escapeshellarg("$cmd website")  
     70     . " " . escapeshellarg("$cmd comment") 
     71     . " " . escapeshellarg("$cmd confdir") 
     72     . " " . escapeshellarg("$cmd description") 
     73     . " " . escapeshellarg("pkg $jail $repo $pbiorigin name") 
     74     , $pbiarray); 
    4075 
    4176  $pbiname = $pbiarray[0]; 
     
    4681  $pbicdir = $pbiarray[5]; 
    4782  $pbidesc = $pbiarray[6]; 
    48   $pbiss = $pbiarray[7]; 
    49  
    50   // Get second tier data 
    51   $cmd="pbi app $pbiorigin"; 
    52   unset($pbiarray); 
    53   exec("$sc ". escapeshellarg("$cmd license") . " " . escapeshellarg("$cmd type") . " " . escapeshellarg("$cmd tags") . " " . escapeshellarg("$cmd relatedapps") . " " . escapeshellarg("$cmd plugins") . " " . escapeshellarg("$cmd options") . " " . escapeshellarg("$cmd rating"), $pbiarray); 
    54   $pbilicense = $pbiarray[0]; 
    55   $pbitype = $pbiarray[1]; 
    56   $pbitags = $pbiarray[2]; 
    57   $pbirelated = $pbiarray[3]; 
    58   $pbiplugins = $pbiarray[4]; 
    59   $pbioptions = $pbiarray[5]; 
    60   $pbirating = $pbiarray[6]; 
    61  
    62   if ( empty($pbiname) ) 
    63   { 
    64     exec("$sc " . escapeshellarg("pkg #system local $pbiorigin name"), $pkgarray); 
    65     $pbiname = $pkgarray[0]; 
     83 
     84  if ( empty($pbiname) or $pbiname == "$SCERROR" ) { 
     85     $isPBI = false; 
     86     $pbiname = $pbiarray[7]; 
     87  } else { 
     88     $isPBI = true; 
    6689  } 
    6790 
     
    6992    die("No such app: $pbi"); 
    7093 
    71   // Check if this app is installed 
    72   $pkgoutput = syscache_ins_pkg_list(); 
    73   $pkglist = explode(", ", $pkgoutput[0]); 
    74   if ( array_search($pbiorigin, $pkglist) !== false) 
    75      $pbiinstalled=true; 
    76   else 
    77      $pbiinstalled=false; 
    78  
    79   // If the application is not installed, we need to fetch some stuff from rquery 
    80   if ( ! $pbiinstalled ) 
    81   { 
    82     exec("$sc " . escapeshellarg("pkg #system remote $pbiorigin version"), $pkgarray); 
    83     $pbiver = $pkgarray[0]; 
     94  if ( $isPBI ) { 
     95    // Get second tier PBI data 
     96    $cmd="pbi app $pbiorigin"; 
     97    unset($pbiarray); 
     98    exec("$sc ". escapeshellarg("$cmd license")  
     99      . " " . escapeshellarg("$cmd type")  
     100      . " " . escapeshellarg("$cmd tags")  
     101      . " " . escapeshellarg("$cmd relatedapps")  
     102      . " " . escapeshellarg("$cmd plugins")  
     103      . " " . escapeshellarg("$cmd options")  
     104      . " " . escapeshellarg("$cmd rating") 
     105     . " " . escapeshellarg("$cmd screenshots") 
     106      , $pbiarray); 
     107    $pbilicense = $pbiarray[0]; 
     108    $pbitype = $pbiarray[1]; 
     109    $pbitags = $pbiarray[2]; 
     110    $pbirelated = $pbiarray[3]; 
     111    $pbiplugins = $pbiarray[4]; 
     112    $pbioptions = $pbiarray[5]; 
     113    $pbirating = $pbiarray[6]; 
     114    $pbiss = $pbiarray[7]; 
     115 
     116  } else { 
     117 
     118    // Not a PBI, fallback to loading data from PKGNG 
     119    exec("$sc ". escapeshellarg("pkg $jail $repo $pbiorigin maintainer")  
     120       . " " . escapeshellarg("pkg $jail $repo $pbiorigin website") 
     121       . " " . escapeshellarg("pkg $jail $repo $pbiorigin comment") 
     122       . " " . escapeshellarg("pkg $jail $repo $pbiorigin description") 
     123       , $pkgarray); 
     124    $pbiauth = $pkgarray[0]; 
     125    $pbiweb = $pkgarray[1]; 
     126    $pbicomment = $pkgarray[2]; 
     127    $pbidesc = $pkgarray[3]; 
     128 
    84129  } 
    85130 
     
    114159    </td> 
    115160  </tr> 
     161 
     162<? if ( $isPBI) { ?> 
     163 
    116164  <tr> 
    117165    <td colspan="2"> 
     
    168216    </td> 
    169217  </tr> 
     218 
     219<? } ?> 
     220 
    170221</table> 
    171222 
Note: See TracChangeset for help on using the changeset viewer.