Updated the dependencies to use Zf3 components, fixed the FO and Core loading paths and updated the configuration.

pull/202/head
Ruslan Baidan 2019-09-04 20:40:41 +02:00
parent 98c4f33e7a
commit 73357c3551
No known key found for this signature in database
GPG Key ID: 4B7724C136BF1D89
9 changed files with 89 additions and 124 deletions

5
.gitignore vendored
View File

@ -23,8 +23,5 @@ module/
npm-debug.log npm-debug.log
node_modules/ node_modules/
bin/ bin/
data/DoctrineORMModule/ data/*
data/monarc/
data/json/
go-pear.phar
scripts/public/ scripts/public/

3
.gitmodules vendored
View File

@ -1,3 +0,0 @@
[submodule "vendor/ZF2"]
path = vendor/ZF2
url = https://github.com/zendframework/zf2.git

View File

@ -1,6 +1,6 @@
{ {
"name": "monarc/skeleton", "name": "monarc/monarc",
"description": "Skeleton for Monarc project", "description": "Monarc application",
"authors": [ "authors": [
{"name": "Cyril Rouyer", "email": "cyril@netlor.fr"}, {"name": "Cyril Rouyer", "email": "cyril@netlor.fr"},
{"name": "Guillaume Lesniak", "email": "guillaume@netlor.fr"}, {"name": "Guillaume Lesniak", "email": "guillaume@netlor.fr"},
@ -12,29 +12,22 @@
{"name": "Cédric Bonhomme", "email": "cedric.bonhomme@cases.lu"} {"name": "Cédric Bonhomme", "email": "cedric.bonhomme@cases.lu"}
], ],
"require": { "require": {
"php": ">=5.5", "php": "^7.1",
"zendframework/zendframework": "2.5.3", "ext-json": "*",
"doctrine/doctrine-orm-module": "^0.10", "ext-pdo": "*",
"robmorgan/phinx": "0.5.*", "monarc/core": "dev-feature/upgrade-to-zf3",
"monarc/core": "dev-master", "monarc/frontoffice": "dev-feature/upgrade-to-zf3",
"monarc/frontoffice": "dev-master",
"phing/phing": "~2.0",
"phpoffice/phpword": "dev-stable", "phpoffice/phpword": "dev-stable",
"ramsey/uuid": "^3.8", "zendframework/zend-component-installer": "^2.1",
"ramsey/uuid-doctrine": "^1.5" "zendframework/zend-mvc": "^3.1",
"zendframework/zend-di": "^3.1",
"zendframework/zend-permissions-rbac": "^3.0",
"zendframework/zend-log": "^2.11"
}, },
"config": { "config": {
"bin-dir": "bin/" "bin-dir": "bin/"
}, },
"repositories": [ "repositories": [
{
"type": "vcs",
"url": "https://github.com/monarc-project/zm-core"
},
{
"type": "vcs",
"url": "https://github.com/monarc-project/zm-client"
},
{ {
"type": "vcs", "type": "vcs",
"url": "https://github.com/monarc-project/monarc_phpword" "url": "https://github.com/monarc-project/monarc_phpword"

Binary file not shown.

View File

@ -5,37 +5,48 @@
* *
* @see https://github.com/zendframework/ZFTool * @see https://github.com/zendframework/ZFTool
*/ */
$env = getenv('APP_ENV') ?: 'production'; $env = getenv('APP_ENV') ?: 'dev';
$appconfdir = getenv('APP_CONF_DIR') ? getenv('APP_CONF_DIR') : ''; $appConfDir = getenv('APP_CONF_DIR') ?? '';
$confpaths = [ 'config/autoload/{,*.}{global,local}.php' ]; $confPaths = ['config/autoload/{,*.}{global,local}.php'];
$datapath = "data"; $dataPath = 'data';
if( ! empty($appconfdir) ){ if (!empty($appConfDir)) {
$confpaths[] = $appconfdir.'/local.php'; $confPaths[] = $appConfDir . '/local.php';
$datapath = $appconfdir.'/data'; $dataPath = $appConfDir . '/data';
if(!is_dir($datapath.'/cache')){ if (!is_dir($dataPath . '/cache')) {
mkdir($datapath.'/cache'); if (!mkdir($concurrentDirectory = $dataPath . '/cache') && !is_dir($concurrentDirectory)) {
throw new \RuntimeException(sprintf('Directory "%s" was not created', $concurrentDirectory));
}
} }
} }
return array( return [
'modules' => array( 'modules' => [
'Monarc\Core',
'Monarc\FrontOffice',
'Zend\Cache',
'Zend\Form',
'Zend\InputFilter',
'Zend\Filter',
'Zend\Paginator',
'Zend\Hydrator',
'Zend\Di',
'Zend\Router',
'Zend\Validator',
'DoctrineModule', 'DoctrineModule',
'DoctrineORMModule', 'DoctrineORMModule',
'MonarcCore', ],
'MonarcFO', 'module_listener_options' => [
), 'module_paths' => [
'module_listener_options' => array(
'module_paths' => array(
'./module', './module',
'./vendor' './vendor'
), ],
'config_glob_paths' => $confpaths, 'config_glob_paths' => $confPaths,
'config_cache_enabled' => ($env == 'production'), 'config_cache_enabled' => $env === 'production',
'config_cache_key' => 'c8aaaaa11586f8b1bf5565cc6064e70a', // md5('config_cache_key_monarc') 'config_cache_key' => 'c8aaaaa11586f8b1bf5565cc6064e70a', // md5('config_cache_key_monarc')
'module_map_cache_enabled' => ($env == 'production'), 'module_map_cache_enabled' => $env === 'production',
'module_map_cache_key' => '664579376c4dcdcaa0bcdd0f7e7bf25b', // md5('module_map_cache_key_monarc'), 'module_map_cache_key' => '664579376c4dcdcaa0bcdd0f7e7bf25b', // md5('module_map_cache_key_monarc'),
'cache_dir' => $datapath.'/cache/', 'cache_dir' => $dataPath . '/cache/',
'check_dependencies' => ($env != 'production'), 'check_dependencies' => $env !== 'production',
), ],
); ];

