From b654096371214b6138aad1618c4b3f5911a26df5 Mon Sep 17 00:00:00 2001 From: shubham_meena Date: Mon, 23 Jun 2014 14:36:29 +0530 Subject: [PATCH] function to install update in the plugin --- .../ryzom_ams/ams_lib/translations/en.ini | 1 + .../ryzom_ams/www/html/func/update_plugin.php | 35 +++++++++++++++++++ .../ryzom_ams/www/html/templates/plugins.tpl | 1 + 3 files changed, 37 insertions(+) create mode 100644 code/ryzom/tools/server/ryzom_ams/www/html/func/update_plugin.php diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini b/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini index d324acb3a..f2a21d2ab 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini @@ -75,6 +75,7 @@ ac_error = "Plugin facing some error in activating. Please try again later." dc_success = "Plugin de-Activated successfuly." dc_error = "Plugin facing some error in de-activating. Please try again later." up_success = "Update added successfully. Go to Updates page for installing updates." +up_install_success = "Update installed successfully." [install_plugin] ip_title = "Install a new Plugin" diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/func/update_plugin.php b/code/ryzom/tools/server/ryzom_ams/www/html/func/update_plugin.php new file mode 100644 index 000000000..ddf4b0abf --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/www/html/func/update_plugin.php @@ -0,0 +1,35 @@ + executeWithoutParams( "SELECT * FROM plugins INNER JOIN updates ON plugins.Id=updates.PluginId Where plugins.Id=$id" ); + $row = $sth -> fetch(); + print_r( $row ); + + // replacing update in the database + Plugincache :: rrmdir( $row['FileName'] ); + Plugincache :: zipExtraction( $row['UpdatePath'], rtrim( $row['FileName'], strtolower( $row['Name'] ) ) ); + + $db -> update( "plugins", array( 'Info' => $row['UpdateInfo'] ), "Id=$row[Id]" ); + + // deleting the previous update + $db -> delete( "updates", array( 'id' => $row['s.no'] ), "s.no=:id" ); + + header( "Location: index.php?page=plugins&result=8" ); + exit; + + } + } + } diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/plugins.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/plugins.tpl index 4aa6e7e3b..73f88d1a2 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/templates/plugins.tpl +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/plugins.tpl @@ -17,6 +17,7 @@ {if isset($smarty.get.result) and $smarty.get.result eq "5"}

{$dc_success}

{/if} {if isset($smarty.get.result) and $smarty.get.result eq "6"}

{$dc_error}

{/if} {if isset($smarty.get.result) and $smarty.get.result eq "7"}

{$up_success}

{/if} + {if isset($smarty.get.result) and $smarty.get.result eq "8"}

{$up_install_success}

{/if}

{$plugin_info}