Compare commits

...

24 Commits

Author SHA1 Message Date
Michael RICOIS
d828e1fbc4 Override version of CacheRedis 2017-05-15 10:31:43 +02:00
Michael RICOIS
450845067f Add change to integrate redis smarty cache 2017-05-15 10:22:02 +02:00
Michael RICOIS
1f11db01f4 Complete module with smarty cache in redis 2017-05-15 10:21:30 +02:00
Michael RICOIS
3ae605fd5b Smarty cache in Redis (not the compiled files) 2017-05-12 17:51:52 +02:00
Michael RICOIS
57d9727071 Documentation 2017-05-12 15:01:44 +02:00
Michael RICOIS
f7f63116b3 Update connection parameters 2017-05-12 14:50:53 +02:00
Michael RICOIS
b0eef3778b Fix PS_CACHE_ENABLED 2017-05-12 12:35:28 +02:00
Michael RICOIS
e9c5ce9a95 _PS_CACHE_ENABLED_ is a defined 2017-05-12 11:32:31 +02:00
Michael RICOIS
b528881e77 Test cache enabled/disabled 2017-05-12 10:49:08 +02:00
Michael RICOIS
862d993b81 Warning about Predis class 2017-05-12 10:24:56 +02:00
Michael RICOIS
e775464368 composer update 2017-05-10 14:52:00 +02:00
Michael RICOIS
199bffbd43 composer update 2017-05-10 14:51:42 +02:00
Michael RICOIS
49b955134b Redis option in Admin 2017-05-10 12:57:56 +02:00
Michael RICOIS
1a7b94993d Use cache method if enabled 2017-05-10 12:57:07 +02:00
Michael RICOIS
67531c5c6c Commit override as module psrediscache is installed 2017-05-10 12:56:35 +02:00
Michael RICOIS
1061a84b8f Add module for redis cache 2017-05-10 12:48:51 +02:00
Michael RICOIS
b6adb199f6 Update composer and add predis\predis 2017-05-10 12:36:34 +02:00
Michael RICOIS
88367797a0 Re-add ignore 2017-05-10 12:36:06 +02:00
Michael RICOIS
a012792bb1 Remove autloader as it's define in config.inc.php 2017-05-10 12:35:15 +02:00
Michael RICOIS
8945d1ac61 vendor dir restriction 2017-05-10 12:15:32 +02:00
Michael RICOIS
68442f9074 Remove Redis class as they are in module 2017-05-10 12:04:52 +02:00
Michael RICOIS
3b11e18c29 Add composer autoload 2017-05-05 17:03:46 +02:00
Michael RICOIS
5896dcf69d Add REDIS sample 2017-05-05 17:03:00 +02:00
Thibault UBUNTU
34cd65f6f1 start redis 2017-05-04 14:46:23 +02:00
855 changed files with 51220 additions and 4836 deletions

4
.gitignore vendored
View File

@ -5,7 +5,6 @@ adminer.php
.mysql_history
.htpasswd
.buildpath
.htaccess
.project
.settings
.idea
@ -96,4 +95,5 @@ rss/*
modules/antadis_doofinder/script/*.csv
modules/flashsales/views/img/banner/*.jpg
classes/ObjectModel.php
modules/colissimoetiquetage/download/*.pdf
modules/colissimoetiquetage/download/*.pdf
/.htaccess

View File

@ -1,7 +1,8 @@
{
"require": {
"filp/whoops": "^1.1",
"require": {
"robmorgan/phinx": "^0.4.6",
"filp/whoops": "^1.1",
"potsky/pimp-my-log": "^1.7",
"robmorgan/phinx": "^0.4.6"
}
"predis/predis": "^1.1"
}
}

542
composer.lock generated
View File

@ -4,41 +4,37 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "e3d6128e6ff6ffe5586c22906e3fe1de",
"content-hash": "572e9a0e2a0b9add53925d0e17022b75",
"packages": [
{
"name": "filp/whoops",
"version": "1.1.7",
"name": "predis/predis",
"version": "v1.1.1",
"source": {
"type": "git",
"url": "https://github.com/filp/whoops.git",
"reference": "72538eeb70bbfb11964412a3d098d109efd012f7"
"url": "https://github.com/nrk/predis.git",
"reference": "f0210e38881631afeafb56ab43405a92cafd9fd1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/filp/whoops/zipball/72538eeb70bbfb11964412a3d098d109efd012f7",
"reference": "72538eeb70bbfb11964412a3d098d109efd012f7",
"url": "https://api.github.com/repos/nrk/predis/zipball/f0210e38881631afeafb56ab43405a92cafd9fd1",
"reference": "f0210e38881631afeafb56ab43405a92cafd9fd1",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
"php": ">=5.3.9"
},
"require-dev": {
"mockery/mockery": "0.9.*"
"phpunit/phpunit": "~4.8"
},
"suggest": {
"ext-curl": "Allows access to Webdis when paired with phpiredis",
"ext-phpiredis": "Allows faster serialization and deserialization of the Redis protocol"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2-dev"
}
},
"autoload": {
"psr-0": {
"Whoops": "src/"
},
"classmap": [
"src/deprecated"
]
"psr-4": {
"Predis\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -46,62 +42,66 @@
],
"authors": [
{
"name": "Filipe Dobreira",
"homepage": "https://github.com/filp",
"role": "Developer"
"name": "Daniele Alessandri",
"email": "suppakilla@gmail.com",
"homepage": "http://clorophilla.net"
}
],
"description": "php error handling for cool kids",
"homepage": "https://github.com/filp/whoops",
"description": "Flexible and feature-complete Redis client for PHP and HHVM",
"homepage": "http://github.com/nrk/predis",
"keywords": [
"error",
"exception",
"handling",
"library",
"silex-provider",
"whoops",
"zf2"
"nosql",
"predis",
"redis"
],
"time": "2015-06-29 05:42:04"
"time": "2016-06-16T16:22:20+00:00"
},
{
"name": "potsky/pimp-my-log",
"version": "1.7.9",
"name": "psr/log",
"version": "1.0.2",
"source": {
"type": "git",
"url": "https://github.com/potsky/PimpMyLog.git",
"reference": "22f448c9aaf8115663536aaef410b5eb9152d950"
"url": "https://github.com/php-fig/log.git",
"reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/potsky/PimpMyLog/zipball/22f448c9aaf8115663536aaef410b5eb9152d950",
"reference": "22f448c9aaf8115663536aaef410b5eb9152d950",
"url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
"reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
"shasum": ""
},
"require": {
"php": ">=5.2.0"
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Log\\": "Psr/Log/"
}
},
"type": "project",
"notification-url": "https://packagist.org/downloads/",
"license": [
"GPL-3.0+"
"MIT"
],
"authors": [
{
"name": "Potsky",
"email": "potsky@me.com",
"homepage": "http://www.potsky.com",
"role": "Developer"
},
{
"name": "Cassio Santos",
"homepage": "http://www.cassiosantos.com",
"role": "Translator (pt_BR)"
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Log viewer for your web server",
"homepage": "http://pimpmylog.com",
"time": "2015-05-27 07:09:41"
"description": "Common interface for logging libraries",
"homepage": "https://github.com/php-fig/log",
"keywords": [
"log",
"psr",
"psr-3"
],
"time": "2016-10-10T12:19:37+00:00"
},
{
"name": "robmorgan/phinx",
@ -163,39 +163,45 @@
"migrations",
"phinx"
],
"time": "2015-09-11 15:44:41"
"time": "2015-09-11T15:44:41+00:00"
},
{
"name": "symfony/config",
"version": "v2.7.5",
"version": "v2.8.20",
"source": {
"type": "git",
"url": "https://github.com/symfony/config.git",
"reference": "9698fdf0a750d6887d5e7729d5cf099765b20e61"
"reference": "0b8541d18507d10204a08384640ff6df3c739ebe"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/config/zipball/9698fdf0a750d6887d5e7729d5cf099765b20e61",
"reference": "9698fdf0a750d6887d5e7729d5cf099765b20e61",
"url": "https://api.github.com/repos/symfony/config/zipball/0b8541d18507d10204a08384640ff6df3c739ebe",
"reference": "0b8541d18507d10204a08384640ff6df3c739ebe",
"shasum": ""
},
"require": {
"php": ">=5.3.9",
"symfony/filesystem": "~2.3"
"symfony/filesystem": "~2.3|~3.0.0"
},
"require-dev": {
"symfony/phpunit-bridge": "~2.7"
"symfony/yaml": "~2.7|~3.0.0"
},
"suggest": {
"symfony/yaml": "To use the yaml reference dumper"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.7-dev"
"dev-master": "2.8-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Config\\": ""
}
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -213,30 +219,31 @@
],
"description": "Symfony Config Component",
"homepage": "https://symfony.com",
"time": "2015-09-21 15:02:29"
"time": "2017-04-12T14:07:15+00:00"
},
{
"name": "symfony/console",
"version": "v2.7.5",
"version": "v2.8.20",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "06cb17c013a82f94a3d840682b49425cd00a2161"
"reference": "2cfcbced8e39e2313ed4da8896fc8c59a56c0d7e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/06cb17c013a82f94a3d840682b49425cd00a2161",
"reference": "06cb17c013a82f94a3d840682b49425cd00a2161",
"url": "https://api.github.com/repos/symfony/console/zipball/2cfcbced8e39e2313ed4da8896fc8c59a56c0d7e",
"reference": "2cfcbced8e39e2313ed4da8896fc8c59a56c0d7e",
"shasum": ""
},
"require": {
"php": ">=5.3.9"
"php": ">=5.3.9",
"symfony/debug": "^2.7.2|~3.0.0",
"symfony/polyfill-mbstring": "~1.0"
},
"require-dev": {
"psr/log": "~1.0",
"symfony/event-dispatcher": "~2.1",
"symfony/phpunit-bridge": "~2.7",
"symfony/process": "~2.1"
"symfony/event-dispatcher": "~2.1|~3.0.0",
"symfony/process": "~2.1|~3.0.0"
},
"suggest": {
"psr/log": "For using the console logger",
@ -246,13 +253,16 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.7-dev"
"dev-master": "2.8-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Console\\": ""
}
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -270,38 +280,95 @@
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
"time": "2015-09-25 08:32:23"
"time": "2017-04-26T01:38:53+00:00"
},
{
"name": "symfony/filesystem",
"version": "v2.7.5",
"name": "symfony/debug",
"version": "v3.0.9",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
"reference": "a17f8a17c20e8614c15b8e116e2f4bcde102cfab"
"url": "https://github.com/symfony/debug.git",
"reference": "697c527acd9ea1b2d3efac34d9806bf255278b0a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/a17f8a17c20e8614c15b8e116e2f4bcde102cfab",
"reference": "a17f8a17c20e8614c15b8e116e2f4bcde102cfab",
"url": "https://api.github.com/repos/symfony/debug/zipball/697c527acd9ea1b2d3efac34d9806bf255278b0a",
"reference": "697c527acd9ea1b2d3efac34d9806bf255278b0a",
"shasum": ""
},
"require": {
"php": ">=5.3.9"
"php": ">=5.5.9",
"psr/log": "~1.0"
},
"conflict": {
"symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2"
},
"require-dev": {
"symfony/phpunit-bridge": "~2.7"
"symfony/class-loader": "~2.8|~3.0",
"symfony/http-kernel": "~2.8|~3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.7-dev"
"dev-master": "3.0-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Debug\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Debug Component",
"homepage": "https://symfony.com",
"time": "2016-07-30T07:22:48+00:00"
},
{
"name": "symfony/filesystem",
"version": "v3.0.9",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
"reference": "b2da5009d9bacbd91d83486aa1f44c793a8c380d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/b2da5009d9bacbd91d83486aa1f44c793a8c380d",
"reference": "b2da5009d9bacbd91d83486aa1f44c793a8c380d",
"shasum": ""
},
"require": {
"php": ">=5.5.9"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Filesystem\\": ""
}
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -319,38 +386,97 @@
],
"description": "Symfony Filesystem Component",
"homepage": "https://symfony.com",
"time": "2015-09-09 17:42:36"
"time": "2016-07-20T05:43:46+00:00"
},
{
"name": "symfony/yaml",
"version": "v2.7.5",
"name": "symfony/polyfill-mbstring",
"version": "v1.3.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
"reference": "31cb2ad0155c95b88ee55fe12bc7ff92232c1770"
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "e79d363049d1c2128f133a2667e4f4190904f7f4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/31cb2ad0155c95b88ee55fe12bc7ff92232c1770",
"reference": "31cb2ad0155c95b88ee55fe12bc7ff92232c1770",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/e79d363049d1c2128f133a2667e4f4190904f7f4",
"reference": "e79d363049d1c2128f133a2667e4f4190904f7f4",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"suggest": {
"ext-mbstring": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for the Mbstring extension",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"mbstring",
"polyfill",
"portable",
"shim"
],
"time": "2016-11-14T01:06:16+00:00"
},
{
"name": "symfony/yaml",
"version": "v2.8.20",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
"reference": "93ccdde79f4b079c7558da4656a3cb1c50c68e02"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/93ccdde79f4b079c7558da4656a3cb1c50c68e02",
"reference": "93ccdde79f4b079c7558da4656a3cb1c50c68e02",
"shasum": ""
},
"require": {
"php": ">=5.3.9"
},
"require-dev": {
"symfony/phpunit-bridge": "~2.7"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.7-dev"
"dev-master": "2.8-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Yaml\\": ""
}
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -368,10 +494,228 @@
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
"time": "2015-09-14 14:14:09"
"time": "2017-05-01T14:31:55+00:00"
}
],
"packages-dev": [
{
"name": "composer/installers",
"version": "v1.3.0",
"source": {
"type": "git",
"url": "https://github.com/composer/installers.git",
"reference": "79ad876c7498c0bbfe7eed065b8651c93bfd6045"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/installers/zipball/79ad876c7498c0bbfe7eed065b8651c93bfd6045",
"reference": "79ad876c7498c0bbfe7eed065b8651c93bfd6045",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.0"
},
"replace": {
"roundcube/plugin-installer": "*",
"shama/baton": "*"
},
"require-dev": {
"composer/composer": "1.0.*@dev",
"phpunit/phpunit": "4.1.*"
},
"type": "composer-plugin",
"extra": {
"class": "Composer\\Installers\\Plugin",
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"psr-4": {
"Composer\\Installers\\": "src/Composer/Installers"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Kyle Robinson Young",
"email": "kyle@dontkry.com",
"homepage": "https://github.com/shama"
}
],
"description": "A multi-framework Composer library installer",
"homepage": "https://composer.github.io/installers/",
"keywords": [
"Craft",
"Dolibarr",
"Eliasis",
"Hurad",
"ImageCMS",
"Kanboard",
"MODX Evo",
"Mautic",
"Maya",
"OXID",
"Plentymarkets",
"Porto",
"RadPHP",
"SMF",
"Thelia",
"WolfCMS",
"agl",
"aimeos",
"annotatecms",
"attogram",
"bitrix",
"cakephp",
"chef",
"cockpit",
"codeigniter",
"concrete5",
"croogo",
"dokuwiki",
"drupal",
"elgg",
"expressionengine",
"fuelphp",
"grav",
"installer",
"itop",
"joomla",
"kohana",
"laravel",
"lavalite",
"lithium",
"magento",
"mako",
"mediawiki",
"modulework",
"moodle",
"phpbb",
"piwik",
"ppi",
"puppet",
"reindex",
"roundcube",
"shopware",
"silverstripe",
"sydes",
"symfony",
"typo3",
"wordpress",
"yawik",
"zend",
"zikula"
],
"time": "2017-04-24T06:37:16+00:00"
},
{
"name": "filp/whoops",
"version": "1.1.10",
"source": {
"type": "git",
"url": "https://github.com/filp/whoops.git",
"reference": "72538eeb70bbfb11964412a3d098d109efd012f7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/filp/whoops/zipball/72538eeb70bbfb11964412a3d098d109efd012f7",
"reference": "72538eeb70bbfb11964412a3d098d109efd012f7",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"require-dev": {
"mockery/mockery": "0.9.*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2-dev"
}
},
"autoload": {
"psr-0": {
"Whoops": "src/"
},
"classmap": [
"src/deprecated"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Filipe Dobreira",
"homepage": "https://github.com/filp",
"role": "Developer"
}
],
"description": "php error handling for cool kids",
"homepage": "https://github.com/filp/whoops",
"keywords": [
"error",
"exception",
"handling",
"library",
"silex-provider",
"whoops",
"zf2"
],
"time": "2015-06-29T05:42:04+00:00"
},
{
"name": "potsky/pimp-my-log",
"version": "1.7.14",
"source": {
"type": "git",
"url": "https://github.com/potsky/PimpMyLog.git",
"reference": "2fed8c1fcedb023dfa0e63df48fb20996a40a76c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/potsky/PimpMyLog/zipball/2fed8c1fcedb023dfa0e63df48fb20996a40a76c",
"reference": "2fed8c1fcedb023dfa0e63df48fb20996a40a76c",
"shasum": ""
},
"require": {
"composer/installers": "*",
"php": ">=5.2.0"
},
"type": "project",
"notification-url": "https://packagist.org/downloads/",
"license": [
"GPL-3.0+"
],
"authors": [
{
"name": "Potsky",
"email": "potsky@me.com",
"homepage": "http://www.potsky.com",
"role": "Developer"
},
{
"name": "Cassio Santos",
"homepage": "http://www.cassiosantos.com",
"role": "Translator (pt_BR)"
},
{
"name": "Martin",
"homepage": "https://github.com/mmattel",
"role": "Configuration examples contributor"
}
],
"description": "Log viewer for your web server",
"homepage": "http://pimpmylog.com",
"time": "2017-04-27T10:46:08+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],

View File

@ -54,6 +54,8 @@ if (!file_exists(_PS_ROOT_DIR_.'/config/settings.inc.php'))
/* include settings file only if we are not in multi-tenancy mode */
require_once(_PS_ROOT_DIR_.'/config/settings.inc.php');
require_once(_PS_CONFIG_DIR_.'autoload.php');
// Composer autoload
require_once(_PS_ROOT_DIR_ . '/vendor/autoload.php' );
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'bootstrap.php';

