mirror of
https://github.com/axeloz/filesharing.git
synced 2025-05-06 01:53:55 +02:00
Renaming console commands
This commit is contained in:
parent
5969ff0de0
commit
52059e110d
5 changed files with 16 additions and 19 deletions
|
@ -12,7 +12,7 @@ class CheckRelease extends Command
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'fs:check-release';
|
||||
protected $signature = 'fs:app:releases';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
|
@ -34,10 +34,6 @@ class CheckRelease extends Command
|
|||
}
|
||||
else {
|
||||
foreach ($xml->entry as $e) {
|
||||
// Title must be a version
|
||||
if (! preg_match('~^[0-9]+\.[0-9]+~', $e->title)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Looking for the release link
|
||||
foreach ($e->link->attributes() as $k => $a) {
|
||||
|
@ -57,7 +53,7 @@ class CheckRelease extends Command
|
|||
// Displaying the releases
|
||||
if (count($releases) > 0) {
|
||||
$this->table([
|
||||
'Version', 'Updated', 'Link'
|
||||
'Version', 'Updated', 'Link'
|
||||
], $releases
|
||||
);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ class CreateUser extends Command
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'fs:create-user {login?}';
|
||||
protected $signature = 'fs:user:create {login?}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
|
@ -28,16 +28,16 @@ class CreateUser extends Command
|
|||
*/
|
||||
public function handle()
|
||||
{
|
||||
$login = $this->argument('login');
|
||||
$login = strtolower($this->argument('login'));
|
||||
|
||||
login:
|
||||
// If user was not provided, asking for it
|
||||
if (empty($login)) {
|
||||
$login = $this->ask('Enter the user\'s login');
|
||||
$login = strtolower($this->ask('Enter the user\'s login'));
|
||||
}
|
||||
|
||||
if (! preg_match('~^[a-z0-9]{1,40}$~', $login)) {
|
||||
$this->error('Invalid login format. Must only contains letters and numbers, between 1 and 40 chars');
|
||||
if (! preg_match('~^[a-z0-9]{4,40}$~', $login)) {
|
||||
$this->error('Invalid login format. Must only contains letters and numbers, between 4 and 40 chars');
|
||||
unset($login);
|
||||
goto login;
|
||||
}
|
||||
|
@ -53,16 +53,17 @@ class CreateUser extends Command
|
|||
// Asking for user's password
|
||||
$password = $this->secret('Enter the user\'s password');
|
||||
|
||||
if (strlen($password) < 5) {
|
||||
$this->error('Invalid password format. Must only contains 5 chars minimum');
|
||||
if (! preg_match('~^.{4,100}$i~', $password)) {
|
||||
$this->error('Invalid password format. Must contains between 5 and 100 chars');
|
||||
unset($password);
|
||||
goto password;
|
||||
}
|
||||
|
||||
try {
|
||||
Storage::disk('users')->put($login.'.json', json_encode([
|
||||
'login' => $login,
|
||||
'password' => Hash::make($password)
|
||||
'username' => $login,
|
||||
'password' => Hash::make($password),
|
||||
'bundles' => []
|
||||
]));
|
||||
|
||||
$this->info('User has been created');
|
||||
|
|
|
@ -13,7 +13,7 @@ class PurgeFiles extends Command
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'fs:purge-expired';
|
||||
protected $signature = 'fs:bundle:purge';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
|
|
|
@ -13,7 +13,7 @@ class Kernel extends ConsoleKernel
|
|||
protected function schedule(Schedule $schedule): void
|
||||
{
|
||||
// $schedule->command('inspire')->hourly();
|
||||
$schedule->command('fs:purge-expired')->hourly();
|
||||
$schedule->command('fs:bundle:purge')->hourly();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -80,9 +80,9 @@ The application also uses:
|
|||
- make sure that the PHP process has write permission on the `./storage` folder
|
||||
- generate the Laravel KEY: `php artisan key:generate`
|
||||
- run `cp .env.example .env` and edit `.env` to fit your needs
|
||||
- (optional) you may create your first user `php artisan fs:create-user`
|
||||
- (optional) you may create your first user `php artisan fs:user:create`
|
||||
- start the Laravel scheduler (it will delete expired bundles of the storage). For example `* * * * * /usr/bin/php /path-to-your-project/artisan schedule:run >> /dev/null 2>&1`
|
||||
- (optional) to purge bundles manually, run `php artisan fs:purge-expired`
|
||||
- (optional) to purge bundles manually, run `php artisan fs:bundle:purge`
|
||||
|
||||
|
||||
Use your browser to navigate to your domain name (example: files.yourdomain.com) and **that's it**.
|
||||
|
|
Loading…
Add table
Reference in a new issue