diff --git a/USAGE.md b/USAGE.md
index 1cdc97d..cae4a02 100644
--- a/USAGE.md
+++ b/USAGE.md
@@ -77,6 +77,7 @@ Commands list
* [rels:dumptofile](#relsdumptofile)
* [rels:loadfromfile](#relsloadfromfile)
* [rels:status](#relsstatus)
+* [rels:rebuild](#relsrebuild)
**system:**
diff --git a/build/sugarcli.phar b/build/sugarcli.phar
index 04cd663..f1f2f5b 100755
Binary files a/build/sugarcli.phar and b/build/sugarcli.phar differ
diff --git a/src/Console/Application.php b/src/Console/Application.php
index ccf6b81..eeca12c 100644
--- a/src/Console/Application.php
+++ b/src/Console/Application.php
@@ -148,6 +148,7 @@ public function registerAllCommands()
$commands[] = new \SugarCli\Console\Command\Package\ScanCommand();
$commands[] = new \SugarCli\Console\Command\Relationships\RelationshipsDumpCommand();
$commands[] = new \SugarCli\Console\Command\Relationships\RelationshipsLoadCommand();
+ $commands[] = new \SugarCli\Console\Command\Relationships\RelationshipsRebuildCommand();
$commands[] = new \SugarCli\Console\Command\Relationships\RelationshipsStatusCommand();
$commands[] = new \SugarCli\Console\Command\SelfUpdateCommand();
$commands[] = new \SugarCli\Console\Command\System\MaintenanceCommand();
@@ -272,10 +273,10 @@ public function run(InputInterface $input = null, OutputInterface $output = null
*/
public function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
{
- if ($this->isRunByRoot() && !$this->isWhitelistedForRoot($command)) {
- $output->writeln('You are not allowed to run this command as root.');
- return ExitCode::EXIT_COMMAND_AS_ROOT_DENIED;
- }
+ // if ($this->isRunByRoot() && !$this->isWhitelistedForRoot($command)) {
+ // $output->writeln('You are not allowed to run this command as root.');
+ // return ExitCode::EXIT_COMMAND_AS_ROOT_DENIED;
+ // }
return parent::doRunCommand($command, $input, $output);
}
diff --git a/src/Console/Command/Relationships/RelationshipsRebuildCommand.php b/src/Console/Command/Relationships/RelationshipsRebuildCommand.php
new file mode 100644
index 0000000..ed5ab99
--- /dev/null
+++ b/src/Console/Command/Relationships/RelationshipsRebuildCommand.php
@@ -0,0 +1,56 @@
+ 5.4
+ * SugarCRM Versions 6.5 - 7.6
+ *
+ * @author RĂ©mi Sauvat
+ * @author Emmanuel Dyan
+ * @copyright 2005-2015 iNet Process
+ *
+ * @package inetprocess/sugarcrm
+ *
+ * @license Apache License 2.0
+ *
+ * @link http://www.inetprocess.com
+ */
+
+namespace SugarCli\Console\Command\Relationships;
+
+use Symfony\Component\Console\Formatter\OutputFormatterStyle;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
+use Inet\SugarCRM\Database\Relationship;
+use Inet\SugarCRM\Exception\SugarException;
+use SugarCli\Console\ExitCode;
+use Inet\SugarCRM\System as SugarSystem;
+use Symfony\Component\Console\Helper\ProgressIndicator;
+
+class RelationshipsRebuildCommand extends AbstractRelationshipsCommand
+{
+ protected function configure()
+ {
+ parent::configure();
+ $this->setName('rels:rebuild')
+ ->setDescription('Rebuild the relationships')
+ ->setHelp(<<enableStandardOption('user-id');
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ $output->writeln('Rebuild Relationship: ');
+ $progress = new ProgressIndicator($output);
+
+ $progress->start('Starting rebuild relationship...');
+ $progress->advance();
+
+ $progress->setMessage('Working...');
+ $sugarEP = $this->getService('sugarcrm.entrypoint');
+ $sugarSystem = new SugarSystem($sugarEP);
+ $sugarSystem->rebuildRelationship($input->getOption('user-id'));
+ $progress->finish('rebuild relationship Done.');
+ }
+}