Merge pull request #1348 from bburnichon/feature/controller-as-service

Controller as service
This commit is contained in:
Benoît Burnichon
2015-04-14 11:47:57 +02:00
18 changed files with 809 additions and 571 deletions

165
composer.lock generated
View File

@@ -11,15 +11,9 @@
"version": "6.0.039",
"source": {
"type": "git",
"url": "https://github.com/alchemy-fr/tcpdf-clone.git",
"url": "https://github.com/alchemy-fr/tcpdf-clone",
"reference": "2ba0248a7187f1626df6c128750650416267f0e7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/alchemy-fr/tcpdf-clone/zipball/2ba0248a7187f1626df6c128750650416267f0e7",
"reference": "2ba0248a7187f1626df6c128750650416267f0e7",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
@@ -66,10 +60,6 @@
"qrcode",
"tcpdf"
],
"support": {
"source": "https://github.com/alchemy-fr/tcpdf-clone/tree/6.0.039",
"issues": "https://github.com/alchemy-fr/tcpdf-clone/issues"
},
"time": "2013-10-13 16:11:17"
},
{
@@ -113,7 +103,7 @@
"homepage": "http://www.lickmychip.com/"
},
{
"name": "nlegoff",
"name": "Nicolas Le Goff",
"email": "legoff.n@gmail.com"
},
{
@@ -1082,12 +1072,12 @@
"source": {
"type": "git",
"url": "https://github.com/doctrine/migrations.git",
"reference": "65978aa4e9ffca3bb632225ad8c6320077d80d85"
"reference": "efb77c10dfb75485998a843154bbc44d8124c4d1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/migrations/zipball/65978aa4e9ffca3bb632225ad8c6320077d80d85",
"reference": "65978aa4e9ffca3bb632225ad8c6320077d80d85",
"url": "https://api.github.com/repos/doctrine/migrations/zipball/efb77c10dfb75485998a843154bbc44d8124c4d1",
"reference": "efb77c10dfb75485998a843154bbc44d8124c4d1",
"shasum": ""
},
"require": {
@@ -1132,7 +1122,7 @@
"database",
"migrations"
],
"time": "2015-03-23 09:47:20"
"time": "2015-04-07 10:34:31"
},
{
"name": "doctrine/orm",
@@ -1269,13 +1259,13 @@
"version": "v1.0.0",
"source": {
"type": "git",
"url": "https://github.com/igorw/evenement.git",
"reference": "fa966683e7df3e5dd5929d984a44abfbd6bafe8d"
"url": "https://github.com/igorw/evenement",
"reference": "v1.0.0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/igorw/evenement/zipball/fa966683e7df3e5dd5929d984a44abfbd6bafe8d",
"reference": "fa966683e7df3e5dd5929d984a44abfbd6bafe8d",
"url": "https://github.com/igorw/evenement/zipball/v1.0.0",
"reference": "v1.0.0",
"shasum": ""
},
"require": {
@@ -1302,19 +1292,19 @@
"keywords": [
"event-dispatcher"
],
"time": "2012-05-30 15:01:08"
"time": "2012-05-30 08:01:08"
},
{
"name": "facebook/php-sdk",
"version": "v3.2.3",
"source": {
"type": "git",
"url": "https://github.com/facebookarchive/facebook-php-sdk.git",
"url": "https://github.com/facebook/facebook-php-sdk.git",
"reference": "6714042fa2f5979d4c64c7d11fb4bcab16bdf6cb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/facebookarchive/facebook-php-sdk/zipball/6714042fa2f5979d4c64c7d11fb4bcab16bdf6cb",
"url": "https://api.github.com/repos/facebook/facebook-php-sdk/zipball/6714042fa2f5979d4c64c7d11fb4bcab16bdf6cb",
"reference": "6714042fa2f5979d4c64c7d11fb4bcab16bdf6cb",
"shasum": ""
},
@@ -1348,7 +1338,6 @@
"facebook",
"sdk"
],
"abandoned": "facebook/php-sdk-v4",
"time": "2013-11-19 23:11:14"
},
{
@@ -3046,7 +3035,7 @@
],
"authors": [
{
"name": "Steve Clay",
"name": "Stephen Clay",
"email": "steve@mrclay.org",
"homepage": "http://www.mrclay.org/",
"role": "Developer"
@@ -3232,21 +3221,21 @@
"source": {
"type": "git",
"url": "https://github.com/romainneutron/Imagine-Silex-Service-Provider.git",
"reference": "a8a7862ae90419f2b23746cd8436c2310e4eb084"
"reference": "0.1.2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/romainneutron/Imagine-Silex-Service-Provider/zipball/a8a7862ae90419f2b23746cd8436c2310e4eb084",
"reference": "a8a7862ae90419f2b23746cd8436c2310e4eb084",
"url": "https://api.github.com/repos/romainneutron/Imagine-Silex-Service-Provider/zipball/0.1.2",
"reference": "0.1.2",
"shasum": ""
},
"require": {
"imagine/imagine": "*",
"php": ">=5.3.3",
"silex/silex": "~1.0"
"silex/silex": ">=1.0,<2.0"
},
"require-dev": {
"symfony/browser-kit": "~2.0"
"symfony/browser-kit": ">=2.0,<3.0"
},
"type": "library",
"autoload": {
@@ -3718,7 +3707,7 @@
"metadata"
],
"support": {
"source": "https://github.com/alchemy-fr/PHPExiftool/tree/dev"
"source": "https://github.com/alchemy-fr/PHPExiftool/tree/0.4.1-mwg-metadata-copy"
},
"time": "2014-10-08 16:09:02"
},
@@ -3927,12 +3916,12 @@
"source": {
"type": "git",
"url": "https://github.com/Roave/SecurityAdvisories.git",
"reference": "1fe4be09c2f44aace9595e6af383e51a6ba4c819"
"reference": "739e965e42ab51361a3b70396557b05157798626"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/1fe4be09c2f44aace9595e6af383e51a6ba4c819",
"reference": "1fe4be09c2f44aace9595e6af383e51a6ba4c819",
"url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/739e965e42ab51361a3b70396557b05157798626",
"reference": "739e965e42ab51361a3b70396557b05157798626",
"shasum": ""
},
"conflict": {
@@ -3941,23 +3930,25 @@
"doctrine/doctrine-module": "<=0.7.1|<=0.7.1",
"doctrine/orm": ">=2.0.0,<2.0.3",
"dompdf/dompdf": ">=0.6.0,<0.6.1",
"firebase/php-jwt": "<2.0.0",
"friendsofsymfony/rest-bundle": ">=1.2.0,<1.2.2",
"friendsofsymfony/user-bundle": ">=1.2.0,<1.2.1|>=1.2.0,<1.2.4|>=1.2.0,<1.3.0|>=1.3.0,<1.3.5|>=1.2.0,<1.2.5|>=1.3.0,<1.3.3",
"illuminate/auth": ">=4.0.0,<4.0.99|>=4.1.0,<4.1.26",
"illuminate/database": ">=4.0.0,<4.0.99|>=4.1.0,<4.1.29",
"laravel/framework": ">=4.0.0,<4.0.99|>=4.1.0,<4.1.26|>=4.0.0,<4.0.99|>=4.1.0,<4.1.29",
"monolog/monolog": ">=1.8.0,<1.12.0",
"namshi/jose": "<1.1.2|<2.0.3|<2.2.0",
"sabre/dav": ">=1.6.0,<1.6.9|>=1.7.0,<1.7.7|>=1.8.0,<1.8.5",
"socalnick/scn-social-auth": "<1.15.2",
"swiftmailer/swiftmailer": ">=4.0.0,<4.99.99|>=5.0.0,<5.2.1",
"symfony/dependency-injection": ">=2.0.0,<2.0.17",
"symfony/framework-bundle": ">=2.0.0,<2.1.0|>=2.1.0,<2.2.0|>=2.2.0,<2.3.0|>=2.3.0,<2.3.18|>=2.4.0,<2.4.8|>=2.5.0,<2.5.2",
"symfony/http-foundation": ">=2.0.0,<2.0.19|>=2.1.0,<2.1.4|>=2.0.0,<2.0.19|>=2.0.0,<2.0.24|>=2.1.0,<2.1.12|>=2.2.0,<2.2.5|>=2.3.0,<2.3.3|>=2.0.0,<2.1.0|>=2.1.0,<2.2.0|>=2.2.0,<2.3.0|>=2.3.0,<2.3.19|>=2.4.0,<2.4.9|>=2.5.0,<2.5.4|>=2.0.0,<2.1.0|>=2.1.0,<2.2.0|>=2.2.0,<2.3.0|>=2.3.0,<2.3.19|>=2.4.0,<2.4.9|>=2.5.0,<2.5.4",
"symfony/http-kernel": ">=2.0.0,<2.1.0|>=2.1.0,<2.2.0|>=2.2.0,<2.3.0|>=2.3.0,<2.3.19|>=2.4.0,<2.4.9|>=2.5.0,<2.5.4",
"symfony/http-foundation": ">=2.0.0,<2.0.19|>=2.1.0,<2.1.4|>=2.0.0,<2.0.19|>=2.0.0,<2.0.24|>=2.1.0,<2.1.12|>=2.2.0,<2.2.5|>=2.3.0,<2.3.3|>=2.0.0,<2.1.0|>=2.1.0,<2.2.0|>=2.2.0,<2.3.0|>=2.3.0,<2.3.19|>=2.4.0,<2.4.9|>=2.5.0,<2.5.4|>=2.0.0,<2.1.0|>=2.1.0,<2.2.0|>=2.2.0,<2.3.0|>=2.3.0,<2.3.19|>=2.4.0,<2.4.9|>=2.5.0,<2.5.4|>=2.0.0,<2.1.0|>=2.1.0,<2.2.0|>=2.2.0,<2.3.0|>=2.3.0,<2.3.27|>=2.4.0,<2.5.0|>=2.5.0,<2.5.11|>=2.6.0,<2.6.6",
"symfony/http-kernel": ">=2.0.0,<2.1.0|>=2.1.0,<2.2.0|>=2.2.0,<2.3.0|>=2.3.0,<2.3.19|>=2.4.0,<2.4.9|>=2.5.0,<2.5.4|>=2.0.0,<2.1.0|>=2.1.0,<2.2.0|>=2.2.0,<2.3.0|>=2.3.0,<2.3.27|>=2.4.0,<2.5.0|>=2.5.0,<2.5.11|>=2.6.0,<2.6.6",
"symfony/routing": ">=2.0.0,<2.0.17|>=2.0.0,<2.0.19",
"symfony/security": ">=2.0.0,<2.0.19|>=2.0.0,<2.0.25|>=2.1.0,<2.1.13|>=2.2.0,<2.2.9|>=2.3.0,<2.3.6",
"symfony/serializer": ">=2.0.0,<2.0.11",
"symfony/symfony": ">=2.0.0,<2.0.6|>=2.0.0,<2.0.11|>=2.0.0,<2.0.17|>=2.0.0,<2.0.19|>=2.1.0,<2.1.4|>=2.0.0,<2.0.19|>=2.0.0,<2.0.20|>=2.1.0,<2.1.5|>=2.0.0,<2.0.22|>=2.0.0,<2.0.22|>=2.1.0,<2.1.7|>=2.0.0,<2.0.24|>=2.1.0,<2.1.12|>=2.2.0,<2.2.5|>=2.3.0,<2.3.3|>=2.0.0,<2.0.24|>=2.1.0,<2.1.12|>=2.2.0,<2.2.5|>=2.3.0,<2.3.3|>=2.0.0,<2.0.25|>=2.1.0,<2.1.13|>=2.2.0,<2.2.9|>=2.3.0,<2.3.6|>=2.0.0,<2.1.0|>=2.1.0,<2.2.0|>=2.2.0,<2.3.0|>=2.3.0,<2.3.19|>=2.4.0,<2.4.9|>=2.5.0,<2.5.4|>=2.0.0,<2.1.0|>=2.1.0,<2.2.0|>=2.2.0,<2.3.0|>=2.3.0,<2.3.19|>=2.4.0,<2.4.9|>=2.5.0,<2.5.4|>=2.0.0,<2.1.0|>=2.1.0,<2.2.0|>=2.2.0,<2.3.0|>=2.3.0,<2.3.19|>=2.4.0,<2.4.9|>=2.5.0,<2.5.4|>=2.0.0,<2.1.0|>=2.1.0,<2.2.0|>=2.2.0,<2.3.0|>=2.3.0,<2.3.19|>=2.4.0,<2.4.9|>=2.5.0,<2.5.4|>=2.0.0,<2.1.0|>=2.1.0,<2.2.0|>=2.2.0,<2.3.0|>=2.3.0,<2.3.19|>=2.4.0,<2.4.9|>=2.5.0,<2.5.4",
"symfony/symfony": ">=2.0.0,<2.0.6|>=2.0.0,<2.0.11|>=2.0.0,<2.0.17|>=2.0.0,<2.0.19|>=2.1.0,<2.1.4|>=2.0.0,<2.0.19|>=2.0.0,<2.0.20|>=2.1.0,<2.1.5|>=2.0.0,<2.0.22|>=2.0.0,<2.0.22|>=2.1.0,<2.1.7|>=2.0.0,<2.0.24|>=2.1.0,<2.1.12|>=2.2.0,<2.2.5|>=2.3.0,<2.3.3|>=2.0.0,<2.0.24|>=2.1.0,<2.1.12|>=2.2.0,<2.2.5|>=2.3.0,<2.3.3|>=2.0.0,<2.0.25|>=2.1.0,<2.1.13|>=2.2.0,<2.2.9|>=2.3.0,<2.3.6|>=2.0.0,<2.1.0|>=2.1.0,<2.2.0|>=2.2.0,<2.3.0|>=2.3.0,<2.3.19|>=2.4.0,<2.4.9|>=2.5.0,<2.5.4|>=2.0.0,<2.1.0|>=2.1.0,<2.2.0|>=2.2.0,<2.3.0|>=2.3.0,<2.3.19|>=2.4.0,<2.4.9|>=2.5.0,<2.5.4|>=2.0.0,<2.1.0|>=2.1.0,<2.2.0|>=2.2.0,<2.3.0|>=2.3.0,<2.3.19|>=2.4.0,<2.4.9|>=2.5.0,<2.5.4|>=2.0.0,<2.1.0|>=2.1.0,<2.2.0|>=2.2.0,<2.3.0|>=2.3.0,<2.3.19|>=2.4.0,<2.4.9|>=2.5.0,<2.5.4|>=2.0.0,<2.1.0|>=2.1.0,<2.2.0|>=2.2.0,<2.3.0|>=2.3.0,<2.3.19|>=2.4.0,<2.4.9|>=2.5.0,<2.5.4|>=2.0.0,<2.1.0|>=2.1.0,<2.2.0|>=2.2.0,<2.3.0|>=2.3.0,<2.3.27|>=2.4.0,<2.5.0|>=2.5.0,<2.5.11|>=2.6.0,<2.6.6|>=2.0.0,<2.1.0|>=2.1.0,<2.2.0|>=2.2.0,<2.3.0|>=2.3.0,<2.3.27|>=2.4.0,<2.5.0|>=2.5.0,<2.5.11|>=2.6.0,<2.6.6",
"symfony/translation": ">=2.0.0,<2.0.17",
"symfony/validator": ">=2.0.0,<2.0.17|>=2.0.0,<2.0.24|>=2.1.0,<2.1.12|>=2.2.0,<2.2.5|>=2.3.0,<2.3.3",
"symfony/web-profiler-bundle": ">=2.0.0,<2.1.0|>=2.1.0,<2.2.0|>=2.2.0,<2.3.0|>=2.3.0,<2.3.19|>=2.4.0,<2.4.9|>=2.5.0,<2.5.4",
@@ -3995,7 +3986,7 @@
}
],
"description": "Prevents installation of composer packages with known security vulnerabilities: no API, simply require it",
"time": "2015-03-13 23:54:02"
"time": "2015-04-03 12:25:49"
},
{
"name": "silex/silex",
@@ -4208,7 +4199,7 @@
},
{
"name": "Phraseanet Team",
"email": "info@alchemy.fr",
"email": "support@alchemy.fr",
"homepage": "http://www.phraseanet.com/"
}
],
@@ -4845,16 +4836,16 @@
},
{
"name": "phpunit/php-code-coverage",
"version": "2.0.15",
"version": "2.0.16",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "34cc484af1ca149188d0d9e91412191e398e0b67"
"reference": "934fd03eb6840508231a7f73eb8940cf32c3b66c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/34cc484af1ca149188d0d9e91412191e398e0b67",
"reference": "34cc484af1ca149188d0d9e91412191e398e0b67",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/934fd03eb6840508231a7f73eb8940cf32c3b66c",
"reference": "934fd03eb6840508231a7f73eb8940cf32c3b66c",
"shasum": ""
},
"require": {
@@ -4903,35 +4894,37 @@
"testing",
"xunit"
],
"time": "2015-01-24 10:06:35"
"time": "2015-04-11 04:35:00"
},
{
"name": "phpunit/php-file-iterator",
"version": "1.3.4",
"version": "1.4.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
"reference": "acd690379117b042d1c8af1fafd61bde001bf6bb"
"reference": "a923bb15680d0089e2316f7a4af8f437046e96bb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/acd690379117b042d1c8af1fafd61bde001bf6bb",
"reference": "acd690379117b042d1c8af1fafd61bde001bf6bb",
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a923bb15680d0089e2316f7a4af8f437046e96bb",
"reference": "a923bb15680d0089e2316f7a4af8f437046e96bb",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4.x-dev"
}
},
"autoload": {
"classmap": [
"File/"
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [
"BSD-3-Clause"
],
@@ -4948,7 +4941,7 @@
"filesystem",
"iterator"
],
"time": "2013-10-10 15:34:57"
"time": "2015-04-02 05:19:05"
},
{
"name": "phpunit/php-text-template",
@@ -5040,16 +5033,16 @@
},
{
"name": "phpunit/php-token-stream",
"version": "1.4.0",
"version": "1.4.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
"reference": "db32c18eba00b121c145575fcbcd4d4d24e6db74"
"reference": "eab81d02569310739373308137284e0158424330"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/db32c18eba00b121c145575fcbcd4d4d24e6db74",
"reference": "db32c18eba00b121c145575fcbcd4d4d24e6db74",
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/eab81d02569310739373308137284e0158424330",
"reference": "eab81d02569310739373308137284e0158424330",
"shasum": ""
},
"require": {
@@ -5085,20 +5078,20 @@
"keywords": [
"tokenizer"
],
"time": "2015-01-17 09:51:32"
"time": "2015-04-08 04:46:07"
},
{
"name": "phpunit/phpunit",
"version": "4.5.1",
"version": "4.6.4",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "d6429b0995b24a2d9dfe5587ee3a7071c1161af4"
"reference": "163232991e652e6efed2f8470326fffa61e848e2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d6429b0995b24a2d9dfe5587ee3a7071c1161af4",
"reference": "d6429b0995b24a2d9dfe5587ee3a7071c1161af4",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/163232991e652e6efed2f8470326fffa61e848e2",
"reference": "163232991e652e6efed2f8470326fffa61e848e2",
"shasum": ""
},
"require": {
@@ -5110,17 +5103,17 @@
"php": ">=5.3.3",
"phpspec/prophecy": "~1.3,>=1.3.1",
"phpunit/php-code-coverage": "~2.0,>=2.0.11",
"phpunit/php-file-iterator": "~1.3.2",
"phpunit/php-file-iterator": "~1.4",
"phpunit/php-text-template": "~1.2",
"phpunit/php-timer": "~1.0.2",
"phpunit/php-timer": "~1.0",
"phpunit/phpunit-mock-objects": "~2.3",
"sebastian/comparator": "~1.1",
"sebastian/diff": "~1.1",
"sebastian/diff": "~1.2",
"sebastian/environment": "~1.2",
"sebastian/exporter": "~1.2",
"sebastian/global-state": "~1.0",
"sebastian/version": "~1.0",
"symfony/yaml": "~2.0"
"symfony/yaml": "~2.1|~3.0"
},
"suggest": {
"phpunit/php-invoker": "~1.1"
@@ -5131,7 +5124,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.5.x-dev"
"dev-master": "4.6.x-dev"
}
},
"autoload": {
@@ -5157,7 +5150,7 @@
"testing",
"xunit"
],
"time": "2015-03-29 09:24:05"
"time": "2015-04-11 05:23:21"
},
{
"name": "phpunit/phpunit-mock-objects",
@@ -5280,16 +5273,16 @@
},
{
"name": "sebastian/diff",
"version": "1.2.0",
"version": "1.3.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/diff.git",
"reference": "5843509fed39dee4b356a306401e9dd1a931fec7"
"reference": "863df9687835c62aa423a22412d26fa2ebde3fd3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/5843509fed39dee4b356a306401e9dd1a931fec7",
"reference": "5843509fed39dee4b356a306401e9dd1a931fec7",
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/863df9687835c62aa423a22412d26fa2ebde3fd3",
"reference": "863df9687835c62aa423a22412d26fa2ebde3fd3",
"shasum": ""
},
"require": {
@@ -5301,7 +5294,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2-dev"
"dev-master": "1.3-dev"
}
},
"autoload": {
@@ -5328,32 +5321,32 @@
"keywords": [
"diff"
],
"time": "2014-08-15 10:29:00"
"time": "2015-02-22 15:13:53"
},
{
"name": "sebastian/environment",
"version": "1.2.1",
"version": "1.2.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/environment.git",
"reference": "6e6c71d918088c251b181ba8b3088af4ac336dd7"
"reference": "5a8c7d31914337b69923db26c4221b81ff5a196e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6e6c71d918088c251b181ba8b3088af4ac336dd7",
"reference": "6e6c71d918088c251b181ba8b3088af4ac336dd7",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5a8c7d31914337b69923db26c4221b81ff5a196e",
"reference": "5a8c7d31914337b69923db26c4221b81ff5a196e",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.3"
"phpunit/phpunit": "~4.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2.x-dev"
"dev-master": "1.3.x-dev"
}
},
"autoload": {
@@ -5378,7 +5371,7 @@
"environment",
"hhvm"
],
"time": "2014-10-25 08:00:45"
"time": "2015-01-01 10:01:08"
},
{
"name": "sebastian/exporter",
@@ -5552,16 +5545,16 @@
},
{
"name": "sebastian/version",
"version": "1.0.4",
"version": "1.0.5",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/version.git",
"reference": "a77d9123f8e809db3fbdea15038c27a95da4058b"
"reference": "ab931d46cd0d3204a91e1b9a40c4bc13032b58e4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/version/zipball/a77d9123f8e809db3fbdea15038c27a95da4058b",
"reference": "a77d9123f8e809db3fbdea15038c27a95da4058b",
"url": "https://api.github.com/repos/sebastianbergmann/version/zipball/ab931d46cd0d3204a91e1b9a40c4bc13032b58e4",
"reference": "ab931d46cd0d3204a91e1b9a40c4bc13032b58e4",
"shasum": ""
},
"type": "library",
@@ -5583,7 +5576,7 @@
],
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
"homepage": "https://github.com/sebastianbergmann/version",
"time": "2014-12-15 14:25:24"
"time": "2015-02-24 06:35:25"
}
],
"aliases": [

View File

@@ -12,9 +12,6 @@
namespace Alchemy\Phrasea;
use Alchemy\Geonames\GeonamesServiceProvider;
use Alchemy\Phrasea\ControllerProvider\Admin\SearchEngine;
use Alchemy\Phrasea\ControllerProvider\Admin\Setup;
use Alchemy\Phrasea\ControllerProvider\Admin\Subdefs;
use Alchemy\Phrasea\ControllerProvider\Admin\TaskManager;
use Alchemy\Phrasea\ControllerProvider\Client\Root as ClientRoot;
use Alchemy\Phrasea\ControllerProvider\Prod\BasketController;
@@ -312,6 +309,10 @@ class Application extends SilexApplication
'Alchemy\Phrasea\ControllerProvider\Admin\Feeds' => [],
'Alchemy\Phrasea\ControllerProvider\Admin\Fields' => [],
'Alchemy\Phrasea\ControllerProvider\Admin\Root' => [],
'Alchemy\Phrasea\ControllerProvider\Admin\SearchEngine' => [],
'Alchemy\Phrasea\ControllerProvider\Admin\Setup' => [],
'Alchemy\Phrasea\ControllerProvider\Admin\Subdefs' => [],
'Alchemy\Phrasea\ControllerProvider\Admin\TaskManager' => [],
'Alchemy\Phrasea\ControllerProvider\Admin\Users' => [],
'Alchemy\Phrasea\ControllerProvider\Datafiles' => [],
'Alchemy\Phrasea\ControllerProvider\Lightbox' => [],
@@ -622,11 +623,6 @@ class Application extends SilexApplication
$this->mount('/login/', new Login());
$this->mount('/developers/', new Developers());
$this->mount('/admin/setup', new Setup());
$this->mount('/admin/search-engine', new SearchEngine());
$this->mount('/admin/task-manager', new TaskManager());
$this->mount('/admin/subdefs', new Subdefs());
$this->mount('/client/', new ClientRoot());
$this->mount('/prod/query/', new Query());
@@ -676,6 +672,10 @@ class Application extends SilexApplication
'/admin/databoxes' => 'Alchemy\Phrasea\ControllerProvider\Admin\Databoxes',
'/admin/fields' => 'Alchemy\Phrasea\ControllerProvider\Admin\Fields',
'/admin/publications' => 'Alchemy\Phrasea\ControllerProvider\Admin\Feeds',
'/admin/search-engine' => 'Alchemy\Phrasea\ControllerProvider\Admin\SearchEngine',
'/admin/setup' => 'Alchemy\Phrasea\ControllerProvider\Admin\Setup',
'/admin/subdefs' => 'Alchemy\Phrasea\ControllerProvider\Admin\Subdefs',
'/admin/task-manager' => 'Alchemy\Phrasea\ControllerProvider\Admin\TaskManager',
'/admin/users' => 'Alchemy\Phrasea\ControllerProvider\Admin\Users',
'/datafiles' => 'Alchemy\Phrasea\ControllerProvider\Datafiles',
'/include/minify' => 'Alchemy\Phrasea\ControllerProvider\Minifier',

View File

@@ -0,0 +1,46 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2015 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Controller\Admin;
use Alchemy\Phrasea\SearchEngine\ConfigurationPanelInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class SearchEngineController
{
/**
* @var ConfigurationPanelInterface
*/
private $configurationPanel;
public function __construct(ConfigurationPanelInterface $configurationPanel)
{
$this->configurationPanel = $configurationPanel;
}
/**
* @param Request $request
* @return Response
*/
public function getConfigurationPanelAction(Request $request)
{
return $this->configurationPanel->get($request);
}
/**
* @param Request $request
* @return Response
*/
public function postConfigurationPanelAction(Request $request)
{
return $this->configurationPanel->post($request);
}
}

View File

@@ -0,0 +1,41 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2015 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Controller\Admin;
use Alchemy\Phrasea\Controller\Controller;
use Alchemy\Phrasea\Core\Configuration\RegistryManipulator;
use Symfony\Component\HttpFoundation\Request;
class SetupController extends Controller
{
public function submitGlobalsAction(Request $request)
{
/** @var RegistryManipulator $manipulator */
$manipulator = $this->app['registry.manipulator'];
$form = $manipulator->createForm($this->app['conf']);
$status = 200;
if ('POST' === $request->getMethod()) {
$form->submit($request->request->all());
if ($form->isValid()) {
$this->app['conf']->set('registry', $manipulator->getRegistryData($form));
return $this->app->redirectPath('setup_display_globals');
}
$status = 400;
}
return $this->renderResponse('admin/setup.html.twig', [
'form' => $form->createView(),
], $status);
}
}

View File

@@ -0,0 +1,118 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2015 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Controller\Admin;
use Alchemy\Phrasea\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class SubdefsController extends Controller
{
/**
* @param int $sbas_id
* @return Response
*/
function indexAction($sbas_id) {
$databox = $this->findDataboxById((int) $sbas_id);
return $this->render('admin/subdefs.html.twig', [
'databox' => $databox,
'subdefs' => $databox->get_subdef_structure()
]);
}
/**
* @param Request $request
* @param int $sbas_id
* @return Response
* @throws \Exception
*/
function changeSubdefsAction(Request $request, $sbas_id) {
$delete_subdef = $request->request->get('delete_subdef');
$toadd_subdef = $request->request->get('add_subdef');
$Parmsubdefs = $request->request->get('subdefs', []);
$databox = $this->findDataboxById((int) $sbas_id);
$add_subdef = ['class' => null, 'name' => null, 'group' => null];
foreach ($add_subdef as $k => $v) {
if (!isset($toadd_subdef[$k]) || trim($toadd_subdef[$k]) === '') {
unset($add_subdef[$k]);
} else {
$add_subdef[$k] = $toadd_subdef[$k];
}
}
if ($delete_subdef) {
$delete_subef = explode('_', $delete_subdef, 2);
$group = $delete_subef[0];
$name = $delete_subef[1];
$subdefs = $databox->get_subdef_structure();
$subdefs->delete_subdef($group, $name);
} elseif (count($add_subdef) === 3) {
$subdefs = $databox->get_subdef_structure();
$group = $add_subdef['group'];
/** @var \unicode $unicode */
$unicode = $this->app['unicode'];
$name = $unicode->remove_nonazAZ09($add_subdef['name'], false);
$class = $add_subdef['class'];
$subdefs->add_subdef($group, $name, $class);
} else {
$subdefs = $databox->get_subdef_structure();
foreach ($Parmsubdefs as $post_sub) {
$options = [];
$post_sub_ex = explode('_', $post_sub, 2);
$group = $post_sub_ex[0];
$name = $post_sub_ex[1];
$class = $request->request->get($post_sub . '_class');
$downloadable = $request->request->get($post_sub . '_downloadable');
$defaults = ['path', 'meta', 'mediatype'];
foreach ($defaults as $def) {
$parm_loc = $request->request->get($post_sub . '_' . $def);
if ($def == 'meta' && !$parm_loc) {
$parm_loc = "no";
}
$options[$def] = $parm_loc;
}
$mediatype = $request->request->get($post_sub . '_mediatype');
$media = $request->request->get($post_sub . '_' . $mediatype, []);
foreach ($media as $option => $value) {
if ($option == 'resolution' && $mediatype == 'image') {
$option = 'dpi';
}
$options[$option] = $value;
}
$labels = $request->request->get($post_sub . '_label', []);
$subdefs->set_subdef($group, $name, $class, $downloadable, $options, $labels);
}
}
return $this->app->redirectPath('admin_subdefs_subdef', [
'sbas_id' => $databox->get_sbas_id(),
]);
}
}

View File

@@ -0,0 +1,380 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2015 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Controller\Admin;
use Alchemy\Phrasea\Controller\Controller;
use Alchemy\Phrasea\Exception\InvalidArgumentException;
use Alchemy\Phrasea\Exception\RuntimeException;
use Alchemy\Phrasea\Form\TaskForm;
use Alchemy\Phrasea\Model\Entities\Task;
use Alchemy\Phrasea\Model\Manipulator\TaskManipulator;
use Alchemy\Phrasea\Model\Repositories\TaskRepository;
use Alchemy\Phrasea\TaskManager\Job\Factory;
use Alchemy\Phrasea\TaskManager\LiveInformation;
use Alchemy\Phrasea\TaskManager\Log\LogFileFactory;
use Alchemy\Phrasea\TaskManager\TaskManagerStatus;
use Silex\Application;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\Process\Process;
class TaskManagerController extends Controller
{
public function startScheduler()
{
/** @var TaskManagerStatus $status */
$status = $this->app['task-manager.status'];
$status->start();
$cmdLine = sprintf(
'%s %s %s',
$this->getConf()->get(['main', 'binaries', 'php_binary']),
realpath(__DIR__ . '/../../../../../bin/console'),
'task-manager:scheduler:run'
);
/** @var EventDispatcherInterface $dispatcher */
$dispatcher = $this->app['dispatcher'];
$dispatcher->addListener(KernelEvents::TERMINATE, function () use ($cmdLine) {
$process = new Process($cmdLine);
$process->setTimeout(0);
$process->disableOutput();
set_time_limit(0);
ignore_user_abort(true);
$process->run();
}, -1000);
return $this->app->redirectPath('admin_tasks_list');
}
public function stopScheduler()
{
/** @var TaskManagerStatus $status */
$status = $this->app['task-manager.status'];
$status->stop();
$info = $this->getLiveInformationRequest();
$data = $info->getManager();
if (null !== $pid = $data['process-id']) {
if (substr(php_uname(), 0, 7) == "Windows"){
exec(sprintf('TaskKill /PID %d', $pid));
} else {
exec(sprintf('kill %d', $pid));
}
}
return $this->app->redirectPath('admin_tasks_list');
}
public function getRoot()
{
return $this->app->redirectPath('admin_tasks_list');
}
public function getLiveInformation(Request $request)
{
if (false === $this->app['phraseanet.configuration']['main']['task-manager']['enabled']) {
throw new RuntimeException('The use of the task manager is disabled on this instance.');
}
if ($request->getRequestFormat() !== "json") {
$this->app->abort(406, 'Only JSON format is accepted.');
}
$tasks = [];
/** @var Task $task */
foreach ($this->getTaskRepository()->findAll() as $task) {
$tasks[$task->getId()] = $this->getLiveInformationRequest()->getTask($task);
}
return $this->app->json([
'manager' => $this->getLiveInformationRequest()->getManager(),
'tasks' => $tasks
]);
}
public function getScheduler(Request $request)
{
if (false === $this->app['phraseanet.configuration']['main']['task-manager']['enabled']) {
throw new RuntimeException('The use of the task manager is disabled on this instance.');
}
if ($request->getRequestFormat() !== "json") {
$this->app->abort(406, 'Only JSON format is accepted.');
}
return $this->app->json([
'name' => $this->app->trans('Task Scheduler'),
'configuration' => $this->app['task-manager.status']->getStatus(),
'urls' => [
'start' => $this->app->path('admin_tasks_scheduler_start'),
'stop' => $this->app->path('admin_tasks_scheduler_stop'),
'log' => $this->app->path('admin_tasks_scheduler_log'),
]
]);
}
public function getTasks(Request $request)
{
$tasks = [];
/** @var Task $task */
foreach ($this->getTaskRepository()->findAll() as $task) {
$tasks[] = [
'id' => $task->getId(),
'name' => $task->getName(),
'status' => $task->getStatus()
];
}
if ($request->getRequestFormat() === "json") {
foreach ($tasks as $k => $task) {
$tasks[$k]['urls'] = $this->getTaskResourceUrls($task['id']);
}
return $this->app->json($tasks);
}
return $this->app['twig']->render('admin/task-manager/index.html.twig', [
'available_jobs' => $this->app['task-manager.available-jobs'],
'tasks' => $tasks,
'scheduler' => [
'id' => null,
'name' => $this->app->trans('Task Scheduler'),
'status' => $this->app['task-manager.status']->getStatus(),
]
]);
}
public function postCreateTask(Request $request)
{
try {
/** @var Factory $factory */
$factory = $this->app['task-manager.job-factory'];
$job = $factory->create($request->request->get('job-name'));
} catch (InvalidArgumentException $e) {
throw new HttpException(400, $e->getMessage(), $e);
}
$task = $this->getTaskManipulator()->create(
$job->getName(),
$job->getJobId(),
$job->getEditor()->getDefaultSettings($this->app['conf']),
$job->getEditor()->getDefaultPeriod()
);
return $this->app->redirectPath('admin_tasks_task_show', ['task' => $task->getId()]);
}
public function getSchedulerLog(Request $request)
{
/** @var LogFileFactory $factory */
$factory = $this->app['task-manager.log-file.factory'];
$logFile = $factory->forManager();
if ($request->query->get('clr')) {
$logFile->clear();
}
return $this->render('admin/task-manager/log.html.twig', [
'logfile' => $logFile,
'logname' => 'Scheduler',
]);
}
public function getTaskLog(Request $request, Task $task)
{
/** @var LogFileFactory $factory */
$factory = $this->app['task-manager.log-file.factory'];
$logFile = $factory->forTask($task);
if ($request->query->get('clr')) {
$logFile->clear();
}
return $this->render('admin/task-manager/log.html.twig', [
'logfile' => $logFile,
'logname' => sprintf('%s (task id %d)', $task->getName(), $task->getId()),
]);
}
public function postTaskDelete(Task $task)
{
if (false === $this->app['phraseanet.configuration']['main']['task-manager']['enabled']) {
throw new RuntimeException('The use of the task manager is disabled on this instance.');
}
$this->getTaskManipulator()->delete($task);
return $this->app->redirectPath('admin_tasks_list');
}
public function postStartTask(Task $task)
{
if (false === $this->app['phraseanet.configuration']['main']['task-manager']['enabled']) {
throw new RuntimeException('The use of the task manager is disabled on this instance.');
}
$this->getTaskManipulator()->start($task);
return $this->app->redirectPath('admin_tasks_list');
}
public function postStopTask(Task $task)
{
if (false === $this->app['phraseanet.configuration']['main']['task-manager']['enabled']) {
throw new RuntimeException('The use of the task manager is disabled on this instance.');
}
$this->getTaskManipulator()->stop($task);
return $this->app->redirectPath('admin_tasks_list');
}
public function postResetCrashes(Task $task)
{
$this->getTaskManipulator()->resetCrashes($task);
return $this->app->json(['success' => true]);
}
public function postSaveTask(Request $request, Task $task)
{
if (false === $this->app['phraseanet.configuration']['main']['task-manager']['enabled']) {
throw new RuntimeException('The use of the task manager is disabled on this instance.');
}
if (!$this->doValidateXML($request->request->get('settings'))) {
return $this->app->json(['success' => false, 'message' => sprintf('Unable to load XML %s', $request->request->get('xml'))]);
}
$form = $this->app->form(new TaskForm());
$form->setData($task);
$form->handleRequest($request);
if ($form->isValid()) {
$this->getTaskManipulator()->update($task);
return $this->app->json(['success' => true]);
}
return $this->app->json([
'success' => false,
'message' => implode("\n", iterator_to_array($form->getErrors())),
]);
}
public function postTaskFacility(Request $request, Task $task)
{
return $this->getJobFactory()
->create($task->getJobId())
->getEditor()
->facility($this->app, $request);
}
public function postXMLFromForm(Request $request, Task $task)
{
return $this->getJobFactory()
->create($task->getJobId())
->getEditor()
->updateXMLWithRequest($request);
}
public function getTask(Request $request, Task $task)
{
if (false === $this->app['phraseanet.configuration']['main']['task-manager']['enabled']) {
throw new RuntimeException('The use of the task manager is disabled on this instance.');
}
if ('json' === $request->getContentType()) {
return $this->app->json(array_replace([
'id' => $task->getId(),
'name' => $task->getName(),
'urls' => $this->getTaskResourceUrls($task->getId())
],
$this->getLiveInformationRequest()->getTask($task)
));
}
$editor = $this->getJobFactory()
->create($task->getJobId())
->getEditor();
$form = $this->app->form(new TaskForm());
$form->setData($task);
return $this->render($editor->getTemplatePath(), [
'task' => $task,
'form' => $form->createView(),
'view' => 'XML',
]);
}
public function validateXML(Request $request)
{
if (false === $this->app['phraseanet.configuration']['main']['task-manager']['enabled']) {
throw new RuntimeException('The use of the task manager is disabled on this instance.');
}
return $this->app->json(['success' => $this->doValidateXML($request->getContent())]);
}
private function doValidateXML($string)
{
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom->strictErrorChecking = true;
return (Boolean) @$dom->loadXML($string);
}
private function getTaskResourceUrls($taskId)
{
return [
'show' => $this->app->path('admin_tasks_task_show', ['task' => $taskId]),
'start' => $this->app->path('admin_tasks_task_start', ['task' => $taskId]),
'stop' => $this->app->path('admin_tasks_task_stop', ['task' => $taskId]),
'delete' => $this->app->path('admin_tasks_task_delete', ['task' => $taskId]),
'log' => $this->app->path('admin_tasks_task_log', ['task' => $taskId]),
];
}
/**
* @return TaskRepository
*/
private function getTaskRepository()
{
return $this->app['repo.tasks'];
}
/**
* @return LiveInformation
*/
private function getLiveInformationRequest()
{
return $this->app['task-manager.live-information'];
}
/**
* @return TaskManipulator
*/
private function getTaskManipulator()
{
return $this->app['manipulator.task'];
}
/**
* @return Factory
*/
private function getJobFactory()
{
return $this->app['task-manager.job-factory'];
}
}

View File

@@ -13,6 +13,7 @@ namespace Alchemy\Phrasea\Controller;
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Authentication\ACLProvider;
use Alchemy\Phrasea\Authentication\Authenticator;
use Alchemy\Phrasea\Core\Configuration\PropertyAccess;
use Alchemy\Phrasea\Model\Entities\User;
use Symfony\Component\HttpFoundation\Response;
@@ -110,4 +111,12 @@ class Controller
{
return $this->getAuthenticator()->getUser();
}
/**
* @return PropertyAccess
*/
protected function getConf()
{
return $this->app['conf'];
}
}

