From 7a4bee3435a99d8f811d04e9ab5e4681dd2f90c4 Mon Sep 17 00:00:00 2001 From: lucha <lucha@paranoici.org> Date: Sat, 23 May 2020 14:42:53 -0700 Subject: [PATCH] include r2db package I am still not sure if we want to use Composer to manage the dependences of r2db, which is only flexihash. It might be easier to simply add flexihash to the repository of r2db, which we never have updated in 7+ years. That way we would not need to include the vendor/ folder into the Noblogs production enviroment. --- README.md | 12 +++++-- composer.json | 34 ++++++++++++------- composer.lock | 92 +++++++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 120 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 2d53f128..9a14d891 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,18 @@ -This is an attempt to re-structure the ai/noblogs-wp> repository using Composer. +This is an attempt to re-structure the ai/noblogs-wp> repository using Composer ([e.g](https://www.smashingmagazine.com/2019/03/composer-wordpress/)) Some rough ideas on how the situation could be improved: - the ```upstream``` branch should disappear. We should not have to care ourselves on keeping a sync of Wordpress source code - we should really just keep the patches and our contributions - we need to be able to build a docker container in the end +- How do we generate the patches? We need to keep the source code of wordpress in the git repo after all, to be able to use git diff. -## About drop-in plugins +## About mu-plugins and drop-in plugins Drop-in plugins, such as ```Hyperdb```, do not have to be installed in the plugins directory, but we have instead to place files directly into wp-content. -We have to thus manually specify where they have to go. +Similarly, mu-plugins are distributed as regular plugins (```wpackagist``` does not have a nice way to select stuff as mu-plugins), but they cannot be dropped in the mu-plugins directory: instead, a single file from their source has to be moved there. + +In order to solve this two problems, we install these plugins outside of the ```app``` sub-directory (since we do not need to distribute them in production), and we manually specify which file we need to move where, using ```dropin-paths```. + +## Gitlab as Composer registry/repository +It might happen [soon](https://gitlab.com/gitlab-org/gitlab/-/issues/15886), in Gitlab version 13.1. diff --git a/composer.json b/composer.json index 02600989..f9ab1b73 100644 --- a/composer.json +++ b/composer.json @@ -14,6 +14,10 @@ { "type": "composer", "url" : "https://wpackagist.org" + }, + { + "type": "vcs", + "url": "git@git.autistici.org:lucha/r2db.git" } ], "require": { @@ -23,24 +27,30 @@ "koodimonni/composer-dropin-installer": "^1.2", "johnpbloch/wordpress": "^5.4", "bjornjohansen/wplang": "^0.1.1", - "wpackagist-theme/minimalism": "1.0.3", - "wpackagist-plugin/hyperdb": "^1.6", - "wpackagist-plugin/disable-wordpress-updates": "^1.6" - }, + "wpackagist-theme/minimalism": "1.0.3", + "wpackagist-plugin/disable-wordpress-updates": "^1.6", + "wpackagist-plugin/hyperdb": "^1.6" + }, + "config": { + "vendor-dir": "app/vendor" + }, "extra": { - "wordpress-install-dir": "web/wp", + "wordpress-install-dir": "app/wp", "installer-paths": { - "web/vendor/{$name}": ["wpackagist-plugin/hyperdb"], - "web/vendor/{$name}/": ["type:wordpress-muplugin"], - "web/app/plugins/{$name}/": ["type:wordpress-plugin"], - "web/app/themes/{$name}/": ["type:wordpress-theme"] + "mu-plugins-src/{$name}": ["wpackagist-plugin/hyperdb", "wpackagist-plugin/disable-wordpress-updates"], + "app/content/mu-plugins/{$name}/" : ["type:wordpress-muplugin"], + "app/content/plugins/{$name}/": ["type:wordpress-plugin"], + "app/content/themes/{$name}/": ["type:wordpress-theme"] }, - "wordpress-language-dir": "web/app/languages", + "wordpress-language-dir": "content/languages/", "wordpress-languages": [ "en_GB", "it_IT" ], "patches-file": "composer.patches.json", "dropin-paths": { - "web/app": ["package:wpackagist-plugin/hyperdb:db.php"], - "web/app/mu-plugins" : ["package:wpackagist-plugin/disable-wordpress-updates:disable-updates.php"] + "app/content/": ["package:wpackagist-plugin/hyperdb:db.php"], + "app/content/mu-plugins/" : ["package:wpackagist-plugin/disable-wordpress-updates:disable-updates.php"] } + }, + "require-dev": { + "lucha/r2db": "dev-master" } } diff --git a/composer.lock b/composer.lock index 07714b15..83ded90d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "d57c53958c37d8c03057c125316c013b", + "content-hash": "89537593d5cc46b09253a3c802eec2a3", "packages": [ { "name": "bjornjohansen/wplang", @@ -463,10 +463,96 @@ "homepage": "https://wordpress.org/themes/minimalism/" } ], - "packages-dev": [], + "packages-dev": [ + { + "name": "flexihash/flexihash", + "version": "v2.0.2", + "source": { + "type": "git", + "url": "https://github.com/pda/flexihash.git", + "reference": "497ba5782606d998f8ab0b4e5942e3a799bec018" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pda/flexihash/zipball/497ba5782606d998f8ab0b4e5942e3a799bec018", + "reference": "497ba5782606d998f8ab0b4e5942e3a799bec018", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8", + "satooshi/php-coveralls": "~1.0", + "squizlabs/php_codesniffer": "^2.3", + "symfony/config": "^2.0.0", + "symfony/console": "^2.0.0", + "symfony/filesystem": "^2.0.0", + "symfony/stopwatch": "^2.0.0", + "symfony/yaml": "^2.0.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Flexihash\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paul Annesley", + "email": "paul@annesley.cc", + "homepage": "http://paul.annesley.cc" + }, + { + "name": "Dom Morgan", + "email": "dom@d3r.com", + "homepage": "https://d3r.com" + } + ], + "description": "Flexihash is a small PHP library which implements consistent hashing", + "homepage": "https://github.com/pda/flexihash", + "time": "2016-04-22T21:03:23+00:00" + }, + { + "name": "lucha/r2db", + "version": "dev-master", + "source": { + "type": "git", + "url": "git@git.autistici.org:lucha/r2db.git", + "reference": "24bf8c45749c08e155dc31dbcd3d070fbc12024f" + }, + "require": { + "flexihash/flexihash": "^2.0" + }, + "type": "library", + "autoload": { + "files": [ + "db-hash.php", + "db-backends.php" + ] + }, + "license": [ + "MIT" + ], + "authors": [ + { + "name": "lucha", + "email": "lucha@paranoici.org" + } + ], + "description": "r2db wordpress database", + "time": "2020-05-23T21:30:55+00:00" + } + ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "lucha/r2db": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { -- GitLab