View File

@ -46,8 +46,6 @@ if (_PS_MODE_DEV_ === true)
@error_reporting(E_ALL | E_STRICT);
define('_PS_DEBUG_SQL_', true);
require_once(dirname(__FILE__).'/../vendor/autoload.php');
$whoops = new \Whoops\Run;
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
$whoops->register();

View File

@ -41,6 +41,12 @@ if (Configuration::get('PS_SMARTY_CACHING_TYPE') == 'mysql')
include(_PS_CLASS_DIR_.'/SmartyCacheResourceMysql.php');
$smarty->caching_type = 'mysql';
}
elseif (Configuration::get('PS_SMARTY_CACHING_TYPE') == 'redis')
{
include(_PS_MODULE_DIR_.'/psrediscache/classes/SmartyCacheResourceRedis.php');
$smarty->caching_type = 'redis';
}
$smarty->force_compile = (Configuration::get('PS_SMARTY_FORCE_COMPILE') == _PS_SMARTY_FORCE_COMPILE_) ? true : false;
$smarty->compile_check = (Configuration::get('PS_SMARTY_FORCE_COMPILE') >= _PS_SMARTY_CHECK_COMPILE_) ? true : false;
$smarty->debug_tpl = _PS_ALL_THEMES_DIR_.'debug.tpl';

View File

@ -0,0 +1,98 @@
# Redis Cache for prestashop
## Require
- redis-server
- php5-redis
## Init
### Install composer
```
$ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
$ php -r "if (hash_file('SHA384', 'composer-setup.php') === '669656bab3166a7aff8a7506b8cb2d1c292f042046c5a994c43155c0be6190fa0355160742ab2e1c88d40d5be660b410') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
$ php composer-setup.php
$ php -r "unlink('composer-setup.php');"
```
```
$ sudo mv composer.phar /usr/local/bin/composer
$ sudo chmod +x /usr/local/bin/composer
```
### Create composer.json
`$ composer require predis/predis`
## Integrate in prestashop
Add this line in `config/config.inc.php`
```
// Composer autoload
require_once(_PS_ROOT_DIR_ . '/vendor/autoload.php' );
```
after
```
/* include settings file only if we are not in multi-tenancy mode */
require_once(_PS_ROOT_DIR_.'/config/settings.inc.php');
require_once(_PS_CONFIG_DIR_.'autoload.php');
```
Add this in `config/smarty.config.inc.php`
```
elseif (Configuration::get('PS_SMARTY_CACHING_TYPE') == 'redis')
{
include(_PS_MODULE_DIR_.'/psrediscache/classes/SmartyCacheResourceRedis.php');
$smarty->caching_type = 'redis';
}
```
after
```
if (Configuration::get('PS_SMARTY_CACHING_TYPE') == 'mysql')
{
include(_PS_CLASS_DIR_.'/SmartyCacheResourceMysql.php');
$smarty->caching_type = 'mysql';
}
```
## Protect vendor
Add a .htaccess in /vendor
```
Order deny,allow
Deny from all
```
## Usage
Define in module page configuration or in settings.inc.php
> `_REDIS_HOST_`
> `_REDIS_PORT_`
TODO : Select DB
```
$cache = Cache::getInstance();
$key = 'yourkey';
if (!$content = $cache->get($key)) {
$content = getContent();
$cache->set($key, $content, $ttl);
}
```
## Note
- TTL a spécifier car pas illimité dans Redis
- Utilisation du cache
```
$total = $this->context->cart->getOrderTotal();
$cache_id = $this->getCacheId() . $total;
if ($this->isCached('mytemplate.tpl', $cache_id')) {
//some object that depends of the total value of the cart
$data = MyModel::getSomeDbData($this->context->cart->getOrderTotal());
$this->context->smarty->assign(['data' => $data]);
}
return $this->display(_PS_MODULE_DIR_ . $this->name, 'mytemplate.tpl', $cache_id);
```

View File

@ -0,0 +1,115 @@
<?php
/*
* 2007-2016 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2016 PrestaShop SA
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
use Predis\Client;
require_once(_PS_TOOL_DIR_.'smarty/Smarty.class.php');
/**
* PS_SMARTY_CACHING_TYPE = redis
*
* config/smarty.config.inc.php
* include(_PS_MODULE_DIR_.'/psrediscache/classes/SmartyCacheResourceRedis.php');
* $smarty->caching_type = 'redis';
*
*/
class Smarty_CacheResource_Redis extends Smarty_CacheResource_KeyValueStore
{
/**
* redis instance
* @var Predis\Client
*/
protected $redis = null;
public function __construct()
{
$parameters = [
'scheme' => 'tcp',
'host' => _REDIS_HOST_,
'port' => _REDIS_PORT_,
//'database' => 0
];
$options = [
//'profile' => '2.8',
//'prefix' => '',
];
$this->redis = new Predis\Client($parameters, $options);
}
/**
* Read values for a set of keys from cache
*
* @param array $keys list of keys to fetch
* @return array list of values with the given keys used as indexes
* @return boolean true on success, false on failure
*/
protected function read(array $keys)
{
foreach ($keys as $k) {
$_res[$k] = $this->redis->get($k);
}
return $_res;
}
/**
* Save values for a set of keys to cache
*
* @param array $keys list of values to save
* @param int $expire expiration time
* @return boolean true on success, false on failure
*/
protected function write(array $keys, $expire = 3600)
{
foreach ($keys as $k => $v) {
$this->redis->setex($k, $expire, $v);
}
return true;
}
/**
* Remove values from cache
*
* @param array $keys list of keys to delete
* @return boolean true on success, false on failure
*/
protected function delete(array $keys)
{
foreach ($keys as $k) {
$this->redis->del($k);
}
return true;
}
/**
* Remove *all* values from cache
*
* @return boolean true on success, false on failure
*/
protected function purge()
{
return $this->redis->flushDB();
}
}

4
modules/psrediscache/index.php Executable file
View File

@ -0,0 +1,4 @@
<?php
header("Location: ../");
exit;

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -0,0 +1,237 @@
<?php
use Predis\Client;
class CacheRedis extends CacheCore
{
/**
* @var Predis\Client
*/
protected $redis;
/**
* @var bool Connection status
*/
protected $is_connected = false;
public function __construct()
{
$this->connect();
}
public function __destruct()
{
$this->close();
}
/**
* Connect to server
*/
public function connect()
{
if (!defined('_PS_CACHE_ENABLED_')) {
return;
}
if (_PS_CACHE_ENABLED_ == '0') {
return;
}
if (class_exists('\\Predis\\Client') && extension_loaded('redis')) {
$parameters = [
'scheme' => 'tcp',
'host' => _REDIS_HOST_,
'port' => _REDIS_PORT_,
//'database' => 0
];
$options = [
//'profile' => '2.8',
//'prefix' => '',
];
$this->redis = new Predis\Client($parameters, $options);
} else {
return;
}
//$this->is_connected = $this->redis->isConnected();
$info = $this->redis->info('server');
if (array_key_exists('Server', $info)) {
$this->is_connected = true;
}
}
/**
* @see Cache::_set()
*/
protected function _set($key, $value, $ttl = 0)
{
if (!$this->is_connected) {
return false;
}
if ($ttl == 0) {
$ttl = 3600;
}
return $this->redis->setex($key, $ttl, $this->encode($value));
}
/**
* @see Cache::_get()
*/
protected function _get($key)
{
if (!$this->is_connected) {
return false;
}
return $this->decode($this->redis->get($key));
}
/**
* @see Cache::_exists()
*/
protected function _exists($key)
{
if (!$this->is_connected) {
return false;
}
return ($this->redis->get($key) !== false);
}
/**
* @see Cache::_delete()
*/
protected function _delete($key)
{
if (!$this->is_connected) {
return false;
}
return $this->redis->del($key);
}
/**
* @see Cache::_writeKeys()
*/
protected function _writeKeys()
{
/*if (!$this->is_connected) {
return false;
}
return true;*/
}
/**
* @see Cache::flush()
*/
public function flush()
{
if (!$this->is_connected) {
return false;
}
return $this->redis->flushdb();
}
/**
* Store a data in cache
*
* @param string $key
* @param mixed $value
* @param int $ttl
* @return bool
*/
public function set($key, $value, $ttl = 0)
{
return $this->_set($key, $value, $ttl);
}
/**
* Retrieve a data from cache
*
* @param string $key
* @return mixed
*/
public function get($key)
{
return $this->_get($key);
}
/**
* Check if a data is cached
*
* @param string $key
* @return bool
*/
public function exists($key)
{
return $this->_exists($key);
}
/**
* Delete one or several data from cache (* joker can be used, but avoid it !)
* E.g.: delete('*'); delete('my_prefix_*'); delete('my_key_name');
*
* @param string $key
* @return bool
*/
public function delete($key)
{
if ($key == '*') {
$this->flush();
} elseif (strpos($key, '*') === false) {
$this->_delete($key);
} else {
$pattern = str_replace('\\*', '.*', preg_quote($key));
$keys = $this->redis->keys($pattern);
foreach ($keys as $key => $data) {
if (preg_match('#^'.$pattern.'$#', $key)) {
$this->_delete($key);
}
}
}
return true;
}
/**
* Close connection to server
*
* @return bool
*/
protected function close()
{
if (!$this->is_connected) {
return false;
}
return $this->redis->quit();
}
/**
* Encode data
*
* @param $data anything
* @return text value encode
*/
public function encode($data)
{
return serialize($data);
}
/**
* Decode data
*
* @param $data anything
* @return text value decode
*/
public function decode($data)
{
return unserialize($data);
}
}

View File

@ -0,0 +1,262 @@
<?php
class AdminPerformanceController extends AdminPerformanceControllerCore
{
public function __construct()
{
$this->bootstrap = true;
$this->className = 'Configuration';
parent::__construct();
}
public function initFieldsetSmarty()
{
$this->fields_form[0]['form'] = array(
'legend' => array(
'title' => $this->l('Smarty'),
'icon' => 'icon-briefcase'
),
'input' => array(
array(
'type' => 'hidden',
'name' => 'smarty_up'
),
array(
'type' => 'radio',
'label' => $this->l('Template compilation'),
'name' => 'smarty_force_compile',
'values' => array(
array(
'id' => 'smarty_force_compile_'._PS_SMARTY_NO_COMPILE_,
'value' => _PS_SMARTY_NO_COMPILE_,
'label' => $this->l('Never recompile template files'),
'hint' => $this->l('This option should be used in a production environment.')
),
array(
'id' => 'smarty_force_compile_'._PS_SMARTY_CHECK_COMPILE_,
'value' => _PS_SMARTY_CHECK_COMPILE_,
'label' => $this->l('Recompile templates if the files have been updated'),
'hint' => $this->l('Templates are recompiled when they are updated. If you experience compilation troubles when you update your template files, you should use Force Compile instead of this option. It should never be used in a production environment.')
),
array(
'id' => 'smarty_force_compile_'._PS_SMARTY_FORCE_COMPILE_,
'value' => _PS_SMARTY_FORCE_COMPILE_,
'label' => $this->l('Force compilation'),
'hint' => $this->l('This forces Smarty to (re)compile templates on every invocation. This is handy for development and debugging. Note: This should never be used in a production environment.')
)
)
),
array(
'type' => 'switch',
'label' => $this->l('Cache'),
'name' => 'smarty_cache',
'is_bool' => true,
'values' => array(
array(
'id' => 'smarty_cache_1',
'value' => 1,
'label' => $this->l('Yes'),
),
array(
'id' => 'smarty_cache_0',
'value' => 0,
'label' => $this->l('No')
)
),
'hint' => $this->l('Should be enabled except for debugging.')
),
array(
'type' => 'radio',
'label' => $this->l('Caching type'),
'name' => 'smarty_caching_type',
'values' => array(
array(
'id' => 'smarty_caching_type_filesystem',
'value' => 'filesystem',
'label' => $this->l('File System').(is_writable(_PS_CACHE_DIR_.'smarty/cache') ? '' : ' '.sprintf($this->l('(the directory %s must be writable)'), realpath(_PS_CACHE_DIR_.'smarty/cache')))
),
array(
'id' => 'smarty_caching_type_mysql',
'value' => 'mysql',
'label' => $this->l('MySQL')
),
array(
'id' => 'smarty_caching_type_redis',
'value' => 'redis',
'label' => $this->l('Redis') . (extension_loaded('redis') ? '' : $this->l('Warning: No redis extension loaded.'))
),
)
),
array(
'type' => 'radio',
'label' => $this->l('Clear cache'),
'name' => 'smarty_clear_cache',
'values' => array(
array(
'id' => 'smarty_clear_cache_never',
'value' => 'never',
'label' => $this->l('Never clear cache files'),
),
array(
'id' => 'smarty_clear_cache_everytime',
'value' => 'everytime',
'label' => $this->l('Clear cache everytime something has been modified'),
),
)
),
),
'submit' => array(
'title' => $this->l('Save')
)
);
$this->fields_value['smarty_force_compile'] = Configuration::get('PS_SMARTY_FORCE_COMPILE');
$this->fields_value['smarty_cache'] = Configuration::get('PS_SMARTY_CACHE');
$this->fields_value['smarty_caching_type'] = Configuration::get('PS_SMARTY_CACHING_TYPE');
$this->fields_value['smarty_clear_cache'] = Configuration::get('PS_SMARTY_CLEAR_CACHE');
$this->fields_value['smarty_console'] = Configuration::get('PS_SMARTY_CONSOLE');
$this->fields_value['smarty_console_key'] = Configuration::get('PS_SMARTY_CONSOLE_KEY');
}
public function initFieldsetCaching()
{
// Prestashop version 1.6+
if (version_compare(_PS_VERSION_, 1.6, '>')) {
$phpdoc_langs = array('en', 'zh', 'fr', 'de', 'ja', 'pl', 'ro', 'ru', 'fa', 'es', 'tr');
$php_lang = in_array($this->context->language->iso_code, $phpdoc_langs) ? $this->context->language->iso_code : 'en';
$warning_memcache = ' '.$this->l('(you must install the [a]Memcache PECL extension[/a])');
$warning_memcache = str_replace('[a]', '<a href="http://www.php.net/manual/'.substr($php_lang, 0, 2).'/memcache.installation.php" target="_blank">', $warning_memcache);
$warning_memcache = str_replace('[/a]', '</a>', $warning_memcache);
$warning_memcached = ' '.$this->l('(you must install the [a]Memcached PECL extension[/a])');
$warning_memcached = str_replace('[a]', '<a href="http://www.php.net/manual/'.substr($php_lang, 0, 2).'/memcached.installation.php" target="_blank">', $warning_memcached);
$warning_memcached = str_replace('[/a]', '</a>', $warning_memcached);
$warning_apc = ' '.$this->l('(you must install the [a]APC PECL extension[/a])');
$warning_apc = str_replace('[a]', '<a href="http://php.net/manual/'.substr($php_lang, 0, 2).'/apc.installation.php" target="_blank">', $warning_apc);
$warning_apc = str_replace('[/a]', '</a>', $warning_apc);
$warning_xcache = ' '.$this->l('(you must install the [a]Xcache extension[/a])');
$warning_xcache = str_replace('[a]', '<a href="http://xcache.lighttpd.net" target="_blank">', $warning_xcache);
$warning_xcache = str_replace('[/a]', '</a>', $warning_xcache);
$warning_fs = ' '.sprintf($this->l('(the directory %s must be writable)'), realpath(_PS_CACHEFS_DIRECTORY_));
$warning_redis = ' ' . $this->l('(you must install the [a]Redis extension[/a])');
$warning_redis = str_replace('[a]', '<a href="https://pecl.php.net/package/redis" target="_blank">', $warning_redis);
$warning_redis = str_replace('[/a]', '</a>', $warning_redis);
$this->fields_form[6]['form'] = array(
'legend' => array(
'title' => $this->l('Caching'),
'icon' => 'icon-desktop'
),
'input' => array(
array(
'type' => 'hidden',
'name' => 'cache_up'
),
array(
'type' => 'switch',
'label' => $this->l('Use cache'),
'name' => 'cache_active',
'is_bool' => true,
'values' => array(
array(
'id' => 'cache_active_on',
'value' => 1,
'label' => $this->l('Enabled')
),
array(
'id' => 'cache_active_off',
'value' => 0,
'label' => $this->l('Disabled')
)
)
),
array(
'type' => 'radio',
'label' => $this->l('Caching system'),
'name' => 'caching_system',
'hint' => $this->l('The CacheFS system should be used only when the infrastructure contains one front-end server. If you are not sure, ask your hosting company.'),
'values' => array(
array(
'id' => 'CacheFs',
'value' => 'CacheFs',
'label' => $this->l('File System').(is_writable(_PS_CACHEFS_DIRECTORY_) ? '' : $warning_fs)
),
array(
'id' => 'CacheMemcache',
'value' => 'CacheMemcache',
'label' => $this->l('Memcached via PHP::Memcache').(extension_loaded('memcache') ? '' : $warning_memcache)
),
array(
'id' => 'CacheMemcached',
'value' => 'CacheMemcached',
'label' => $this->l('Memcached via PHP::Memcached').(extension_loaded('memcached') ? '' : $warning_memcached)
),
array(
'id' => 'CacheApc',
'value' => 'CacheApc',
'label' => $this->l('APC').((extension_loaded('apc') || extension_loaded('apcu')) ? '' : $warning_apc)
),
array(
'id' => 'CacheXcache',
'value' => 'CacheXcache',
'label' => $this->l('Xcache').(extension_loaded('xcache') ? '' : $warning_xcache)
),
array(
'id' => 'CacheRedis',
'value' => 'CacheRedis',
'label' => $this->l('Redis') . (extension_loaded('redis') ? '' : $warning_redis)
),
)
),
array(
'type' => 'text',
'label' => $this->l('Directory depth'),
'name' => 'ps_cache_fs_directory_depth'
),
),
'submit' => array(
'title' => $this->l('Save')
),
'memcachedServers' => true
);
} else {
// Old version 1.5
}
$depth = Configuration::get('PS_CACHEFS_DIRECTORY_DEPTH');
$this->fields_value['cache_active'] = _PS_CACHE_ENABLED_;
$this->fields_value['caching_system'] = _PS_CACHING_SYSTEM_;
$this->fields_value['ps_cache_fs_directory_depth'] = $depth ? $depth : 1;
$this->tpl_form_vars['servers'] = CacheMemcache::getMemcachedServers();
$this->tpl_form_vars['_PS_CACHE_ENABLED_'] = _PS_CACHE_ENABLED_;
}
public function renderForm()
{
$this->initFieldsetSmarty();
$this->initFieldsetDebugMode();
$this->initFieldsetFeaturesDetachables();
$this->initFieldsetCCC();
if (!defined('_PS_HOST_MODE_')) {
$this->initFieldsetMediaServer();
$this->initFieldsetCiphering();
$this->initFieldsetCaching();
}
// Reindex fields
$this->fields_form = array_values($this->fields_form);
// Activate multiple fieldset
$this->multiple_fieldsets = true;
return parent::renderForm();
}
}