View File

@@ -12,34 +12,36 @@
namespace Alchemy\Phrasea\ControllerProvider\Admin;
use Alchemy\Phrasea\Application as PhraseaApplication;
use Symfony\Component\HttpFoundation\Request;
use Alchemy\Phrasea\Controller\Admin\SearchEngineController;
use Silex\ControllerCollection;
use Silex\ServiceProviderInterface;
use Silex\Application;
use Silex\ControllerProviderInterface;
class SearchEngine implements ControllerProviderInterface
class SearchEngine implements ControllerProviderInterface, ServiceProviderInterface
{
public function register(Application $app)
{
$app['controller.admin.search-engine'] = $app->share(function (PhraseaApplication $app) {
return new SearchEngineController($app);
});
}
public function boot(Application $app)
{
}
public function connect(Application $app)
{
$app['controller.admin.search-engine'] = $this;
/** @var ControllerCollection $controllers */
$controllers = $app['controllers_factory'];
$controllers->get('/', 'controller.admin.search-engine:getSearchEngineConfigurationPanel')
$controllers->get('/', 'controller.admin.search-engine:getConfigurationPanelAction')
->bind('admin_searchengine_get');
$controllers->post('/', 'controller.admin.search-engine:postSearchEngineConfigurationPanel')
$controllers->post('/', 'controller.admin.search-engine:postConfigurationPanelAction')
->bind('admin_searchengine_post');
return $controllers;
}
public function getSearchEngineConfigurationPanel(PhraseaApplication $app, Request $request)
{
return $app['phraseanet.SE']->getConfigurationPanel()->get($app, $request);
}
public function postSearchEngineConfigurationPanel(PhraseaApplication $app, Request $request)
{
return $app['phraseanet.SE']->getConfigurationPanel()->post($app, $request);
}
}

