diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..19be60f4 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +vendor +.git +*.phar +data +images +thumbs +composer.lock +*.sqlite diff --git a/.travis.yml b/.travis.yml index 459b6395..db087aa9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: php php: - - 7.0 - 7.1 + - 7.2 sudo: false @@ -10,8 +10,6 @@ env: - DB=mysql - DB=pgsql - DB=sqlite - allow_failures: - - DB=sqlite cache: directories: @@ -36,9 +34,11 @@ install: mysql -e "CREATE DATABASE shimmie;" -uroot ; echo ' data/config/auto_install.conf.php ; fi - - if [[ "$DB" == "sqlite" ]]; then echo ' data/config/auto_install.conf.php ; fi + - if [[ "$DB" == "sqlite" ]]; then + echo ' data/config/auto_install.conf.php ; + fi - composer install - - php install.php + - php index.php script: - vendor/bin/phpunit --configuration tests/phpunit.xml --coverage-clover=data/coverage.clover diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..35c20085 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM debian:testing-slim +ENV DEBIAN_FRONTEND=noninteractive +EXPOSE 8000 +RUN apt update && apt install -y curl +HEALTHCHECK --interval=5m --timeout=3s CMD curl --fail http://127.0.0.1:8000/ || exit 1 + +RUN apt install -y php7.3-cli php7.3-gd php7.3-pgsql php7.3-mysql php7.3-sqlite3 php7.3-zip php7.3-dom php7.3-mbstring php-xdebug +RUN apt install -y composer imagemagick vim zip unzip + +COPY composer.json /app/ +WORKDIR /app +RUN composer install + +COPY . /app/ +RUN mkdir -p data/config && \ + echo " data/config/auto_install.conf.php && \ + php index.php && \ + ./vendor/bin/phpunit --configuration tests/phpunit.xml --coverage-text && \ + rm -rf data +CMD ["/usr/bin/php", "-d", "upload_max_filesize=50M", "-d", "post_max_size=50M", "-S", "0.0.0.0:8000", "tests/router.php"] diff --git a/README.markdown b/README.markdown index dae48e1e..4b60f8ad 100644 --- a/README.markdown +++ b/README.markdown @@ -29,7 +29,7 @@ check out one of the versioned branches. # Requirements - MySQL/MariaDB 5.1+ (with experimental support for PostgreSQL 9+ and SQLite 3) -- [Stable PHP](https://en.wikipedia.org/wiki/PHP#Release_history) (7.0+ as of writing) +- [Stable PHP](https://en.wikipedia.org/wiki/PHP#Release_history) (7.1+ as of writing) - GD or ImageMagick # Installation diff --git a/composer.json b/composer.json index ccb454e3..509164c6 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,8 @@ ], "require" : { - "php" : ">=7.0", + "php" : ">=7.1", + "ext-pdo": "*", "flexihash/flexihash" : "^2.0.0", "ifixit/php-akismet" : "1.*", @@ -41,30 +42,5 @@ "require-dev" : { "phpunit/phpunit" : "6.*" - }, - - "vendor-copy": { - "vendor/bower-asset/jquery/dist/jquery.min.js" : "lib/vendor/js/jquery-1.12.3.min.js", - "vendor/bower-asset/jquery/dist/jquery.min.map" : "lib/vendor/js/jquery-1.12.3.min.map", - "vendor/bower-asset/jquery-timeago/jquery.timeago.js" : "lib/vendor/js/jquery.timeago.js", - "vendor/bower-asset/tablesorter/jquery.tablesorter.min.js" : "lib/vendor/js/jquery.tablesorter.min.js", - "vendor/bower-asset/mediaelement/build/flashmediaelement.swf" : "lib/vendor/swf/flashmediaelement.swf", - "vendor/bower-asset/js-cookie/src/js.cookie.js" : "lib/vendor/js/js.cookie.js" - }, - - "scripts": { - "pre-install-cmd" : [ - "php -r \"array_map('unlink', array_merge(glob('lib/vendor/js/j*.{js,map}', GLOB_BRACE), glob('lib/vendor/css/*.css'), glob('lib/vendor/swf/*.swf')));\"" - ], - "pre-update-cmd" : [ - "php -r \"array_map('unlink', array_merge(glob('lib/vendor/js/j*.{js,map}', GLOB_BRACE), glob('lib/vendor/css/*.css'), glob('lib/vendor/swf/*.swf')));\"" - ], - - "post-install-cmd" : [ - "php -r \"array_map('copy', array_keys(json_decode(file_get_contents('composer.json'), TRUE)['vendor-copy']), json_decode(file_get_contents('composer.json'), TRUE)['vendor-copy']);\"" - ], - "post-update-cmd" : [ - "php -r \"array_map('copy', array_keys(json_decode(file_get_contents('composer.json'), TRUE)['vendor-copy']), json_decode(file_get_contents('composer.json'), TRUE)['vendor-copy']);\"" - ] } } diff --git a/core/_bootstrap.inc.php b/core/_bootstrap.php similarity index 89% rename from core/_bootstrap.inc.php rename to core/_bootstrap.php index 5ed87783..025a4e6a 100644 --- a/core/_bootstrap.inc.php +++ b/core/_bootstrap.php @@ -6,11 +6,11 @@ global $config, $database, $user, $page, $_shm_ctx; -require_once "core/sys_config.inc.php"; -require_once "core/util.inc.php"; +require_once "core/sys_config.php"; +require_once "core/polyfills.php"; +require_once "core/util.php"; require_once "vendor/shish/libcontext-php/context.php"; require_once "vendor/autoload.php"; -require_once "core/imageboard.pack.php"; // set up and purify the environment _version_check(); @@ -20,6 +20,7 @@ _sanitise_environment(); $_shm_ctx->log_start("Opening files"); $_shm_files = array_merge( zglob("core/*.php"), + zglob("core/{".ENABLED_MODS."}/*.php"), zglob("ext/{".ENABLED_EXTS."}/main.php") ); foreach($_shm_files as $_shm_filename) { diff --git a/install.php b/core/_install.php similarity index 59% rename from install.php rename to core/_install.php index 8584a9ac..d8971fc0 100644 --- a/install.php +++ b/core/_install.php @@ -25,42 +25,9 @@ date_default_timezone_set('UTC');
", $warnings) : ""; + $err_msg = $errors ? "
", $errors) : "";
print <<Database Install
-