Skip to content

Commit

Permalink
14054 - INTERNE - Sugarcli - adaptation to the new php version
Browse files Browse the repository at this point in the history
  • Loading branch information
salmanahmad-rt committed Nov 8, 2024
1 parent d34eb20 commit b165195
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 4 deletions.
1 change: 1 addition & 0 deletions USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ Commands list
* [rels:dumptofile](#relsdumptofile)
* [rels:loadfromfile](#relsloadfromfile)
* [rels:status](#relsstatus)
* [rels:rebuild](#relsrebuild)

**system:**

Expand Down
Binary file modified build/sugarcli.phar
Binary file not shown.
5 changes: 1 addition & 4 deletions src/Console/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -272,10 +273,6 @@ 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('<error>You are not allowed to run this command as root.</error>');
return ExitCode::EXIT_COMMAND_AS_ROOT_DENIED;
}
return parent::doRunCommand($command, $input, $output);
}

Expand Down
56 changes: 56 additions & 0 deletions src/Console/Command/Relationships/RelationshipsRebuildCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php
/**
* SugarCLI
*
* PHP Version 5.3 -> 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(<<<EOH
EOH
)->enableStandardOption('user-id');
}

protected function execute(InputInterface $input, OutputInterface $output)
{
$output->writeln('<comment>Rebuild Relationship</comment>: ');
$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('<info>rebuild relationship Done.</info>');
}
}

0 comments on commit b165195

Please sign in to comment.