View File

@@ -11,45 +11,42 @@
namespace Alchemy\Phrasea\ControllerProvider\Admin;
use Alchemy\Phrasea\Application;
use Silex\Application as SilexApplication;
use Alchemy\Phrasea\Application as PhraseaApplication;
use Alchemy\Phrasea\Controller\Admin\SetupController;
use Alchemy\Phrasea\Security\Firewall;
use Silex\Application;
use Silex\ControllerCollection;
use Silex\ControllerProviderInterface;
use Symfony\Component\HttpFoundation\Request;
use Silex\ServiceProviderInterface;
class Setup implements ControllerProviderInterface
class Setup implements ControllerProviderInterface, ServiceProviderInterface
{
public function connect(SilexApplication $app)
public function register(Application $app)
{
$app['controller.admin.setup'] = $this;
$app['controller.admin.setup'] = $app->share(function (PhraseaApplication $app) {
return new SetupController($app);
});
}
public function boot(Application $app)
{
}
public function connect(Application $app)
{
/** @var ControllerCollection $controllers */
$controllers = $app['controllers_factory'];
$controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireAdmin();
/** @var Firewall $firewall */
$firewall = $app['firewall'];
$controllers->before(function () use ($firewall) {
$firewall->requireAdmin();
});
$controllers->match('/', 'controller.admin.setup:getGlobals')
$controllers->match('/', 'controller.admin.setup:submitGlobalsAction')
->bind('setup_display_globals')
->method('GET|POST');
return $controllers;
}
public function getGlobals(Application $app, Request $request)
{
$form = $app['registry.manipulator']->createForm($app['conf']);
if ('POST' === $request->getMethod()) {
$form->bind($request);
if ($form->isValid()) {
$app['conf']->set('registry', $app['registry.manipulator']->getRegistryData($form));
return $app->redirectPath('setup_display_globals');
}
}
return $app['twig']->render('admin/setup.html.twig', [
'form' => $form->createView(),
]);
}
}