View File

@ -11,6 +11,9 @@
* file. * file.
*/ */
use Monarc\Core\Service\DoctrineCacheServiceFactory;
use Monarc\Core\Service\DoctrineLoggerFactory;
$appconfdir = getenv('APP_CONF_DIR') ? getenv('APP_CONF_DIR') : ''; $appconfdir = getenv('APP_CONF_DIR') ? getenv('APP_CONF_DIR') : '';
$datapath = "data"; $datapath = "data";
@ -22,8 +25,8 @@ return array(
// DOCTRINE CONF // DOCTRINE CONF
'service_manager' => array( 'service_manager' => array(
'factories' => array( 'factories' => array(
'doctrine.cache.mycache' => 'MonarcCore\Service\DoctrineCacheServiceFactory', 'doctrine.cache.mycache' => DoctrineCacheServiceFactory::class,
'doctrine.monarc_logger' => 'MonarcCore\Service\DoctrineLoggerFactory', 'doctrine.monarc_logger' => DoctrineLoggerFactory::class,
), ),
), ),
'doctrine' => array( 'doctrine' => array(

View File

@ -1,54 +0,0 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* This autoloading setup is really more complicated than it needs to be for most
* applications. The added complexity is simply to reduce the time it takes for
* new developers to be productive with a fresh skeleton. It allows autoloading
* to be correctly configured, regardless of the installation method and keeps
* the use of composer completely optional. This setup should work fine for
* most users, however, feel free to configure autoloading however you'd like.
*/
// Composer autoloading
if (file_exists('vendor/autoload.php')) {
$loader = include 'vendor/autoload.php';
}
if (class_exists('Zend\Loader\AutoloaderFactory')) {
return;
}
$zf2Path = false;
if (is_dir('vendor/ZF2/library')) {
$zf2Path = 'vendor/ZF2/library';
} elseif (getenv('ZF2_PATH')) { // Support for ZF2_PATH environment variable or git submodule
$zf2Path = getenv('ZF2_PATH');
} elseif (get_cfg_var('zf2_path')) { // Support for zf2_path directive value
$zf2Path = get_cfg_var('zf2_path');
}
if ($zf2Path) {
if (isset($loader)) {
$loader->add('Zend', $zf2Path);
$loader->add('ZendXml', $zf2Path);
} else {
include $zf2Path . '/Zend/Loader/AutoloaderFactory.php';
Zend\Loader\AutoloaderFactory::factory(array(
'Zend\Loader\StandardAutoloader' => array(
'autoregister_zf' => true
)
));
}
}
if (!class_exists('Zend\Loader\AutoloaderFactory')) {
throw new RuntimeException('Unable to load ZF2. Run `php composer.phar install` or define a ZF2_PATH environment variable.');
}

View File

@ -1,24 +1,39 @@
<?php <?php
/**
* This makes our life easier when dealing with paths. Everything is relative use Monarc\Core\Service\Initializer\ObjectManagerInitializer;
* to the application root now. use Zend\Mvc\Application;
*/
chdir(dirname(__DIR__)); chdir(dirname(__DIR__));
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
// Decline static file requests back to the PHP built-in webserver // Decline static file requests back to the PHP built-in webserver
if (php_sapi_name() === 'cli-server' && is_file(__DIR__ . parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH))) { if (php_sapi_name() === 'cli-server') {
$path = realpath(__DIR__ . parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));
if (__FILE__ !== $path && is_file($path)) {
return false; return false;
}
unset($path);
} }
/**
* Default Timezone
*/
if(date_default_timezone_get() != ini_get('date.timezone')){ if(date_default_timezone_get() != ini_get('date.timezone')){
date_default_timezone_set('Europe/Luxembourg'); date_default_timezone_set('Europe/Luxembourg');
} }
// Setup autoloading include 'vendor/autoload.php';
require 'init_autoloader.php';
// Run the application! if (! class_exists(Application::class)) {
Zend\Mvc\Application::init(require 'config/application.config.php')->run(); throw new RuntimeException(
"Unable to load application.\n"
. "- Type `composer install` if you are developing locally.\n"
);
}
$appConfig = require 'config/application.config.php';
if (file_exists('config/development.config.php')) {
$appConfig = Zend\Stdlib\ArrayUtils::merge($appConfig, include 'config/development.config.php');
}
Application::init($appConfig)->run();

