Skip to content

Commit d61ac9d

Browse files
committed
Move CMS console commands into the CMS module
Moved the following: - \System\Console\ThemeInstall -> \Cms\Console\ThemeInstall - \System\Console\ThemeRemove -> \Cms\Console\ThemeRemove - \System\Console\ThemeList -> \Cms\Console\ThemeList - \System\Console\ThemeUse -> \Cms\Console\ThemeUse - \System\Console\ThemeSync -> \Cms\Console\ThemeSync
1 parent 301ffd1 commit d61ac9d

9 files changed

+46
-21
lines changed

artisan

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
| Composer provides a convenient, automatically generated class loader
1010
| for our application. We just need to utilize it! We'll require it
1111
| into the script here so that we do not have to worry about the
12-
| loading of any our classes "manually". Feels great to relax.
12+
| loading of any of our classes manually. It's great to relax.
1313
|
1414
*/
1515

@@ -40,7 +40,7 @@ $status = $kernel->handle(
4040
| Shutdown The Application
4141
|--------------------------------------------------------------------------
4242
|
43-
| Once Artisan has finished running. We will fire off the shutdown events
43+
| Once Artisan has finished running, we will fire off the shutdown events
4444
| so that any final work may be done by the application before we shut
4545
| down the process. This is the last thing to happen to the request.
4646
|

modules/cms/ServiceProvider.php

+13
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public function register()
3232
{
3333
parent::register('cms');
3434

35+
$this->registerConsole();
3536
$this->registerAssetBundles();
3637
$this->registerComponents();
3738
$this->registerThemeLogging();
@@ -67,6 +68,18 @@ public function boot()
6768
}
6869
}
6970

71+
/**
72+
* Register command line specifics
73+
*/
74+
protected function registerConsole()
75+
{
76+
$this->registerConsoleCommand('theme.install', \Cms\Console\ThemeInstall::class);
77+
$this->registerConsoleCommand('theme.remove', \Cms\Console\ThemeRemove::class);
78+
$this->registerConsoleCommand('theme.list', \Cms\Console\ThemeList::class);
79+
$this->registerConsoleCommand('theme.use', \Cms\Console\ThemeUse::class);
80+
$this->registerConsoleCommand('theme.sync', \Cms\Console\ThemeSync::class);
81+
}
82+
7083
/**
7184
* Register asset bundles
7285
*/

modules/system/console/ThemeInstall.php modules/cms/console/ThemeInstall.php

+16-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php namespace System\Console;
1+
<?php namespace Cms\Console;
22

33
use File;
44
use Cms\Classes\Theme;
@@ -13,7 +13,7 @@
1313
*
1414
* This adds a new theme by requesting it from the Winter marketplace.
1515
*
16-
* @package winter\wn-system-module
16+
* @package winter\wn-cms-module
1717
* @author Alexey Bobkov, Samuel Georges
1818
*/
1919
class ThemeInstall extends Command
@@ -36,6 +36,10 @@ class ThemeInstall extends Command
3636
*/
3737
public function handle()
3838
{
39+
echo 'wtf';
40+
\Winter\Storm\Network\Http::post('https://google.com/');
41+
42+
3943
$themeName = $this->argument('name');
4044
$argDirName = $this->argument('dirName');
4145

@@ -59,10 +63,14 @@ public function handle()
5963

6064
$themeDetails = $updateManager->requestThemeDetails($themeName);
6165

66+
dd('after requestThemeDetails');
67+
6268
if ($themeManager->isInstalled($themeDetails['code'])) {
6369
return $this->error(sprintf('The theme %s is already installed.', $themeDetails['code']));
6470
}
6571

72+
dd($themeName);
73+
6674
if (Theme::exists($themeDetails['code'])) {
6775
return $this->error(sprintf('A theme named %s already exists.', $themeDetails['code']));
6876
}
@@ -81,6 +89,8 @@ public function handle()
8189
return;
8290
}
8391

92+
dd($themeName);
93+
8494
$this->info('Downloading theme...');
8595
$updateManager->downloadTheme($themeDetails['code'], $themeDetails['hash']);
8696

@@ -104,12 +114,14 @@ public function handle()
104114

105115
$dirName = $argDirName;
106116
}
117+
dd($themeName);
107118

