Skip to content

Commit 5274873

Browse files
authored
Merge branch 'wintercms:develop' into fix/artisan-migrate-force
2 parents fb27763 + 513d062 commit 5274873

File tree

3 files changed

+33
-33
lines changed

3 files changed

+33
-33
lines changed

modules/backend/widgets/lists/partials/_list_head_row.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<tr>
2-
<?php if ($showCheckboxes): ?>
2+
<?php if ($showCheckboxes && count($records)): ?>
33
<th class="list-checkbox">
44
<div class="checkbox custom-checkbox nolabel">
55
<input type="checkbox" id="<?= $this->getId('checkboxAll') ?>" />

modules/system/console/WinterEnv.php

Lines changed: 19 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php namespace System\Console;
1+
<?php
2+
3+
namespace System\Console;
24

35
use App;
46
use Winter\Storm\Parse\EnvFile;
@@ -16,11 +18,21 @@
1618
*/
1719
class WinterEnv extends Command
1820
{
21+
use \Illuminate\Console\ConfirmableTrait;
22+
1923
/**
2024
* The console command name.
2125
*/
2226
protected $name = 'winter:env';
2327

28+
/**
29+
* The name and signature of the console command.
30+
*
31+
* @var string
32+
*/
33+
protected $signature = 'winter:env
34+
{--force : Force the operation to run when in production}';
35+
2436
/**
2537
* The console command description.
2638
*/
@@ -55,8 +67,12 @@ public function __construct()
5567
public function handle(): int
5668
{
5769
if (
58-
file_exists($this->laravel->environmentFilePath())
59-
&& !$this->confirmToProceed()
70+
!$this->confirmToProceed(
71+
'The .env file already exists. Proceeding may overwrite some values!',
72+
function () {
73+
return file_exists($this->laravel->environmentFilePath()) && $this->getLaravel()->environment() === 'production';
74+
}
75+
)
6076
) {
6177
return 1;
6278
}
@@ -69,34 +85,6 @@ public function handle(): int
6985
return 0;
7086
}
7187

72-
/**
73-
* Confirm before proceeding with the action.
74-
*
75-
* This method only asks for confirmation in production.
76-
*
77-
* @param string $warning
78-
* @param \Closure|bool|null $callback
79-
* @return bool
80-
*/
81-
public function confirmToProceed($warning = 'Application In Production!', $callback = null)
82-
{
83-
if ($this->hasOption('force') && $this->option('force')) {
84-
return true;
85-
}
86-
87-
$this->alert('The .env file already exists. Proceeding may overwrite some values!');
88-
89-
$confirmed = $this->confirm('Do you really wish to run this command?');
90-
91-
if (!$confirmed) {
92-
$this->comment('Command Canceled!');
93-
94-
return false;
95-
}
96-
97-
return true;
98-
}
99-
10088
/**
10189
* Get the full path of a config file
10290
* @param string $config

modules/system/console/asset/AssetCreate.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414

1515
abstract class AssetCreate extends Command
1616
{
17-
protected const TYPE_THEME = 'theme';
17+
protected const TYPE_MODULE = 'module';
1818
protected const TYPE_PLUGIN = 'plugin';
19+
protected const TYPE_THEME = 'theme';
1920

2021
/**
2122
* @var string The console command description.
@@ -114,6 +115,17 @@ protected function getPackagePathType(string $package): array
114115
return [null, null];
115116
}
116117

118+
if (str_starts_with($package, 'module-')) {
119+
if (
120+
($modulePath = base_path('modules') . '/' . str_after($package, 'module-'))
121+
&& File::exists($modulePath)
122+
) {
123+
return [$modulePath, static::TYPE_MODULE];
124+
}
125+
126+
return [null, null];
127+
}
128+
117129
if ($plugin = PluginManager::instance()->findByIdentifier($package)) {
118130
return [$plugin->getPluginPath(), static::TYPE_PLUGIN];
119131
}

0 commit comments

Comments
 (0)