aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authormistic100 <mistic@piwigo.org>2014-01-22 21:21:37 +0000
committermistic100 <mistic@piwigo.org>2014-01-22 21:21:37 +0000
commitcf0750dbc0c188a80b0dbefb89ea9cf4e1c79c5f (patch)
tree5e145351455bfbba50e3eb66ae9fa866f606fb7d /admin
parent597be89274c80b8b4c87ec84730e2f516e5fe6f4 (diff)
Display "Activate it now" link when installing a new plugin
git-svn-id: http://piwigo.org/svn/trunk@26909 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/include/plugins.class.php9
-rw-r--r--admin/plugins_new.php11
2 files changed, 13 insertions, 7 deletions
diff --git a/admin/include/plugins.class.php b/admin/include/plugins.class.php
index 0ddc85b50..b410ff647 100644
--- a/admin/include/plugins.class.php
+++ b/admin/include/plugins.class.php
@@ -509,7 +509,7 @@ DELETE FROM '. PLUGINS_TABLE .'
* @param string - archive URL
* @param string - plugin id or extension id
*/
- function extract_plugin_files($action, $revision, $dest)
+ function extract_plugin_files($action, $revision, $dest, &$plugin_id=null)
{
if ($archive = tempnam( PHPWG_PLUGINS_PATH, 'zip'))
{
@@ -541,13 +541,14 @@ DELETE FROM '. PLUGINS_TABLE .'
$root = dirname($main_filepath); // main.inc.php path in archive
if ($action == 'upgrade')
{
- $extract_path = PHPWG_PLUGINS_PATH . $dest;
+ $plugin_id = $dest;
}
else
{
- $extract_path = PHPWG_PLUGINS_PATH
- . ($root == '.' ? 'extension_' . $dest : basename($root));
+ $plugin_id = ($root == '.' ? 'extension_' . $dest : basename($root));
}
+ $extract_path = PHPWG_PLUGINS_PATH . $plugin_id;
+
if($result = $zip->extract(PCLZIP_OPT_PATH, $extract_path,
PCLZIP_OPT_REMOVE_PATH, $root,
PCLZIP_OPT_REPLACE_NEWER))
diff --git a/admin/plugins_new.php b/admin/plugins_new.php
index 379077410..a8df9359c 100644
--- a/admin/plugins_new.php
+++ b/admin/plugins_new.php
@@ -45,9 +45,9 @@ if (isset($_GET['revision']) and isset($_GET['extension']))
{
check_pwg_token();
- $install_status = $plugins->extract_plugin_files('install', $_GET['revision'], $_GET['extension']);
+ $install_status = $plugins->extract_plugin_files('install', $_GET['revision'], $_GET['extension'], $plugin_id);
- redirect($base_url.'&installstatus='.$install_status);
+ redirect($base_url.'&installstatus='.$install_status.'&plugin_id='.$plugin_id);
}
}
@@ -57,8 +57,13 @@ if (isset($_GET['installstatus']))
switch ($_GET['installstatus'])
{
case 'ok':
+ $activate_url = get_root_url().'admin.php?page=plugins'
+ . '&amp;plugin=' . $_GET['plugin_id']
+ . '&amp;pwg_token=' . get_pwg_token()
+ . '&amp;action=activate';
+
$page['infos'][] = l10n('Plugin has been successfully copied');
- $page['infos'][] = l10n('You might go to plugin list to install and activate it.');
+ $page['infos'][] = '<a href="'. $activate_url . '">' . l10n('Activate it now') . '</a>';
break;
case 'temp_path_error':