start creating xsd module management

This commit is contained in:
Manuel Raynaud
2013-10-16 17:39:32 +02:00
parent 4f83c7f078
commit 84ad1e6f95
6 changed files with 171 additions and 5 deletions

View File

@@ -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.*",

4
composer.lock generated
View File

@@ -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",

View File

@@ -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));
}

View File

@@ -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;

View File

@@ -0,0 +1,55 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Module;
use Symfony\Component\Finder\Finder;
/**
* Class ModuleManagement
* @package Thelia\Module
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
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";
}
}
}

View File

@@ -0,0 +1,108 @@
<?xml version="1.0" encoding='UTF-8'?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="plugin">
<xs:complexType>
<xs:sequence>
<xs:element name="descriptif" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>le descriptif complet, dans autant de langues que nécessaire.
Le code de la langue doit être un code pays ISO 639</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="title" minOccurs="1" maxOccurs="1"/>
<xs:element type="xs:string" name="subtitle" minOccurs="0" maxOccurs="1"/>
<xs:element type="xs:string" name="description" minOccurs="0" maxOccurs="1"/>
<xs:element type="xs:string" name="postscriptum" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
<xs:attribute type="xs:string" name="locale"/>
</xs:complexType>
</xs:element>
<xs:element type="xs:string" name="version">
<xs:annotation>
<xs:documentation>La version du plugin. Format libre</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="auteur">
<xs:annotation>
<xs:documentation>Auteur du plugin</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="nom"/>
<xs:element type="xs:string" name="societe" minOccurs="0" maxOccurs="1"/>
<xs:element type="xs:string" name="email"/>
<xs:element type="xs:anyURI" name="web" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="type">
<xs:annotation>
<xs:documentation>Le type du plugin: classique, transport, paiement, filtre, taxe</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="classique"/>
<xs:enumeration value="transport"/>
<xs:enumeration value="paiement"/>
<xs:enumeration value="filtre"/>
<xs:enumeration value="taxe"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="prerequis" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>Les plugins qui doivent déjà être présents</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="plugin" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:string" name="version" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="thelia">
<xs:annotation>
<xs:documentation>La version minimum requise de Thelia, au format 'dot' (1.2.3.4 par exemple)</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[0-9.]+"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="etat">
<xs:annotation>
<xs:documentation>Le statut actuel du plugin: alpha, beta, rc, production</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="alpha"/>
<xs:enumeration value="beta"/>
<xs:enumeration value="rc"/>
<xs:enumeration value="production"/>
<xs:enumeration value="autre"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element type="xs:string" name="documentation" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>Le nom du fichier contenant la documentation. Ce fichier doit se trouver dans le répertoire du plugin.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element type="xs:anyURI" name="urlmiseajour" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>L'URL a interroger pour vérifier la présence d'une nouvelle version, appellé avec le nom du plugin et sa version</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>