-
Notifications
You must be signed in to change notification settings - Fork 645
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
project-config/sync command, plus apply yawl changes in app/migrate
resolves #3510
- Loading branch information
1 parent
80355ea
commit 37064bb
Showing
3 changed files
with
61 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
/** | ||
* @link https://craftcms.com/ | ||
* @copyright Copyright (c) Pixel & Tonic, Inc. | ||
* @license https://craftcms.github.io/license/ | ||
*/ | ||
|
||
namespace craft\console\controllers; | ||
|
||
use Craft; | ||
use craft\helpers\Console; | ||
use yii\console\Controller; | ||
use yii\console\ExitCode; | ||
|
||
/** | ||
* Manages the project config. | ||
* | ||
* @author Pixel & Tonic, Inc. <[email protected]> | ||
* @since 3.1 | ||
*/ | ||
class ProjectConfigController extends Controller | ||
{ | ||
/** | ||
* Syncs the project config. | ||
* | ||
* @return int | ||
*/ | ||
public function actionSync(): int | ||
{ | ||
if (!Craft::$app->getConfig()->getGeneral()->useProjectConfigFile) { | ||
$this->stdout('Craft is not configured to use project.yaml. Please enable the \'useProjectConfigFile\' config setting in config/general.php.' . PHP_EOL, Console::FG_YELLOW); | ||
return ExitCode::OK; | ||
} | ||
|
||
$this->stdout('Applying changes from project.yaml... ', Console::FG_YELLOW); | ||
try { | ||
Craft::$app->getProjectConfig()->applyYamlChanges(); | ||
} catch (\Throwable $e) { | ||
$this->stderr('error: ' . $e->getMessage() . PHP_EOL, Console::FG_RED); | ||
return ExitCode::UNSPECIFIED_ERROR; | ||
} | ||
|
||
$this->stdout('done' . PHP_EOL, Console::FG_GREEN); | ||
return ExitCode::OK; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters