Skip to content

Commit

Permalink
Merge branch 'forkcms/5.0.0-dev' into remove-library
Browse files Browse the repository at this point in the history
# Conflicts:
#	UPGRADE_5.0.md
  • Loading branch information
jeroendesloovere committed Feb 23, 2017
1 parent d4453b7 commit c6e5b3b
Show file tree
Hide file tree
Showing 190 changed files with 5,108 additions and 198 deletions.
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/docs export-ignore
/.github export-ignore
.gitattributes export-ignore
.travis.yml export-ignore
5 changes: 3 additions & 2 deletions .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ FileETag MTime Size
RewriteRule src/Backend/Cache/Locale/.*\.php - [F]

# redirect all trafic to https
# RewriteCond %{SERVER_PORT} 80
# Header set Strict-Transport-Security "max-age=31536000; includeSubDomains" env=HTTPS
# RewriteCond %{HTTPS} != on
# RewriteCond %{HTTP_HOST} !.*\.dev [NC]
# RewriteRule ^(.*)$ https://www.<domain>.be/$1 [R=301,L]
# RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

# one url to rule them all
# RewriteCond %{HTTP_HOST} !^www\.<domain>\.be [NC]
Expand Down
8 changes: 3 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ matrix:
include:
- php: 7.0
- php: 7.1
- php: hhvm
allow_failures:
- php: hhvm

script:
- phpunit --coverage-clover=coverage.clover
- bin/phpcs --standard=psr2 --extensions=php --warning-severity=0 --ignore=src/Backend/Core/Js/ckfinder,src/Backend/Cache,src/Frontend/Cache,src/Backend/Core/Js/ckeditor --report=full "src"

before_script:
- npm install -g bower
Expand All @@ -20,8 +18,8 @@ before_script:
- mysql -e "SET GLOBAL wait_timeout = 3600" # try to avoid mysql has gone away errors

after_success:
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]] && [[ "$TRAVIS_PHP_VERSION" != "7.1" ]]; then wget https://scrutinizer-ci.com/ocular.phar; fi
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]] && [[ "$TRAVIS_PHP_VERSION" != "7.1" ]]; then php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi
- if [[ "$TRAVIS_PHP_VERSION" != "7.1" ]]; then wget https://scrutinizer-ci.com/ocular.phar; fi
- if [[ "$TRAVIS_PHP_VERSION" != "7.1" ]]; then php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi

after_failure:
- cat app/logs/test.log
Expand Down
41 changes: 41 additions & 0 deletions UPGRADE_5.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,44 @@ PATH_LIBRARY is removed.
### site.path_library

site.path_library is removed.

## meta table is now using InnoDB

In order to use constraints in mysql 5.5 we need to use InnoDB
Execute the following queries to migrate

RENAME TABLE meta TO old_meta;
CREATE TABLE `meta` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`keywords` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`keywords_overwrite` enum('Y','N') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'N' COMMENT '(DC2Type:enum_bool)',
`description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`description_overwrite` enum('Y','N') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'N' COMMENT '(DC2Type:enum_bool)',
`title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`title_overwrite` enum('Y','N') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'N' COMMENT '(DC2Type:enum_bool)',
`url` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`url_overwrite` enum('Y','N') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'N' COMMENT '(DC2Type:enum_bool)',
`custom` longtext COLLATE utf8mb4_unicode_ci,
`data` longtext COLLATE utf8mb4_unicode_ci,
PRIMARY KEY (`id`),
KEY `idx_url` (`url`(191))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
INSERT INTO meta SELECT * FROM old_meta;
DROP TABLE old_meta;

## PSR-4

We are now using PSR-4

As part of this transition the classes in the app directory are now also autoloaded and can be accessed via the ForkCMS\App namespace

routing.php has been renamed to ForkController because we need the classname to match the filename

| Old classname | New classname |
|-----------------------|-----------------------------------|
| \KernelLoader | \ForkCMS\App\KernelLoader |
| \Kernel | \ForkCMS\App\Kernel |
| \ApplicationRouting | \ForkCMS\App\ForkController |
| \BaseModel | \ForkCMS\App\BaseModel |
| \ApplicationInterface | \ForkCMS\App\ApplicationInterface |
| \AppKernel | \ForkCMS\App\AppKernel |
42 changes: 20 additions & 22 deletions app/AppKernel.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace ForkCMS\App;