View File

@@ -11,115 +11,47 @@
namespace Alchemy\Phrasea\ControllerProvider\Admin;
use Alchemy\Phrasea\Application as PhraseaApplication;
use Alchemy\Phrasea\Controller\Admin\SubdefsController;
use Alchemy\Phrasea\Security\Firewall;
use Silex\Application;
use Silex\ControllerCollection;
use Silex\ControllerProviderInterface;
use Silex\ServiceProviderInterface;
use Symfony\Component\HttpFoundation\Request;
class Subdefs implements ControllerProviderInterface
class Subdefs implements ControllerProviderInterface, ServiceProviderInterface
{
public function register(Application $app)
{
$app['controller.admin.subdefs'] = $app->share(function (PhraseaApplication $app) {
return new SubdefsController($app);
});
}
public function boot(Application $app)
{
}
public function connect(Application $app)
{
$app['controller.admin.subdefs'] = $this;
/** @var ControllerCollection $controllers */
$controllers = $app['controllers_factory'];
$app['firewall']->addMandatoryAuthentication($controllers);
/** @var Firewall $firewall */
$firewall = $app['firewall'];
$firewall->addMandatoryAuthentication($controllers);
$controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireAccessToModule('admin')
$controllers->before(function (Request $request) use ($firewall) {
$firewall->requireAccessToModule('admin')
->requireRightOnSbas($request->attributes->get('sbas_id'), 'bas_modify_struct');
});
$controllers->get('/{sbas_id}/', function (Application $app, $sbas_id) {
$databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id);
return $app['twig']->render('admin/subdefs.html.twig', [
'databox' => $databox,
'subdefs' => $databox->get_subdef_structure()
]);
})
$controllers->get('/{sbas_id}/', 'controller.admin.subdefs:indexAction')
->bind('admin_subdefs_subdef')
->assert('sbas_id', '\d+');
$controllers->post('/{sbas_id}/', function (Application $app, Request $request, $sbas_id) {
$delete_subdef = $request->request->get('delete_subdef');
$toadd_subdef = $request->request->get('add_subdef');
$Parmsubdefs = $request->request->get('subdefs', []);
$databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id);
$add_subdef = ['class' => null, 'name' => null, 'group' => null];
foreach ($add_subdef as $k => $v) {
if (!isset($toadd_subdef[$k]) || trim($toadd_subdef[$k]) === '')
unset($add_subdef[$k]);
else
$add_subdef[$k] = $toadd_subdef[$k];
}
if ($delete_subdef) {
$delete_subef = explode('_', $delete_subdef, 2);
$group = $delete_subef[0];
$name = $delete_subef[1];
$subdefs = $databox->get_subdef_structure();
$subdefs->delete_subdef($group, $name);
} elseif (count($add_subdef) === 3) {
$subdefs = $databox->get_subdef_structure();
$group = $add_subdef['group'];
$name = $app['unicode']->remove_nonazAZ09($add_subdef['name'], false);
$class = $add_subdef['class'];
$subdefs->add_subdef($group, $name, $class);
} else {
$subdefs = $databox->get_subdef_structure();
foreach ($Parmsubdefs as $post_sub) {
$options = [];
$post_sub_ex = explode('_', $post_sub, 2);
$group = $post_sub_ex[0];
$name = $post_sub_ex[1];
$class = $request->request->get($post_sub . '_class');
$downloadable = $request->request->get($post_sub . '_downloadable');
$defaults = ['path', 'meta', 'mediatype'];
foreach ($defaults as $def) {
$parm_loc = $request->request->get($post_sub . '_' . $def);
if ($def == 'meta' && !$parm_loc) {
$parm_loc = "no";
}
$options[$def] = $parm_loc;
}
$mediatype = $request->request->get($post_sub . '_mediatype');
$media = $request->request->get($post_sub . '_' . $mediatype, []);
foreach ($media as $option => $value) {
if ($option == 'resolution' && $mediatype == 'image') {
$option = 'dpi';
}
$options[$option] = $value;
}
$labels = $request->request->get($post_sub . '_label', []);
$subdefs->set_subdef($group, $name, $class, $downloadable, $options, $labels);
}
}
return $app->redirectPath('admin_subdefs_subdef', ['sbas_id' => $databox->get_sbas_id()]);
})
$controllers->post('/{sbas_id}/', 'controller.admin.subdefs:changeSubdefsAction')
->bind('admin_subdefs_subdef_update')
->assert('sbas_id', '\d+');