View File

@ -0,0 +1,125 @@
a<?php
if (!defined('_PS_VERSION_')) {
exit;
}
class PsRedisCache extends Module
{
public function __construct()
{
$this->name = 'psrediscache';
$this->tab = 'front_office_features';
$this->version = '0.1';
$this->author = 'antadis';
$this->bootstrap = true;
parent::__construct();
$this->displayName = $this->l('Prestashop Redis Cache');
$this->description = $this->l('Use Redis as cache server');
$this->confirmUninstall = $this->l('Are you sure you want to uninstall this module?');
$this->_checkContent();
}
public function install()
{
// Call install parent method
if (!parent::install()) {
return false;
}
// All went well!
return true;
}
public function uninstall()
{
// Call uninstall parent method
if (!parent::uninstall()) {
return false;
}
// All went well!
return true;
}
public function getContent()
{
$this->processConfiguration();
return $this->display(__FILE__, 'getContent.tpl');
}
public function processConfiguration()
{
$message = '';
if (Tools::isSubmit('submit_psrediscache')) {
$message = $this->_saveContent();
}
$this->_displayContent($message);
}
private function _saveContent()
{
$message = '';
$settings_content = file_get_contents(_PS_CONFIG_DIR_.'/settings.inc.php');
$settings_constants = array(
'_REDIS_HOST_' => "'".Tools::getValue('_REDIS_HOST_')."'",
'_REDIS_PORT_' => (int)Tools::getValue('_REDIS_PORT_'),
);
foreach ($settings_constants as $constant => $value) {
if (substr($settings_content, -1) == ';') {
$settings_content.= "\n";
}
$settings_content.= "define('$constant', $value);\n";
}
$result = file_put_contents(_PS_CONFIG_DIR_.'/settings.inc.php', $settings_content);
if ($result !== false) {
$message = $this->displayConfirmation($this->l('Your settings have been saved'));
} else {
$message = $this->displayError($this->l('There was an error while saving your settings'));
}
return $message;
}
private function _displayContent($message)
{
$host = defined('_REDIS_HOST_') ? _REDIS_HOST_: '';
$port = defined('_REDIS_PORT_') ? _REDIS_PORT_: '';
$isClassExist = false;
if (class_exists('\\Predis\\Client')) {
$isClassExist = true;
}
$this->context->smarty->assign(array(
'message' => $message,
'isClassExist' => $isClassExist,
'_REDIS_HOST_' => str_replace(array('"', '\''), array('', ''), $host),
'_REDIS_PORT_' => $port,
));
}
private function _checkContent()
{
if (!defined('_REDIS_HOST_') && !defined('_REDIS_PORT_')) {
$this->warning = $this->l('You need to configure this module.');
}
}
private function _createContent()
{
if (!defined('_REDIS_HOST_') || !defined('_REDIS_PORT_')) {
return false;
}
return true;
}
}

View File

@ -0,0 +1,28 @@
{$message}
<fieldset>
<legend>Settings Redis Cache</legend>
<form method="post">
<p class="success">{l s='Please fill in the details about your redis server' mod='psrediscache'}</p>
<p>{l s='In order to remove configuration, edit settings.inc.php' mod='psrediscache'}</p>
<p>
<label for="REDIS_HOST">Serveur :</label>
<input id="REDIS_HOST" name="_REDIS_HOST_" type="text" value="{$_REDIS_HOST_}"{if $_REDIS_HOST_ ne ''} readonly{/if}/>
</p>
<p>
<label for="REDIS_PORT">Port :</label>
<input id="REDIS_PORT" name="_REDIS_PORT_" type="text" value="{$_REDIS_PORT_}"{if $_REDIS_PORT_ ne ''} readonly{/if}/>
</p>
<p>
<label>&nbsp;</label>
<input id="submit_{$module_name}" name="submit_{$module_name}" type="submit" value="Save" class="button" />
</p>
{if $isClassExist}
<p class="error">{l s='Error : The "Predis" class is not detected.' mod='psrediscache'}</p>
{/if}
<p>
{l s='NB : Please check if Redis server is correctly installed on your server' mod='psrediscache'}
<a href="http://redis.io/download" target="_blank"/> {l s='( Redis Server website ) ' mod='psrediscache'}</a>
</p>
</form>
</fieldset>

237
override/classes/cache/CacheRedis.php vendored Normal file
View File

@ -0,0 +1,237 @@
<?php
use Predis\Client;
class CacheRedis extends CacheCore
{
/**
* @var Predis\Client
*/
protected $redis;
/**
* @var bool Connection status
*/
protected $is_connected = false;
public function __construct()
{
$this->connect();
}
public function __destruct()
{
$this->close();
}
/**
* Connect to server
*/
public function connect()
{
if (!defined('_PS_CACHE_ENABLED_')) {
return;
}
if (_PS_CACHE_ENABLED_ == '0') {
return;
}
if (class_exists('\\Predis\\Client') && extension_loaded('redis')) {
$parameters = [
'scheme' => 'tcp',
'host' => _REDIS_HOST_,
'port' => _REDIS_PORT_,
//'database' => 0
];
$options = [
//'profile' => '2.8',
//'prefix' => '',
];
$this->redis = new Predis\Client($parameters, $options);
} else {
return;
}
//$this->is_connected = $this->redis->isConnected();
$info = $this->redis->info('server');
if (array_key_exists('Server', $info)) {
$this->is_connected = true;
}
}
/**
* @see Cache::_set()
*/
protected function _set($key, $value, $ttl = 0)
{
if (!$this->is_connected) {
return false;
}
if ($ttl == 0) {
$ttl = 3600;
}
return $this->redis->setex($key, $ttl, $this->encode($value));
}
/**
* @see Cache::_get()
*/
protected function _get($key)
{
if (!$this->is_connected) {
return false;
}
return $this->decode($this->redis->get($key));
}
/**
* @see Cache::_exists()
*/
protected function _exists($key)
{
if (!$this->is_connected) {
return false;
}
return ($this->redis->get($key) !== false);
}
/**
* @see Cache::_delete()
*/
protected function _delete($key)
{
if (!$this->is_connected) {
return false;
}
return $this->redis->del($key);
}
/**
* @see Cache::_writeKeys()
*/
protected function _writeKeys()
{
/*if (!$this->is_connected) {
return false;
}
return true;*/
}
/**
* @see Cache::flush()
*/
public function flush()
{
if (!$this->is_connected) {
return false;
}
return $this->redis->flushdb();
}
/**
* Store a data in cache
*
* @param string $key
* @param mixed $value
* @param int $ttl
* @return bool
*/
public function set($key, $value, $ttl = 0)
{
return $this->_set($key, $value, $ttl);
}
/**
* Retrieve a data from cache
*
* @param string $key
* @return mixed
*/
public function get($key)
{
return $this->_get($key);
}
/**
* Check if a data is cached
*
* @param string $key
* @return bool
*/
public function exists($key)
{
return $this->_exists($key);
}
/**
* Delete one or several data from cache (* joker can be used, but avoid it !)
* E.g.: delete('*'); delete('my_prefix_*'); delete('my_key_name');
*
* @param string $key
* @return bool
*/
public function delete($key)
{
if ($key == '*') {
$this->flush();
} elseif (strpos($key, '*') === false) {
$this->_delete($key);
} else {
$pattern = str_replace('\\*', '.*', preg_quote($key));
$keys = $this->redis->keys($pattern);
foreach ($keys as $key => $data) {
if (preg_match('#^'.$pattern.'$#', $key)) {
$this->_delete($key);
}
}
}
return true;
}
/**
* Close connection to server
*
* @return bool
*/
protected function close()
{
if (!$this->is_connected) {
return false;
}
return $this->redis->quit();
}
/**
* Encode data
*
* @param $data anything
* @return text value encode
*/
public function encode($data)
{
return serialize($data);
}
/**
* Decode data
*
* @param $data anything
* @return text value decode
*/
public function decode($data)
{
return unserialize($data);
}
}

View File

@ -0,0 +1,262 @@
<?php
class AdminPerformanceController extends AdminPerformanceControllerCore
{
public function __construct()
{
$this->bootstrap = true;
$this->className = 'Configuration';
parent::__construct();
}
public function initFieldsetSmarty()
{
$this->fields_form[0]['form'] = array(
'legend' => array(
'title' => $this->l('Smarty'),
'icon' => 'icon-briefcase'
),
'input' => array(
array(
'type' => 'hidden',
'name' => 'smarty_up'
),
array(
'type' => 'radio',
'label' => $this->l('Template compilation'),
'name' => 'smarty_force_compile',
'values' => array(
array(
'id' => 'smarty_force_compile_'._PS_SMARTY_NO_COMPILE_,
'value' => _PS_SMARTY_NO_COMPILE_,
'label' => $this->l('Never recompile template files'),
'hint' => $this->l('This option should be used in a production environment.')
),
array(
'id' => 'smarty_force_compile_'._PS_SMARTY_CHECK_COMPILE_,
'value' => _PS_SMARTY_CHECK_COMPILE_,
'label' => $this->l('Recompile templates if the files have been updated'),
'hint' => $this->l('Templates are recompiled when they are updated. If you experience compilation troubles when you update your template files, you should use Force Compile instead of this option. It should never be used in a production environment.')
),
array(
'id' => 'smarty_force_compile_'._PS_SMARTY_FORCE_COMPILE_,
'value' => _PS_SMARTY_FORCE_COMPILE_,
'label' => $this->l('Force compilation'),
'hint' => $this->l('This forces Smarty to (re)compile templates on every invocation. This is handy for development and debugging. Note: This should never be used in a production environment.')
)
)
),
array(
'type' => 'switch',
'label' => $this->l('Cache'),
'name' => 'smarty_cache',
'is_bool' => true,
'values' => array(
array(
'id' => 'smarty_cache_1',
'value' => 1,
'label' => $this->l('Yes'),
),
array(
'id' => 'smarty_cache_0',
'value' => 0,
'label' => $this->l('No')
)
),
'hint' => $this->l('Should be enabled except for debugging.')
),
array(
'type' => 'radio',
'label' => $this->l('Caching type'),
'name' => 'smarty_caching_type',
'values' => array(
array(
'id' => 'smarty_caching_type_filesystem',
'value' => 'filesystem',
'label' => $this->l('File System').(is_writable(_PS_CACHE_DIR_.'smarty/cache') ? '' : ' '.sprintf($this->l('(the directory %s must be writable)'), realpath(_PS_CACHE_DIR_.'smarty/cache')))
),
array(
'id' => 'smarty_caching_type_mysql',
'value' => 'mysql',
'label' => $this->l('MySQL')
),
array(
'id' => 'smarty_caching_type_redis',
'value' => 'redis',
'label' => $this->l('Redis') . (extension_loaded('redis') ? '' : $this->l('Warning: No redis extension loaded.'))
),
)
),
array(
'type' => 'radio',
'label' => $this->l('Clear cache'),
'name' => 'smarty_clear_cache',
'values' => array(
array(
'id' => 'smarty_clear_cache_never',
'value' => 'never',
'label' => $this->l('Never clear cache files'),
),
array(
'id' => 'smarty_clear_cache_everytime',
'value' => 'everytime',
'label' => $this->l('Clear cache everytime something has been modified'),
),
)
),
),
'submit' => array(
'title' => $this->l('Save')
)
);
$this->fields_value['smarty_force_compile'] = Configuration::get('PS_SMARTY_FORCE_COMPILE');
$this->fields_value['smarty_cache'] = Configuration::get('PS_SMARTY_CACHE');
$this->fields_value['smarty_caching_type'] = Configuration::get('PS_SMARTY_CACHING_TYPE');
$this->fields_value['smarty_clear_cache'] = Configuration::get('PS_SMARTY_CLEAR_CACHE');
$this->fields_value['smarty_console'] = Configuration::get('PS_SMARTY_CONSOLE');
$this->fields_value['smarty_console_key'] = Configuration::get('PS_SMARTY_CONSOLE_KEY');
}
public function initFieldsetCaching()
{
// Prestashop version 1.6+
if (version_compare(_PS_VERSION_, 1.6, '>')) {
$phpdoc_langs = array('en', 'zh', 'fr', 'de', 'ja', 'pl', 'ro', 'ru', 'fa', 'es', 'tr');
$php_lang = in_array($this->context->language->iso_code, $phpdoc_langs) ? $this->context->language->iso_code : 'en';
$warning_memcache = ' '.$this->l('(you must install the [a]Memcache PECL extension[/a])');
$warning_memcache = str_replace('[a]', '<a href="http://www.php.net/manual/'.substr($php_lang, 0, 2).'/memcache.installation.php" target="_blank">', $warning_memcache);
$warning_memcache = str_replace('[/a]', '</a>', $warning_memcache);
$warning_memcached = ' '.$this->l('(you must install the [a]Memcached PECL extension[/a])');
$warning_memcached = str_replace('[a]', '<a href="http://www.php.net/manual/'.substr($php_lang, 0, 2).'/memcached.installation.php" target="_blank">', $warning_memcached);
$warning_memcached = str_replace('[/a]', '</a>', $warning_memcached);
$warning_apc = ' '.$this->l('(you must install the [a]APC PECL extension[/a])');
$warning_apc = str_replace('[a]', '<a href="http://php.net/manual/'.substr($php_lang, 0, 2).'/apc.installation.php" target="_blank">', $warning_apc);
$warning_apc = str_replace('[/a]', '</a>', $warning_apc);
$warning_xcache = ' '.$this->l('(you must install the [a]Xcache extension[/a])');
$warning_xcache = str_replace('[a]', '<a href="http://xcache.lighttpd.net" target="_blank">', $warning_xcache);
$warning_xcache = str_replace('[/a]', '</a>', $warning_xcache);
$warning_fs = ' '.sprintf($this->l('(the directory %s must be writable)'), realpath(_PS_CACHEFS_DIRECTORY_));
$warning_redis = ' ' . $this->l('(you must install the [a]Redis extension[/a])');
$warning_redis = str_replace('[a]', '<a href="https://pecl.php.net/package/redis" target="_blank">', $warning_redis);
$warning_redis = str_replace('[/a]', '</a>', $warning_redis);
$this->fields_form[6]['form'] = array(
'legend' => array(
'title' => $this->l('Caching'),
'icon' => 'icon-desktop'
),
'input' => array(
array(
'type' => 'hidden',
'name' => 'cache_up'
),
array(
'type' => 'switch',
'label' => $this->l('Use cache'),
'name' => 'cache_active',
'is_bool' => true,
'values' => array(
array(
'id' => 'cache_active_on',
'value' => 1,
'label' => $this->l('Enabled')
),
array(
'id' => 'cache_active_off',
'value' => 0,
'label' => $this->l('Disabled')
)
)
),
array(
'type' => 'radio',
'label' => $this->l('Caching system'),
'name' => 'caching_system',
'hint' => $this->l('The CacheFS system should be used only when the infrastructure contains one front-end server. If you are not sure, ask your hosting company.'),
'values' => array(
array(
'id' => 'CacheFs',
'value' => 'CacheFs',
'label' => $this->l('File System').(is_writable(_PS_CACHEFS_DIRECTORY_) ? '' : $warning_fs)
),
array(
'id' => 'CacheMemcache',
'value' => 'CacheMemcache',
'label' => $this->l('Memcached via PHP::Memcache').(extension_loaded('memcache') ? '' : $warning_memcache)
),
array(
'id' => 'CacheMemcached',
'value' => 'CacheMemcached',
'label' => $this->l('Memcached via PHP::Memcached').(extension_loaded('memcached') ? '' : $warning_memcached)
),
array(
'id' => 'CacheApc',
'value' => 'CacheApc',
'label' => $this->l('APC').((extension_loaded('apc') || extension_loaded('apcu')) ? '' : $warning_apc)
),
array(
'id' => 'CacheXcache',
'value' => 'CacheXcache',
'label' => $this->l('Xcache').(extension_loaded('xcache') ? '' : $warning_xcache)
),
array(
'id' => 'CacheRedis',
'value' => 'CacheRedis',
'label' => $this->l('Redis') . (extension_loaded('redis') ? '' : $warning_redis)
),
)
),
array(
'type' => 'text',
'label' => $this->l('Directory depth'),
'name' => 'ps_cache_fs_directory_depth'
),
),
'submit' => array(
'title' => $this->l('Save')
),
'memcachedServers' => true
);
} else {
// Old version 1.5
}
$depth = Configuration::get('PS_CACHEFS_DIRECTORY_DEPTH');
$this->fields_value['cache_active'] = _PS_CACHE_ENABLED_;
$this->fields_value['caching_system'] = _PS_CACHING_SYSTEM_;
$this->fields_value['ps_cache_fs_directory_depth'] = $depth ? $depth : 1;
$this->tpl_form_vars['servers'] = CacheMemcache::getMemcachedServers();
$this->tpl_form_vars['_PS_CACHE_ENABLED_'] = _PS_CACHE_ENABLED_;
}
public function renderForm()
{
$this->initFieldsetSmarty();
$this->initFieldsetDebugMode();
$this->initFieldsetFeaturesDetachables();
$this->initFieldsetCCC();
if (!defined('_PS_HOST_MODE_')) {
$this->initFieldsetMediaServer();
$this->initFieldsetCiphering();
$this->initFieldsetCaching();
}
// Reindex fields
$this->fields_form = array_values($this->fields_form);
// Activate multiple fieldset
$this->multiple_fieldsets = true;
return parent::renderForm();
}
}