108119
$this->info(sprintf('The theme %s has been installed. (now %s)', $themeDetails['code'], $dirName));
109-
}
110-
catch (Exception $ex) {
120+
} catch (\Throwable $ex) {
111121
$this->error($ex->getMessage());
112122
}
123+
124+
dd($themeName);
113125
}
114126

115127
/**

modules/system/console/ThemeList.php modules/cms/console/ThemeList.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php namespace System\Console;
1+
<?php namespace Cms\Console;
22

33
use Illuminate\Console\Command;
44
use Symfony\Component\Console\Input\InputOption;
@@ -11,7 +11,7 @@
1111
*
1212
* This lists all the available themes in the system. It also shows the active theme.
1313
*
14-
* @package winter\wn-system-module
14+
* @package winter\wn-cms-module
1515
* @author Alexey Bobkov, Samuel Georges
1616
*/
1717
class ThemeList extends Command

modules/system/console/ThemeRemove.php modules/cms/console/ThemeRemove.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php namespace System\Console;
1+
<?php namespace Cms\Console;
22

33
use Cms\Classes\Theme;
44
use Cms\Classes\ThemeManager;
@@ -12,7 +12,7 @@
1212
*
1313
* This completely deletes an existing theme, including all files and directories.
1414
*
15-
* @package winter\wn-system-module
15+
* @package winter\wn-cms-module
1616
* @author Alexey Bobkov, Samuel Georges
1717
*/
1818
class ThemeRemove extends Command

modules/system/console/ThemeSync.php modules/cms/console/ThemeSync.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php namespace System\Console;
1+
<?php namespace Cms\Console;
22

33
use App;
44
use Event;
@@ -19,7 +19,7 @@
1919
* - --target defaults to "filesystem", the source will whichever of filesystem vs database is not the target
2020
* - --force bypasses the confirmation request
2121
*
22-
* @package winter\wn-system-module
22+
* @package winter\wn-cms-module
2323
* @author Luke Towers
2424
*/
2525
class ThemeSync extends Command

modules/system/console/ThemeUse.php modules/cms/console/ThemeUse.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php namespace System\Console;
1+
<?php namespace Cms\Console;
22

33
use Cms\Classes\Theme;
44
use Illuminate\Console\Command;
@@ -10,7 +10,7 @@
1010
*
1111
* This switches the active theme to another one, saved to the database.
1212
*
13-
* @package winter\wn-system-module
13+
* @package winter\wn-cms-module
1414
* @author Alexey Bobkov, Samuel Georges
1515
*/
1616
class ThemeUse extends Command

modules/system/ServiceProvider.php

-6
Original file line numberDiff line numberDiff line change
@@ -271,12 +271,6 @@ protected function registerConsole()
271271
$this->registerConsoleCommand('plugin.refresh', 'System\Console\PluginRefresh');
272272
$this->registerConsoleCommand('plugin.rollback', 'System\Console\PluginRollback');
273273
$this->registerConsoleCommand('plugin.list', 'System\Console\PluginList');
274-
275-
$this->registerConsoleCommand('theme.install', 'System\Console\ThemeInstall');
276-
$this->registerConsoleCommand('theme.remove', 'System\Console\ThemeRemove');
277-
$this->registerConsoleCommand('theme.list', 'System\Console\ThemeList');
278-
$this->registerConsoleCommand('theme.use', 'System\Console\ThemeUse');
279-
$this->registerConsoleCommand('theme.sync', 'System\Console\ThemeSync');
280274
}
281275

282276
/*

modules/system/classes/UpdateManager.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -890,10 +890,16 @@ public function setNotesOutput($output)
890890
*/
891891
public function requestServerData($uri, $postData = [])
892892
{
893-
$result = Http::post($this->createServerUrl($uri), function ($http) use ($postData) {
893+
// dd(Http::class, (new \ReflectionClass(Http::class))->getFileName());
894+
895+
// dd($this->createServerUrl($uri));
896+
897+
$result = \Winter\Storm\Network\Http::post($this->createServerUrl($uri), function ($http) use ($postData) {
894898
$this->applyHttpAttributes($http, $postData);
895899
});
896900

901+
dd($result, 'after Http::post');
902+
897903
if ($result->code == 404) {
898904
throw new ApplicationException(Lang::get('system::lang.server.response_not_found'));
899905
}

0 commit comments

Comments
 (0)