/*
* This file is part of Fork CMS.
*
Expand All @@ -10,10 +12,6 @@
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\Filesystem\Filesystem;

// hardcoded this for now, this should be autoloaded
require_once __DIR__ . '/Kernel.php';
require_once __DIR__ . '/routing.php';

/**
* The AppKernel provides a proper way to handle a request and transform it into a response.
*/
Expand All @@ -27,25 +25,25 @@ class AppKernel extends Kernel
public function registerBundles()
{
$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new ForkCMS\Bundle\InstallerBundle\ForkCMSInstallerBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new SimpleBus\SymfonyBridge\SimpleBusCommandBusBundle(),
new SimpleBus\SymfonyBridge\DoctrineOrmBridgeBundle(),
new SimpleBus\SymfonyBridge\SimpleBusEventBusBundle(),
new Backend\Modules\Mailmotor\Mailmotor,
new MailMotor\Bundle\MailMotorBundle\MailMotorMailMotorBundle(),
new MailMotor\Bundle\MailChimpBundle\MailMotorMailChimpBundle(),
new MailMotor\Bundle\CampaignMonitorBundle\MailMotorCampaignMonitorBundle(),
new \Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new \Symfony\Bundle\TwigBundle\TwigBundle(),
new \Symfony\Bundle\MonologBundle\MonologBundle(),
new \Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new \Symfony\Bundle\AsseticBundle\AsseticBundle(),
new \ForkCMS\Bundle\InstallerBundle\ForkCMSInstallerBundle(),
new \Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new \SimpleBus\SymfonyBridge\SimpleBusCommandBusBundle(),
new \SimpleBus\SymfonyBridge\DoctrineOrmBridgeBundle(),
new \SimpleBus\SymfonyBridge\SimpleBusEventBusBundle(),
new \Backend\Modules\Mailmotor\Mailmotor,
new \MailMotor\Bundle\MailMotorBundle\MailMotorMailMotorBundle(),
new \MailMotor\Bundle\MailChimpBundle\MailMotorMailChimpBundle(),
new \MailMotor\Bundle\CampaignMonitorBundle\MailMotorCampaignMonitorBundle(),
);

if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
$bundles[] = new \Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new \Symfony\Bundle\DebugBundle\DebugBundle();
}

return $bundles;
Expand All @@ -61,8 +59,8 @@ public function registerContainerConfiguration(LoaderInterface $loader)
$loader->load(__DIR__ . '/config/config.yml');
}

if ($fs->exists(__DIR__.'/config/config_'.$this->getEnvironment().'.yml')) {
$loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
if ($fs->exists(__DIR__ . '/config/config_' . $this->getEnvironment() . '.yml')) {
$loader->load(__DIR__ . '/config/config_' . $this->getEnvironment() . '.yml');
}
}
}
6 changes: 5 additions & 1 deletion app/ApplicationInterface.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
<?php

namespace ForkCMS\App;

/*
* This file is part of Fork CMS.
*
* For the full copyright and license information, please view the license
* file that was distributed with this source code.
*/

use Symfony\Component\HttpFoundation\Response;

/**
* If you want to extend Fork with an application of your own, you should implement this interface
* to ensure that initialize() and display() are *always* present.
Expand All @@ -24,7 +28,7 @@ public function initialize();
/**
* Sends the output of the app to our browser, in the form of a Response object.
*
* @return Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function display();
}
4 changes: 3 additions & 1 deletion app/BaseModel.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace ForkCMS\App;

/*
* This file is part of Fork CMS.
*
Expand All @@ -18,7 +20,7 @@
class BaseModel
{
/**
* @var Symfony\Component\DependencyInjection\ContainerInterface
* @var ContainerInterface
*/
private static $container;

Expand Down
22 changes: 12 additions & 10 deletions app/routing.php → app/ForkController.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
<?php

namespace ForkCMS\App;

/*
* This file is part of Fork CMS.
*
* For the full copyright and license information, please view the license
* file that was distributed with this source code.
*/

use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Backend\Init as BackendInit;
use Frontend\Init as FrontendInit;
use Common\Exception\RedirectException;
use Symfony\Component\HttpFoundation\Response;