View File

@ -4,17 +4,38 @@ require_once _PS_MODULE_DIR_.'cmsps/classes/CmsPsPost.php';
class IndexController extends IndexControllerCore
{
public function initContent()
{
public function initContent()
{
$id_lang = Context::getContext()->language->id;
/*
$edito = CmsPsEdito::getLast($id_lang);
$posts = CmsPsPost::getPostHome($id_lang);
*/
$cache = Cache::getInstance();
$key = 'cmspsedito:getlast'.$id_lang;
if (!$edito = $cache->get($key)) {
$edito = CmsPsEdito::getLast($id_lang);
$cache->set($key, $edito);
}
$key = 'cmspsedito:getposthome:'.$id_lang;
if (!$posts = $cache->get($key)) {
$posts = CmsPsPost::getPostHome($id_lang);
$cache->set($key, $posts);
}
$constructor = Hook::exec('displayConstructorLink');
if (empty($constructor)) {
$homeEdito = CmsPsEdito::getHomeEdito($id_lang);
$key = 'cmspsedito:gethomeedito:'.$id_lang;
if (!$homeEdito = $cache->get($key)) {
$homeEdito = CmsPsEdito::getHomeEdito($id_lang);
$cache->set($key, $homeEdito);
}
/*
$homeEdito = CmsPsEdito::getHomeEdito($id_lang);
$homeEdito->smallTitle = strlen($homeEdito->title) > 30;
*/
}
$this->context->smarty->assign(array(

2
vendor/.htaccess vendored Normal file
View File

@ -0,0 +1,2 @@
Order deny,allow
Deny from all

4
vendor/autoload.php vendored
View File

@ -2,6 +2,6 @@
// autoload.php @generated by Composer
require_once __DIR__ . '/composer' . '/autoload_real.php';
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit745aac61f4fe98ed4c269e23d0de31af::getLoader();
return ComposerAutoloaderInit1771582d9a19cf297d1f66e2e2ff9a3f::getLoader();

7
vendor/bin/phinx vendored
View File

@ -1,7 +0,0 @@
#!/usr/bin/env sh
SRC_DIR="`pwd`"
cd "`dirname "$0"`"
cd "../robmorgan/phinx/bin"
BIN_TARGET="`pwd`/phinx"
cd "$SRC_DIR"
"$BIN_TARGET" "$@"

1
vendor/bin/phinx vendored Symbolic link
View File

@ -0,0 +1 @@
../robmorgan/phinx/bin/phinx

View File

@ -1,3 +0,0 @@
@ECHO OFF
SET BIN_TARGET=%~dp0/../robmorgan/phinx/bin/phinx
php "%BIN_TARGET%" %*

View File

@ -13,9 +13,7 @@
namespace Composer\Autoload;
/**
* ClassLoader implements a PSR-0 class loader
*
* See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
*
* $loader = new \Composer\Autoload\ClassLoader();
*
@ -39,6 +37,8 @@ namespace Composer\Autoload;
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Jordi Boggiano <j.boggiano@seld.be>
* @see http://www.php-fig.org/psr/psr-0/
* @see http://www.php-fig.org/psr/psr-4/
*/
class ClassLoader
{
@ -53,8 +53,9 @@ class ClassLoader
private $useIncludePath = false;
private $classMap = array();
private $classMapAuthoritative = false;
private $missingClasses = array();
private $apcuPrefix;
public function getPrefixes()
{
@ -147,7 +148,7 @@ class ClassLoader
* appending or prepending to the ones previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-0 base directories
* @param array|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
*
* @throws \InvalidArgumentException
@ -271,6 +272,26 @@ class ClassLoader
return $this->classMapAuthoritative;
}
/**
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
*
* @param string|null $apcuPrefix
*/
public function setApcuPrefix($apcuPrefix)
{
$this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
}
/**
* The APCu prefix in use, or null if APCu caching is not enabled.
*
* @return string|null
*/
public function getApcuPrefix()
{
return $this->apcuPrefix;
}
/**
* Registers this instance as an autoloader.
*
@ -313,29 +334,34 @@ class ClassLoader
*/
public function findFile($class)
{
// work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
if ('\\' == $class[0]) {
$class = substr($class, 1);
}
// class map lookup
if (isset($this->classMap[$class])) {
return $this->classMap[$class];
}
if ($this->classMapAuthoritative) {
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
return false;
}
if (null !== $this->apcuPrefix) {
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
if ($hit) {
return $file;
}
}
$file = $this->findFileWithExtension($class, '.php');
// Search for Hack files if we are running on HHVM
if ($file === null && defined('HHVM_VERSION')) {
if (false === $file && defined('HHVM_VERSION')) {
$file = $this->findFileWithExtension($class, '.hh');
}
if ($file === null) {
if (null !== $this->apcuPrefix) {
apcu_add($this->apcuPrefix.$class, $file);
}
if (false === $file) {
// Remember that this class does not exist.
return $this->classMap[$class] = false;
$this->missingClasses[$class] = true;
}
return $file;
@ -348,9 +374,13 @@ class ClassLoader
$first = $class[0];
if (isset($this->prefixLengthsPsr4[$first])) {
foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
if (0 === strpos($class, $prefix)) {
foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
$subPath = $class;
while (false !== $lastPos = strrpos($subPath, '\\')) {
$subPath = substr($subPath, 0, $lastPos);
$search = $subPath.'\\';
if (isset($this->prefixDirsPsr4[$search])) {
foreach ($this->prefixDirsPsr4[$search] as $dir) {
$length = $this->prefixLengthsPsr4[$first][$search];
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
return $file;
}
@ -399,6 +429,8 @@ class ClassLoader
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
return $file;
}
return false;
}
}

View File

@ -1,5 +1,5 @@
Copyright (c) 2015 Nils Adermann, Jordi Boggiano
Copyright (c) Nils Adermann, Jordi Boggiano
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

10
vendor/composer/autoload_files.php vendored Normal file
View File

@ -0,0 +1,10 @@
<?php
// autoload_files.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
);

View File

@ -6,9 +6,14 @@ $vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
'Symfony\\Component\\Yaml\\' => array($vendorDir . '/symfony/yaml'),
'Symfony\\Component\\Filesystem\\' => array($vendorDir . '/symfony/filesystem'),
'Symfony\\Component\\Debug\\' => array($vendorDir . '/symfony/debug'),
'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'),
'Symfony\\Component\\Config\\' => array($vendorDir . '/symfony/config'),
'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
'Predis\\' => array($vendorDir . '/predis/predis/src'),
'Phinx\\' => array($vendorDir . '/robmorgan/phinx/src/Phinx'),
'Composer\\Installers\\' => array($vendorDir . '/composer/installers/src/Composer/Installers'),
);

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit745aac61f4fe98ed4c269e23d0de31af
class ComposerAutoloaderInit1771582d9a19cf297d1f66e2e2ff9a3f
{
private static $loader;
@ -19,32 +19,52 @@ class ComposerAutoloaderInit745aac61f4fe98ed4c269e23d0de31af
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit745aac61f4fe98ed4c269e23d0de31af', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit1771582d9a19cf297d1f66e2e2ff9a3f', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInit745aac61f4fe98ed4c269e23d0de31af', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit1771582d9a19cf297d1f66e2e2ff9a3f', 'loadClassLoader'));
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require_once __DIR__ . '/autoload_static.php';
$map = require __DIR__ . '/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}
call_user_func(\Composer\Autoload\ComposerStaticInit1771582d9a19cf297d1f66e2e2ff9a3f::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
$map = require __DIR__ . '/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
}
$loader->register(true);
if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInit1771582d9a19cf297d1f66e2e2ff9a3f::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire1771582d9a19cf297d1f66e2e2ff9a3f($fileIdentifier, $file);
}
return $loader;
}
}
function composerRequire745aac61f4fe98ed4c269e23d0de31af($file)
function composerRequire1771582d9a19cf297d1f66e2e2ff9a3f($fileIdentifier, $file)
{
require $file;
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
}
}

104
vendor/composer/autoload_static.php vendored Normal file
View File

@ -0,0 +1,104 @@
<?php
// autoload_static.php @generated by Composer
namespace Composer\Autoload;
class ComposerStaticInit1771582d9a19cf297d1f66e2e2ff9a3f
{
public static $files = array (
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
);
public static $prefixLengthsPsr4 = array (
'S' =>
array (
'Symfony\\Polyfill\\Mbstring\\' => 26,
'Symfony\\Component\\Yaml\\' => 23,
'Symfony\\Component\\Filesystem\\' => 29,
'Symfony\\Component\\Debug\\' => 24,
'Symfony\\Component\\Console\\' => 26,
'Symfony\\Component\\Config\\' => 25,
),
'P' =>
array (
'Psr\\Log\\' => 8,
'Predis\\' => 7,
'Phinx\\' => 6,
),
'C' =>
array (
'Composer\\Installers\\' => 20,
),
);
public static $prefixDirsPsr4 = array (
'Symfony\\Polyfill\\Mbstring\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
),
'Symfony\\Component\\Yaml\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/yaml',
),
'Symfony\\Component\\Filesystem\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/filesystem',
),
'Symfony\\Component\\Debug\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/debug',
),
'Symfony\\Component\\Console\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/console',
),
'Symfony\\Component\\Config\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/config',
),
'Psr\\Log\\' =>
array (
0 => __DIR__ . '/..' . '/psr/log/Psr/Log',
),
'Predis\\' =>
array (
0 => __DIR__ . '/..' . '/predis/predis/src',
),
'Phinx\\' =>
array (
0 => __DIR__ . '/..' . '/robmorgan/phinx/src/Phinx',
),
'Composer\\Installers\\' =>
array (
0 => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers',
),
);
public static $prefixesPsr0 = array (
'W' =>
array (
'Whoops' =>
array (
0 => __DIR__ . '/..' . '/filp/whoops/src',
),
),
);
public static $classMap = array (
'Whoops\\Module' => __DIR__ . '/..' . '/filp/whoops/src/deprecated/Zend/Module.php',
'Whoops\\Provider\\Zend\\ExceptionStrategy' => __DIR__ . '/..' . '/filp/whoops/src/deprecated/Zend/ExceptionStrategy.php',
'Whoops\\Provider\\Zend\\RouteNotFoundStrategy' => __DIR__ . '/..' . '/filp/whoops/src/deprecated/Zend/RouteNotFoundStrategy.php',
);
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit1771582d9a19cf297d1f66e2e2ff9a3f::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit1771582d9a19cf297d1f66e2e2ff9a3f::$prefixDirsPsr4;
$loader->prefixesPsr0 = ComposerStaticInit1771582d9a19cf297d1f66e2e2ff9a3f::$prefixesPsr0;
$loader->classMap = ComposerStaticInit1771582d9a19cf297d1f66e2e2ff9a3f::$classMap;
}, null, ClassLoader::class);
}
}

View File

