diff --git a/.gitignore b/.gitignore
index 39712f98ad..a7b0218222 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,6 +23,7 @@ releases
tmp
config.local.php
+!docker/config.local.php
# all custom templates
templates/*
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000000..f2525fbc53
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,41 @@
+version: "1.0"
+services:
+ web:
+ ports:
+ - 8001:80
+ build:
+ args:
+ user: www-data
+ uid: 33
+ context: ./
+ dockerfile: ./docker/Dockerfile
+ restart: unless-stopped
+ working_dir: /var/www/html
+ depends_on:
+ - db
+ #volumes:
+ # - ./:/var/www/html
+
+ db:
+ image: mysql:8.0
+ restart: unless-stopped # always?
+ environment:
+ MYSQL_RANDOM_ROOT_PASSWORD: "yes"
+ MYSQL_DATABASE: myaac
+ #MYSQL_ROOT_PASSWORD: root
+ MYSQL_PASSWORD: myaac
+ MYSQL_USER: myaac
+ ports:
+ - 8003:3306
+ volumes:
+ - ./docker/tfs_schema.sql:/docker-entrypoint-initdb.d/tfs_schema.sql
+ - db:/var/lib/mysql
+
+ phpmyadmin:
+ image: phpmyadmin
+ restart: always
+ ports:
+ - 8002:80
+
+volumes:
+ db:
diff --git a/docker/Dockerfile b/docker/Dockerfile
new file mode 100644
index 0000000000..b5f3a99d18
--- /dev/null
+++ b/docker/Dockerfile
@@ -0,0 +1,53 @@
+FROM php:8.2-apache
+
+ARG APCU_VERSION=5.1.22
+
+# Arguments defined in docker-compose.yml
+ARG user
+ARG uid
+
+# Install system dependencies
+RUN apt-get update && apt-get install -y \
+ git \
+ curl \
+ libpng-dev \
+ libonig-dev \
+ libxml2-dev \
+ libzip-dev \
+ zip \
+ unzip \
+ nano \
+ vim
+
+# Clear cache
+RUN apt-get clean && rm -rf /var/lib/apt/lists/*
+
+# Install PHP extensions
+RUN docker-php-ext-install pdo pdo_mysql gd zip opcache
+RUN docker-php-ext-configure opcache --enable-opcache
+RUN pecl install apcu-${APCU_VERSION} && docker-php-ext-enable apcu
+
+# Get latest Composer
+COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
+
+# Create system user to run Composer Commands
+#RUN useradd -G www-data,root -u $uid -d /home/$user $user
+RUN mkdir -p /home/$user/.composer && \
+ chown -R $user:$user /home/$user
+
+RUN chown -R www-data.www-data /var/www
+
+USER $user
+
+WORKDIR /home/$user
+RUN git clone https://github.com/otland/forgottenserver.git
+
+COPY --chown=www-data:www-data docker/config.lua /home/$user/forgottenserver
+COPY --chown=www-data:www-data docker/config.local.php /var/www/html
+
+#WORKDIR /home/$user/forgottenserver
+
+WORKDIR /var/www/html
+
+COPY --chown=www-data:www-data . .
+RUN composer install
diff --git a/docker/config.local.php b/docker/config.local.php
new file mode 100644
index 0000000000..8a0cc6524c
--- /dev/null
+++ b/docker/config.local.php
@@ -0,0 +1,4 @@
+ 100 will be then normal items inside depots',
+ `pid` int NOT NULL DEFAULT '0',
+ `itemtype` smallint unsigned NOT NULL,
+ `count` smallint NOT NULL DEFAULT '0',
+ `attributes` blob NOT NULL,
+ UNIQUE KEY `player_id_2` (`player_id`, `sid`),
+ FOREIGN KEY (`player_id`) REFERENCES `players`(`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8;
+
+CREATE TABLE IF NOT EXISTS `player_inboxitems` (
+ `player_id` int NOT NULL,
+ `sid` int NOT NULL,
+ `pid` int NOT NULL DEFAULT '0',
+ `itemtype` smallint unsigned NOT NULL,
+ `count` smallint NOT NULL DEFAULT '0',
+ `attributes` blob NOT NULL,
+ UNIQUE KEY `player_id_2` (`player_id`, `sid`),
+ FOREIGN KEY (`player_id`) REFERENCES `players`(`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8;
+
+CREATE TABLE IF NOT EXISTS `player_storeinboxitems` (
+ `player_id` int NOT NULL,
+ `sid` int NOT NULL,
+ `pid` int NOT NULL DEFAULT '0',
+ `itemtype` smallint unsigned NOT NULL,
+ `count` smallint NOT NULL DEFAULT '0',
+ `attributes` blob NOT NULL,
+ UNIQUE KEY `player_id_2` (`player_id`, `sid`),
+ FOREIGN KEY (`player_id`) REFERENCES `players`(`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8;
+
+CREATE TABLE IF NOT EXISTS `player_items` (
+ `player_id` int NOT NULL DEFAULT '0',
+ `pid` int NOT NULL DEFAULT '0',
+ `sid` int NOT NULL DEFAULT '0',
+ `itemtype` smallint unsigned NOT NULL DEFAULT '0',
+ `count` smallint NOT NULL DEFAULT '0',
+ `attributes` blob NOT NULL,
+ FOREIGN KEY (`player_id`) REFERENCES `players`(`id`) ON DELETE CASCADE,
+ KEY `sid` (`sid`)
+) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8;
+
+CREATE TABLE IF NOT EXISTS `player_spells` (
+ `player_id` int NOT NULL,
+ `name` varchar(255) NOT NULL,
+ FOREIGN KEY (`player_id`) REFERENCES `players`(`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8;
+
+CREATE TABLE IF NOT EXISTS `player_storage` (
+ `player_id` int NOT NULL DEFAULT '0',
+ `key` int unsigned NOT NULL DEFAULT '0',
+ `value` int NOT NULL DEFAULT '0',
+ PRIMARY KEY (`player_id`,`key`),
+ FOREIGN KEY (`player_id`) REFERENCES `players`(`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8;
+
+CREATE TABLE IF NOT EXISTS `server_config` (
+ `config` varchar(50) NOT NULL,
+ `value` varchar(256) NOT NULL DEFAULT '',
+ PRIMARY KEY `config` (`config`)
+) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8;
+
+CREATE TABLE IF NOT EXISTS `tile_store` (
+ `house_id` int NOT NULL,
+ `data` longblob NOT NULL,
+ FOREIGN KEY (`house_id`) REFERENCES `houses` (`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8;
+
+CREATE TABLE IF NOT EXISTS `towns` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `name` varchar(255) NOT NULL,
+ `posx` int NOT NULL DEFAULT '0',
+ `posy` int NOT NULL DEFAULT '0',
+ `posz` int NOT NULL DEFAULT '0',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `name` (`name`)
+) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8;
+
+INSERT INTO `server_config` (`config`, `value`) VALUES ('db_version', '35'), ('players_record', '0');
+
+DROP TRIGGER IF EXISTS `ondelete_players`;
+DROP TRIGGER IF EXISTS `oncreate_guilds`;
+
+DELIMITER //
+CREATE TRIGGER `ondelete_players` BEFORE DELETE ON `players`
+ FOR EACH ROW BEGIN
+ UPDATE `houses` SET `owner` = 0 WHERE `owner` = OLD.`id`;
+END
+//
+CREATE TRIGGER `oncreate_guilds` AFTER INSERT ON `guilds`
+ FOR EACH ROW BEGIN
+ INSERT INTO `guild_ranks` (`name`, `level`, `guild_id`) VALUES ('the Leader', 3, NEW.`id`);
+ INSERT INTO `guild_ranks` (`name`, `level`, `guild_id`) VALUES ('a Vice-Leader', 2, NEW.`id`);
+ INSERT INTO `guild_ranks` (`name`, `level`, `guild_id`) VALUES ('a Member', 1, NEW.`id`);
+END
+//
+DELIMITER ;
diff --git a/install/index.php b/install/index.php
index 6536829eb2..91c8a7efeb 100644
--- a/install/index.php
+++ b/install/index.php
@@ -194,7 +194,7 @@
}
}
- if(!$allow)
+ if(!$allow && !config('install_ignore_ip_check'))
{
$content = warning('In file install/ip.txt must be your IP!
In file is:
' . nl2br($file_content) . '
diff --git a/install/steps/4-config.php b/install/steps/4-config.php
index 325b97f1b4..731538c362 100644
--- a/install/steps/4-config.php
+++ b/install/steps/4-config.php
@@ -11,6 +11,7 @@
}
$twig->display('install.config.html.twig', array(
+ 'config' => $config,
'clients' => $clients,
'timezones' => DateTimeZone::listIdentifiers(),
'locale' => $locale,
diff --git a/install/steps/5-database.php b/install/steps/5-database.php
index ed8f82a1f0..881953d691 100644
--- a/install/steps/5-database.php
+++ b/install/steps/5-database.php
@@ -40,6 +40,9 @@
$configToSave['gzip_output'] = false;
$configToSave['cache_engine'] = 'auto';
$configToSave['cache_prefix'] = 'myaac_' . generateRandomString(8, true, false, true);
+ if (isset($config['install_ignore_ip_check'])) {
+ $configToSave['install_ignore_ip_check'] = $config['install_ignore_ip_check'];
+ }
if(!$error) {
$content = '';
@@ -88,7 +91,7 @@
$_SESSION['config_content'] = $content;
unset($_SESSION['saved']);
- $locale['step_database_error_file'] = str_replace('$FILE$', '' . BASE . 'config.php', $locale['step_database_error_file']);
+ $locale['step_database_error_file'] = str_replace('$FILE$', '' . BASE . 'config.local.php', $locale['step_database_error_file']);
error($locale['step_database_error_file'] . '
');
}
diff --git a/system/templates/install.config.html.twig b/system/templates/install.config.html.twig
index ab4fc36195..afb91a7064 100644
--- a/system/templates/install.config.html.twig
+++ b/system/templates/install.config.html.twig
@@ -10,9 +10,13 @@
{% for value in ['server_path'] %}
+ {% if value == 'server_path' and config.server_path is not null %}
+ {% set server_path = { 'var_server_path': config.server_path } %}
+ {% set session = session | merge (server_path) %}
+ {% endif %}