1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[ticket/10631] Fixing and finishing the extension metadata class.

PHPBB3-10631
This commit is contained in:
Michael Cullum
2012-05-20 14:16:00 +01:00
committed by Unknown Bliss
parent 10cba1426d
commit 3e6761b026
2 changed files with 62 additions and 57 deletions

View File

@@ -25,7 +25,7 @@ class acp_extensions
function main()
{
// Start the page
global $user, $template, $request, $phpbb_extension_manager, $db;
global $user, $template, $request, $phpbb_extension_manager, $db, $phpbb_root_path;
$user->add_lang(array('install', 'acp/extensions'));
@@ -42,11 +42,13 @@ class acp_extensions
$this->list_enabled_exts($db, $template);
$this->list_disabled_exts($db, $template);
$this->list_available_exts($phpbb_extension_manager, $template);
$this->tpl_name = 'acp_ext_list';
break;
case 'enable_pre':
$this->tpl_name = 'acp_ext_enable';
$template->assign_vars(array(
'PRE' => true,
'U_ENABLE' => $this->u_action . '&action=enable&ext_name=' . $ext_name,
@@ -55,7 +57,9 @@ class acp_extensions
case 'enable':
$phpbb_extension_manager->enable($ext_name);
$this->tpl_name = 'acp_ext_enable';
$template->assign_vars(array(
'U_RETURN' => $this->u_action . '&action=list',
));
@@ -63,6 +67,7 @@ class acp_extensions
case 'disable_pre':
$this->tpl_name = 'acp_ext_disable';
$template->assign_vars(array(
'PRE' => true,
'U_DISABLE' => $this->u_action . '&action=disable&ext_name=' . $ext_name,
@@ -71,7 +76,9 @@ class acp_extensions
case 'disable':
$phpbb_extension_manager->disable($ext_name);
$this->tpl_name = 'acp_ext_disable';
$template->assign_vars(array(
'U_RETURN' => $this->u_action . '&action=list',
));
@@ -79,6 +86,7 @@ class acp_extensions
case 'purge_pre':
$this->tpl_name = 'acp_ext_purge';
$template->assign_vars(array(
'PRE' => true,
'U_PURGE' => $this->u_action . '&action=purge&ext_name=' . $ext_name,
@@ -87,7 +95,9 @@ class acp_extensions
case 'purge':
$phpbb_extension_manager->purge($ext_name);
$this->tpl_name = 'acp_ext_purge';
$template->assign_vars(array(
'U_RETURN' => $this->u_action . '&action=list',
));
@@ -95,6 +105,7 @@ class acp_extensions
case 'delete_pre':
$this->tpl_name = 'acp_ext_delete';
$template->assign_vars(array(
'PRE' => true,
'U_DELETE' => $this->u_action . '&action=delete&ext_name=' . $ext_name,
@@ -106,9 +117,10 @@ class acp_extensions
break;
case 'details':
$filepath = $phpbb_root_path . 'ext/' . $ext_name . '/extension.json';
$md_manager = new phpbb_extension_metadata_manager($ext_name, $db, $phpbb_extension_manager, $phpbb_root_path, ".$phpEx", $template);
$md_manager->get_all_meta_data('all', true);
$this->tpl_name = 'acp_ext_details';
$this->parse_meta_info($ext_name, $phpbb_extension_manager);
break;
}
}
@@ -120,6 +132,7 @@ class acp_extensions
WHERE ext_active = 1
ORDER BY ext_name ASC';
$result = $db->sql_query($sql);
// TODO: Use the display name from the composer.json
while ($row = $db->sql_fetchrow($result))
{
$template->assign_block_vars('enabled', array(
@@ -142,6 +155,7 @@ class acp_extensions
WHERE ext_active = 0
ORDER BY ext_name ASC';
$result = $db->sql_query($sql);
// TODO: Use the display name from the composer.json
while ($row = $db->sql_fetchrow($result))
{
$template->assign_block_vars('disabled', array(
@@ -165,6 +179,8 @@ class acp_extensions
$all_configured = array_keys($phpbb_extension_manager->all_configured());
$uninstalled = array_diff($all_available, $all_configured);
// TODO: Use the display name from the composer.json
foreach ($uninstalled as $ext)
{
$template->assign_block_vars('disabled', array(
@@ -178,34 +194,4 @@ class acp_extensions
return;
}
function parse_meta_info($ext_name, $phpbb_extension_manager)
{
$phpbb_extension_manager->get_meta_data($ext_name);
$template->assign_vars(array(
'NAME' => $metadata['name'],
'TYPE' => $metadata['type'],
'DESCRIPTION' => $metadata['description'],
'HOMEPAGE' => $metadata['homepage'],
'VERSION' => $metadata['version'],
'TIME' => $metadata['time'],
'LICENSE' => $metadata['licence'],
'REQUIRE_PHP' => $metadata['require']['php'],
'REQUIRE_PHPBB' => $metadata['require']['phpbb'],
'DISPLAY_NAME' => $metadata['extra']['display-name'],
));
foreach ($metadata['authors'] as $author)
{
$template->assign_block_vars('authors', array(
'AUTHOR_NAME' => $author['name'],
'AUTHOR_EMAIL' => $author['email'],
'AUTHOR_HOMEPAGE' => $author['homepage'],
'AUTHOR_ROLE' => $author['role'],
));
}
return $metadata;
}
}