View File

@ -6,7 +6,7 @@ GITHUB_AUTH_TOKEN=$1
TAG='' TAG=''
PATH_TO_MONARC='/home/ubuntu/monarc' PATH_TO_MONARC='/home/ubuntu/monarc'
ENVIRONMENT='PRODUCTION' ENVIRONMENT='DEVELOPMENT'
DBHOST='localhost' DBHOST='localhost'
DBNAME_COMMON='monarc_common' DBNAME_COMMON='monarc_common'
@ -142,19 +142,22 @@ if [ "$TAG" != '' ]; then
fi fi
echo -e "\n--- Retrieving MONARC libraries… ---\n" echo -e "\n--- Retrieving MONARC libraries… ---\n"
# TODO: Can be removed when we move to packagis.
composer config -g github-oauth.github.com $GITHUB_AUTH_TOKEN composer config -g github-oauth.github.com $GITHUB_AUTH_TOKEN
composer install -o composer install -o
# Back-end # Back-end
mkdir module mkdir module
cd module cd module
ln -s ./../vendor/monarc/core MonarcCore mkdir Monarc
ln -s ./../vendor/monarc/frontoffice MonarcFO cd Monarc
ln -s ./../../vendor/monarc/core Core
ln -s ./../../vendor/monarc/frontoffice FrontOffice
cd $PATH_TO_MONARC cd $PATH_TO_MONARC
cd module/MonarcFO/ cd module/Monarc/FrontOffice
git config core.fileMode false git config core.fileMode false
cd $PATH_TO_MONARC cd $PATH_TO_MONARC
cd module/MonarcCore/ cd module/Monarc/Core
git config core.fileMode false git config core.fileMode false
cd $PATH_TO_MONARC cd $PATH_TO_MONARC