From f09e4e48a542ce42a09940a422b497c19234ef49 Mon Sep 17 00:00:00 2001 From: shubham_meena Date: Thu, 19 Jun 2014 17:11:10 +0530 Subject: [PATCH] template for updates of plugins --HG-- branch : Gsoc14-ryzomAppImprovements --- .../ams_lib/autoload/plugincache.php | 41 ++++++++++++++----- .../ryzom_ams/ams_lib/translations/en.ini | 4 +- .../ryzom_ams/www/html/inc/plugins_update.php | 36 ++++++++++++++++ 3 files changed, 69 insertions(+), 12 deletions(-) create mode 100644 code/ryzom/tools/server/ryzom_ams/www/html/inc/plugins_update.php diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/plugincache.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/plugincache.php index 1f0ef9bf6..09bd942b3 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/plugincache.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/plugincache.php @@ -14,7 +14,7 @@ class Plugincache { private $plugin_permission; private $plugin_status; private $plugin_info = array(); - + private $update_info = array(); /** * A constructor. * Empty constructor @@ -26,15 +26,17 @@ class Plugincache { public function set( $values ) { $this -> setId( $values['Id'] ); $this -> setPluginName( $values['Name'] ); - $this -> setPluginType( $values['Type'] ); - $this -> setPluginPermission( $values['Permission'] ); - $this -> setPluginStatus( $values['Status'] ); - $this -> setPluginInfo( json_decode( $values['Info'] ) ); + $this -> setPluginType( $values['Type'] ); + $this -> setPluginPermission( $values['Permission'] ); + $this -> setPluginStatus( $values['Status'] ); + $this -> setPluginInfo( json_decode( $values['Info'] ) ); + @$this -> setUpdateInfo( json_decode( $values['UpdateInfo'] ) ); } /** * loads the object's attributes. */ + public function load_With_SID() { $dbl = new DBLayer( "lib" ); $statement = $dbl -> executeWithoutParams( "SELECT * FROM plugins" ); @@ -140,14 +142,33 @@ class Plugincache { $this -> plugin_info = $p_n; } + /** + * functionalities for plugin updates + */ + + /** + * set update info attribute array of the object. + * + * @param $p_n array + */ + public function setUpdateInfo( $p_n ) { + $this -> update_info = $p_n; + } + + /** + * get update info array attribute of the object. + */ + public function getUpdateInfo() { + return $this -> update_info; + } + /** * some more plugin function that requires during plugin operations * - * / - * - * - * /** + */ + + /** * function to remove a non empty directory * * @param $dir directory address @@ -166,4 +187,4 @@ class Plugincache { return rmdir( $dir ); } } - } + } 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 548b2ea06..d324acb3a 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 @@ -86,11 +86,11 @@ ip_file_nfnd="Please upload a plugin before clicking on install button" [plugins_update] up_title = "Updates for Plugins" up_info = "Here you can see the entire list of available updates for plugins." -up_serial = "Serial No." +up_description = "Updates Info" plugin_name = "Name" plugin_version = "Version" up_updated_version = "New Version" -up_action = "Actions" +up_actions = "Actions" [show_ticket] t_title = "Ticket" diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/plugins_update.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/plugins_update.php new file mode 100644 index 000000000..89d547860 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/www/html/inc/plugins_update.php @@ -0,0 +1,36 @@ + getElements(), Array( "getId", "getPluginName", "getPluginInfo", "getUpdateInfo" ), Array( "id", "plugin_name", "plugin_info", "update_info" ) ); + $pageResult['links'] = $pagination -> getLinks( 5 ); + $pageResult['lastPage'] = $pagination -> getLast(); + $pageResult['currentPage'] = $pagination -> getCurrent(); + + global $INGAME_WEBPATH; + $pageResult['ingame_webpath'] = $INGAME_WEBPATH; + + // check if shard is online + try { + $dbs = new DBLayer( "shard" ); + $pageResult['shard'] = "online"; + } + catch( PDOException $e ) { + $pageResult['shard'] = "offline"; + } + return( $pageResult ); + } else { + // ERROR: No access! + $_SESSION['error_code'] = "403"; + header( "Location: index.php?page=error" ); + exit; + } + }