2001-07-30 17:59:25 +02:00
|
|
|
<?php
|
2008-08-20 08:04:28 +02:00
|
|
|
/**
|
|
|
|
* eGroupware Setup - Install, update & remove single apps
|
|
|
|
*
|
|
|
|
* @link http://www.egroupware.org
|
|
|
|
* @package setup
|
|
|
|
* @author Miles Lott <milos@groupwhere.org>
|
|
|
|
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
|
|
|
* @version $Id$
|
|
|
|
*/
|
|
|
|
|
2016-03-05 15:02:13 +01:00
|
|
|
use EGroupware\Api;
|
|
|
|
|
2008-08-20 08:04:28 +02:00
|
|
|
$DEBUG = @$_POST['debug'] || @$_GET['debug'];
|
|
|
|
/*
|
|
|
|
TODO: We allow a user to hose their setup here, need to make use
|
|
|
|
of dependencies so they are warned that they are pulling the rug
|
|
|
|
out from under other apps. e.g. if they select to uninstall the api
|
|
|
|
this will happen without further warning.
|
|
|
|
*/
|
|
|
|
|
|
|
|
include ('./inc/functions.inc.php');
|
|
|
|
|
|
|
|
@set_time_limit(0);
|
|
|
|
|
|
|
|
// Check header and authentication
|
|
|
|
if (!$GLOBALS['egw_setup']->auth('Config'))
|
|
|
|
{
|
|
|
|
Header('Location: index.php');
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
// Does not return unless user is authorized
|
|
|
|
|
|
|
|
$tpl_root = $GLOBALS['egw_setup']->html->setup_tpl_dir('setup');
|
2016-03-05 15:02:13 +01:00
|
|
|
$setup_tpl = new Template($tpl_root);
|
2008-08-20 08:04:28 +02:00
|
|
|
$setup_tpl->set_file(array(
|
|
|
|
'T_head' => 'head.tpl',
|
|
|
|
'T_footer' => 'footer.tpl',
|
|
|
|
'T_alert_msg' => 'msg_alert_msg.tpl',
|
|
|
|
'T_login_main' => 'login_main.tpl',
|
|
|
|
'T_login_stage_header' => 'login_stage_header.tpl',
|
|
|
|
'T_setup_main' => 'applications.tpl'
|
|
|
|
));
|
2016-04-05 18:21:23 +02:00
|
|
|
$setup_tpl->set_var('hidden_vars', Api\Html::input_hidden('csrf_token', Api\Csrf::token(__FILE__)));
|
2014-05-01 08:26:09 +02:00
|
|
|
|
|
|
|
// check CSRF token for POST requests with any content (setup uses empty POST to call it's modules!)
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST)
|
|
|
|
{
|
2016-03-05 15:02:13 +01:00
|
|
|
Api\Csrf::validate($_POST['csrf_token'], __FILE__);
|
2014-05-01 08:26:09 +02:00
|
|
|
}
|
2008-08-20 08:04:28 +02:00
|
|
|
|
|
|
|
$setup_tpl->set_block('T_login_stage_header','B_multi_domain','V_multi_domain');
|
|
|
|
$setup_tpl->set_block('T_login_stage_header','B_single_domain','V_single_domain');
|
|
|
|
$setup_tpl->set_block('T_setup_main','header','header');
|
|
|
|
$setup_tpl->set_block('T_setup_main','app_header','app_header');
|
|
|
|
$setup_tpl->set_block('T_setup_main','apps','apps');
|
|
|
|
$setup_tpl->set_block('T_setup_main','detail','detail');
|
|
|
|
$setup_tpl->set_block('T_setup_main','table','table');
|
|
|
|
$setup_tpl->set_block('T_setup_main','hook','hook');
|
|
|
|
$setup_tpl->set_block('T_setup_main','dep','dep');
|
|
|
|
$setup_tpl->set_block('T_setup_main','app_footer','app_footer');
|
|
|
|
$setup_tpl->set_block('T_setup_main','submit','submit');
|
|
|
|
$setup_tpl->set_block('T_setup_main','footer','footer');
|
|
|
|
|
|
|
|
$bgcolor = array('#DDDDDD','#EEEEEE');
|
|
|
|
|
|
|
|
function parsedep($depends,$main=True)
|
|
|
|
{
|
|
|
|
$depstring = '(';
|
2016-04-02 21:55:08 +02:00
|
|
|
foreach($depends as $b)
|
2001-12-18 03:20:31 +01:00
|
|
|
{
|
2008-08-20 08:04:28 +02:00
|
|
|
foreach($b as $c => $d)
|
2001-07-30 17:59:25 +02:00
|
|
|
{
|
2008-08-20 08:04:28 +02:00
|
|
|
if (is_array($d))
|
2001-07-30 17:59:25 +02:00
|
|
|
{
|
2008-08-20 08:04:28 +02:00
|
|
|
$depstring .= $c . ': ' .implode(',',$d) . '; ';
|
|
|
|
$depver[] = $d;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$depstring .= $c . ': ' . $d . '; ';
|
|
|
|
$depapp[] = $d;
|
2001-07-30 17:59:25 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-08-20 08:04:28 +02:00
|
|
|
$depstring .= ')';
|
|
|
|
if ($main)
|
2001-07-30 17:59:25 +02:00
|
|
|
{
|
2008-08-20 08:04:28 +02:00
|
|
|
return $depstring;
|
2001-07-30 17:59:25 +02:00
|
|
|
}
|
2008-08-20 08:04:28 +02:00
|
|
|
else
|
2001-07-30 17:59:25 +02:00
|
|
|
{
|
2008-08-20 08:04:28 +02:00
|
|
|
return array($depapp,$depver);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$GLOBALS['egw_setup']->loaddb();
|
|
|
|
$GLOBALS['egw_info']['setup']['stage']['db'] = $GLOBALS['egw_setup']->detection->check_db();
|
|
|
|
|
2016-04-02 21:55:08 +02:00
|
|
|
$setup_info = $GLOBALS['egw_setup']->detection->check_depends(
|
|
|
|
$GLOBALS['egw_setup']->detection->compare_versions(
|
|
|
|
$GLOBALS['egw_setup']->detection->get_db_versions(
|
|
|
|
$GLOBALS['egw_setup']->detection->get_versions())));
|
|
|
|
|
2008-08-20 08:04:28 +02:00
|
|
|
@ksort($setup_info);
|
|
|
|
|
|
|
|
if(@get_var('cancel',Array('POST')))
|
|
|
|
{
|
|
|
|
Header("Location: index.php");
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(@get_var('submit',Array('POST')))
|
|
|
|
{
|
|
|
|
$GLOBALS['egw_setup']->html->show_header(lang('Application Management'),False,'config',$GLOBALS['egw_setup']->ConfigDomain . '(' . $GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_type'] . ')');
|
|
|
|
$setup_tpl->set_var('description',lang('App install/remove/upgrade') . ':');
|
|
|
|
$setup_tpl->pparse('out','header');
|
|
|
|
|
|
|
|
$appname = get_var('appname',Array('POST'));
|
|
|
|
$remove = get_var('remove',Array('POST'));
|
|
|
|
$install = get_var('install',Array('POST'));
|
|
|
|
$upgrade = get_var('upgrade',Array('POST'));
|
|
|
|
|
2016-04-05 18:21:23 +02:00
|
|
|
$register_hooks = false;
|
|
|
|
|
2008-08-20 08:04:28 +02:00
|
|
|
if(!empty($remove) && is_array($remove))
|
|
|
|
{
|
2016-04-05 18:21:23 +02:00
|
|
|
$historylog = new Api\Storage\History();
|
2008-08-20 08:04:28 +02:00
|
|
|
$historylog->db = $GLOBALS['egw_setup']->db;
|
|
|
|
|
|
|
|
foreach($remove as $appname => $key)
|
2001-07-30 17:59:25 +02:00
|
|
|
{
|
2008-08-20 08:04:28 +02:00
|
|
|
$app_title = $setup_info[$appname]['title'] ? $setup_info[$appname]['title'] : $setup_info[$appname]['name'];
|
|
|
|
$terror = array();
|
2009-05-28 13:33:30 +02:00
|
|
|
$terror[$appname] = $setup_info[$appname];
|
2003-09-23 01:48:28 +02:00
|
|
|
|
2008-08-20 08:04:28 +02:00
|
|
|
if ($setup_info[$appname]['tables'])
|
2001-07-30 17:59:25 +02:00
|
|
|
{
|
2008-08-20 08:04:28 +02:00
|
|
|
$GLOBALS['egw_setup']->process->droptables($terror,$DEBUG);
|
|
|
|
echo '<br />' . $app_title . ' ' . lang('tables dropped') . '.';
|
|
|
|
}
|
2003-08-28 16:31:11 +02:00
|
|
|
|
2008-08-20 08:04:28 +02:00
|
|
|
$GLOBALS['egw_setup']->deregister_app($setup_info[$appname]['name']);
|
|
|
|
echo '<br />' . $app_title . ' ' . lang('deregistered') . '.';
|
2003-09-23 01:48:28 +02:00
|
|
|
|
2016-04-05 18:21:23 +02:00
|
|
|
$register_hooks = true;
|
2003-12-29 22:12:37 +01:00
|
|
|
|
2013-01-14 21:25:37 +01:00
|
|
|
$historylog->appname = $appname;
|
|
|
|
if ($historylog->delete(null))
|
2008-08-20 08:04:28 +02:00
|
|
|
{
|
|
|
|
echo '<br />' . $app_title . ' ' . lang('Historylog removed') . '.';
|
2003-08-28 16:31:11 +02:00
|
|
|
}
|
2008-08-20 08:04:28 +02:00
|
|
|
|
|
|
|
// delete all application categories and ACL
|
|
|
|
$GLOBALS['egw_setup']->db->delete($GLOBALS['egw_setup']->cats_table,array('cat_appname' => $appname),__LINE__,__FILE__);
|
|
|
|
$GLOBALS['egw_setup']->db->delete($GLOBALS['egw_setup']->acl_table,array('acl_appname' => $appname),__LINE__,__FILE__);
|
2001-07-30 17:59:25 +02:00
|
|
|
}
|
2008-08-20 08:04:28 +02:00
|
|
|
}
|
2001-07-30 17:59:25 +02:00
|
|
|
|
2008-08-20 08:04:28 +02:00
|
|
|
if(!empty($install) && is_array($install))
|
|
|
|
{
|
|
|
|
foreach($install as $appname => $key)
|
2001-07-30 17:59:25 +02:00
|
|
|
{
|
2008-08-20 08:04:28 +02:00
|
|
|
$app_title = $setup_info[$appname]['title'] ? $setup_info[$appname]['title'] : $setup_info[$appname]['name'];
|
|
|
|
$terror = array();
|
2009-05-28 13:33:30 +02:00
|
|
|
$terror[$appname] = $setup_info[$appname];
|
2003-08-28 16:31:11 +02:00
|
|
|
|
2008-08-20 08:04:28 +02:00
|
|
|
if ($setup_info[$appname]['tables'])
|
|
|
|
{
|
2016-04-02 21:55:08 +02:00
|
|
|
$terror_c = $GLOBALS['egw_setup']->process->current($terror, $DEBUG);
|
|
|
|
$terror = $GLOBALS['egw_setup']->process->default_records($terror_c, $DEBUG);
|
2008-08-20 08:04:28 +02:00
|
|
|
echo '<br />' . $app_title . ' '
|
|
|
|
. lang('tables installed, unless there are errors printed above') . '.';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-05-28 13:33:30 +02:00
|
|
|
// check default_records for apps without tables, they might need some initial work too
|
|
|
|
$terror = $GLOBALS['egw_setup']->process->default_records($terror,$DEBUG);
|
2008-08-20 08:04:28 +02:00
|
|
|
if ($GLOBALS['egw_setup']->app_registered($setup_info[$appname]['name']))
|
2002-01-05 19:12:16 +01:00
|
|
|
{
|
2008-08-20 08:04:28 +02:00
|
|
|
$GLOBALS['egw_setup']->update_app($setup_info[$appname]['name']);
|
2002-01-05 19:12:16 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-08-20 08:04:28 +02:00
|
|
|
$GLOBALS['egw_setup']->register_app($setup_info[$appname]['name']);
|
|
|
|
}
|
|
|
|
echo '<br />' . $app_title . ' ' . lang('registered') . '.';
|
2001-07-30 17:59:25 +02:00
|
|
|
|
2008-08-20 08:04:28 +02:00
|
|
|
if ($setup_info[$appname]['hooks'])
|
|
|
|
{
|
2016-04-05 18:21:23 +02:00
|
|
|
$register_hooks = true;
|
2003-08-28 16:31:11 +02:00
|
|
|
}
|
2001-07-30 17:59:25 +02:00
|
|
|
}
|
|
|
|
}
|
2008-08-20 08:04:28 +02:00
|
|
|
}
|
2001-07-30 17:59:25 +02:00
|
|
|
|
2008-08-20 08:04:28 +02:00
|
|
|
if(!empty($upgrade) && is_array($upgrade))
|
|
|
|
{
|
|
|
|
foreach($upgrade as $appname => $key)
|
2001-07-30 17:59:25 +02:00
|
|
|
{
|
2008-08-20 08:04:28 +02:00
|
|
|
$app_title = $setup_info[$appname]['title'] ? $setup_info[$appname]['title'] : $setup_info[$appname]['name'];
|
|
|
|
$terror = array();
|
2009-05-28 13:33:30 +02:00
|
|
|
$terror[$appname] = $setup_info[$appname];
|
2002-01-05 22:20:52 +01:00
|
|
|
|
2008-08-20 08:04:28 +02:00
|
|
|
$GLOBALS['egw_setup']->process->upgrade($terror,$DEBUG);
|
|
|
|
if ($setup_info[$appname]['tables'])
|
|
|
|
{
|
|
|
|
echo '<br />' . $app_title . ' ' . lang('tables upgraded') . '.';
|
|
|
|
// The process_upgrade() function also handles registration
|
2003-08-28 16:31:11 +02:00
|
|
|
}
|
2008-08-20 08:04:28 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo '<br />' . $app_title . ' ' . lang('upgraded') . '.';
|
|
|
|
}
|
2016-04-05 18:21:23 +02:00
|
|
|
$register_hooks = true;
|
2001-07-30 17:59:25 +02:00
|
|
|
}
|
|
|
|
}
|
2016-04-05 18:21:23 +02:00
|
|
|
|
|
|
|
if ($register_hooks)
|
|
|
|
{
|
|
|
|
Api\Hooks::read(true);
|
|
|
|
echo '<br />' . $app_title . ' ' . lang('hooks registered') . '.';
|
|
|
|
}
|
|
|
|
|
2008-08-20 08:04:28 +02:00
|
|
|
//$setup_tpl->set_var('goback',
|
|
|
|
echo '<br /><a href="applications.php?debug='.$DEBUG.'">' . lang('Go back') . '</a>';
|
|
|
|
//$setup_tpl->pparse('out','submit');
|
|
|
|
$setup_tpl->pparse('out','footer');
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$GLOBALS['egw_setup']->html->show_header(lang('Application Management'),False,'config',$GLOBALS['egw_setup']->ConfigDomain . '(' . $GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_type'] . ')');
|
|
|
|
}
|
|
|
|
|
2011-03-23 17:19:32 +01:00
|
|
|
if(@get_var('hooks', Array('GET')))
|
|
|
|
{
|
2016-04-02 21:55:08 +02:00
|
|
|
Api\Cache::flush(Api\Cache::INSTANCE);
|
2012-10-31 18:17:28 +01:00
|
|
|
|
2016-04-02 21:55:08 +02:00
|
|
|
echo lang('Cached cleared') . '<br />';
|
2011-03-23 17:19:32 +01:00
|
|
|
}
|
2008-08-20 08:04:28 +02:00
|
|
|
$detail = get_var('detail',Array('GET'));
|
|
|
|
$resolve = get_var('resolve',Array('GET'));
|
|
|
|
if(@$detail)
|
|
|
|
{
|
|
|
|
@ksort($setup_info[$detail]);
|
|
|
|
$setup_tpl->set_var('description',lang('App details') . ':');
|
|
|
|
$setup_tpl->pparse('out','header');
|
|
|
|
|
|
|
|
$setup_tpl->set_var('name','application');
|
|
|
|
$setup_tpl->set_var('details', lang($setup_info[$detail]['title']));
|
|
|
|
$setup_tpl->pparse('out','detail');
|
|
|
|
|
|
|
|
foreach($setup_info[$detail] as $key => $val)
|
2001-07-30 17:59:25 +02:00
|
|
|
{
|
2016-04-02 21:55:08 +02:00
|
|
|
switch($key)
|
2003-08-28 16:31:11 +02:00
|
|
|
{
|
2016-04-02 21:55:08 +02:00
|
|
|
case 'title':
|
|
|
|
continue 2;
|
|
|
|
case 'tables':
|
2008-08-20 08:04:28 +02:00
|
|
|
$tblcnt = count($setup_info[$detail][$key]);
|
|
|
|
if(is_array($val))
|
2001-07-30 17:59:25 +02:00
|
|
|
{
|
2008-08-20 08:04:28 +02:00
|
|
|
$key = '<a href="sqltoarray.php?appname=' . $detail . '&submit=True&apps=True">' . $key . '(' . $tblcnt . ')</a>' . "\n";
|
|
|
|
$val = implode(',' . "\n",$val);
|
2001-07-30 17:59:25 +02:00
|
|
|
}
|
2016-04-02 21:55:08 +02:00
|
|
|
break;
|
|
|
|
case 'hooks':
|
|
|
|
foreach($val as &$hooks)
|
|
|
|
{
|
|
|
|
$hooks = (array)$hooks;
|
|
|
|
}
|
|
|
|
$val = str_replace('EGroupware\\', '', implode(', ', call_user_func_array('array_merge', $val)));
|
|
|
|
break;
|
|
|
|
case 'depends':
|
|
|
|
foreach($val as &$dep)
|
|
|
|
{
|
|
|
|
$dep = $dep['appname'].': '.implode(', ', $dep['versions']);
|
|
|
|
}
|
|
|
|
$val = implode('; ', $val);
|
|
|
|
break;
|
|
|
|
case 'check_install':
|
|
|
|
$val = array2string($val);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (is_array($val)) $val = implode(', ', $val);
|
|
|
|
break;
|
2001-07-30 17:59:25 +02:00
|
|
|
}
|
2016-04-02 21:55:08 +02:00
|
|
|
$setup_tpl->set_var('bg_color', $bgcolor[++$i & 1]);
|
|
|
|
$setup_tpl->set_var('name',$key);
|
|
|
|
$setup_tpl->set_var('details',$val);
|
|
|
|
$setup_tpl->pparse('out','detail');
|
2008-08-20 08:04:28 +02:00
|
|
|
}
|
2001-07-30 17:59:25 +02:00
|
|
|
|
2008-08-20 08:04:28 +02:00
|
|
|
echo '<br /><a href="applications.php?debug='.$DEBUG.'">' . lang('Go back') . '</a>';
|
|
|
|
$setup_tpl->pparse('out','footer');
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
elseif (@$resolve)
|
|
|
|
{
|
|
|
|
$version = get_var('version',Array('GET'));
|
|
|
|
$notables = get_var('notables',Array('GET'));
|
|
|
|
$setup_tpl->set_var('description',lang('Problem resolution'). ':');
|
|
|
|
$setup_tpl->pparse('out','header');
|
|
|
|
$app_title = $setup_info[$resolve]['title'] ? $setup_info[$resolve]['title'] : $setup_info[$resolve]['name'];
|
|
|
|
|
|
|
|
if(get_var('post',Array('GET')))
|
|
|
|
{
|
|
|
|
echo '"' . $app_title . '" ' . lang('may be broken') . ' ';
|
|
|
|
echo lang('because an application it depends upon was upgraded');
|
|
|
|
echo '<br />';
|
|
|
|
echo lang('to a version it does not know about') . '.';
|
|
|
|
echo '<br />';
|
|
|
|
echo lang('However, the application may still work') . '.';
|
2001-07-30 17:59:25 +02:00
|
|
|
}
|
2008-08-20 08:04:28 +02:00
|
|
|
elseif(get_var('badinstall',Array('GET')))
|
2001-07-30 17:59:25 +02:00
|
|
|
{
|
2008-08-20 08:04:28 +02:00
|
|
|
echo '"' . $app_title . '" ' . lang('is broken') . ' ';
|
|
|
|
echo lang('because of a failed upgrade or install') . '.';
|
|
|
|
echo '<br />';
|
|
|
|
echo lang('Some or all of its tables are missing') . '.';
|
|
|
|
echo '<br />';
|
|
|
|
echo lang('You should either uninstall and then reinstall it, or attempt manual repairs') . '.';
|
|
|
|
}
|
|
|
|
elseif(get_var('deleted',Array('GET')))
|
|
|
|
{
|
|
|
|
echo '"' . $app_title . '" ' . lang('is broken') . ' ';
|
|
|
|
echo lang('because its sources are missing') . '!';
|
|
|
|
echo '<br />';
|
|
|
|
echo lang('However the tables are still in the database') . '.';
|
|
|
|
echo '<br />';
|
|
|
|
echo lang('You should either install the sources or uninstall it, to get rid of the tables') . '.';
|
|
|
|
}
|
|
|
|
elseif (!$version)
|
|
|
|
{
|
|
|
|
if($setup_info[$resolve]['enabled'])
|
2001-07-30 17:59:25 +02:00
|
|
|
{
|
2004-11-17 14:37:33 +01:00
|
|
|
echo '"' . $app_title . '" ' . lang('is broken') . ' ';
|
2001-07-30 17:59:25 +02:00
|
|
|
}
|
2008-08-20 08:04:28 +02:00
|
|
|
else
|
2007-05-08 11:53:11 +02:00
|
|
|
{
|
2008-08-20 08:04:28 +02:00
|
|
|
echo '"' . $app_title . '" ' . lang('is disabled') . ' ';
|
2007-05-08 11:53:11 +02:00
|
|
|
}
|
2001-07-30 17:59:25 +02:00
|
|
|
|
2008-08-20 08:04:28 +02:00
|
|
|
if (!$notables)
|
|
|
|
{
|
|
|
|
if($setup_info[$resolve]['status'] == 'D')
|
2001-07-30 17:59:25 +02:00
|
|
|
{
|
2008-08-20 08:04:28 +02:00
|
|
|
echo lang('because it depends upon') . ':<br />' . "\n";
|
|
|
|
list($depapp,$depver) = parsedep($setup_info[$resolve]['depends'],False);
|
|
|
|
$depapp_count = count($depapp);
|
|
|
|
for ($i=0; $i<$depapp_count; $i++)
|
2001-07-30 17:59:25 +02:00
|
|
|
{
|
2008-08-20 08:04:28 +02:00
|
|
|
echo '<br />' . $depapp[$i] . ': ';
|
|
|
|
$list = '';
|
|
|
|
foreach($depver[$i] as $x => $y)
|
2001-07-30 17:59:25 +02:00
|
|
|
{
|
2008-08-20 08:04:28 +02:00
|
|
|
$list .= $y . ', ';
|
2001-07-30 17:59:25 +02:00
|
|
|
}
|
2016-04-02 21:55:08 +02:00
|
|
|
echo substr($list,0,-2)."\n";
|
2001-07-30 17:59:25 +02:00
|
|
|
}
|
2008-08-20 08:04:28 +02:00
|
|
|
echo '<br /><br />' . lang('The table definition was correct, and the tables were installed') . '.';
|
2001-07-30 17:59:25 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-08-20 08:04:28 +02:00
|
|
|
echo lang('because it was manually disabled') . '.';
|
2001-07-30 17:59:25 +02:00
|
|
|
}
|
2008-08-20 08:04:28 +02:00
|
|
|
}
|
|
|
|
elseif($setup_info[$resolve]['enable'] == 2)
|
|
|
|
{
|
|
|
|
echo lang('because it is not a user application, or access is controlled via acl') . '.';
|
|
|
|
}
|
|
|
|
elseif($setup_info[$resolve]['enable'] == 0)
|
|
|
|
{
|
|
|
|
echo lang('because the enable flag for this app is set to 0, or is undefined') . '.';
|
2001-07-30 17:59:25 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-08-20 08:04:28 +02:00
|
|
|
echo lang('because it requires manual table installation, <br />or the table definition was incorrect') . ".\n"
|
|
|
|
. lang("Please check for sql scripts within the application's directory") . '.';
|
2001-07-30 17:59:25 +02:00
|
|
|
}
|
2008-08-20 08:04:28 +02:00
|
|
|
echo '<br />' . lang('However, the application is otherwise installed') . '.';
|
2001-07-30 17:59:25 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-08-20 08:04:28 +02:00
|
|
|
echo $app_title . ' ' . lang('has a version mismatch') . ' ';
|
|
|
|
echo lang('because of a failed upgrade, or the database is newer than the installed version of this app') . '.';
|
|
|
|
echo '<br />';
|
|
|
|
echo lang('If the application has no defined tables, selecting upgrade should remedy the problem') . '.';
|
|
|
|
echo '<br />' . lang('However, the application is otherwise installed') . '.';
|
|
|
|
}
|
|
|
|
|
|
|
|
echo '<br /><a href="applications.php?debug='.$DEBUG.'">' . lang('Go back') . '</a>';
|
|
|
|
$setup_tpl->pparse('out','footer');
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$setup_tpl->set_var('description',lang('Select the desired action(s) from the available choices'));
|
|
|
|
$setup_tpl->set_var('action_url','applications.php');
|
|
|
|
$setup_tpl->pparse('out','header');
|
|
|
|
|
|
|
|
$setup_tpl->set_var('appdata',lang('Application Data'));
|
|
|
|
$setup_tpl->set_var('actions',lang('Actions'));
|
|
|
|
$setup_tpl->set_var('app_info',lang('Application Name and Status Information'));
|
|
|
|
$setup_tpl->set_var('app_title',lang('Application Title'));
|
|
|
|
$setup_tpl->set_var('app_currentver',lang('Current Version'));
|
|
|
|
$setup_tpl->set_var('app_version',lang('Available Version'));
|
|
|
|
$setup_tpl->set_var('app_install',lang('Install'));
|
|
|
|
$setup_tpl->set_var('app_remove',lang('Remove'));
|
|
|
|
$setup_tpl->set_var('app_upgrade',lang('Upgrade'));
|
|
|
|
$setup_tpl->set_var('app_resolve',lang('Resolve'));
|
|
|
|
$setup_tpl->set_var('check','check.png');
|
|
|
|
$setup_tpl->set_var('install_all',lang('Install All'));
|
|
|
|
$setup_tpl->set_var('upgrade_all',lang('Upgrade All'));
|
|
|
|
$setup_tpl->set_var('remove_all',lang('Remove All'));
|
|
|
|
$setup_tpl->set_var('lang_debug',lang('enable for extra debug-messages'));
|
|
|
|
$setup_tpl->set_var('debug','<input type="checkbox" name="debug" value="True"' .($DEBUG ? ' checked="checked"' : '') . ' />');
|
|
|
|
$setup_tpl->set_var('bg_color',$bgcolor[0]);
|
|
|
|
|
|
|
|
$setup_tpl->pparse('out','app_header');
|
|
|
|
|
|
|
|
$i = 0;
|
|
|
|
foreach($setup_info as $key => $value)
|
|
|
|
{
|
|
|
|
if(@$value['name'])
|
2001-07-30 17:59:25 +02:00
|
|
|
{
|
2008-08-20 08:04:28 +02:00
|
|
|
$i = ($i ? 0 : 1);
|
|
|
|
$setup_tpl->set_var('apptitle',$value['title']?$value['title']:lang($value['name']));
|
|
|
|
$setup_tpl->set_var('currentver',@$value['currentver']);
|
|
|
|
$setup_tpl->set_var('version',$value['version']);
|
|
|
|
$setup_tpl->set_var('bg_color',$bgcolor[$i]);
|
|
|
|
|
|
|
|
switch($value['status'])
|
2001-07-30 17:59:25 +02:00
|
|
|
{
|
2008-08-20 08:04:28 +02:00
|
|
|
case 'C':
|
2016-04-02 21:55:08 +02:00
|
|
|
$setup_tpl->set_var('remove', in_array($key, array('api', 'phpgwapi')) ? ' ' : '<input type="checkbox" name="remove[' . $value['name'] . ']" />');
|
2008-08-20 08:04:28 +02:00
|
|
|
$setup_tpl->set_var('upgrade',' ');
|
|
|
|
if (!$GLOBALS['egw_setup']->detection->check_app_tables($value['name']))
|
|
|
|
{
|
|
|
|
// App installed and enabled, but some tables are missing
|
|
|
|
$setup_tpl->set_var('instimg','table.png');
|
|
|
|
$setup_tpl->set_var('bg_color','FFCCAA');
|
|
|
|
$setup_tpl->set_var('instalt',lang('Not Completed'));
|
|
|
|
$setup_tpl->set_var('resolution','<a href="applications.php?resolve=' . $value['name'] . '&badinstall=True">' . lang('Potential Problem') . '</a>');
|
|
|
|
$status = lang('Requires reinstall or manual repair') . ' - ' . $value['status'];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$setup_tpl->set_var('instimg','completed.png');
|
|
|
|
$setup_tpl->set_var('instalt',lang('Completed'));
|
|
|
|
$setup_tpl->set_var('install',' ');
|
|
|
|
if($value['enabled'])
|
2001-07-30 17:59:25 +02:00
|
|
|
{
|
2008-08-20 08:04:28 +02:00
|
|
|
$setup_tpl->set_var('resolution','');
|
|
|
|
$status = lang('OK') . ' - ' . $value['status'];
|
2001-07-30 17:59:25 +02:00
|
|
|
}
|
2014-12-11 11:48:16 +01:00
|
|
|
else
|
2001-07-30 17:59:25 +02:00
|
|
|
{
|
2008-08-20 08:04:28 +02:00
|
|
|
if ($value['tables'][0] != '')
|
2001-07-30 17:59:25 +02:00
|
|
|
{
|
2008-08-20 08:04:28 +02:00
|
|
|
$notables = '¬ables=True';
|
2001-07-30 17:59:25 +02:00
|
|
|
}
|
|
|
|
$setup_tpl->set_var('bg_color','CCCCFF');
|
2008-08-20 08:04:28 +02:00
|
|
|
$setup_tpl->set_var('resolution',
|
|
|
|
'<a href="applications.php?resolve=' . $value['name'] . $notables . '">' . lang('Possible Reasons') . '</a>'
|
|
|
|
);
|
|
|
|
$status = lang('Disabled') . ' - ' . $value['status'];
|
2007-05-08 11:53:11 +02:00
|
|
|
}
|
2008-08-20 08:04:28 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'U':
|
|
|
|
$setup_tpl->set_var('instimg','incomplete.png');
|
|
|
|
$setup_tpl->set_var('instalt',lang('Not Completed'));
|
|
|
|
if (!@$value['currentver'])
|
|
|
|
{
|
|
|
|
if ($value['tables'] && $GLOBALS['egw_setup']->detection->check_app_tables($value['name'],True))
|
2007-05-08 11:53:11 +02:00
|
|
|
{
|
2008-08-20 08:04:28 +02:00
|
|
|
// Some tables missing
|
2007-05-08 11:53:11 +02:00
|
|
|
$setup_tpl->set_var('remove',$key == 'phpgwapi' ? ' ' : '<input type="checkbox" name="remove[' . $value['name'] . ']" />');
|
2008-08-20 08:04:28 +02:00
|
|
|
$setup_tpl->set_var('resolution','<a href="applications.php?resolve=' . $value['name'] . '&badinstall=True">' . lang('Potential Problem') . '</a>');
|
|
|
|
$status = lang('Requires reinstall or manual repair') . ' - ' . $value['status'];
|
2007-05-08 11:53:11 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-08-20 08:04:28 +02:00
|
|
|
$setup_tpl->set_var('remove',' ');
|
|
|
|
$setup_tpl->set_var('resolution','');
|
|
|
|
$status = lang('Requires upgrade') . ' - ' . $value['status'];
|
2007-05-08 11:53:11 +02:00
|
|
|
}
|
2008-08-20 08:04:28 +02:00
|
|
|
// show not installed apps without icon
|
|
|
|
$setup_tpl->set_var('instimg','spacer.png');
|
|
|
|
$setup_tpl->set_var('instalt','');
|
|
|
|
$setup_tpl->set_var('bg_color','CCFFCC');
|
|
|
|
$setup_tpl->set_var('install','<input type="checkbox" name="install[' . $value['name'] . ']" />');
|
2001-07-30 17:59:25 +02:00
|
|
|
$setup_tpl->set_var('upgrade',' ');
|
2008-08-20 08:04:28 +02:00
|
|
|
$status = lang('Please install') . ' - ' . $value['status'];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$setup_tpl->set_var('bg_color','CCCCFF');
|
2002-01-13 20:52:47 +01:00
|
|
|
$setup_tpl->set_var('install',' ');
|
2008-08-20 08:04:28 +02:00
|
|
|
// TODO display some info about breakage if you mess with this app
|
|
|
|
$setup_tpl->set_var('upgrade','<input type="checkbox" name="upgrade[' . $value['name'] . ']" />');
|
|
|
|
$setup_tpl->set_var('remove',$key == 'phpgwapi' ? ' ' : '<input type="checkbox" name="remove[' . $value['name'] . ']" />');
|
|
|
|
$setup_tpl->set_var('resolution','');
|
|
|
|
$status = lang('Requires upgrade') . ' - ' . $value['status'];
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'V':
|
|
|
|
$setup_tpl->set_var('instimg','incomplete.png');
|
|
|
|
$setup_tpl->set_var('instalt',lang('Not Completed'));
|
|
|
|
$setup_tpl->set_var('install',' ');
|
|
|
|
$setup_tpl->set_var('remove',$key == 'phpgwapi' ? ' ' : '<input type="checkbox" name="remove[' . $value['name'] . ']" />');
|
|
|
|
if ($value['version'] == 'deleted')
|
|
|
|
{
|
2010-09-15 21:08:29 +02:00
|
|
|
$setup_tpl->set_var('bg_color','CCAAAA');
|
2002-01-13 20:52:47 +01:00
|
|
|
$setup_tpl->set_var('upgrade',' ');
|
2008-08-20 08:04:28 +02:00
|
|
|
$setup_tpl->set_var('resolution','<a href="applications.php?resolve=' . $value['name'] . '&deleted=True">' . lang('Possible Solutions') . '</a>');
|
|
|
|
$status = lang('Sources deleted/missing') . ' - ' . $value['status'];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$setup_tpl->set_var('upgrade','<input type="checkbox" name="upgrade[' . $value['name'] . ']" />');
|
|
|
|
$setup_tpl->set_var('resolution','<a href="applications.php?resolve=' . $value['name'] . '&version=True">' . lang('Possible Solutions') . '</a>');
|
|
|
|
$status = lang('Version Mismatch') . ' - ' . $value['status'];
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'D':
|
|
|
|
$setup_tpl->set_var('bg_color','FFCCCC');
|
|
|
|
$depstring = parsedep($value['depends']);
|
|
|
|
$depstring .= ')';
|
|
|
|
$setup_tpl->set_var('instimg','dep.png');
|
|
|
|
$setup_tpl->set_var('instalt',lang('Dependency Failure'));
|
|
|
|
$setup_tpl->set_var('install',' ');
|
|
|
|
if ($values['currentver'])
|
|
|
|
{
|
|
|
|
$setup_tpl->set_var('remove',$key == 'phpgwapi' ? ' ' : '<input type="checkbox" name="remove[' . $value['name'] . ']" />');
|
|
|
|
$setup_tpl->set_var('resolution','<a href="applications.php?resolve=' . $value['name'] . '">' . lang('Possible Solutions') . '</a>');
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-07-30 17:59:25 +02:00
|
|
|
$setup_tpl->set_var('remove',' ');
|
2008-08-20 08:04:28 +02:00
|
|
|
$setup_tpl->set_var('resolution',' ');
|
|
|
|
}
|
|
|
|
$setup_tpl->set_var('upgrade',' ');
|
|
|
|
$status = lang('Dependency Failure') . ':' . $depstring . $value['status'];
|
|
|
|
break;
|
|
|
|
case 'P':
|
|
|
|
$setup_tpl->set_var('bg_color','FFCCFF');
|
|
|
|
$depstring = parsedep($value['depends']);
|
|
|
|
$depstring .= ')';
|
|
|
|
$setup_tpl->set_var('instimg','dep.png');
|
|
|
|
$setup_tpl->set_var('instalt',lang('Post-install Dependency Failure'));
|
|
|
|
$setup_tpl->set_var('install',' ');
|
|
|
|
$setup_tpl->set_var('remove',' ');
|
|
|
|
$setup_tpl->set_var('upgrade',' ');
|
|
|
|
$setup_tpl->set_var('resolution','<a href="applications.php?resolve=' . $value['name'] . '&post=True">' . lang('Possible Solutions') . '</a>');
|
|
|
|
$status = lang('Post-install Dependency Failure') . ':' . $depstring . $value['status'];
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
$setup_tpl->set_var('instimg','incomplete.png');
|
|
|
|
$setup_tpl->set_var('instalt',lang('Not Completed'));
|
|
|
|
$setup_tpl->set_var('install',' ');
|
|
|
|
$setup_tpl->set_var('remove',' ');
|
|
|
|
$setup_tpl->set_var('upgrade',' ');
|
|
|
|
$setup_tpl->set_var('resolution','');
|
|
|
|
$status = '';
|
|
|
|
break;
|
2001-07-30 17:59:25 +02:00
|
|
|
}
|
2008-08-20 08:04:28 +02:00
|
|
|
//$setup_tpl->set_var('appname',$value['name'] . '-' . $status . ',' . $value['filename']);
|
|
|
|
$setup_tpl->set_var('appinfo',$value['name'] . '-' . $status);
|
|
|
|
$setup_tpl->set_var('appname',$value['name']);
|
2001-07-30 17:59:25 +02:00
|
|
|
|
2008-08-20 08:04:28 +02:00
|
|
|
$setup_tpl->pparse('out','apps',True);
|
|
|
|
}
|
2001-07-30 17:59:25 +02:00
|
|
|
}
|
2008-08-20 08:04:28 +02:00
|
|
|
|
|
|
|
$setup_tpl->set_var('submit',lang('Save'));
|
|
|
|
$setup_tpl->set_var('cancel',lang('Cancel'));
|
|
|
|
$setup_tpl->pparse('out','app_footer');
|
|
|
|
$setup_tpl->pparse('out','footer');
|
|
|
|
$GLOBALS['egw_setup']->html->show_footer();
|
|
|
|
}
|