View File

@@ -11,34 +11,44 @@
namespace Alchemy\Phrasea\ControllerProvider\Admin;
use Alchemy\Phrasea\Exception\InvalidArgumentException;
use Alchemy\Phrasea\Exception\RuntimeException;
use Alchemy\Phrasea\Form\TaskForm;
use Alchemy\Phrasea\Model\Entities\Task;
use Alchemy\Phrasea\TaskManager\LiveInformation;
use Alchemy\Phrasea\Controller\Admin\TaskManagerController;
use Alchemy\Phrasea\Model\Converter\TaskConverter;
use Alchemy\Phrasea\Security\Firewall;
use Silex\Application;
use Silex\ControllerCollection;
use Silex\ControllerProviderInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\Process\Process;
use Silex\ServiceProviderInterface;
class TaskManager implements ControllerProviderInterface
class TaskManager implements ControllerProviderInterface, ServiceProviderInterface
{
public function register(Application $app)
{
$app['controller.admin.task'] = $app->share(function (\Alchemy\Phrasea\Application $app) {
return new TaskManagerController($app);
});
}
public function boot(Application $app)
{
}
public function connect(Application $app)
{
$app['controller.admin.task'] = $this;
/** @var ControllerCollection $controllers */
$controllers = $app['controllers_factory'];
$app['firewall']->addMandatoryAuthentication($controllers);
/** @var Firewall $firewall */
$firewall = $app['firewall'];
$firewall->addMandatoryAuthentication($controllers);
$converter = function ($task) use ($app) {
return $app['converter.task']->convert($task);
/** @var TaskConverter $converter */
$converter = $app['converter.task'];
return $converter->convert($task);
};
$controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireRight('taskmanager');
$controllers->before(function () use ($firewall) {
$firewall->requireRight('taskmanager');
});
$controllers
@@ -124,309 +134,4 @@ class TaskManager implements ControllerProviderInterface
return $controllers;
}
public function startScheduler(Application $app, Request $request)
{
$app['task-manager.status']->start();
$cmdLine = sprintf(
'%s %s %s',
$app['conf']->get(['main', 'binaries', 'php_binary']),
realpath(__DIR__ . '/../../../../../bin/console'),
'task-manager:scheduler:run'
);
/** @var EventDispatcherInterface $dispatcher */
$dispatcher = $app['dispatcher'];
$dispatcher->addListener(KernelEvents::TERMINATE, function () use ($cmdLine) {
$process = new Process($cmdLine);
$process->setTimeout(0);
$process->disableOutput();
set_time_limit(0);
ignore_user_abort(true);
$process->run();
}, -1000);
return $app->redirectPath('admin_tasks_list');
}
public function stopScheduler(Application $app, Request $request)
{
$app['task-manager.status']->stop();
/** @var LiveInformation $info */
$info = $app['task-manager.live-information'];
$data = $info->getManager();
if (null !== $pid = $data['process-id']) {
if (substr(php_uname(), 0, 7) == "Windows"){
exec(sprintf('TaskKill /PID %d', $pid));
} else {
exec(sprintf('kill %d', $pid));
}
}
return $app->redirectPath('admin_tasks_list');
}
public function getRoot(Application $app, Request $request)
{
return $app->redirectPath('admin_tasks_list');
}
public function getLiveInformation(Application $app, Request $request)
{
if (false === $app['phraseanet.configuration']['main']['task-manager']['enabled']) {
throw new RuntimeException('The use of the task manager is disabled on this instance.');
}
if ($request->getRequestFormat() !== "json") {
$app->abort(406, 'Only JSON format is accepted.');
}
$tasks = [];
foreach ($app['repo.tasks']->findAll() as $task) {
$tasks[$task->getId()] = $app['task-manager.live-information']->getTask($task);
}
return $app->json([
'manager' => $app['task-manager.live-information']->getManager(),
'tasks' => $tasks
]);
}
public function getScheduler(Application $app, Request $request)
{
if (false === $app['phraseanet.configuration']['main']['task-manager']['enabled']) {
throw new RuntimeException('The use of the task manager is disabled on this instance.');
}
if ($request->getRequestFormat() !== "json") {
$app->abort(406, 'Only JSON format is accepted.');
}
return $app->json([
'name' => $app->trans('Task Scheduler'),
'configuration' => $app['task-manager.status']->getStatus(),
'urls' => [
'start' => $app->path('admin_tasks_scheduler_start'),
'stop' => $app->path('admin_tasks_scheduler_stop'),
'log' => $app->path('admin_tasks_scheduler_log'),
]
]);
}
public function getTasks(Application $app, Request $request)
{
$tasks = [];
foreach ($app['repo.tasks']->findAll() as $task) {
$tasks[] = [
'id' => $task->getId(),
'name' => $task->getName(),
'status' => $task->getStatus()
];
}
if ($request->getRequestFormat() === "json") {
foreach ($tasks as $k => $task) {
$tasks[$k]['urls'] = $this->getTaskResourceUrls($app, $task['id']);
}
return $app->json($tasks);
}
return $app['twig']->render('admin/task-manager/index.html.twig', [
'available_jobs' => $app['task-manager.available-jobs'],
'tasks' => $tasks,
'scheduler' => [
'id' => null,
'name' => $app->trans('Task Scheduler'),
'status' => $app['task-manager.status']->getStatus(),
]
]);
}
public function postCreateTask(Application $app, Request $request)
{
try {
$job = $app['task-manager.job-factory']->create($request->request->get('job-name'));
} catch (InvalidArgumentException $e) {
$app->abort(400, $e->getMessage());
}
$task = $app['manipulator.task']->create(
$job->getName(),
$job->getJobId(),
$job->getEditor()->getDefaultSettings($app['conf']),
$job->getEditor()->getDefaultPeriod()
);
return $app->redirectPath('admin_tasks_task_show', ['task' => $task->getId()]);
}
public function getSchedulerLog(Application $app, Request $request)
{
$logFile = $app['task-manager.log-file.factory']->forManager();
if ($request->query->get('clr')) {
$logFile->clear();
}
return $app['twig']->render('admin/task-manager/log.html.twig', [
'logfile' => $logFile,
'logname' => 'Scheduler',
]);
}
public function getTaskLog(Application $app, Request $request, Task $task)
{
$logFile = $app['task-manager.log-file.factory']->forTask($task);
if ($request->query->get('clr')) {
$logFile->clear();
}
return $app['twig']->render('admin/task-manager/log.html.twig', [
'logfile' => $logFile,
'logname' => sprintf('%s (task id %d)', $task->getName(), $task->getId()),
]);
}
public function postTaskDelete(Application $app, Request $request, Task $task)
{
if (false === $app['phraseanet.configuration']['main']['task-manager']['enabled']) {
throw new RuntimeException('The use of the task manager is disabled on this instance.');
}
$app['manipulator.task']->delete($task);
return $app->redirectPath('admin_tasks_list');
}
public function postStartTask(Application $app, Request $request, Task $task)
{
if (false === $app['phraseanet.configuration']['main']['task-manager']['enabled']) {
throw new RuntimeException('The use of the task manager is disabled on this instance.');
}
$app['manipulator.task']->start($task);
return $app->redirectPath('admin_tasks_list');
}
public function postStopTask(Application $app, Request $request, Task $task)
{
if (false === $app['phraseanet.configuration']['main']['task-manager']['enabled']) {
throw new RuntimeException('The use of the task manager is disabled on this instance.');
}
$app['manipulator.task']->stop($task);
return $app->redirectPath('admin_tasks_list');
}
public function postResetCrashes(Application $app, Request $request, Task $task)
{
$app['manipulator.task']->resetCrashes($task);
return $app->json(['success' => true]);
}
public function postSaveTask(Application $app, Request $request, Task $task)
{
if (false === $app['phraseanet.configuration']['main']['task-manager']['enabled']) {
throw new RuntimeException('The use of the task manager is disabled on this instance.');
}
if (!$this->doValidateXML($request->request->get('settings'))) {
return $app->json(['success' => false, 'message' => sprintf('Unable to load XML %s', $request->request->get('xml'))]);
}
$form = $app->form(new TaskForm());
$form->setData($task);
$form->bind($request);
if ($form->isValid()) {
$app['manipulator.task']->update($task);
return $app->json(['success' => true]);
}
return $app->json([
'success' => false,
'message' => implode("\n", $form->getErrors())
]);
}
public function postTaskFacility(Application $app, Request $request, Task $task)
{
return $app['task-manager.job-factory']
->create($task->getJobId())
->getEditor()
->facility($app, $request);
}
public function postXMLFromForm(Application $app, Request $request, Task $task)
{
return $app['task-manager.job-factory']
->create($task->getJobId())
->getEditor()
->updateXMLWithRequest($request);
}
public function getTask(Application $app, Request $request, Task $task)
{
if (false === $app['phraseanet.configuration']['main']['task-manager']['enabled']) {
throw new RuntimeException('The use of the task manager is disabled on this instance.');
}
if ('json' === $request->getContentType()) {
return $app->json(array_replace([
'id' => $task->getId(),
'name' => $task->getName(),
'urls' => $this->getTaskResourceUrls($app, $task->getId())
],
$app['task-manager.live-information']->getTask($task)
));
}
$editor = $app['task-manager.job-factory']
->create($task->getJobId())
->getEditor();
$form = $app->form(new TaskForm());
$form->setData($task);
return $app['twig']->render($editor->getTemplatePath(), [
'task' => $task,
'form' => $form->createView(),
'view' => 'XML',
]);
}
public function validateXML(Application $app, Request $request)
{
if (false === $app['phraseanet.configuration']['main']['task-manager']['enabled']) {
throw new RuntimeException('The use of the task manager is disabled on this instance.');
}
return $app->json(['success' => $this->doValidateXML($request->getContent())]);
}
private function doValidateXML($string)
{
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom->strictErrorChecking = true;
return (Boolean) @$dom->loadXML($string);
}
private function getTaskResourceUrls(Application $app, $taskId)
{
return [
'show' => $app->path('admin_tasks_task_show', ['task' => $taskId]),
'start' => $app->path('admin_tasks_task_start', ['task' => $taskId]),
'stop' => $app->path('admin_tasks_task_stop', ['task' => $taskId]),
'delete' => $app->path('admin_tasks_task_delete', ['task' => $taskId]),
'log' => $app->path('admin_tasks_task_log', ['task' => $taskId]),
];
}
}

