Skip to content

Commit 602c301

Browse files
salmanahmad-rtsmtaha01
authored andcommitted
14054 - INTERNE - Sugarcli - adaptation to the new php version
1 parent d34eb20 commit 602c301

4 files changed

Lines changed: 58 additions & 4 deletions

File tree

USAGE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ Commands list
7777
* [rels:dumptofile](#relsdumptofile)
7878
* [rels:loadfromfile](#relsloadfromfile)
7979
* [rels:status](#relsstatus)
80+
* [rels:rebuild](#relsrebuild)
8081

8182
**system:**
8283

build/sugarcli.phar

775 Bytes
Binary file not shown.

src/Console/Application.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ public function registerAllCommands()
148148
$commands[] = new \SugarCli\Console\Command\Package\ScanCommand();
149149
$commands[] = new \SugarCli\Console\Command\Relationships\RelationshipsDumpCommand();
150150
$commands[] = new \SugarCli\Console\Command\Relationships\RelationshipsLoadCommand();
151+
$commands[] = new \SugarCli\Console\Command\Relationships\RelationshipsRebuildCommand();
151152
$commands[] = new \SugarCli\Console\Command\Relationships\RelationshipsStatusCommand();
152153
$commands[] = new \SugarCli\Console\Command\SelfUpdateCommand();
153154
$commands[] = new \SugarCli\Console\Command\System\MaintenanceCommand();
@@ -272,10 +273,6 @@ public function run(InputInterface $input = null, OutputInterface $output = null
272273
*/
273274
public function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
274275
{
275-
if ($this->isRunByRoot() && !$this->isWhitelistedForRoot($command)) {
276-
$output->writeln('<error>You are not allowed to run this command as root.</error>');
277-
return ExitCode::EXIT_COMMAND_AS_ROOT_DENIED;
278-
}
279276
return parent::doRunCommand($command, $input, $output);
280277
}
281278

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?php
2+
/**
3+
* SugarCLI
4+
*
5+
* PHP Version 5.3 -> 5.4
6+
* SugarCRM Versions 6.5 - 7.6
7+
*
8+
* @author Rémi Sauvat
9+
* @author Emmanuel Dyan
10+
* @copyright 2005-2015 iNet Process
11+
*
12+
* @package inetprocess/sugarcrm
13+
*
14+
* @license Apache License 2.0
15+
*
16+
* @link http://www.inetprocess.com
17+
*/
18+
19+
namespace SugarCli\Console\Command\Relationships;
20+
21+
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
22+
use Symfony\Component\Console\Input\InputInterface;
23+
use Symfony\Component\Console\Output\OutputInterface;
24+
use Inet\SugarCRM\Database\Relationship;
25+
use Inet\SugarCRM\Exception\SugarException;
26+
use SugarCli\Console\ExitCode;
27+
use Inet\SugarCRM\System as SugarSystem;
28+
use Symfony\Component\Console\Helper\ProgressIndicator;
29+
30+
class RelationshipsRebuildCommand extends AbstractRelationshipsCommand
31+
{
32+
protected function configure()
33+
{
34+
parent::configure();
35+
$this->setName('rels:rebuild')
36+
->setDescription('Rebuild the relationships')
37+
->setHelp(<<<EOH
38+
EOH
39+
)->enableStandardOption('user-id');
40+
}
41+
42+
protected function execute(InputInterface $input, OutputInterface $output)
43+
{
44+
$output->writeln('<comment>Rebuild Relationship</comment>: ');
45+
$progress = new ProgressIndicator($output);
46+
47+
$progress->start('Starting rebuild relationship...');
48+
$progress->advance();
49+
50+
$progress->setMessage('Working...');
51+
$sugarEP = $this->getService('sugarcrm.entrypoint');
52+
$sugarSystem = new SugarSystem($sugarEP);
53+
$sugarSystem->rebuildRelationship($input->getOption('user-id'));
54+
$progress->finish('<info>rebuild relationship Done.</info>');
55+
}
56+
}

0 commit comments

Comments
 (0)