Current Behavior
I want to install Flarum, but when it's time for the Markdown (or BBCode) extension to migrate it throws an error.
Steps to Reproduce
composer.json
{
"name": "flarum/flarum",
"description": "Delightfully simple forum software.",
"type": "project",
"keywords": ["forum", "discussion"],
"homepage": "https://flarum.org/",
"license": "MIT",
"authors": [
{
"name": "Toby Zerner",
"email": "[email protected]"
},
{
"name": "Franz Liedke",
"email": "[email protected]"
}
],
"support": {
"issues": "https://github.com/flarum/core/issues",
"source": "https://github.com/flarum/flarum",
"docs": "https://flarum.org/docs/"
},
"require": {
"flarum/core": "dev-master",
"flarum/flarum-ext-english": "dev-master",
"flarum/flarum-ext-likes": "dev-master",
"flarum/flarum-ext-lock": "dev-master",
"flarum/flarum-ext-markdown": "dev-master",
"flarum/flarum-ext-mentions": "dev-master",
"flarum/flarum-ext-sticky": "dev-master",
"flarum/flarum-ext-subscriptions": "dev-master",
"flarum/flarum-ext-suspend": "dev-master",
"flarum/flarum-ext-tags": "dev-master"
},
"config": {
"preferred-install": "dist",
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true
}
install.json
{
"debug": "true",
"baseUrl": "http://flarumsecond.localhost",
"databaseConfiguration": {
"driver": "mysql",
"host": "localhost",
"port": 3306,
"database": "flarum_second",
"username": "flarum",
"password": "password",
"prefix": ""
},
"adminUser": {
"username": "admin",
"password": "password",
"password_confirmation": "password",
"email": "[email protected]"
},
"settings": {
}
}
Run the install command
./flarum install -f install.json
After the Flarum migrations, there will be an error when migrating the Markdown extension
Enabling extension: flarum-markdown
In Container.php line 752:
Class cache.store does not exist
See the full log.
A similar problem also happens when installing on the web, but there isn't a nice error message shown, instead of the message mentioned above there's another error:
Error booting Flarum: Too few arguments to function Illuminate\Support\Manager::createDriver(), 0 passed in D:\lukas\Coding\PhpstormProjects\flarum\flarum\vendor\illuminate\support\Manager.php on line 88 and exactly 1 expected
Read more about this on #1169.
Expected Behavior
It should install without any error.
Environment
$ ./flarum info
Flarum core 0.1.0-beta.7 (737d33826e9d4caf1d07fa8ee5509d1ff06066d6)
PHP version: 7.1.11
Loaded extensions: Core, bcmath, calendar, ctype, date, filter, hash, iconv, json, mcrypt, SPL, pcre, readline, Reflection, session, standard, mysqlnd, tokenizer, zip, zlib, libxml, dom, PDO, bz2, SimpleXML, xml, wddx, xmlreader, xmlwriter, openssl, curl, fileinfo, gd, gettext, mbstring, exif, mysqli, pdo_mysql, pdo_sqlite, soap, sockets, sqlite3, tidy, Phar, ftp
+----------------------+------------+--------+
| Flarum Extensions | | |
+----------------------+------------+--------+
| ID | Version | Commit |
+----------------------+------------+--------+
| flarum-english | dev-master | |
| flarum-likes | dev-master | |
| flarum-lock | dev-master | |
| flarum-mentions | dev-master | |
| flarum-sticky | dev-master | |
| flarum-subscriptions | dev-master | |
| flarum-suspend | dev-master | |
| flarum-tags | dev-master | |
+----------------------+------------+--------+
Base URL: http://flarumsecond.localhost
Installation path: P:\Programme\XAMPP\htdocs\flarum-test2
Debug mode: ON
Don't forget to turn off debug mode! It should never be turned on in a production system.
Possible Solution
I'll look into this tomorrow.
Additional Context
The installation works fine with the latest beta build (0.1-beta7) and when using the latest repository (development) version without the Markdown and BBCode extensions. See this installation log, where I excluded those extensions from the composer.json.
@franzliedke seems like this could be related to the Sites rewrite?
Okay I found the reason, why both of those extensions, which extend a formatter, are failing to install.
The Extend\Formatter depends on the "actucal" Formatter\Formatter.
This Formatter\Formatter depends on a cache Repository (See Formatter#L44).
A possible soultion could to be register the cache after the main Flarum application is installed like it's done for an installed application.
Do we need the extenders to run when the app wasn't yet installed? If so it would probably be best to have a unit test go over all extenders in both states of the application.
Actually, we don't need those extenders during the installation. The formatter extender just flushes a entry from the cache, but maybe there are others.
Do you suggest adding a new method in the LifecycleInterface which indicates whether the onEnable method needs to be called during the installtion or just a try{}catch or did I understand the test thing fully wrong?
--- Edit ---
I got it 🤦♂️ Just a real test.
I've created a pull request to show a possible solution to this problem.
Soon I'll also add tests to the PR.
This requires quite a bit of restructuring in the installer, but I am 70% there.
Okay, 95%. One TODO and a bit of cleanup (e.g. PHP documentation left). I might get the PR done tomorrow. :zzz:
There you go: #1617 :sweat_smile:
Most helpful comment
This requires quite a bit of restructuring in the installer, but I am 70% there.