From 84ad1e6f954266ffb9fe39f3a809032406ee44ef Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Wed, 16 Oct 2013 17:39:32 +0200 Subject: [PATCH] start creating xsd module management --- composer.json | 3 +- composer.lock | 4 +- .../Controller/Admin/ModuleController.php | 4 +- core/lib/Thelia/Module/BaseModule.php | 2 +- core/lib/Thelia/Module/ModuleManagement.php | 55 +++++++++ core/lib/Thelia/Module/schema/module-1.0.xsd | 108 ++++++++++++++++++ 6 files changed, 171 insertions(+), 5 deletions(-) create mode 100644 core/lib/Thelia/Module/ModuleManagement.php create mode 100644 core/lib/Thelia/Module/schema/module-1.0.xsd diff --git a/composer.json b/composer.json index 0a4fc0629..e96385edd 100755 --- a/composer.json +++ b/composer.json @@ -39,7 +39,8 @@ "symfony/icu": "1.0", "swiftmailer/swiftmailer": "5.0.*", "symfony/serializer": "2.3.*", - "ensepar/html2pdf": "1.0.1" + "ensepar/html2pdf": "1.0.1", + "symfony/finder": "~2.2" }, "require-dev" : { "phpunit/phpunit": "3.7.*", diff --git a/composer.lock b/composer.lock index f50fb4a4d..a6f05615a 100755 --- a/composer.lock +++ b/composer.lock @@ -3,7 +3,7 @@ "This file locks the dependencies of your project to a known state", "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file" ], - "hash": "852879ecc2e39e5cf283a3b1c5051a8e", + "hash": "4f3fabbb795a71df45ae9f6ccb6df355", "packages": [ { "name": "ensepar/html2pdf", @@ -949,7 +949,7 @@ }, { "name": "symfony/finder", - "version": "v2.3.5", + "version": "v2.3.6", "target-dir": "Symfony/Component/Finder", "source": { "type": "git", diff --git a/core/lib/Thelia/Controller/Admin/ModuleController.php b/core/lib/Thelia/Controller/Admin/ModuleController.php index d2b96ce2e..1f0411987 100644 --- a/core/lib/Thelia/Controller/Admin/ModuleController.php +++ b/core/lib/Thelia/Controller/Admin/ModuleController.php @@ -22,6 +22,7 @@ /*************************************************************************************/ namespace Thelia\Controller\Admin; +use Thelia\Module\ModuleManagement; /** * Class ModuleController @@ -35,7 +36,8 @@ class ModuleController extends BaseAdminController if (null !== $response = $this->checkAuth("admin.module.view")) return $response; - + $modulemanagement = new ModuleManagement(); + $modulemanagement->updateModules(); return $this->render("modules", array("display_module" => 20)); } diff --git a/core/lib/Thelia/Module/BaseModule.php b/core/lib/Thelia/Module/BaseModule.php index 37c40c953..4f18b02a8 100755 --- a/core/lib/Thelia/Module/BaseModule.php +++ b/core/lib/Thelia/Module/BaseModule.php @@ -72,7 +72,7 @@ abstract class BaseModule extends ContainerAware public function getContainer() { if ($this->hasContainer() === false) { - throw new \RuntimeException("Sorry, container his not available in this context"); + throw new \RuntimeException("Sorry, container is not available in this context"); } return $this->container; diff --git a/core/lib/Thelia/Module/ModuleManagement.php b/core/lib/Thelia/Module/ModuleManagement.php new file mode 100644 index 000000000..754a60998 --- /dev/null +++ b/core/lib/Thelia/Module/ModuleManagement.php @@ -0,0 +1,55 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Module; +use Symfony\Component\Finder\Finder; + + +/** + * Class ModuleManagement + * @package Thelia\Module + * @author Manuel Raynaud + */ +class ModuleManagement +{ + protected $baseModuleDir; + + public function __construct() + { + $this->baseModuleDir = THELIA_MODULE_DIR; + } + + public function updateModules() + { + $finder = new Finder(); + + $finder + ->name('config.xml') + ->in($this->baseModuleDir . '/*/Config'); + + foreach ($finder as $file) { + echo $file->getRealPath()."\n"; + } + } + +} \ No newline at end of file diff --git a/core/lib/Thelia/Module/schema/module-1.0.xsd b/core/lib/Thelia/Module/schema/module-1.0.xsd new file mode 100644 index 000000000..2a6d29371 --- /dev/null +++ b/core/lib/Thelia/Module/schema/module-1.0.xsd @@ -0,0 +1,108 @@ + + + + + + + + le descriptif complet, dans autant de langues que nécessaire. + Le code de la langue doit être un code pays ISO 639 + + + + + + + + + + + + + + La version du plugin. Format libre + + + + + Auteur du plugin + + + + + + + + + + + + + Le type du plugin: classique, transport, paiement, filtre, taxe + + + + + + + + + + + + + + Les plugins qui doivent déjà être présents + + + + + + + + + + + + + + + + + + La version minimum requise de Thelia, au format 'dot' (1.2.3.4 par exemple) + + + + + + + + + + Le statut actuel du plugin: alpha, beta, rc, production + + + + + + + + + + + + + + Le nom du fichier contenant la documentation. Ce fichier doit se trouver dans le répertoire du plugin. + + + + + L'URL a interroger pour vérifier la présence d'une nouvelle version, appellé avec le nom du plugin et sa version + + + + + + \ No newline at end of file