/**
* Application routing
*/
class ApplicationRouting extends Controller
class ForkController extends Controller
{
const DEFAULT_APPLICATION = 'Frontend';

Expand Down Expand Up @@ -45,7 +47,7 @@ public static function getRoutes()
/**
* Runs the backend
*
* @return Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function backendController()
{
Expand All @@ -61,7 +63,7 @@ public function backendController()
/**
* Runs the backend ajax requests
*
* @return Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function backendAjaxController()
{
Expand All @@ -76,7 +78,7 @@ public function backendAjaxController()
/**
* Runs the cronjobs
*
* @return Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function backendCronjobController()
{
Expand All @@ -91,7 +93,7 @@ public function backendCronjobController()
/**
* Runs the frontend requests
*
* @return Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function frontendController()
{
Expand All @@ -106,7 +108,7 @@ public function frontendController()
/**
* Runs the frontend ajax requests
*
* @return Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function frontendAjaxController()
{
Expand All @@ -121,11 +123,11 @@ public function frontendAjaxController()
/**
* Runs an application and returns the Response
*
* @param \ApplicationInterface $application
* @param ApplicationInterface $application
*
* @return Symfony\Component\HttpFoundation\Response
* @return Response
*/
protected function handleApplication(\ApplicationInterface $application)
protected function handleApplication(ApplicationInterface $application)
{
$application->passContainerToModels();

Expand Down
8 changes: 6 additions & 2 deletions app/Kernel.php
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
<?php

namespace ForkCMS\App;

/*
* This file is part of Fork CMS.
*
* For the full copyright and license information, please view the license
* file that was distributed with this source code.
*/

use PDOException;
use Spoon;
use SpoonDatabaseException;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Finder\Finder;
use Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\KernelInterface;
use Backend\DependencyInjection\BackendExtension;

/**
* The Kernel provides a proper way to load an environment and DI container.
* It also handles requests and responses.
*/
abstract class Kernel extends BaseKernel implements KernelInterface
abstract class Kernel extends BaseKernel
{
/** @var Request We need this to check if a module is being installed */
private $request;
Expand Down
5 changes: 4 additions & 1 deletion app/KernelLoader.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<?php

namespace ForkCMS\App;

/*
* This file is part of Fork CMS.
*
* For the full copyright and license information, please view the license
* file that was distributed with this source code.
*/

use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpKernel\KernelInterface;
use Backend\Core\Engine\Model as BackendModel;
use Frontend\Core\Engine\Model as FrontendModel;
Expand Down Expand Up @@ -42,7 +45,7 @@ public function get($reference)
}

/**
* @return Symfony\Component\DependencyInjection\ContainerInterface
* @return ContainerInterface
*/
public function getContainer()
{
Expand Down
10 changes: 5 additions & 5 deletions app/config/routing.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
backend:
path: /private/{_locale}/{module}/{action}
defaults:
_controller: ApplicationRouting::backendController
_controller: \ForkCMS\App\ForkController::backendController
_locale: ~
module: ~
action: ~
backend_ajax:
path: /backend/ajax
defaults:
_controller: ApplicationRouting::backendAjaxController
_controller: \ForkCMS\App\ForkController::backendAjaxController
backend_cronjob:
path: /backend/cronjob
defaults:
_controller: ApplicationRouting::backendCronjobController
_controller: \ForkCMS\App\ForkController::backendCronjobController
frontend_ajax:
path: /frontend/ajax
defaults:
_controller: ApplicationRouting::frontendAjaxController
_controller: \ForkCMS\App\ForkController::frontendAjaxController
frontend:
path: /{route}
defaults:
_controller: ApplicationRouting::frontendController
_controller: \ForkCMS\App\ForkController::frontendController
route: ~
requirements:
route: (.*)
4 changes: 2 additions & 2 deletions app/console
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
set_time_limit(0);

require_once __DIR__ . '/../autoload.php';
require_once __DIR__ . '/AppKernel.php';
require_once __DIR__ . '/BaseModel.php';

use Common\ModulesSettings;
use ForkCMS\App\AppKernel;
use ForkCMS\App\BaseModel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Debug\Debug;
Expand Down
Loading

0 comments on commit c6e5b3b

Please sign in to comment.