Add october:util set project --projectId=id console command (#3946)
Implements #3944. Credit to @obuchmann.
This commit is contained in:
parent
41b8bb84f1
commit
cd275554f2
|
|
@ -10,6 +10,7 @@ use Symfony\Component\Console\Input\InputArgument;
|
|||
use System\Classes\UpdateManager;
|
||||
use System\Classes\CombineAssets;
|
||||
use Exception;
|
||||
use System\Models\Parameter;
|
||||
|
||||
/**
|
||||
* Console command for other utility commands.
|
||||
|
|
@ -27,6 +28,7 @@ use Exception;
|
|||
* - compile scss: Compile registered SCSS files only.
|
||||
* - compile lang: Compile registered Language files only.
|
||||
* - set build: Pull the latest stable build number from the update gateway and set it as the current build number.
|
||||
* - set project --projectId=<id>: Set the projectId for this october instance.
|
||||
*
|
||||
* @package october\system
|
||||
* @author Alexey Bobkov, Samuel Georges
|
||||
|
|
@ -98,6 +100,7 @@ class OctoberUtil extends Command
|
|||
return [
|
||||
['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production.'],
|
||||
['debug', null, InputOption::VALUE_NONE, 'Run the operation in debug / development mode.'],
|
||||
['projectId', null, InputOption::VALUE_REQUIRED, 'Specify a projectId for set project'],
|
||||
];
|
||||
}
|
||||
|
||||
|
|
@ -328,4 +331,24 @@ class OctoberUtil extends Command
|
|||
}
|
||||
}
|
||||
|
||||
protected function utilSetProject()
|
||||
{
|
||||
$projectId = $this->option('projectId');
|
||||
|
||||
if (empty($projectId)){
|
||||
$this->error("No projectId defined, use --projectId=<id> to set a projectId");
|
||||
return;
|
||||
}
|
||||
|
||||
$manager = UpdateManager::instance();
|
||||
$result = $manager->requestProjectDetails($projectId);
|
||||
|
||||
Parameter::set([
|
||||
'system::project.id' => $projectId,
|
||||
'system::project.name' => $result['name'],
|
||||
'system::project.owner' => $result['owner'],
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue