mirror of
https://github.com/YunoHost-Apps/flarum_ynh.git
synced 2024-09-03 18:36:24 +02:00
parent
76d6c8f7b9
commit
5945b3c89d
2 changed files with 75 additions and 5 deletions
|
@ -129,10 +129,14 @@ adminemail=$(ynh_user_get_info $admin mail)
|
|||
sed -i "s%YNH_ADMIN_EMAIL%$adminemail%g" ../sources/configuration.yml
|
||||
sed -i "s@YNH_FORUM_TITLE@$title@g" ../sources/configuration.yml
|
||||
sudo cp ../sources/configuration.yml $final_path
|
||||
#sudo su - www-data -s /bin/bash -c "cd $final_path && php -d memory_limit=-1 flarum install -f configuration.yml"
|
||||
# Workaround, waiting for beta6
|
||||
sudo \cp ../sources/Server.php $final_path/vendor/flarum/core/src/Console/Server.php
|
||||
sudo su - www-data -s /bin/bash -c "cd $final_path && php -d memory_limit=-1 flarum install -f configuration.yml"
|
||||
sudo rm $final_path/configuration.yml
|
||||
fi
|
||||
|
||||
# Tell user the MySQL credentials for post-installation
|
||||
echo "MySQL database user is " $dbuser
|
||||
echo "MySQL database password is " $dbpass
|
||||
# Generate and add root token for user creation and deletion
|
||||
roottoken=$(ynh_string_random 40)
|
||||
rootsql="INSERT INTO api_keys VALUES ('"$roottoken"')"
|
||||
ynh_mysql_execute_as_root "$rootsql" $dbname
|
||||
ynh_app_setting_set "$app" root_token "$roottoken"
|
||||
fi
|
||||
|
|
66
sources/Server.php
Normal file
66
sources/Server.php
Normal file
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* (c) Toby Zerner <toby.zerner@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Console;
|
||||
|
||||
use Flarum\Console\Command\GenerateExtensionCommand;
|
||||
use Flarum\Console\Command\GenerateMigrationCommand;
|
||||
use Flarum\Debug\Console\CacheClearCommand;
|
||||
use Flarum\Debug\Console\InfoCommand;
|
||||
use Flarum\Foundation\AbstractServer;
|
||||
use Flarum\Install\Console\InstallCommand;
|
||||
use Flarum\Update\Console\MigrateCommand;
|
||||
use Symfony\Component\Console\Application;
|
||||
|
||||
class Server extends AbstractServer
|
||||
{
|
||||
public function listen()
|
||||
{
|
||||
$console = $this->getConsoleApplication();
|
||||
|
||||
exit($console->run());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Application
|
||||
*/
|
||||
protected function getConsoleApplication()
|
||||
{
|
||||
$app = $this->getApp();
|
||||
$console = new Application('Flarum', $app->version());
|
||||
|
||||
$app->register('Flarum\Install\InstallServiceProvider');
|
||||
|
||||
$commands = [
|
||||
InstallCommand::class,
|
||||
MigrateCommand::class,
|
||||
GenerateExtensionCommand::class,
|
||||
GenerateMigrationCommand::class,
|
||||
];
|
||||
|
||||
if ($app->isInstalled()) {
|
||||
$commands = array_merge($commands, [
|
||||
InfoCommand::class,
|
||||
CacheClearCommand::class
|
||||
]);
|
||||
}
|
||||
|
||||
foreach ($commands as $command) {
|
||||
$console->add($app->make(
|
||||
$command,
|
||||
['config' => $app->isInstalled() ? $app->make('flarum.config') : []]
|
||||
));
|
||||
}
|
||||
|
||||
return $console;
|
||||
}
|
||||
}
|
||||
|
Loading…
Add table
Reference in a new issue