Skip to content

Commit

Permalink
Fixes updater and backup creator
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelfolaron committed Nov 27, 2024
1 parent 87e3774 commit 22d28a5
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 23 deletions.
4 changes: 3 additions & 1 deletion app/Command/AddUserCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/
#[AsCommand(
name: 'user:add',
description: 'Add a new user',
description: 'Add a new user (email, password, role required options)',
)]
class AddUserCommand extends Command
{
Expand Down Expand Up @@ -139,6 +139,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int
return Command::FAILURE;
}

$io->success('User created successfully');

return Command::SUCCESS;
}
}
2 changes: 1 addition & 1 deletion app/Command/BackupDbCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$output = [];
$cmd = sprintf(
'mysqldump --column-statistics=0 --user=%s --password=%s --host=%s %s --port=%s --result-file=%s 2>&1',
'mysqldump --column-statistics=0 --user=\'%s\' --password=\'%s\' --host=%s %s --port=%s --result-file=%s 2>&1',
$config->dbUser,
$config->dbPassword,
$config->dbHost == 'localhost' ? '127.0.0.1' : $config->dbHost,
Expand Down
2 changes: 1 addition & 1 deletion app/Command/MigrateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
#[AsCommand(
name: 'db:migrate',
description: 'Runs and pending Database Migrations',
description: 'Runs and pending Leantime Database Migrations',
)]
class MigrateCommand extends Command
{
Expand Down
2 changes: 1 addition & 1 deletion app/Command/UpdateLeantime.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
#[AsCommand(
name: 'system:update',
description: 'Updates the system',
description: 'Updates Leantime to the latest version from Github',
)]
class UpdateLeantime extends Command
{
Expand Down
31 changes: 27 additions & 4 deletions app/Core/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Leantime\Core;

use Illuminate\Log\LogServiceProvider;
use Illuminate\Routing\Router;
use Illuminate\Routing\RoutingServiceProvider;
use Leantime\Core\Configuration\Environment;
use Leantime\Core\Events\DispatchesEvents;
Expand Down Expand Up @@ -98,21 +97,45 @@ protected function registerBaseServiceProviders()

public function registerLeantimeAliases()
{

foreach ([
'app' => [self::class, \Illuminate\Foundation\Application::class, \Illuminate\Contracts\Container\Container::class, \Illuminate\Contracts\Foundation\Application::class, \Psr\Container\ContainerInterface::class],
'auth' => [\Illuminate\Auth\AuthManager::class, \Illuminate\Contracts\Auth\Factory::class],
'auth.driver' => [\Illuminate\Contracts\Auth\Guard::class],
'blade.compiler' => [\Illuminate\View\Compilers\BladeCompiler::class],
'cache' => [\Illuminate\Cache\CacheManager::class, \Illuminate\Contracts\Cache\Factory::class],
'cache.store' => [\Illuminate\Cache\Repository::class, \Illuminate\Contracts\Cache\Repository::class, \Psr\SimpleCache\CacheInterface::class],
'cache.psr6' => [\Symfony\Component\Cache\Adapter\Psr16Adapter::class, \Symfony\Component\Cache\Adapter\AdapterInterface::class, \Psr\Cache\CacheItemPoolInterface::class],
'config' => [Environment::class, \Illuminate\Config\Repository::class, \Illuminate\Contracts\Config\Repository::class],
'cookie' => [\Illuminate\Cookie\CookieJar::class, \Illuminate\Contracts\Cookie\Factory::class, \Illuminate\Contracts\Cookie\QueueingFactory::class],
'db' => [\Illuminate\Database\DatabaseManager::class, \Illuminate\Database\ConnectionResolverInterface::class],
'db.connection' => [\Illuminate\Database\Connection::class, \Illuminate\Database\ConnectionInterface::class],
'db.schema' => [\Illuminate\Database\Schema\Builder::class],
'encrypter' => [\Illuminate\Encryption\Encrypter::class, \Illuminate\Contracts\Encryption\Encrypter::class, \Illuminate\Contracts\Encryption\StringEncrypter::class],
'events' => [\Leantime\Core\Events\EventDispatcher::class, \Illuminate\Events\Dispatcher::class, \Illuminate\Contracts\Events\Dispatcher::class],
'request' => [IncomingRequest::class, ApiRequest::class, Console\CliRequest::class, \Illuminate\Http\Request::class, \Symfony\Component\HttpFoundation\Request::class],
'files' => [\Illuminate\Filesystem\Filesystem::class],
'filesystem' => [\Illuminate\Filesystem\FilesystemManager::class, \Illuminate\Contracts\Filesystem\Factory::class],
'filesystem.disk' => [\Illuminate\Contracts\Filesystem\Filesystem::class],
'filesystem.cloud' => [\Illuminate\Contracts\Filesystem\Cloud::class],
'hash' => [\Illuminate\Hashing\HashManager::class],
'hash.driver' => [\Illuminate\Contracts\Hashing\Hasher::class],
//'translator' => [\Illuminate\Translation\Translator::class, \Illuminate\Contracts\Translation\Translator::class],
'log' => [\Illuminate\Log\LogManager::class, \Psr\Log\LoggerInterface::class],
//'mail.manager' => [\Illuminate\Mail\MailManager::class, \Illuminate\Contracts\Mail\Factory::class],
//'mailer' => [\Illuminate\Mail\Mailer::class, \Illuminate\Contracts\Mail\Mailer::class, \Illuminate\Contracts\Mail\MailQueue::class],
//'auth.password' => [\Illuminate\Auth\Passwords\PasswordBrokerManager::class, \Illuminate\Contracts\Auth\PasswordBrokerFactory::class],
//'auth.password.broker' => [\Illuminate\Auth\Passwords\PasswordBroker::class, \Illuminate\Contracts\Auth\PasswordBroker::class],
//'queue' => [\Illuminate\Queue\QueueManager::class, \Illuminate\Contracts\Queue\Factory::class, \Illuminate\Contracts\Queue\Monitor::class],
//'queue.connection' => [\Illuminate\Contracts\Queue\Queue::class],
//'queue.failer' => [\Illuminate\Queue\Failed\FailedJobProviderInterface::class],
'redirect' => [\Illuminate\Routing\Redirector::class],
'redis' => [\Illuminate\Redis\RedisManager::class, \Illuminate\Contracts\Redis\Factory::class],
'redis.connection' => [\Illuminate\Redis\Connections\Connection::class, \Illuminate\Contracts\Redis\Connection::class],
'request' => [IncomingRequest::class, ApiRequest::class, Console\CliRequest::class, \Illuminate\Http\Request::class, \Symfony\Component\HttpFoundation\Request::class],
'router' => [\Illuminate\Routing\Router::class, \Illuminate\Contracts\Routing\Registrar::class, \Illuminate\Contracts\Routing\BindingRegistrar::class],
'session' => [\Illuminate\Session\SessionManager::class],
'session.store' => [\Illuminate\Session\Store::class, \Illuminate\Contracts\Session\Session::class],
'router' => [Router::class, \Illuminate\Contracts\Routing\Registrar::class, \Illuminate\Contracts\Routing\BindingRegistrar::class],
'url' => [\Illuminate\Routing\UrlGenerator::class, \Illuminate\Contracts\Routing\UrlGenerator::class],
'validator' => [\Illuminate\Validation\Factory::class, \Illuminate\Contracts\Validation\Factory::class],
'view' => [\Illuminate\View\Factory::class, \Illuminate\Contracts\View\Factory::class],
] as $key => $aliases) {
foreach ($aliases as $alias) {
Expand Down
7 changes: 5 additions & 2 deletions app/Core/Bootstrap/LoadConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ public function bootstrap(Application $app)
});
}

//Need to run this in case config is coming from cache
$this->setBaseConstants($app['config']->get('appUrl'), $app);

$config = $app['config'];

self::dispatchEvent('config_initialized');
Expand Down Expand Up @@ -121,9 +124,9 @@ public function setBaseConstants($appUrl, $app)
if (! defined('BASE_URL')) {
if (isset($appUrl) && ! empty($appUrl)) {
define('BASE_URL', $appUrl);

} else {
define('BASE_URL', ! empty($app['request']) ? $app['request']->getSchemeAndHttpHost() : 'http://localhost');
$appUrl = ! empty($app['request']) ? $app['request']->getSchemeAndHttpHost() : 'http://localhost';
define('BASE_URL', $appUrl);
}
}

Expand Down
8 changes: 7 additions & 1 deletion app/Core/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

namespace Leantime\Core\Providers;

use Illuminate\Foundation\Console\AboutCommand;
use Illuminate\Support\ServiceProvider;
use Leantime\Core\Configuration\AppSettings;

class AppServiceProvider extends ServiceProvider
{
Expand All @@ -19,6 +21,10 @@ public function register(): void
*/
public function boot(): void
{
//
AboutCommand::add('Environment', [
'Leantime App Version' => fn () => $this->app->make(AppSettings::class)->appVersion,
'Leantime Db Version' => fn () => $this->app->make(AppSettings::class)->dbVersion,
]);

}
}
6 changes: 3 additions & 3 deletions app/Core/Providers/CliServices.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ class CliServices extends ServiceProvider implements DeferrableProvider
'ConfigCache' => ConfigCacheCommand::class,
'ConfigClear' => ConfigClearCommand::class,
'ConfigShow' => ConfigShowCommand::class,
//'Db' => DbCommand::class,
//'DbMonitor' => DatabaseMonitorCommand::class,
'Db' => DbCommand::class,
'DbMonitor' => DatabaseMonitorCommand::class,
//'DbPrune' => PruneCommand::class,
//'DbShow' => ShowCommand::class,
'DbShow' => ShowCommand::class,
//'DbTable' => DatabaseTableCommand::class,
//'DbWipe' => WipeCommand::class,
'Down' => DownCommand::class,
Expand Down
8 changes: 0 additions & 8 deletions app/Core/Providers/FileSystemServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@ public function register()

$this->registerFlysystem();

$this->app->alias(\Illuminate\Filesystem\Filesystem::class, 'files');

$this->app->alias(\Illuminate\Filesystem\FilesystemManager::class, 'filesystem');
$this->app->alias(\Illuminate\Filesystem\FilesystemManager::class, \Illuminate\Contracts\Filesystem\Factory::class);

$this->app->alias(\Illuminate\Contracts\Filesystem\Filesystem::class, 'filesystem.disk');
$this->app->alias(\Illuminate\Contracts\Filesystem\Cloud::class, 'filesystem.cloud');

}

public function prepareConfig()
Expand Down
2 changes: 1 addition & 1 deletion app/Plugins

0 comments on commit 22d28a5

Please sign in to comment.