Moved installation to UMIL install file

This commit is contained in:
Marc Alexander
2010-11-17 19:44:54 +00:00
parent ed8f256ffb
commit 670bd11fa6
3 changed files with 90 additions and 70 deletions

View File

@@ -20,6 +20,10 @@ if (!file_exists($phpbb_root_path . 'umil/umil_auto.' . $phpEx))
{
trigger_error('Please download the latest UMIL (Unified MOD Install Library) from: <a href="http://www.phpbb.com/mods/umil/">phpBB.com/mods/umil</a>', E_USER_ERROR);
}
if(!function_exists('board3_basic_install'))
{
include($phpbb_root_path . 'portal/includes/functions.' . $phpEx);
}
// The name of the mod to be displayed during installation.
$mod_name = 'Board3 Portal';
@@ -83,7 +87,7 @@ $versions = array(
),
'PRIMARY_KEY' => 'config_name',
));
)),
),
@@ -95,7 +99,6 @@ $versions = array(
array('board3_forum_index', 1, 0),
array('board3_left_column_width', 180, 0),
array('board3_right_column_width', 180, 0),
array('board3_first_install', 1, 0), // this will tell board3 portal to install the basic modules
),
'module_add' => array(
@@ -118,6 +121,7 @@ $versions = array(
),
),
),
'custom' => array('board3_basic_install'),
),
);

View File

@@ -65,6 +65,10 @@ $lang = array_merge($lang, array(
'PORTAL_RIGHT_COLUMN_WIDTH' => 'Width of the right column',
'PORTAL_RIGHT_COLUMN_WIDTH_EXP' => 'Change the width of the right column in pixels; recommended value is 180',
// Install
'PORTAL_BASIC_INSTALL' => 'Adding basic set of modules',
'PORTAL_BASIC_UNINSTALL' => 'Removing modules from database',
// Portal Modules
'ACP_PORTAL_MODULES' => 'Portal Modules',

View File

@@ -9,7 +9,7 @@
*
*/
if (!defined('IN_PHPBB'))
if (!defined('IN_PHPBB') && !defined('UMIL_AUTO') && !defined('IN_INSTALL'))
{
exit;
}
@@ -815,12 +815,21 @@ function get_portal_tracking_info($fetch_news)
* !! this function should usually only be executed once upon installing the portal !!
* DO NOT set $purge_modules to false unless you want to auto-add all modules again after deleting them (i.e. if your database was corrupted)
*/
function board3_basic_install($purge_modules = true, $u_action)
function board3_basic_install($mode = 'install', $purge_modules = true, $u_action = '')
{
global $db, $phpbb_root_path, $phpEx, $cache, $user;
global $db, $phpbb_root_path, $phpEx, $cache, $user, $table_prefix;
if(!defined('PORTAL_MODULES_TABLE'))
{
include($phpbb_root_path . 'portal/includes/constants.' . $phpEx);
}
if($mode == 'install')
{
$directory = $phpbb_root_path . 'portal/modules/';
if($purge_modules)
{
$sql = 'DELETE FROM ' . PORTAL_MODULES_TABLE;
@@ -891,9 +900,12 @@ function board3_basic_install($purge_modules = true, $u_action)
$c_class->install($db->sql_nextid());
}
$cache->purge(); // make sure we don't get errors after re-adding a module
trigger_error($user->lang['SUCCESS_ADD'] . adm_back_link($u_action));
return $user->lang['PORTAL_BASIC_INSTALL'];
}
else
{
return $user->lang['PORTAL_BASIC_UNINSTALL'];
}
}
?>