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

Binary file not shown.

View File

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

View File

@ -11,6 +11,9 @@
* file.
*/
use Monarc\Core\Service\DoctrineCacheServiceFactory;
use Monarc\Core\Service\DoctrineLoggerFactory;
$appconfdir = getenv('APP_CONF_DIR') ? getenv('APP_CONF_DIR') : '';
$datapath = "data";
@ -22,8 +25,8 @@ return array(
// DOCTRINE CONF
'service_manager' => array(
'factories' => array(
'doctrine.cache.mycache' => 'MonarcCore\Service\DoctrineCacheServiceFactory',
'doctrine.monarc_logger' => 'MonarcCore\Service\DoctrineLoggerFactory',
'doctrine.cache.mycache' => DoctrineCacheServiceFactory::class,
'doctrine.monarc_logger' => DoctrineLoggerFactory::class,
),
),
'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
/**
* This makes our life easier when dealing with paths. Everything is relative
* to the application root now.
*/
use Monarc\Core\Service\Initializer\ObjectManagerInitializer;
use Zend\Mvc\Application;
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
if (php_sapi_name() === 'cli-server' && is_file(__DIR__ . parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH))) {
return false;
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;
}
unset($path);
}
/**
* Default Timezone
*/
if(date_default_timezone_get() != ini_get('date.timezone')){
date_default_timezone_set('Europe/Luxembourg');
}
// Setup autoloading
require 'init_autoloader.php';
include 'vendor/autoload.php';
// Run the application!
Zend\Mvc\Application::init(require 'config/application.config.php')->run();
if (! class_exists(Application::class)) {
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=''
PATH_TO_MONARC='/home/ubuntu/monarc'
ENVIRONMENT='PRODUCTION'
ENVIRONMENT='DEVELOPMENT'
DBHOST='localhost'
DBNAME_COMMON='monarc_common'
@ -142,19 +142,22 @@ if [ "$TAG" != '' ]; then
fi
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 install -o
# Back-end
mkdir module
cd module
ln -s ./../vendor/monarc/core MonarcCore
ln -s ./../vendor/monarc/frontoffice MonarcFO
mkdir Monarc
cd Monarc
ln -s ./../../vendor/monarc/core Core
ln -s ./../../vendor/monarc/frontoffice FrontOffice
cd $PATH_TO_MONARC
cd module/MonarcFO/
cd module/Monarc/FrontOffice
git config core.fileMode false
cd $PATH_TO_MONARC
cd module/MonarcCore/
cd module/Monarc/Core
git config core.fileMode false
cd $PATH_TO_MONARC