Commit 7f24dbf6 authored by Tino Goratsch's avatar Tino Goratsch

adapted the recent changes to the installation wizard / db schema updater

parent 4fef2113
<?php
namespace ACP3\Core;
use ACP3\Core\Enum\Environment;
/**
* Class AbstractApplication
......@@ -11,6 +12,18 @@ abstract class AbstractApplication implements ApplicationInterface
* @var \Symfony\Component\DependencyInjection\ContainerInterface
*/
protected $container;
/**
* @var string
*/
protected $environment;
/**
* @param string $environment
*/
public function __construct($environment = Environment::PRODUCTION)
{
$this->environment = $environment;
}
/**
* @inheritdoc
......
......@@ -28,18 +28,6 @@ class Application extends AbstractApplication
* @var array
*/
protected $systemSettings = [];
/**
* @var string
*/
protected $environment;
/**
* @param string $environment
*/
public function __construct($environment = Environment::PRODUCTION)
{
$this->environment = $environment;
}
/**
* @inheritdoc
......@@ -78,7 +66,7 @@ class Application extends AbstractApplication
define('MODULES_DIR', ACP3_DIR . 'Modules/');
define('LIBRARIES_DIR', ACP3_ROOT_DIR . 'libraries/');
define('UPLOADS_DIR', ACP3_ROOT_DIR . 'uploads/');
define('CACHE_DIR', UPLOADS_DIR . 'cache/' . $this->environment . '/');
define('CACHE_DIR', ACP3_ROOT_DIR . 'cache/' . $this->environment . '/');
}
/**
......
......@@ -9,4 +9,6 @@ final class Environment
{
const PRODUCTION = 'prod';
const DEVELOPMENT = 'dev';
const INSTALLER = 'installer';
const UPDATER = 'updater';
}
\ No newline at end of file
......@@ -74,7 +74,7 @@ class ParameterBag
*/
public function has($key)
{
return array_key_exists($key, $this->data);
return isset($this->data[$key]);
}
/**
......
......@@ -29,9 +29,9 @@ class Smarty extends AbstractRenderer
$settings = $this->container->get('core.config')->getSettings('system');
$this->renderer = new \Smarty();
$this->renderer->error_reporting = defined('IN_INSTALL') === true || $this->isDevEnvironment() ? E_ALL : 0;
$this->renderer->error_reporting = $this->isDevOrInstall() ? E_ALL : 0;
$this->renderer->compile_id = !empty($params['compile_id']) ? $params['compile_id'] : $settings['design'];
$this->renderer->compile_check = $this->isDevEnvironment();
$this->renderer->compile_check = $this->isDevOrInstall();
$this->renderer->compile_dir = CACHE_DIR . 'tpl_compiled/';
$this->renderer->cache_dir = CACHE_DIR . 'tpl_cached/';
......@@ -109,8 +109,10 @@ class Smarty extends AbstractRenderer
/**
* @return bool
*/
protected function isDevEnvironment()
protected function isDevOrInstall()
{
return $this->container->getParameter('core.environment') === Environment::DEVELOPMENT;
return $this->container->getParameter('core.environment') === Environment::DEVELOPMENT ||
$this->container->getParameter('core.environment') === Environment::INSTALLER ||
$this->container->getParameter('core.environment') === Environment::UPDATER;
}
}
......@@ -22,7 +22,7 @@ $dirname = str_replace('/ACP3/Modules/ACP3/Filemanager/libraries/kcfinder/', '',
$hostname = 'http://' . $_SERVER['HTTP_HOST'];
$uploadURL = $hostname . $dirname . '/uploads/';
$uploadDir = realpath(__DIR__ . '/../../../../../../../') . '/uploads/';
$thumbsDir = "cache/images/kcfinder";
$thumbsDir = "kcfinder";
$_CONFIG = [
......
......@@ -98,13 +98,11 @@ class Index extends Core\Modules\FrontendController
$this->view->assign('form', array_merge(['mail' => ''], $this->request->getPost()->getAll()));
$fieldValue = $action;
$actions_Lang = [
$this->lang->t('newsletter', 'subscribe'),
$this->lang->t('newsletter', 'unsubscribe')
];
$this->view->assign('actions', $this->get('core.helpers.forms')->checkboxGenerator('action', ['subscribe', 'unsubscribe'], $actions_Lang, $fieldValue));
$this->view->assign('actions', $this->get('core.helpers.forms')->checkboxGenerator('action', ['subscribe', 'unsubscribe'], $actions_Lang, $action));
if ($this->acl->hasPermission('frontend/captcha/index/image') === true) {
$this->view->assign('captcha', $this->captchaHelpers->captcha());
......
......@@ -20,10 +20,7 @@ class Application extends Core\AbstractApplication
{
$this->defineDirConstants();
if (defined('IN_UPDATER') &&
IN_UPDATER === true &&
$this->startupChecks() === false
) {
if ($this->environment === Core\Enum\Environment::UPDATER && $this->startupChecks() === false) {
return;
}
......@@ -45,11 +42,12 @@ class Application extends Core\AbstractApplication
define('MODULES_DIR', ACP3_DIR . 'Modules/');
define('LIBRARIES_DIR', ACP3_ROOT_DIR . 'libraries/');
define('UPLOADS_DIR', ACP3_ROOT_DIR . 'uploads/');
define('CACHE_DIR', UPLOADS_DIR . 'cache/');
define('CACHE_DIR', ACP3_ROOT_DIR . 'cache/');
define('INSTALLER_ACP3_DIR', realpath(ACP3_DIR . '../installation/') . '/Installer/');
define('INSTALLER_MODULES_DIR', INSTALLER_ACP3_DIR . 'Modules/');
define('INSTALLER_CLASSES_DIR', INSTALLER_ACP3_DIR . 'Core/');
define('INSTALLER_CACHE_DIR', CACHE_DIR . 'install/');
define('INSTALLATION_DIR', ACP3_ROOT_DIR . 'installation/');
// Set theme paths
......@@ -66,7 +64,7 @@ class Application extends Core\AbstractApplication
$loader = new YamlFileLoader($this->container, new FileLocator(__DIR__));
if (defined('IN_UPDATER') === true) {
if ($this->environment === Core\Enum\Environment::UPDATER) {
$loader->load(INSTALLER_CLASSES_DIR . 'config/update.yml');
$excludedDirs = [];
} else {
......@@ -83,8 +81,10 @@ class Application extends Core\AbstractApplication
}
}
$this->container->setParameter('core.environment', $this->environment);
// When in updater context, also include "normal" module services
if (defined('IN_UPDATER') === true) {
if ($this->environment === Core\Enum\Environment::UPDATER) {
$vendors = $this->container->get('core.modules.vendors')->getVendors();
foreach ($vendors as $vendor) {
......@@ -134,7 +134,7 @@ class Application extends Core\AbstractApplication
error_reporting(E_ALL);
if (defined('IN_UPDATER') === true) {
if ($this->environment === Core\Enum\Environment::UPDATER) {
return $this->databaseConfigExists();
}
......
......@@ -16,16 +16,16 @@ class Smarty extends \ACP3\Core\View\Renderer\Smarty
public function configure(array $params = [])
{
$this->renderer = new \Smarty();
$this->renderer->error_reporting = defined('IN_INSTALL') === true || (defined('DEBUG') === true && DEBUG === true) ? E_ALL : 0;
$this->renderer->error_reporting = $this->isDevOrInstall() ? E_ALL : 0;
if (!empty($params['compile_id'])) {
$this->renderer->compile_id = $params['compile_id'];
}
$this->renderer->setCompileCheck(defined('DEBUG') === true && DEBUG === true);
$this->renderer->setCompileCheck($this->isDevOrInstall());
$this->renderer
->setCompileDir(CACHE_DIR . 'tpl_compiled/')
->setCacheDir(CACHE_DIR . 'tpl_cached/');
->setCompileDir(INSTALLER_CACHE_DIR . 'tpl_compiled/')
->setCacheDir(INSTALLER_CACHE_DIR . 'tpl_cached/');
$this->_registerPlugins();
}
......
......@@ -145,7 +145,7 @@ class Requirements
*/
private function fetchRequiredFilesAndDirectories()
{
$defaults = ['ACP3/config.yml'];
$defaults = ['ACP3/config.yml', 'cache/'];
foreach (Filesystem::scandir(UPLOADS_DIR) as $row) {
$path = 'uploads/' . $row . '/';
......
......@@ -6,10 +6,8 @@
*/
define('IN_ACP3', true);
define('IN_INSTALL', true);
define('ACP3_ROOT_DIR', realpath(__DIR__ . '/../') . '/');
require '../vendor/autoload.php';
$application = new \ACP3\Installer\Core\Application();
$application->run();
(new \ACP3\Installer\Core\Application(\ACP3\Core\Enum\Environment::INSTALLER))->run();
<?php
/**
* Installer
* UPDATER
*
* @author Tino Goratsch
*/
define('IN_UPDATER', true);
define('IN_ACP3', true);
define('ACP3_ROOT_DIR', realpath(__DIR__ . '/../') . '/');
require 'index.php';
\ No newline at end of file
require '../vendor/autoload.php';
(new \ACP3\Installer\Core\Application(\ACP3\Core\Enum\Environment::UPDATER))->run();
\ No newline at end of file
<Limit GET POST PUT>
Order Allow,Deny
Deny from All
</Limit>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment