{"id":666,"date":"2014-05-23T18:26:25","date_gmt":"2014-05-23T16:26:25","guid":{"rendered":"http:\/\/www.h-hennes.fr\/blog\/?p=666"},"modified":"2014-05-23T18:26:25","modified_gmt":"2014-05-23T16:26:25","slug":"prestashop-installer-des-modules-sans-passer-par-ladministration","status":"publish","type":"post","link":"https:\/\/www.h-hennes.fr\/blog\/2014\/05\/23\/prestashop-installer-des-modules-sans-passer-par-ladministration\/","title":{"rendered":"Prestashop : Installer des modules sans passer par l&rsquo;administration"},"content":{"rendered":"<p>Voici un module Prestashop qui vous permettra d&rsquo;installer un module en appelant directement une page web ( depuis un navigateur ou la ligne de commande )<\/p>\n<p>Ceci peut \u00eatre pratique dans le cas ou il est n\u00e9cessaire de d\u00e9ployer un module sur de nombreux sites diff\u00e9rents<\/p>\n<p>Une fois les fichiers d\u00e9pos\u00e9 par ftp sur l&rsquo;h\u00e9bergement concern\u00e9 , il vous suffit d&rsquo;appeller la page http:\/\/www.site.com\/modules\/eiinstallmodulescli\/install_module.php?module_name=<strong>module_name<\/strong> et le module sera automatiquement install\u00e9.<\/p>\n<p>Le code ex\u00e9cut\u00e9 est des plus basiques :-p , mais de mon c\u00f4t\u00e9 cela m&rsquo;a d\u00e9j\u00e0 permis de gagner pas mal de temps \ud83d\ude42<\/p>\n<pre lang=\"php\" escaped=\"true\">require_once(dirname(__FILE__).'\/..\/..\/config\/config.inc.php');\r\n\r\n\/\/Nom du module \u00e0 installer\r\n$module_name = Tools::getValue('module_name');\r\n\r\nif ( $module_name ) {\r\n\t\r\n\t\/\/Inclusion de la classe du module\r\n\tif ( ! is_file(dirname(__FILE__).'\/..\/'.$module_name.'\/'.$module_name.'.php' ) )\r\n\t\tdie (' Erreur : Impossible d\\'inclure le fichier du module');\r\n\t\t\r\n\tinclude_once ( dirname(__FILE__).'\/..\/'.$module_name.'\/'.$module_name.'.php');\r\n\t\r\n\t\/\/Installation du module\r\n\ttry {\r\n\t$module = new $module_name();\r\n\t$module-&gt;install();\r\n\t}\r\n\tcatch ( PrestashopException $e ) {\r\n\t\techo 'Erreur Impossible d\\'installer le module';\r\n\t\techo $e-&gt;getMessage();\r\n\t\t\r\n\t\texit();\r\n\t}\r\n\t\r\n\techo 'Module install\u00e9 avec succ\u00e8s';\r\n\t\r\n}\r\nelse {\r\n\techo 'Pas de param\u00e8tre de module \u00e0 installer';\r\n}\r\n\r\n<\/pre>\n<p>Pour les int\u00e9ress\u00e9s le module est t\u00e9l\u00e9chargeable ici : [filedownload file=\u00a0\u00bbhttps:\/\/www.h-hennes.fr\/blog\/wp-content\/uploads\/2014\/05\/eiinstallmodulescli-latest.zip\u00a0\u00bb]eiinstallmodulescli-latest[\/filedownload]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Voici un module Prestashop qui vous permettra d&rsquo;installer un module en appelant directement une page web ( depuis un navigateur ou la ligne de commande ) Ceci peut \u00eatre pratique dans le cas ou il est n\u00e9cessaire de d\u00e9ployer un module sur de nombreux sites diff\u00e9rents Une fois les fichiers d\u00e9pos\u00e9 par ftp sur l&rsquo;h\u00e9bergement [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[245,6],"tags":[282,283,104],"class_list":["post-666","post","type-post","status-publish","format-standard","hentry","category-prestashop-2","category-trucs-et-astuces","tag-cli","tag-installation-modules-prestashop","tag-prestashop"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.h-hennes.fr\/blog\/wp-json\/wp\/v2\/posts\/666","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.h-hennes.fr\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.h-hennes.fr\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.h-hennes.fr\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.h-hennes.fr\/blog\/wp-json\/wp\/v2\/comments?post=666"}],"version-history":[{"count":2,"href":"https:\/\/www.h-hennes.fr\/blog\/wp-json\/wp\/v2\/posts\/666\/revisions"}],"predecessor-version":[{"id":669,"href":"https:\/\/www.h-hennes.fr\/blog\/wp-json\/wp\/v2\/posts\/666\/revisions\/669"}],"wp:attachment":[{"href":"https:\/\/www.h-hennes.fr\/blog\/wp-json\/wp\/v2\/media?parent=666"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.h-hennes.fr\/blog\/wp-json\/wp\/v2\/categories?post=666"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.h-hennes.fr\/blog\/wp-json\/wp\/v2\/tags?post=666"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}