View File

@@ -11,18 +11,28 @@
namespace Alchemy\Phrasea\SearchEngine;
use Alchemy\Phrasea\Core\Configuration\PropertyAccess;
abstract class AbstractConfigurationPanel implements ConfigurationPanelInterface
{
/** @var PropertyAccess */
protected $conf;
public function __construct(PropertyAccess $conf)
{
$this->conf = $conf;
}
/**
* {@inheritdoc}
* @param \databox[] $databoxes
* @return array
*/
public function getAvailableDateFields(array $databoxes)
{
$date_fields = [];
foreach ($databoxes as $databox) {
/** @var \databox_field $field */
foreach ($databox->get_meta_structure() as $field) {
if ($field->get_type() !== \databox_field::TYPE_DATE) {
continue;

View File

@@ -20,20 +20,18 @@ interface ConfigurationPanelInterface
/**
* Handles the GET request to the configuration panel
*
* @param Application $app
* @param Request $request
* @return Response
*/
public function get(Application $app, Request $request);
public function get(Request $request);
/**
* Handles the POST request to the configuration panel
*
* @param Application $app
* @param Request $request
* @return Response
*/
public function post(Application $app, Request $request);
public function post(Request $request);
/**
* Return the associated search engine name
@@ -60,7 +58,7 @@ interface ConfigurationPanelInterface
/**
* Return the names of the date fields
*
* @param array $databoxes
* @param \databox[] $databoxes
* @return array An array of date fields names
*/
public function getAvailableDateFields(array $databoxes);

View File

@@ -18,12 +18,13 @@ use Symfony\Component\HttpFoundation\Request;
class ConfigurationPanel extends AbstractConfigurationPanel
{
private $searchEngine;
/** @var Application */
private $app;
public function __construct(ElasticSearchEngine $engine, PropertyAccess $conf)
public function __construct(Application $app, PropertyAccess $conf)
{
$this->searchEngine = $engine;
$this->conf = $conf;
parent::__construct($conf);
$this->app = $app;
}
/**
@@ -37,15 +38,15 @@ class ConfigurationPanel extends AbstractConfigurationPanel
/**
* {@inheritdoc}
*/
public function get(Application $app, Request $request)
public function get(Request $request)
{
return $app['twig']->render('admin/search-engine/elastic-search.html.twig', ['configuration' => $this->getConfiguration()]);
return $this->app['twig']->render('admin/search-engine/elastic-search.html.twig', ['configuration' => $this->getConfiguration()]);
}
/**
* {@inheritdoc}
*/
public function post(Application $app, Request $request)
public function post(Request $request)
{
$configuration = $this->getConfiguration();
@@ -54,7 +55,7 @@ class ConfigurationPanel extends AbstractConfigurationPanel
$this->saveConfiguration($configuration);
return $app->redirectPath('admin_searchengine_get');
return $this->app->redirectPath('admin_searchengine_get');
}
/**

View File

@@ -105,7 +105,7 @@ class ElasticSearchEngine implements SearchEngineInterface
public function getConfigurationPanel()
{
if (!$this->configurationPanel) {
$this->configurationPanel = new ConfigurationPanel($this, $this->app['conf']);
$this->configurationPanel = new ConfigurationPanel($this->app, $this->app['conf']);
}
return $this->configurationPanel;

View File

@@ -29,6 +29,10 @@ class Factory
$this->translator = $translator;
}
/**
* @param string $fqn
* @return JobInterface
*/
public function create($fqn)
{
if (!class_exists($fqn)) {

View File

@@ -60,7 +60,7 @@ class databox_descriptionStructure implements IteratorAggregate, Countable
/**
*
* @return array
* @return databox_field[]
*/
public function get_elements()
{

View File

@@ -52,7 +52,9 @@ class SetupTest extends \PhraseanetAuthenticatedWebTestCase
->with('registry',$this->isType('array'));
self::$DI['app']['conf'] = $registry;
self::$DI['client']->request('POST', '/admin/setup/', ['_token' => 'token']);
$this->assertTrue(self::$DI['client']->getResponse()->isRedirect());
/** @var Client $client */
$client = self::$DI['client'];
$client->request('POST', '/admin/setup/', ['_token' => 'token']);
$this->assertTrue($client->getResponse()->isRedirect('/admin/setup/'));
}
}