@ -1,40 +1,43 @@
[
{
"name": "filp/whoops",
"version": "1.1.7",
"version_normalized": "1.1.7.0",
"name": "composer/installers",
"version": "v1.3.0",
"version_normalized": "1.3.0.0",
"source": {
"type": "git",
"url": "https://github.com/filp/whoops.git",
"reference": "72538eeb70bbfb11964412a3d098d109efd012f7"
"url": "https://github.com/composer/installers.git",
"reference": "79ad876c7498c0bbfe7eed065b8651c93bfd6045"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/filp/whoops/zipball/72538eeb70bbfb11964412a3d098d109efd012f7",
"reference": "72538eeb70bbfb11964412a3d098d109efd012f7",
"url": "https://api.github.com/repos/composer/installers/zipball/79ad876c7498c0bbfe7eed065b8651c93bfd6045",
"reference": "79ad876c7498c0bbfe7eed065b8651c93bfd6045",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
"composer-plugin-api": "^1.0"
},
"replace": {
"roundcube/plugin-installer": "*",
"shama/baton": "*"
},
"require-dev": {
"mockery/mockery": "0.9.*"
"composer/composer": "1.0.*@dev",
"phpunit/phpunit": "4.1.*"
},
"time": "2015-06-29 05:42:04",
"type": "library",
"time": "2017-04-24T06:37:16+00:00",
"type": "composer-plugin",
"extra": {
"class": "Composer\\Installers\\Plugin",
"branch-alias": {
"dev-master": "1.2-dev"
"dev-master": "1.0-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-0": {
"Whoops": "src/"
},
"classmap": [
"src/deprecated"
]
"psr-4": {
"Composer\\Installers\\": "src/Composer/Installers"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -42,56 +45,161 @@
],
"authors": [
{
"name": "Filipe Dobreira",
"homepage": "https://github.com/filp",
"role": "Developer"
"name": "Kyle Robinson Young",
"email": "kyle@dontkry.com",
"homepage": "https://github.com/shama"
}
],
"description": "php error handling for cool kids",
"homepage": "https://github.com/filp/whoops",
"description": "A multi-framework Composer library installer",
"homepage": "https://composer.github.io/installers/",
"keywords": [
"error",
"exception",
"handling",
"library",
"silex-provider",
"whoops",
"zf2"
"Craft",
"Dolibarr",
"Eliasis",
"Hurad",
"ImageCMS",
"Kanboard",
"MODX Evo",
"Mautic",
"Maya",
"OXID",
"Plentymarkets",
"Porto",
"RadPHP",
"SMF",
"Thelia",
"WolfCMS",
"agl",
"aimeos",
"annotatecms",
"attogram",
"bitrix",
"cakephp",
"chef",
"cockpit",
"codeigniter",
"concrete5",
"croogo",
"dokuwiki",
"drupal",
"elgg",
"expressionengine",
"fuelphp",
"grav",
"installer",
"itop",
"joomla",
"kohana",
"laravel",
"lavalite",
"lithium",
"magento",
"mako",
"mediawiki",
"modulework",
"moodle",
"phpbb",
"piwik",
"ppi",
"puppet",
"reindex",
"roundcube",
"shopware",
"silverstripe",
"sydes",
"symfony",
"typo3",
"wordpress",
"yawik",
"zend",
"zikula"
]
},
{
"name": "symfony/yaml",
"version": "v2.7.5",
"version_normalized": "2.7.5.0",
"name": "predis/predis",
"version": "v1.1.1",
"version_normalized": "1.1.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
"reference": "31cb2ad0155c95b88ee55fe12bc7ff92232c1770"
"url": "https://github.com/nrk/predis.git",
"reference": "f0210e38881631afeafb56ab43405a92cafd9fd1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/31cb2ad0155c95b88ee55fe12bc7ff92232c1770",
"reference": "31cb2ad0155c95b88ee55fe12bc7ff92232c1770",
"url": "https://api.github.com/repos/nrk/predis/zipball/f0210e38881631afeafb56ab43405a92cafd9fd1",
"reference": "f0210e38881631afeafb56ab43405a92cafd9fd1",
"shasum": ""
},
"require": {
"php": ">=5.3.9"
},
"require-dev": {
"symfony/phpunit-bridge": "~2.7"
"phpunit/phpunit": "~4.8"
},
"time": "2015-09-14 14:14:09",
"suggest": {
"ext-curl": "Allows access to Webdis when paired with phpiredis",
"ext-phpiredis": "Allows faster serialization and deserialization of the Redis protocol"
},
"time": "2016-06-16T16:22:20+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Predis\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Daniele Alessandri",
"email": "suppakilla@gmail.com",
"homepage": "http://clorophilla.net"
}
],
"description": "Flexible and feature-complete Redis client for PHP and HHVM",
"homepage": "http://github.com/nrk/predis",
"keywords": [
"nosql",
"predis",
"redis"
]
},
{
"name": "symfony/yaml",
"version": "v2.8.20",
"version_normalized": "2.8.20.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
"reference": "93ccdde79f4b079c7558da4656a3cb1c50c68e02"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/93ccdde79f4b079c7558da4656a3cb1c50c68e02",
"reference": "93ccdde79f4b079c7558da4656a3cb1c50c68e02",
"shasum": ""
},
"require": {
"php": ">=5.3.9"
},
"time": "2017-05-01T14:31:55+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.7-dev"
"dev-master": "2.8-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Symfony\\Component\\Yaml\\": ""
}
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -111,38 +219,270 @@
"homepage": "https://symfony.com"
},
{
"name": "symfony/filesystem",
"version": "v2.7.5",
"version_normalized": "2.7.5.0",
"name": "symfony/polyfill-mbstring",
"version": "v1.3.0",
"version_normalized": "1.3.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
"reference": "a17f8a17c20e8614c15b8e116e2f4bcde102cfab"
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "e79d363049d1c2128f133a2667e4f4190904f7f4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/a17f8a17c20e8614c15b8e116e2f4bcde102cfab",
"reference": "a17f8a17c20e8614c15b8e116e2f4bcde102cfab",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/e79d363049d1c2128f133a2667e4f4190904f7f4",
"reference": "e79d363049d1c2128f133a2667e4f4190904f7f4",
"shasum": ""
},
"require": {
"php": ">=5.3.9"
"php": ">=5.3.3"
},
"require-dev": {
"symfony/phpunit-bridge": "~2.7"
"suggest": {
"ext-mbstring": "For best performance"
},
"time": "2015-09-09 17:42:36",
"time": "2016-11-14T01:06:16+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.7-dev"
"dev-master": "1.3-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for the Mbstring extension",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"mbstring",
"polyfill",
"portable",
"shim"
]
},
{
"name": "psr/log",
"version": "1.0.2",
"version_normalized": "1.0.2.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
"reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
"reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"time": "2016-10-10T12:19:37+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Psr\\Log\\": "Psr/Log/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for logging libraries",
"homepage": "https://github.com/php-fig/log",
"keywords": [
"log",
"psr",
"psr-3"
]
},
{
"name": "symfony/debug",
"version": "v3.0.9",
"version_normalized": "3.0.9.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/debug.git",
"reference": "697c527acd9ea1b2d3efac34d9806bf255278b0a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/debug/zipball/697c527acd9ea1b2d3efac34d9806bf255278b0a",
"reference": "697c527acd9ea1b2d3efac34d9806bf255278b0a",
"shasum": ""
},
"require": {
"php": ">=5.5.9",
"psr/log": "~1.0"
},
"conflict": {
"symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2"
},
"require-dev": {
"symfony/class-loader": "~2.8|~3.0",
"symfony/http-kernel": "~2.8|~3.0"
},
"time": "2016-07-30T07:22:48+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Symfony\\Component\\Debug\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Debug Component",
"homepage": "https://symfony.com"
},
{
"name": "symfony/console",
"version": "v2.8.20",
"version_normalized": "2.8.20.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "2cfcbced8e39e2313ed4da8896fc8c59a56c0d7e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/2cfcbced8e39e2313ed4da8896fc8c59a56c0d7e",
"reference": "2cfcbced8e39e2313ed4da8896fc8c59a56c0d7e",
"shasum": ""
},
"require": {
"php": ">=5.3.9",
"symfony/debug": "^2.7.2|~3.0.0",
"symfony/polyfill-mbstring": "~1.0"
},
"require-dev": {
"psr/log": "~1.0",
"symfony/event-dispatcher": "~2.1|~3.0.0",
"symfony/process": "~2.1|~3.0.0"
},
"suggest": {
"psr/log": "For using the console logger",
"symfony/event-dispatcher": "",
"symfony/process": ""
},
"time": "2017-04-26T01:38:53+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.8-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Symfony\\Component\\Console\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com"
},
{
"name": "symfony/filesystem",
"version": "v3.0.9",
"version_normalized": "3.0.9.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
"reference": "b2da5009d9bacbd91d83486aa1f44c793a8c380d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/b2da5009d9bacbd91d83486aa1f44c793a8c380d",
"reference": "b2da5009d9bacbd91d83486aa1f44c793a8c380d",
"shasum": ""
},
"require": {
"php": ">=5.5.9"
},
"time": "2016-07-20T05:43:46+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Symfony\\Component\\Filesystem\\": ""
}
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -163,38 +503,44 @@
},
{
"name": "symfony/config",
"version": "v2.7.5",
"version_normalized": "2.7.5.0",
"version": "v2.8.20",
"version_normalized": "2.8.20.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/config.git",
"reference": "9698fdf0a750d6887d5e7729d5cf099765b20e61"
"reference": "0b8541d18507d10204a08384640ff6df3c739ebe"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/config/zipball/9698fdf0a750d6887d5e7729d5cf099765b20e61",
"reference": "9698fdf0a750d6887d5e7729d5cf099765b20e61",
"url": "https://api.github.com/repos/symfony/config/zipball/0b8541d18507d10204a08384640ff6df3c739ebe",
"reference": "0b8541d18507d10204a08384640ff6df3c739ebe",
"shasum": ""
},
"require": {
"php": ">=5.3.9",
"symfony/filesystem": "~2.3"
"symfony/filesystem": "~2.3|~3.0.0"
},
"require-dev": {
"symfony/phpunit-bridge": "~2.7"
"symfony/yaml": "~2.7|~3.0.0"
},
"time": "2015-09-21 15:02:29",
"suggest": {
"symfony/yaml": "To use the yaml reference dumper"
},
"time": "2017-04-12T14:07:15+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.7-dev"
"dev-master": "2.8-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Symfony\\Component\\Config\\": ""
}
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -213,65 +559,6 @@
"description": "Symfony Config Component",
"homepage": "https://symfony.com"
},
{
"name": "symfony/console",
"version": "v2.7.5",
"version_normalized": "2.7.5.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "06cb17c013a82f94a3d840682b49425cd00a2161"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/06cb17c013a82f94a3d840682b49425cd00a2161",
"reference": "06cb17c013a82f94a3d840682b49425cd00a2161",
"shasum": ""
},
"require": {
"php": ">=5.3.9"
},
"require-dev": {
"psr/log": "~1.0",
"symfony/event-dispatcher": "~2.1",
"symfony/phpunit-bridge": "~2.7",
"symfony/process": "~2.1"
},
"suggest": {
"psr/log": "For using the console logger",
"symfony/event-dispatcher": "",
"symfony/process": ""
},
"time": "2015-09-25 08:32:23",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.7-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Symfony\\Component\\Console\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com"
},
{
"name": "robmorgan/phinx",
"version": "v0.4.6",
@ -297,7 +584,7 @@
"phpunit/phpunit": "3.7.*",
"squizlabs/php_codesniffer": "dev-phpcs-fixer"
},
"time": "2015-09-11 15:44:41",
"time": "2015-09-11T15:44:41+00:00",
"bin": [
"bin/phinx"
],
@ -337,24 +624,85 @@
]
},
{
"name": "potsky/pimp-my-log",
"version": "1.7.9",
"version_normalized": "1.7.9.0",
"name": "filp/whoops",
"version": "1.1.10",
"version_normalized": "1.1.10.0",
"source": {
"type": "git",
"url": "https://github.com/potsky/PimpMyLog.git",
"reference": "22f448c9aaf8115663536aaef410b5eb9152d950"
"url": "https://github.com/filp/whoops.git",
"reference": "72538eeb70bbfb11964412a3d098d109efd012f7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/potsky/PimpMyLog/zipball/22f448c9aaf8115663536aaef410b5eb9152d950",
"reference": "22f448c9aaf8115663536aaef410b5eb9152d950",
"url": "https://api.github.com/repos/filp/whoops/zipball/72538eeb70bbfb11964412a3d098d109efd012f7",
"reference": "72538eeb70bbfb11964412a3d098d109efd012f7",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"require-dev": {
"mockery/mockery": "0.9.*"
},
"time": "2015-06-29T05:42:04+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-0": {
"Whoops": "src/"
},
"classmap": [
"src/deprecated"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Filipe Dobreira",
"homepage": "https://github.com/filp",
"role": "Developer"
}
],
"description": "php error handling for cool kids",
"homepage": "https://github.com/filp/whoops",
"keywords": [
"error",
"exception",
"handling",
"library",
"silex-provider",
"whoops",
"zf2"
]
},
{
"name": "potsky/pimp-my-log",
"version": "1.7.14",
"version_normalized": "1.7.14.0",
"source": {
"type": "git",
"url": "https://github.com/potsky/PimpMyLog.git",
"reference": "2fed8c1fcedb023dfa0e63df48fb20996a40a76c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/potsky/PimpMyLog/zipball/2fed8c1fcedb023dfa0e63df48fb20996a40a76c",
"reference": "2fed8c1fcedb023dfa0e63df48fb20996a40a76c",
"shasum": ""
},
"require": {
"composer/installers": "*",
"php": ">=5.2.0"
},
"time": "2015-05-27 07:09:41",
"time": "2017-04-27T10:46:08+00:00",
"type": "project",
"installation-source": "dist",
"notification-url": "https://packagist.org/downloads/",
@ -372,6 +720,11 @@
"name": "Cassio Santos",
"homepage": "http://www.cassiosantos.com",
"role": "Translator (pt_BR)"
},
{
"name": "Martin",
"homepage": "https://github.com/mmattel",
"role": "Configuration examples contributor"
}
],
"description": "Log viewer for your web server",

View File

@ -0,0 +1,10 @@
; top-most EditorConfig file
root = true
; Unix-style newlines
[*]
end_of_line = LF
[*.php]
indent_style = space
indent_size = 4

3
vendor/composer/installers/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
vendor/
composer.lock
.idea/

23
vendor/composer/installers/.travis.yml vendored Normal file
View File

@ -0,0 +1,23 @@
language: php
php:
- 5.3
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
- hhvm
matrix:
fast_finish: true
allow_failures:
- php: 7.0
- php: 7.1
before_script:
- composer self-update
- composer install
script:
- composer test

60
vendor/composer/installers/CHANGELOG.md vendored Normal file
View File

@ -0,0 +1,60 @@
# Change Log
## v1.3.0 - 2017-04-24
### Added
* Kanboard plugins installer.
* Porto-SAP installer.
* Add `core` to concrete5 installer.
* Support Moodle "search" plugin type.
* SyDES installer.
* iTop installer.
* Lavalite installer.
* Module type for Eliasis.
* Vgmcp installer.
* OntoWiki installer.
* The requirements for contributing (CONTRIBUTING.md).
### Changed
* Concrete5: block & theme install location updates.
## v1.2.0 - 2016-08-13
### Added
* Installer for Attogram.
* Installer for Cockpit.
* Installer for Plentymarkets.
* Installer for ReIndex.
* Installer for Vanilla.
* Installer for YAWIK.
* Added missing environments for new Shopware (5.2) Plugin System.
## v1.1.0 - 2016-07-05
### Added
* Installer for ReIndex.
* Installer for RadPHP.
* Installer for Decibel.
* Installer for Phifty.
* Installer for ExpressionEngine.
### Changed
* New paths for new Bitrix CMS. Old paths is deprecated.
### Deprecated
* Old paths in Bitrix CMS Installer is deprecated.
## v1.0.25 - 2016-04-13
### Removed
* Revert TYPO3 installer deletion.
## v1.0.24 - 2016-04-05
### Added
* Installer for ImageCMS.
* Installer for Mautic.
* New types in the Kirby installer: `kirby-plugin` and `kirby-field`.
* New types in the Drupal installer: `custom-theme` and `custom-module`.
### Changed
* Switch to PSR-4.
* Update Bitrix Installer: configuration for setting custom path to directory with kernel.
### Removed
* Remove TYPO3 Extension installers.

View File

@ -0,0 +1,24 @@
# Contributing
If you would like to help, please take a look at the list of
[issues](https://github.com/composer/installers/issues).
## Pull requests
* [Fork and clone](https://help.github.com/articles/fork-a-repo).
* Run the command `php composer.phar install` to install the dependencies.
This will also install the dev dependencies. See [Composer](https://getcomposer.org/doc/03-cli.md#install).
* Use the command `phpunit` to run the tests. See [PHPUnit](http://phpunit.de).
* Create a branch, commit, push and send us a
[pull request](https://help.github.com/articles/using-pull-requests).
To ensure a consistent code base, you should make sure the code follows the
coding standards [PSR-1](http://www.php-fig.org/psr/psr-1/) and
[PSR-2](http://www.php-fig.org/psr/psr-2/).
### Create a new Installer
* Create class extends `Composer\Installers\BaseInstaller` with your Installer.
* Create unit tests as a separate class or as part of a `Composer\Installers\Test\InstallerTest`.
* Add information about your Installer in `README.md` in section "Current Supported Package Types".
* Run the tests.

19
vendor/composer/installers/LICENSE vendored Normal file
View File

@ -0,0 +1,19 @@
Copyright (c) 2012 Kyle Robinson Young
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

214
vendor/composer/installers/README.md vendored Normal file
View File

@ -0,0 +1,214 @@
# A Multi-Framework [Composer](http://getcomposer.org) Library Installer
[![Build Status](http://img.shields.io/travis/composer/installers.svg)](http://travis-ci.org/composer/installers)
This is for PHP package authors to require in their `composer.json`. It will
install their package to the correct location based on the specified package
type.
The goal of Installers is to be a simple package type to install path map.
Users can also customize the install path per package and package authors can
modify the package name upon installing.
Installers isn't intended on replacing all custom installers. If your
package requires special installation handling then by all means, create a
custom installer to handle it.
**Natively Supported Frameworks**:
The following frameworks natively work with Composer and will be
installed to the default `vendor` directory. `composer/installers`
is not needed to install packages with these frameworks:
* Aura
* Symfony2
* Yii
* Yii2
## Current Supported Package Types
> Stable types are marked as **bold**, this means that installation paths
> for those type will not be changed. Any adjustment for those types would
> require creation of brand new type that will cover required changes.
| Framework | Types
| --------- | -----
| Aimeos | `aimeos-extension`
| Asgard | `asgard-module`<br>`asgard-theme`
| Attogram | `attogram-module`
| AGL | `agl-module`
| Bonefish | `bonefish-package`
| AnnotateCms | `annotatecms-module`<br>`annotatecms-component`<br>`annotatecms-service`
| Bitrix | `bitrix-module` (deprecated) <br>`bitrix-component` (deprecated) <br>`bitrix-theme` (deprecated) <br><br> `bitrix-d7-module` <br> `bitrix-d7-component` <br> `bitrix-d7-template`
| CakePHP 2+ | **`cakephp-plugin`**
| Chef | `chef-cookbook`<br>`chef-role`
| CCFramework | `ccframework-ship`<br>`ccframework-theme`
| Cockpit | `cockpit-module`
| CodeIgniter | `codeigniter-library`<br>`codeigniter-third-party`<br>`codeigniter-module`
| concrete5 | `concrete5-core`<br>`concrete5-package`<br>`concrete5-theme`<br>`concrete5-block`<br>`concrete5-update`
| Craft | `craft-plugin`
| Croogo | `croogo-plugin`<br>`croogo-theme`
| Decibel | `decibel-app`
| DokuWiki | `dokuwiki-plugin`<br>`dokuwiki-template`
| Dolibarr | `dolibarr-module`
| Drupal | <b>`drupal-core`<br>`drupal-module`<br>`drupal-theme`</b><br>`drupal-library`<br>`drupal-profile`<br>`drupal-drush`
| Elgg | `elgg-plugin`
| Eliasis | `eliasis-module`
| ExpressionEngine 3 | `ee3-addon`<br>`ee3-theme`
| FuelPHP v1.x | `fuel-module`<br>`fuel-package`<br/>`fuel-theme`
| FuelPHP v2.x | `fuelphp-component`
| Grav | `grav-plugin`<br>`grav-theme`
| Hurad | `hurad-plugin`<br>`hurad-theme`
| ImageCMS | `imagecms-template`<br>`imagecms-module`<br>`imagecms-library`
| iTop | `itop-extension`
| Joomla | `joomla-component`<br>`joomla-module`<br>`joomla-template`<br>`joomla-plugin`<br>`joomla-library`
| Kanboard | `kanboard-plugin`
| Kirby | **`kirby-plugin`**<br>`kirby-field`<br>`kirby-tag`
| KodiCMS | `kodicms-plugin`<br>`kodicms-media`
| Kohana | **`kohana-module`**
| Laravel | `laravel-library`
| Lavalite | `lavalite-theme`<br>`lavalite-package`
| Lithium | **`lithium-library`<br>`lithium-source`**
| Magento | `magento-library`<br>`magento-skin`<br>`magento-theme`
| Mako | `mako-package`
| Mautic | `mautic-plugin`<br>`mautic-theme`
| Maya | `maya-module`
| MODX Evo | `modxevo-snippet`<br>`modxevo-plugin`<br>`modxevo-module`<br>`modxevo-template`<br>`modxevo-lib`
| MediaWiki | `mediawiki-extension`
| October | **`october-module`<br>`october-plugin`<br>`october-theme`**
| OntoWiki | `ontowiki-extension`<br>`ontowiki-theme`<br>`ontowiki-translation`
| OXID | `oxid-module`<br>`oxid-theme`<br>`oxid-out`
| MODULEWork | `modulework-module`
| Moodle | `moodle-*` (Please [check source](https://raw.githubusercontent.com/composer/installers/master/src/Composer/Installers/MoodleInstaller.php) for all supported types)
| Piwik | `piwik-plugin`
| phpBB | `phpbb-extension`<br>`phpbb-style`<br>`phpbb-language`
| Pimcore | `pimcore-plugin`
| Plentymarkets | `plentymarkets-plugin`
| PPI | **`ppi-module`**
| Puppet | `puppet-module`
| Porto | `porto-container`
| RadPHP | `radphp-bundle`
| REDAXO | `redaxo-addon`
| ReIndex | **`reindex-plugin`** <br> **`reindex-theme`**
| Roundcube | `roundcube-plugin`
| shopware | `shopware-backend-plugin`<br/>`shopware-core-plugin`<br/>`shopware-frontend-plugin`<br/>`shopware-theme`<br/>`shopware-plugin`<br/>`shopware-frontend-theme`
| SilverStripe | `silverstripe-module`<br>`silverstripe-theme`
| SMF | `smf-module`<br>`smf-theme`
| SyDES | `sydes-module`<br>`sydes-theme`
| symfony1 | **`symfony1-plugin`**
| Tusk | `tusk-task`<br>`tusk-command`<br>`tusk-asset`
| TYPO3 Flow | `typo3-flow-package`<br>`typo3-flow-framework`<br>`typo3-flow-plugin`<br>`typo3-flow-site`<br>`typo3-flow-boilerplate`<br>`typo3-flow-build`
| TYPO3 CMS | `typo3-cms-extension` (Deprecated in this package, use the [TYPO3 CMS Installers](https://packagist.org/packages/typo3/cms-composer-installers) instead)
| Vanilla | `vanilla-plugin`<br>`vanilla-theme`
| Vgmcp | `vgmcp-bundle`<br>`vgmcp-theme`
| Wolf CMS | `wolfcms-plugin`
| WordPress | <b>`wordpress-plugin`<br>`wordpress-theme`</b><br>`wordpress-muplugin`
| YAWIK | `yawik-module`
| Zend | `zend-library`<br>`zend-extra`<br>`zend-module`
| Zikula | `zikula-module`<br>`zikula-theme`
| Prestashop | `prestashop-module`<br>`prestashop-theme`
| Phifty | `phifty-bundle`<br>`phifty-framework`<br>`phifty-library`
## Example `composer.json` File
This is an example for a CakePHP plugin. The only important parts to set in your
composer.json file are `"type": "cakephp-plugin"` which describes what your
package is and `"require": { "composer/installers": "~1.0" }` which tells composer
to load the custom installers.
```json
{
"name": "you/ftp",
"type": "cakephp-plugin",
"require": {
"composer/installers": "~1.0"
}
}
```
This would install your package to the `Plugin/Ftp/` folder of a CakePHP app
when a user runs `php composer.phar install`.
So submit your packages to [packagist.org](http://packagist.org)!
## Custom Install Paths
If you are consuming a package that uses the `composer/installers` you can
override the install path with the following extra in your `composer.json`:
```json
{
"extra": {
"installer-paths": {
"your/custom/path/{$name}/": ["shama/ftp", "vendor/package"]
}
}
}
```
A package type can have a custom installation path with a `type:` prefix.
``` json
{
"extra": {
"installer-paths": {
"your/custom/path/{$name}/": ["type:wordpress-plugin"]
}
}
}
```
You can also have the same vendor packages with a custom installation path by
using the `vendor:` prefix.
``` json
{
"extra": {
"installer-paths": {
"your/custom/path/{$name}/": ["vendor:my_organization"]
}
}
}
```
These would use your custom path for each of the listed packages. The available
variables to use in your paths are: `{$name}`, `{$vendor}`, `{$type}`.
## Custom Install Names
If you're a package author and need your package to be named differently when
installed consider using the `installer-name` extra.
For example you have a package named `shama/cakephp-ftp` with the type
`cakephp-plugin`. Installing with `composer/installers` would install to the
path `Plugin/CakephpFtp`. Due to the strict naming conventions, you as a
package author actually need the package to be named and installed to
`Plugin/Ftp`. Using the following config within your **package** `composer.json`
will allow this:
```json
{
"name": "shama/cakephp-ftp",
"type": "cakephp-plugin",
"extra": {
"installer-name": "Ftp"
}
}
```
Please note the name entered into `installer-name` will be the final and will
not be inflected.
## Should we allow dynamic package types or paths? No.
What are they? The ability for a package author to determine where a package
will be installed either through setting the path directly in their
`composer.json` or through a dynamic package type: `"type":
"framework-install-here"`.
It has been proposed many times. Even implemented once early on and then
removed. Installers won't do this because it would allow a single package
author to wipe out entire folders without the user's consent. That user would
then come here to yell at us.
Anyone still wanting this capability should consider requiring https://github.com/oomphinc/composer-installers-extender.

View File

@ -0,0 +1,99 @@
{
"name": "composer/installers",
"type": "composer-plugin",
"license": "MIT",
"description": "A multi-framework Composer library installer",
"keywords": [
"installer",
"Aimeos",
"AGL",
"AnnotateCms",
"Attogram",
"Bitrix",
"CakePHP",
"Chef",
"Cockpit",
"CodeIgniter",
"concrete5",
"Craft",
"Croogo",
"DokuWiki",
"Dolibarr",
"Drupal",
"Elgg",
"Eliasis",
"ExpressionEngine",
"FuelPHP",
"Grav",
"Hurad",
"ImageCMS",
"iTop",
"Joomla",
"Kanboard",
"Kohana",
"Laravel",
"Lavalite",
"Lithium",
"Magento",
"Mako",
"Mautic",
"Maya",
"MODX Evo",
"MediaWiki",
"OXID",
"MODULEWork",
"Moodle",
"Piwik",
"phpBB",
"Plentymarkets",
"PPI",
"Puppet",
"Porto",
"RadPHP",
"ReIndex",
"Roundcube",
"shopware",
"SilverStripe",
"SMF",
"SyDES",
"symfony",
"Thelia",
"TYPO3",
"WolfCMS",
"WordPress",
"YAWIK",
"Zend",
"Zikula"
],
"homepage": "https://composer.github.io/installers/",
"authors": [
{
"name": "Kyle Robinson Young",
"email": "kyle@dontkry.com",
"homepage": "https://github.com/shama"
}
],
"autoload": {
"psr-4": { "Composer\\Installers\\": "src/Composer/Installers" }
},
"extra": {
"class": "Composer\\Installers\\Plugin",
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"replace": {
"shama/baton": "*",
"roundcube/plugin-installer": "*"
},
"require": {
"composer-plugin-api": "^1.0"
},
"require-dev": {
"composer/composer": "1.0.*@dev",
"phpunit/phpunit": "4.1.*"
},
"scripts": {
"test": "phpunit"
}
}

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="tests/bootstrap.php"
>
<testsuites>
<testsuite name="Installers Test Suite">
<directory>tests/Composer/Installers</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>src/Composer/Installers</directory>
</whitelist>
</filter>
</phpunit>

View File

@ -0,0 +1,21 @@
<?php
namespace Composer\Installers;
class AglInstaller extends BaseInstaller
{
protected $locations = array(
'module' => 'More/{$name}/',
);
/**
* Format package name to CamelCase
*/
public function inflectPackageVars($vars)
{
$vars['name'] = preg_replace_callback('/(?:^|_|-)(.?)/', function ($matches) {
return strtoupper($matches[1]);
}, $vars['name']);
return $vars;
}
}

View File

@ -0,0 +1,9 @@
<?php
namespace Composer\Installers;
class AimeosInstaller extends BaseInstaller
{
protected $locations = array(
'extension' => 'ext/{$name}/',
);
}

View File

@ -0,0 +1,11 @@
<?php
namespace Composer\Installers;
class AnnotateCmsInstaller extends BaseInstaller
{
protected $locations = array(
'module' => 'addons/modules/{$name}/',
'component' => 'addons/components/{$name}/',
'service' => 'addons/services/{$name}/',
);
}

View File

@ -0,0 +1,49 @@
<?php
namespace Composer\Installers;
class AsgardInstaller extends BaseInstaller
{
protected $locations = array(
'module' => 'Modules/{$name}/',
'theme' => 'Themes/{$name}/'
);
/**
* Format package name.
*
* For package type asgard-module, cut off a trailing '-plugin' if present.
*
* For package type asgard-theme, cut off a trailing '-theme' if present.
*
*/
public function inflectPackageVars($vars)
{
if ($vars['type'] === 'asgard-module') {
return $this->inflectPluginVars($vars);
}
if ($vars['type'] === 'asgard-theme') {
return $this->inflectThemeVars($vars);
}
return $vars;
}
protected function inflectPluginVars($vars)
{
$vars['name'] = preg_replace('/-module$/', '', $vars['name']);
$vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
$vars['name'] = str_replace(' ', '', ucwords($vars['name']));
return $vars;
}
protected function inflectThemeVars($vars)
{
$vars['name'] = preg_replace('/-theme$/', '', $vars['name']);
$vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
$vars['name'] = str_replace(' ', '', ucwords($vars['name']));
return $vars;
}
}

View File

@ -0,0 +1,9 @@
<?php
namespace Composer\Installers;
class AttogramInstaller extends BaseInstaller
{
protected $locations = array(
'module' => 'modules/{$name}/',
);
}

View File

@ -0,0 +1,136 @@
<?php
namespace Composer\Installers;
use Composer\IO\IOInterface;
use Composer\Composer;
use Composer\Package\PackageInterface;
abstract class BaseInstaller
{
protected $locations = array();
protected $composer;
protected $package;
protected $io;
/**
* Initializes base installer.
*
* @param PackageInterface $package
* @param Composer $composer
* @param IOInterface $io
*/
public function __construct(PackageInterface $package = null, Composer $composer = null, IOInterface $io = null)
{
$this->composer = $composer;
$this->package = $package;
$this->io = $io;
}
/**
* Return the install path based on package type.
*
* @param PackageInterface $package
* @param string $frameworkType
* @return string
*/
public function getInstallPath(PackageInterface $package, $frameworkType = '')
{
$type = $this->package->getType();
$prettyName = $this->package->getPrettyName();
if (strpos($prettyName, '/') !== false) {
list($vendor, $name) = explode('/', $prettyName);
} else {
$vendor = '';
$name = $prettyName;
}
$availableVars = $this->inflectPackageVars(compact('name', 'vendor', 'type'));
$extra = $package->getExtra();
if (!empty($extra['installer-name'])) {
$availableVars['name'] = $extra['installer-name'];
}
if ($this->composer->getPackage()) {
$extra = $this->composer->getPackage()->getExtra();
if (!empty($extra['installer-paths'])) {
$customPath = $this->mapCustomInstallPaths($extra['installer-paths'], $prettyName, $type, $vendor);
if ($customPath !== false) {
return $this->templatePath($customPath, $availableVars);
}
}
}
$packageType = substr($type, strlen($frameworkType) + 1);
$locations = $this->getLocations();
if (!isset($locations[$packageType])) {
throw new \InvalidArgumentException(sprintf('Package type "%s" is not supported', $type));
}
return $this->templatePath($locations[$packageType], $availableVars);
}
/**
* For an installer to override to modify the vars per installer.
*
* @param array $vars
* @return array
*/
public function inflectPackageVars($vars)
{
return $vars;
}
/**
* Gets the installer's locations
*
* @return array
*/
public function getLocations()
{
return $this->locations;
}
/**
* Replace vars in a path
*
* @param string $path
* @param array $vars
* @return string
*/
protected function templatePath($path, array $vars = array())
{
if (strpos($path, '{') !== false) {
extract($vars);
preg_match_all('@\{\$([A-Za-z0-9_]*)\}@i', $path, $matches);
if (!empty($matches[1])) {
foreach ($matches[1] as $var) {
$path = str_replace('{$' . $var . '}', $$var, $path);
}
}
}
return $path;
}
/**
* Search through a passed paths array for a custom install path.
*
* @param array $paths
* @param string $name
* @param string $type
* @param string $vendor = NULL
* @return string
*/
protected function mapCustomInstallPaths(array $paths, $name, $type, $vendor = NULL)
{
foreach ($paths as $path => $names) {
if (in_array($name, $names) || in_array('type:' . $type, $names) || in_array('vendor:' . $vendor, $names)) {
return $path;
}
}
return false;
}
}

View File

@ -0,0 +1,126 @@
<?php
namespace Composer\Installers;
use Composer\Util\Filesystem;
/**
* Installer for Bitrix Framework. Supported types of extensions:
* - `bitrix-d7-module` copy the module to directory `bitrix/modules/<vendor>.<name>`.
* - `bitrix-d7-component` copy the component to directory `bitrix/components/<vendor>/<name>`.
* - `bitrix-d7-template` copy the template to directory `bitrix/templates/<vendor>_<name>`.
*
* You can set custom path to directory with Bitrix kernel in `composer.json`:
*
* ```json
* {
* "extra": {
* "bitrix-dir": "s1/bitrix"
* }
* }
* ```
*
* @author Nik Samokhvalov <nik@samokhvalov.info>
* @author Denis Kulichkin <onexhovia@gmail.com>
*/
class BitrixInstaller extends BaseInstaller
{
protected $locations = array(
'module' => '{$bitrix_dir}/modules/{$name}/', // deprecated, remove on the major release (Backward compatibility will be broken)
'component' => '{$bitrix_dir}/components/{$name}/', // deprecated, remove on the major release (Backward compatibility will be broken)
'theme' => '{$bitrix_dir}/templates/{$name}/', // deprecated, remove on the major release (Backward compatibility will be broken)
'd7-module' => '{$bitrix_dir}/modules/{$vendor}.{$name}/',
'd7-component' => '{$bitrix_dir}/components/{$vendor}/{$name}/',
'd7-template' => '{$bitrix_dir}/templates/{$vendor}_{$name}/',
);
/**
* @var array Storage for informations about duplicates at all the time of installation packages.
*/
private static $checkedDuplicates = array();
/**
* {@inheritdoc}
*/
public function inflectPackageVars($vars)
{
if ($this->composer->getPackage()) {
$extra = $this->composer->getPackage()->getExtra();
if (isset($extra['bitrix-dir'])) {
$vars['bitrix_dir'] = $extra['bitrix-dir'];
}
}
if (!isset($vars['bitrix_dir'])) {
$vars['bitrix_dir'] = 'bitrix';
}
return parent::inflectPackageVars($vars);
}
/**
* {@inheritdoc}
*/
protected function templatePath($path, array $vars = array())
{
$templatePath = parent::templatePath($path, $vars);
$this->checkDuplicates($templatePath, $vars);
return $templatePath;
}
/**
* Duplicates search packages.
*
* @param string $path
* @param array $vars
*/
protected function checkDuplicates($path, array $vars = array())
{
$packageType = substr($vars['type'], strlen('bitrix') + 1);
$localDir = explode('/', $vars['bitrix_dir']);
array_pop($localDir);
$localDir[] = 'local';
$localDir = implode('/', $localDir);
$oldPath = str_replace(
array('{$bitrix_dir}', '{$name}'),
array($localDir, $vars['name']),
$this->locations[$packageType]
);
if (in_array($oldPath, static::$checkedDuplicates)) {
return;
}
if ($oldPath !== $path && file_exists($oldPath) && $this->io && $this->io->isInteractive()) {
$this->io->writeError(' <error>Duplication of packages:</error>');
$this->io->writeError(' <info>Package ' . $oldPath . ' will be called instead package ' . $path . '</info>');
while (true) {
switch ($this->io->ask(' <info>Delete ' . $oldPath . ' [y,n,?]?</info> ', '?')) {
case 'y':
$fs = new Filesystem();
$fs->removeDirectory($oldPath);
break 2;
case 'n':
break 2;
case '?':
default:
$this->io->writeError(array(
' y - delete package ' . $oldPath . ' and to continue with the installation',
' n - don\'t delete and to continue with the installation',
));
$this->io->writeError(' ? - print help');
break;
}
}
}
static::$checkedDuplicates[] = $oldPath;
}
}

View File

@ -0,0 +1,9 @@
<?php
namespace Composer\Installers;
class BonefishInstaller extends BaseInstaller
{
protected $locations = array(
'package' => 'Packages/{$vendor}/{$name}/'
);
}

View File

@ -0,0 +1,83 @@
<?php
namespace Composer\Installers;
use Composer\DependencyResolver\Pool;
use Composer\Package\PackageInterface;
class CakePHPInstaller extends BaseInstaller
{
protected $locations = array(
'plugin' => 'Plugin/{$name}/',
);
/**
* Format package name to CamelCase
*/
public function inflectPackageVars($vars)
{
if ($this->matchesCakeVersion('>=', '3.0.0')) {
return $vars;
}
$nameParts = explode('/', $vars['name']);
foreach ($nameParts as &$value) {
$value = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $value));
$value = str_replace(array('-', '_'), ' ', $value);
$value = str_replace(' ', '', ucwords($value));
}
$vars['name'] = implode('/', $nameParts);
return $vars;
}
/**
* Change the default plugin location when cakephp >= 3.0
*/
public function getLocations()
{
if ($this->matchesCakeVersion('>=', '3.0.0')) {
$this->locations['plugin'] = $this->composer->getConfig()->get('vendor-dir') . '/{$vendor}/{$name}/';
}
return $this->locations;
}
/**
* Check if CakePHP version matches against a version
*
* @param string $matcher
* @param string $version
* @return bool
*/
protected function matchesCakeVersion($matcher, $version)
{
if (class_exists('Composer\Semver\Constraint\MultiConstraint')) {
$multiClass = 'Composer\Semver\Constraint\MultiConstraint';
$constraintClass = 'Composer\Semver\Constraint\Constraint';
} else {
$multiClass = 'Composer\Package\LinkConstraint\MultiConstraint';
$constraintClass = 'Composer\Package\LinkConstraint\VersionConstraint';
}
$repositoryManager = $this->composer->getRepositoryManager();
if ($repositoryManager) {
$repos = $repositoryManager->getLocalRepository();
if (!$repos) {
return false;
}
$cake3 = new $multiClass(array(
new $constraintClass($matcher, $version),
new $constraintClass('!=', '9999999-dev'),
));
$pool = new Pool('dev');
$pool->addRepository($repos);
$packages = $pool->whatProvides('cakephp/cakephp');
foreach ($packages as $package) {
$installed = new $constraintClass('=', $package->getVersion());
if ($cake3->matches($installed)) {
return true;
}
}
}
return false;
}
}

View File

@ -0,0 +1,11 @@
<?php
namespace Composer\Installers;
class ChefInstaller extends BaseInstaller
{
protected $locations = array(
'cookbook' => 'Chef/{$vendor}/{$name}/',
'role' => 'Chef/roles/{$name}/',
);
}

View File

@ -0,0 +1,10 @@
<?php
namespace Composer\Installers;
class ClanCatsFrameworkInstaller extends BaseInstaller
{
protected $locations = array(
'ship' => 'CCF/orbit/{$name}/',
'theme' => 'CCF/app/themes/{$name}/',
);
}

View File

@ -0,0 +1,34 @@
<?php
namespace Composer\Installers;
class CockpitInstaller extends BaseInstaller
{
protected $locations = array(
'module' => 'cockpit/modules/addons/{$name}/',
);
/**
* Format module name.
*
* Strip `module-` prefix from package name.
*
* @param array @vars
*
* @return array
*/
public function inflectPackageVars($vars)
{
if ($vars['type'] == 'cockpit-module') {
return $this->inflectModuleVars($vars);
}
return $vars;
}
public function inflectModuleVars($vars)
{
$vars['name'] = ucfirst(preg_replace('/cockpit-/i', '', $vars['name']));
return $vars;
}
}

View File

@ -0,0 +1,11 @@
<?php
namespace Composer\Installers;
class CodeIgniterInstaller extends BaseInstaller
{
protected $locations = array(
'library' => 'application/libraries/{$name}/',
'third-party' => 'application/third_party/{$name}/',
'module' => 'application/modules/{$name}/',
);
}

View File

@ -0,0 +1,13 @@
<?php
namespace Composer\Installers;
class Concrete5Installer extends BaseInstaller
{
protected $locations = array(
'core' => 'concrete/',
'block' => 'application/blocks/{$name}/',
'package' => 'packages/{$name}/',
'theme' => 'application/themes/{$name}/',
'update' => 'updates/{$name}/',
);
}

View File

@ -0,0 +1,35 @@
<?php
namespace Composer\Installers;
/**
* Installer for Craft Plugins
*/
class CraftInstaller extends BaseInstaller
{
const NAME_PREFIX = 'craft';
const NAME_SUFFIX = 'plugin';
protected $locations = array(
'plugin' => 'craft/plugins/{$name}/',
);
/**
* Strip `craft-` prefix and/or `-plugin` suffix from package names
*
* @param array $vars
*
* @return array
*/
final public function inflectPackageVars($vars)
{
return $this->inflectPluginVars($vars);
}
private function inflectPluginVars($vars)
{
$vars['name'] = preg_replace('/-' . self::NAME_SUFFIX . '$/i', '', $vars['name']);
$vars['name'] = preg_replace('/^' . self::NAME_PREFIX . '-/i', '', $vars['name']);
return $vars;
}
}

View File

@ -0,0 +1,21 @@
<?php
namespace Composer\Installers;
class CroogoInstaller extends BaseInstaller
{
protected $locations = array(
'plugin' => 'Plugin/{$name}/',
'theme' => 'View/Themed/{$name}/',
);
/**
* Format package name to CamelCase
*/
public function inflectPackageVars($vars)
{
$vars['name'] = strtolower(str_replace(array('-', '_'), ' ', $vars['name']));
$vars['name'] = str_replace(' ', '', ucwords($vars['name']));
return $vars;
}
}

View File

@ -0,0 +1,10 @@
<?php
namespace Composer\Installers;
class DecibelInstaller extends BaseInstaller
{
/** @var array */
protected $locations = array(
'app' => 'app/{$name}/',
);
}

View File

@ -0,0 +1,50 @@
<?php
namespace Composer\Installers;
class DokuWikiInstaller extends BaseInstaller
{
protected $locations = array(
'plugin' => 'lib/plugins/{$name}/',
'template' => 'lib/tpl/{$name}/',
);
/**
* Format package name.
*
* For package type dokuwiki-plugin, cut off a trailing '-plugin',
* or leading dokuwiki_ if present.
*
* For package type dokuwiki-template, cut off a trailing '-template' if present.
*
*/
public function inflectPackageVars($vars)
{
if ($vars['type'] === 'dokuwiki-plugin') {
return $this->inflectPluginVars($vars);
}
if ($vars['type'] === 'dokuwiki-template') {
return $this->inflectTemplateVars($vars);
}
return $vars;
}
protected function inflectPluginVars($vars)
{
$vars['name'] = preg_replace('/-plugin$/', '', $vars['name']);
$vars['name'] = preg_replace('/^dokuwiki_?-?/', '', $vars['name']);
return $vars;
}
protected function inflectTemplateVars($vars)
{
$vars['name'] = preg_replace('/-template$/', '', $vars['name']);
$vars['name'] = preg_replace('/^dokuwiki_?-?/', '', $vars['name']);
return $vars;
}
}

View File

@ -0,0 +1,16 @@
<?php
namespace Composer\Installers;
/**
* Class DolibarrInstaller
*
* @package Composer\Installers
* @author Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
*/
class DolibarrInstaller extends BaseInstaller
{
//TODO: Add support for scripts and themes
protected $locations = array(
'module' => 'htdocs/custom/{$name}/',
);
}

View File

@ -0,0 +1,16 @@
<?php
namespace Composer\Installers;
class DrupalInstaller extends BaseInstaller
{
protected $locations = array(
'core' => 'core/',
'module' => 'modules/{$name}/',
'theme' => 'themes/{$name}/',
'library' => 'libraries/{$name}/',
'profile' => 'profiles/{$name}/',
'drush' => 'drush/{$name}/',
'custom-theme' => 'themes/custom/{$name}/',
'custom-module' => 'modules/custom/{$name}',
);
}

View File

@ -0,0 +1,9 @@
<?php
namespace Composer\Installers;
class ElggInstaller extends BaseInstaller
{
protected $locations = array(
'plugin' => 'mod/{$name}/',
);
}

View File

@ -0,0 +1,9 @@
<?php
namespace Composer\Installers;
class EliasisInstaller extends BaseInstaller
{
protected $locations = array(
'module' => 'modules/{$name}/'
);
}

View File

@ -0,0 +1,29 @@
<?php
namespace Composer\Installers;
use Composer\Package\PackageInterface;
class ExpressionEngineInstaller extends BaseInstaller
{
protected $locations = array();
private $ee2Locations = array(
'addon' => 'system/expressionengine/third_party/{$name}/',
'theme' => 'themes/third_party/{$name}/',
);
private $ee3Locations = array(
'addon' => 'system/user/addons/{$name}/',
'theme' => 'themes/user/{$name}/',
);
public function getInstallPath(PackageInterface $package, $frameworkType = '')
{
$version = "{$frameworkType}Locations";
$this->locations = $this->$version;
return parent::getInstallPath($package, $frameworkType);
}
}

View File

@ -0,0 +1,11 @@
<?php
namespace Composer\Installers;
class FuelInstaller extends BaseInstaller
{
protected $locations = array(
'module' => 'fuel/app/modules/{$name}/',
'package' => 'fuel/packages/{$name}/',
'theme' => 'fuel/app/themes/{$name}/',
);
}

View File

@ -0,0 +1,9 @@
<?php
namespace Composer\Installers;
class FuelphpInstaller extends BaseInstaller
{
protected $locations = array(
'component' => 'components/{$name}/',
);
}

View File

@ -0,0 +1,30 @@
<?php
namespace Composer\Installers;
class GravInstaller extends BaseInstaller
{
protected $locations = array(
'plugin' => 'user/plugins/{$name}/',
'theme' => 'user/themes/{$name}/',
);
/**
* Format package name
*
* @param array $vars
*
* @return array
*/
public function inflectPackageVars($vars)
{
$restrictedWords = implode('|', array_keys($this->locations));
$vars['name'] = strtolower($vars['name']);
$vars['name'] = preg_replace('/^(?:grav-)?(?:(?:'.$restrictedWords.')-)?(.*?)(?:-(?:'.$restrictedWords.'))?$/ui',
'$1',
$vars['name']
);
return $vars;
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace Composer\Installers;
class HuradInstaller extends BaseInstaller
{
protected $locations = array(
'plugin' => 'plugins/{$name}/',
'theme' => 'plugins/{$name}/',
);
/**
* Format package name to CamelCase
*/
public function inflectPackageVars($vars)
{
$nameParts = explode('/', $vars['name']);
foreach ($nameParts as &$value) {
$value = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $value));
$value = str_replace(array('-', '_'), ' ', $value);
$value = str_replace(' ', '', ucwords($value));
}
$vars['name'] = implode('/', $nameParts);
return $vars;
}
}

View File

@ -0,0 +1,11 @@
<?php
namespace Composer\Installers;
class ImageCMSInstaller extends BaseInstaller
{
protected $locations = array(
'template' => 'templates/{$name}/',
'module' => 'application/modules/{$name}/',
'library' => 'application/libraries/{$name}/',
);
}

View File

@ -0,0 +1,197 @@
<?php
namespace Composer\Installers;
use Composer\IO\IOInterface;
use Composer\Installer\LibraryInstaller;
use Composer\Package\PackageInterface;
use Composer\Repository\InstalledRepositoryInterface;
class Installer extends LibraryInstaller
{
/**
* Package types to installer class map
*
* @var array
*/
private $supportedTypes = array(
'aimeos' => 'AimeosInstaller',
'asgard' => 'AsgardInstaller',
'attogram' => 'AttogramInstaller',
'agl' => 'AglInstaller',
'annotatecms' => 'AnnotateCmsInstaller',
'bitrix' => 'BitrixInstaller',
'bonefish' => 'BonefishInstaller',
'cakephp' => 'CakePHPInstaller',
'chef' => 'ChefInstaller',
'ccframework' => 'ClanCatsFrameworkInstaller',
'cockpit' => 'CockpitInstaller',
'codeigniter' => 'CodeIgniterInstaller',
'concrete5' => 'Concrete5Installer',
'craft' => 'CraftInstaller',
'croogo' => 'CroogoInstaller',
'dokuwiki' => 'DokuWikiInstaller',
'dolibarr' => 'DolibarrInstaller',
'decibel' => 'DecibelInstaller',
'drupal' => 'DrupalInstaller',
'elgg' => 'ElggInstaller',
'eliasis' => 'EliasisInstaller',
'ee3' => 'ExpressionEngineInstaller',
'ee2' => 'ExpressionEngineInstaller',
'fuel' => 'FuelInstaller',
'fuelphp' => 'FuelphpInstaller',
'grav' => 'GravInstaller',
'hurad' => 'HuradInstaller',
'imagecms' => 'ImageCMSInstaller',
'itop' => 'ItopInstaller',
'joomla' => 'JoomlaInstaller',
'kanboard' => 'KanboardInstaller',
'kirby' => 'KirbyInstaller',
'kodicms' => 'KodiCMSInstaller',
'kohana' => 'KohanaInstaller',
'laravel' => 'LaravelInstaller',
'lavalite' => 'LavaLiteInstaller',
'lithium' => 'LithiumInstaller',
'magento' => 'MagentoInstaller',
'mako' => 'MakoInstaller',
'maya' => 'MayaInstaller',
'mautic' => 'MauticInstaller',
'mediawiki' => 'MediaWikiInstaller',
'microweber' => 'MicroweberInstaller',
'modulework' => 'MODULEWorkInstaller',
'modxevo' => 'MODXEvoInstaller',
'moodle' => 'MoodleInstaller',
'october' => 'OctoberInstaller',
'ontowiki' => 'OntoWikiInstaller',
'oxid' => 'OxidInstaller',
'phpbb' => 'PhpBBInstaller',
'pimcore' => 'PimcoreInstaller',
'piwik' => 'PiwikInstaller',
'plentymarkets'=> 'PlentymarketsInstaller',
'ppi' => 'PPIInstaller',
'puppet' => 'PuppetInstaller',
'radphp' => 'RadPHPInstaller',
'phifty' => 'PhiftyInstaller',
'porto' => 'PortoInstaller',
'redaxo' => 'RedaxoInstaller',
'reindex' => 'ReIndexInstaller',
'roundcube' => 'RoundcubeInstaller',
'shopware' => 'ShopwareInstaller',
'silverstripe' => 'SilverStripeInstaller',
'smf' => 'SMFInstaller',
'sydes' => 'SyDESInstaller',
'symfony1' => 'Symfony1Installer',
'thelia' => 'TheliaInstaller',
'tusk' => 'TuskInstaller',
'typo3-cms' => 'TYPO3CmsInstaller',
'typo3-flow' => 'TYPO3FlowInstaller',
'vanilla' => 'VanillaInstaller',
'whmcs' => 'WHMCSInstaller',
'wolfcms' => 'WolfCMSInstaller',
'wordpress' => 'WordPressInstaller',
'yawik' => 'YawikInstaller',
'zend' => 'ZendInstaller',
'zikula' => 'ZikulaInstaller',
'prestashop' => 'PrestashopInstaller'
);
/**
* {@inheritDoc}
*/
public function getInstallPath(PackageInterface $package)
{
$type = $package->getType();
$frameworkType = $this->findFrameworkType($type);
if ($frameworkType === false) {
throw new \InvalidArgumentException(
'Sorry the package type of this package is not yet supported.'
);
}
$class = 'Composer\\Installers\\' . $this->supportedTypes[$frameworkType];
$installer = new $class($package, $this->composer, $this->getIO());
return $installer->getInstallPath($package, $frameworkType);
}
public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
{
if (!$repo->hasPackage($package)) {
throw new \InvalidArgumentException('Package is not installed: '.$package);
}
$repo->removePackage($package);
$installPath = $this->getInstallPath($package);
$this->io->write(sprintf('Deleting %s - %s', $installPath, $this->filesystem->removeDirectory($installPath) ? '<comment>deleted</comment>' : '<error>not deleted</error>'));
}
/**
* {@inheritDoc}
*/
public function supports($packageType)
{
$frameworkType = $this->findFrameworkType($packageType);
if ($frameworkType === false) {
return false;
}
$locationPattern = $this->getLocationPattern($frameworkType);
return preg_match('#' . $frameworkType . '-' . $locationPattern . '#', $packageType, $matches) === 1;
}
/**
* Finds a supported framework type if it exists and returns it
*
* @param string $type
* @return string
*/
protected function findFrameworkType($type)
{
$frameworkType = false;
krsort($this->supportedTypes);
foreach ($this->supportedTypes as $key => $val) {
if ($key === substr($type, 0, strlen($key))) {
$frameworkType = substr($type, 0, strlen($key));
break;
}
}
return $frameworkType;
}
/**
* Get the second part of the regular expression to check for support of a
* package type
*
* @param string $frameworkType
* @return string
*/
protected function getLocationPattern($frameworkType)
{
$pattern = false;
if (!empty($this->supportedTypes[$frameworkType])) {
$frameworkClass = 'Composer\\Installers\\' . $this->supportedTypes[$frameworkType];
/** @var BaseInstaller $framework */
$framework = new $frameworkClass(null, $this->composer, $this->getIO());
$locations = array_keys($framework->getLocations());
$pattern = $locations ? '(' . implode('|', $locations) . ')' : false;
}
return $pattern ? : '(\w+)';
}
/**
* Get I/O object
*
* @return IOInterface
*/
private function getIO()
{
return $this->io;
}
}

View File

@ -0,0 +1,9 @@
<?php
namespace Composer\Installers;
class ItopInstaller extends BaseInstaller
{
protected $locations = array(
'extension' => 'extensions/{$name}/',
);
}

View File

@ -0,0 +1,15 @@
<?php
namespace Composer\Installers;
class JoomlaInstaller extends BaseInstaller
{
protected $locations = array(
'component' => 'components/{$name}/',
'module' => 'modules/{$name}/',
'template' => 'templates/{$name}/',
'plugin' => 'plugins/{$name}/',
'library' => 'libraries/{$name}/',
);
// TODO: Add inflector for mod_ and com_ names
}

View File

@ -0,0 +1,18 @@
<?php
namespace Composer\Installers;
/**
*
* Installer for kanboard plugins
*
* kanboard.net
*
* Class KanboardInstaller
* @package Composer\Installers
*/
class KanboardInstaller extends BaseInstaller
{
protected $locations = array(
'plugin' => 'plugins/{$name}/',
);
}

View File

@ -0,0 +1,11 @@
<?php
namespace Composer\Installers;
class KirbyInstaller extends BaseInstaller
{
protected $locations = array(
'plugin' => 'site/plugins/{$name}/',
'field' => 'site/fields/{$name}/',
'tag' => 'site/tags/{$name}/'
);
}

View File

@ -0,0 +1,10 @@
<?php
namespace Composer\Installers;
class KodiCMSInstaller extends BaseInstaller
{
protected $locations = array(
'plugin' => 'cms/plugins/{$name}/',
'media' => 'cms/media/vendor/{$name}/'
);
}

View File

@ -0,0 +1,9 @@
<?php
namespace Composer\Installers;
class KohanaInstaller extends BaseInstaller
{
protected $locations = array(
'module' => 'modules/{$name}/',
);
}

View File

@ -0,0 +1,9 @@
<?php
namespace Composer\Installers;
class LaravelInstaller extends BaseInstaller
{
protected $locations = array(
'library' => 'libraries/{$name}/',
);
}

View File

@ -0,0 +1,10 @@
<?php
namespace Composer\Installers;
class LavaLiteInstaller extends BaseInstaller
{
protected $locations = array(
'package' => 'packages/{$name}/',
'theme' => 'public/themes/{$name}/',
);
}

View File

@ -0,0 +1,10 @@
<?php
namespace Composer\Installers;
class LithiumInstaller extends BaseInstaller
{
protected $locations = array(
'library' => 'libraries/{$name}/',
'source' => 'libraries/_source/{$name}/',
);
}

View File

@ -0,0 +1,9 @@
<?php
namespace Composer\Installers;
class MODULEWorkInstaller extends BaseInstaller
{
protected $locations = array(
'module' => 'modules/{$name}/',
);
}

View File

@ -0,0 +1,16 @@
<?php
namespace Composer\Installers;
/**
* An installer to handle MODX Evolution specifics when installing packages.
*/
class MODXEvoInstaller extends BaseInstaller
{
protected $locations = array(
'snippet' => 'assets/snippets/{$name}/',
'plugin' => 'assets/plugins/{$name}/',
'module' => 'assets/modules/{$name}/',
'template' => 'assets/templates/{$name}/',
'lib' => 'assets/lib/{$name}/'
);
}

View File

@ -0,0 +1,11 @@
<?php
namespace Composer\Installers;
class MagentoInstaller extends BaseInstaller
{
protected $locations = array(
'theme' => 'app/design/frontend/{$name}/',
'skin' => 'skin/frontend/default/{$name}/',
'library' => 'lib/{$name}/',
);
}

View File

@ -0,0 +1,9 @@
<?php
namespace Composer\Installers;
class MakoInstaller extends BaseInstaller
{
protected $locations = array(
'package' => 'app/packages/{$name}/',
);
}

View File

@ -0,0 +1,25 @@
<?php
namespace Composer\Installers;
class MauticInstaller extends BaseInstaller
{
protected $locations = array(
'plugin' => 'plugins/{$name}/',
'theme' => 'themes/{$name}/',
);
/**
* Format package name of mautic-plugins to CamelCase
*/
public function inflectPackageVars($vars)
{
if ($vars['type'] == 'mautic-plugin') {
$vars['name'] = preg_replace_callback('/(-[a-z])/', function ($matches) {
return strtoupper($matches[0][1]);
}, ucfirst($vars['name']));
}
return $vars;
}
}

View File

@ -0,0 +1,33 @@
<?php
namespace Composer\Installers;
class MayaInstaller extends BaseInstaller
{
protected $locations = array(
'module' => 'modules/{$name}/',
);
/**
* Format package name.
*
* For package type maya-module, cut off a trailing '-module' if present.
*
*/
public function inflectPackageVars($vars)
{
if ($vars['type'] === 'maya-module') {
return $this->inflectModuleVars($vars);
}
return $vars;
}
protected function inflectModuleVars($vars)
{
$vars['name'] = preg_replace('/-module$/', '', $vars['name']);
$vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
$vars['name'] = str_replace(' ', '', ucwords($vars['name']));
return $vars;
}
}

View File

@ -0,0 +1,50 @@
<?php
namespace Composer\Installers;
class MediaWikiInstaller extends BaseInstaller
{
protected $locations = array(
'extension' => 'extensions/{$name}/',
'skin' => 'skins/{$name}/',
);
/**
* Format package name.
*
* For package type mediawiki-extension, cut off a trailing '-extension' if present and transform
* to CamelCase keeping existing uppercase chars.
*
* For package type mediawiki-skin, cut off a trailing '-skin' if present.
*
*/
public function inflectPackageVars($vars)
{
if ($vars['type'] === 'mediawiki-extension') {
return $this->inflectExtensionVars($vars);
}
if ($vars['type'] === 'mediawiki-skin') {
return $this->inflectSkinVars($vars);
}
return $vars;
}
protected function inflectExtensionVars($vars)
{
$vars['name'] = preg_replace('/-extension$/', '', $vars['name']);
$vars['name'] = str_replace('-', ' ', $vars['name']);
$vars['name'] = str_replace(' ', '', ucwords($vars['name']));
return $vars;
}
protected function inflectSkinVars($vars)
{
$vars['name'] = preg_replace('/-skin$/', '', $vars['name']);
return $vars;
}
}

View File

@ -0,0 +1,111 @@
<?php
namespace Composer\Installers;
class MicroweberInstaller extends BaseInstaller
{
protected $locations = array(
'module' => 'userfiles/modules/{$name}/',
'module-skin' => 'userfiles/modules/{$name}/templates/',
'template' => 'userfiles/templates/{$name}/',
'element' => 'userfiles/elements/{$name}/',
'vendor' => 'vendor/{$name}/',
'components' => 'components/{$name}/'
);
/**
* Format package name.
*
* For package type microweber-module, cut off a trailing '-module' if present
*
* For package type microweber-template, cut off a trailing '-template' if present.
*
*/
public function inflectPackageVars($vars)
{
if ($vars['type'] === 'microweber-template') {
return $this->inflectTemplateVars($vars);
}
if ($vars['type'] === 'microweber-templates') {
return $this->inflectTemplatesVars($vars);
}
if ($vars['type'] === 'microweber-core') {
return $this->inflectCoreVars($vars);
}
if ($vars['type'] === 'microweber-adapter') {
return $this->inflectCoreVars($vars);
}
if ($vars['type'] === 'microweber-module') {
return $this->inflectModuleVars($vars);
}
if ($vars['type'] === 'microweber-modules') {
return $this->inflectModulesVars($vars);
}
if ($vars['type'] === 'microweber-skin') {
return $this->inflectSkinVars($vars);
}
if ($vars['type'] === 'microweber-element' or $vars['type'] === 'microweber-elements') {
return $this->inflectElementVars($vars);
}
return $vars;
}
protected function inflectTemplateVars($vars)
{
$vars['name'] = preg_replace('/-template$/', '', $vars['name']);
$vars['name'] = preg_replace('/template-$/', '', $vars['name']);
return $vars;
}
protected function inflectTemplatesVars($vars)
{
$vars['name'] = preg_replace('/-templates$/', '', $vars['name']);
$vars['name'] = preg_replace('/templates-$/', '', $vars['name']);
return $vars;
}
protected function inflectCoreVars($vars)
{
$vars['name'] = preg_replace('/-providers$/', '', $vars['name']);
$vars['name'] = preg_replace('/-provider$/', '', $vars['name']);
$vars['name'] = preg_replace('/-adapter$/', '', $vars['name']);
return $vars;
}
protected function inflectModuleVars($vars)
{
$vars['name'] = preg_replace('/-module$/', '', $vars['name']);
$vars['name'] = preg_replace('/module-$/', '', $vars['name']);
return $vars;
}
protected function inflectModulesVars($vars)
{
$vars['name'] = preg_replace('/-modules$/', '', $vars['name']);
$vars['name'] = preg_replace('/modules-$/', '', $vars['name']);
return $vars;
}
protected function inflectSkinVars($vars)
{
$vars['name'] = preg_replace('/-skin$/', '', $vars['name']);
$vars['name'] = preg_replace('/skin-$/', '', $vars['name']);
return $vars;
}
protected function inflectElementVars($vars)
{
$vars['name'] = preg_replace('/-elements$/', '', $vars['name']);
$vars['name'] = preg_replace('/elements-$/', '', $vars['name']);
$vars['name'] = preg_replace('/-element$/', '', $vars['name']);
$vars['name'] = preg_replace('/element-$/', '', $vars['name']);
return $vars;
}
}

View File

@ -0,0 +1,57 @@
<?php
namespace Composer\Installers;
class MoodleInstaller extends BaseInstaller
{
protected $locations = array(
'mod' => 'mod/{$name}/',
'admin_report' => 'admin/report/{$name}/',
'atto' => 'lib/editor/atto/plugins/{$name}/',
'tool' => 'admin/tool/{$name}/',
'assignment' => 'mod/assignment/type/{$name}/',
'assignsubmission' => 'mod/assign/submission/{$name}/',
'assignfeedback' => 'mod/assign/feedback/{$name}/',
'auth' => 'auth/{$name}/',
'availability' => 'availability/condition/{$name}/',
'block' => 'blocks/{$name}/',
'booktool' => 'mod/book/tool/{$name}/',
'cachestore' => 'cache/stores/{$name}/',
'cachelock' => 'cache/locks/{$name}/',
'calendartype' => 'calendar/type/{$name}/',
'format' => 'course/format/{$name}/',
'coursereport' => 'course/report/{$name}/',
'datafield' => 'mod/data/field/{$name}/',
'datapreset' => 'mod/data/preset/{$name}/',
'editor' => 'lib/editor/{$name}/',
'enrol' => 'enrol/{$name}/',
'filter' => 'filter/{$name}/',
'gradeexport' => 'grade/export/{$name}/',
'gradeimport' => 'grade/import/{$name}/',
'gradereport' => 'grade/report/{$name}/',
'gradingform' => 'grade/grading/form/{$name}/',
'local' => 'local/{$name}/',
'logstore' => 'admin/tool/log/store/{$name}/',
'ltisource' => 'mod/lti/source/{$name}/',
'ltiservice' => 'mod/lti/service/{$name}/',
'message' => 'message/output/{$name}/',
'mnetservice' => 'mnet/service/{$name}/',
'plagiarism' => 'plagiarism/{$name}/',
'portfolio' => 'portfolio/{$name}/',
'qbehaviour' => 'question/behaviour/{$name}/',
'qformat' => 'question/format/{$name}/',
'qtype' => 'question/type/{$name}/',
'quizaccess' => 'mod/quiz/accessrule/{$name}/',
'quiz' => 'mod/quiz/report/{$name}/',
'report' => 'report/{$name}/',
'repository' => 'repository/{$name}/',
'scormreport' => 'mod/scorm/report/{$name}/',
'search' => 'search/engine/{$name}/',
'theme' => 'theme/{$name}/',
'tinymce' => 'lib/editor/tinymce/plugins/{$name}/',
'profilefield' => 'user/profile/field/{$name}/',
'webservice' => 'webservice/{$name}/',
'workshopallocation' => 'mod/workshop/allocation/{$name}/',
'workshopeval' => 'mod/workshop/eval/{$name}/',
'workshopform' => 'mod/workshop/form/{$name}/'
);
}

View File

@ -0,0 +1,46 @@
<?php
namespace Composer\Installers;
class OctoberInstaller extends BaseInstaller
{
protected $locations = array(
'module' => 'modules/{$name}/',
'plugin' => 'plugins/{$vendor}/{$name}/',
'theme' => 'themes/{$name}/'
);
/**
* Format package name.
*
* For package type october-plugin, cut off a trailing '-plugin' if present.
*
* For package type october-theme, cut off a trailing '-theme' if present.
*
*/
public function inflectPackageVars($vars)
{
if ($vars['type'] === 'october-plugin') {
return $this->inflectPluginVars($vars);
}
if ($vars['type'] === 'october-theme') {
return $this->inflectThemeVars($vars);
}
return $vars;
}
protected function inflectPluginVars($vars)
{
$vars['name'] = preg_replace('/-plugin$/', '', $vars['name']);
return $vars;
}
protected function inflectThemeVars($vars)
{
$vars['name'] = preg_replace('/-theme$/', '', $vars['name']);
return $vars;
}
}

View File

@ -0,0 +1,24 @@
<?php
namespace Composer\Installers;
class OntoWikiInstaller extends BaseInstaller
{
protected $locations = array(
'extension' => 'extensions/{$name}/',
'theme' => 'extensions/themes/{$name}/',
'translation' => 'extensions/translations/{$name}/',
);
/**
* Format package name to lower case and remove ".ontowiki" suffix
*/
public function inflectPackageVars($vars)
{
$vars['name'] = strtolower($vars['name']);
$vars['name'] = preg_replace('/.ontowiki$/', '', $vars['name']);
$vars['name'] = preg_replace('/-theme$/', '', $vars['name']);
$vars['name'] = preg_replace('/-translation$/', '', $vars['name']);
return $vars;
}
}

View File

@ -0,0 +1,59 @@
<?php
namespace Composer\Installers;
use Composer\Package\PackageInterface;
class OxidInstaller extends BaseInstaller
{
const VENDOR_PATTERN = '/^modules\/(?P<vendor>.+)\/.+/';
protected $locations = array(
'module' => 'modules/{$name}/',
'theme' => 'application/views/{$name}/',
'out' => 'out/{$name}/',
);
/**
* getInstallPath
*
* @param PackageInterface $package
* @param string $frameworkType
* @return void
*/
public function getInstallPath(PackageInterface $package, $frameworkType = '')
{
$installPath = parent::getInstallPath($package, $frameworkType);
$type = $this->package->getType();
if ($type === 'oxid-module') {
$this->prepareVendorDirectory($installPath);
}
return $installPath;
}
/**
* prepareVendorDirectory
*
* Makes sure there is a vendormetadata.php file inside
* the vendor folder if there is a vendor folder.
*
* @param string $installPath
* @return void
*/
protected function prepareVendorDirectory($installPath)
{
$matches = '';
$hasVendorDirectory = preg_match(self::VENDOR_PATTERN, $installPath, $matches);
if (!$hasVendorDirectory) {
return;
}
$vendorDirectory = $matches['vendor'];
$vendorPath = getcwd() . '/modules/' . $vendorDirectory;
if (!file_exists($vendorPath)) {
mkdir($vendorPath, 0755, true);
}
$vendorMetaDataPath = $vendorPath . '/vendormetadata.php';
touch($vendorMetaDataPath);
}
}

View File

@ -0,0 +1,9 @@
<?php
namespace Composer\Installers;
class PPIInstaller extends BaseInstaller
{
protected $locations = array(
'module' => 'modules/{$name}/',
);
}

View File

@ -0,0 +1,11 @@
<?php
namespace Composer\Installers;
class PhiftyInstaller extends BaseInstaller
{
protected $locations = array(
'bundle' => 'bundles/{$name}/',
'library' => 'libraries/{$name}/',
'framework' => 'frameworks/{$name}/',
);
}

View File

@ -0,0 +1,11 @@
<?php
namespace Composer\Installers;
class PhpBBInstaller extends BaseInstaller
{
protected $locations = array(
'extension' => 'ext/{$vendor}/{$name}/',
'language' => 'language/{$name}/',
'style' => 'styles/{$name}/',
);
}

View File

@ -0,0 +1,21 @@
<?php
namespace Composer\Installers;
class PimcoreInstaller extends BaseInstaller
{
protected $locations = array(
'plugin' => 'plugins/{$name}/',
);
/**
* Format package name to CamelCase
*/
public function inflectPackageVars($vars)
{
$vars['name'] = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $vars['name']));
$vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
$vars['name'] = str_replace(' ', '', ucwords($vars['name']));
return $vars;
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace Composer\Installers;
/**
* Class PiwikInstaller
*
* @package Composer\Installers
*/
class PiwikInstaller extends BaseInstaller
{
/**
* @var array
*/
protected $locations = array(
'plugin' => 'plugins/{$name}/',
);
/**
* Format package name to CamelCase
* @param array $vars
*
* @return array
*/
public function inflectPackageVars($vars)
{
$vars['name'] = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $vars['name']));
$vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
$vars['name'] = str_replace(' ', '', ucwords($vars['name']));
return $vars;
}
}

View File

@ -0,0 +1,29 @@
<?php
namespace Composer\Installers;
class PlentymarketsInstaller extends BaseInstaller
{
protected $locations = array(
'plugin' => '{$name}/'
);
/**
* Remove hyphen, "plugin" and format to camelcase
* @param array $vars
*
* @return array
*/
public function inflectPackageVars($vars)
{
$vars['name'] = explode("-", $vars['name']);
foreach ($vars['name'] as $key => $name) {
$vars['name'][$key] = ucfirst($vars['name'][$key]);
if (strcasecmp($name, "Plugin") == 0) {
unset($vars['name'][$key]);
}
}
$vars['name'] = implode("",$vars['name']);
return $vars;
}
}

View File

@ -0,0 +1,17 @@
<?php
namespace Composer\Installers;
use Composer\Composer;
use Composer\IO\IOInterface;
use Composer\Plugin\PluginInterface;
class Plugin implements PluginInterface
{
public function activate(Composer $composer, IOInterface $io)
{
$installer = new Installer($io, $composer);
$composer->getInstallationManager()->addInstaller($installer);
}
}

View File

@ -0,0 +1,9 @@
<?php
namespace Composer\Installers;
class PortoInstaller extends BaseInstaller
{
protected $locations = array(
'container' => 'app/Containers/{$name}/',
);
}

View File

@ -0,0 +1,10 @@
<?php
namespace Composer\Installers;
class PrestashopInstaller extends BaseInstaller
{
protected $locations = array(
'module' => 'modules/{$name}/',
'theme' => 'themes/{$name}/',
);
}

View File

@ -0,0 +1,11 @@
<?php
namespace Composer\Installers;
class PuppetInstaller extends BaseInstaller
{
protected $locations = array(
'module' => 'modules/{$name}/',
);
}

View File

@ -0,0 +1,24 @@
<?php
namespace Composer\Installers;
class RadPHPInstaller extends BaseInstaller
{
protected $locations = array(
'bundle' => 'src/{$name}/'
);
/**
* Format package name to CamelCase
*/
public function inflectPackageVars($vars)
{
$nameParts = explode('/', $vars['name']);
foreach ($nameParts as &$value) {
$value = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $value));
$value = str_replace(array('-', '_'), ' ', $value);
$value = str_replace(' ', '', ucwords($value));
}
$vars['name'] = implode('/', $nameParts);
return $vars;
}
}

Some files were not shown because too many files have changed in this diff Show More