Skip to content

Commit

Permalink
Return occ response in case it is not recognized
Browse files Browse the repository at this point in the history
  • Loading branch information
VicDeo committed Nov 17, 2015
1 parent 385e545 commit 55dd234
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
17 changes: 11 additions & 6 deletions src/Console/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,35 @@
class Application extends \Symfony\Component\Console\Application {

/** @var Container */
protected $container;
public static $container;


/** @var Container */
protected $DIcontainer;

/**
* Pass Pimple container into application
* @param Container $container
*/
public function setContainer(Container $container){
$this->container = $container;
$this->DIcontainer = $container;
self::$container = $container;
}

/**
* Get Pimple container
* @return Container
*/
public function getContainer(){
return $this->container;
return $this->DIcontainer;
}

/**
* Get logger instance
* @return \Psr\Log\LoggerInterface
*/
public function getLogger(){
return $this->container['logger'];
return $this->DIcontainer['logger'];
}

/**
Expand All @@ -49,15 +54,15 @@ public function logException($e){
}

public function doRun(InputInterface $input, OutputInterface $output){
if (!($this->container['logger.output'] instanceof StreamOutput)){
if (!($this->DIcontainer['logger.output'] instanceof StreamOutput)){
$output->writeln('[Warning] Failed to init logger. Logging is disabled.');
}
try {
// TODO: check if the current command needs a valid OC instance
$this->assertOwncloudFound();
$this->initDirectoryStructure();

$configReader = $this->container['utils.configReader'];
$configReader = $this->DIcontainer['utils.configReader'];
$configReader->init();
return parent::doRun($input, $output);
} catch (\Exception $e) {
Expand Down
2 changes: 1 addition & 1 deletion src/Utils/ConfigReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private function load(){
$rawConfig = $process->getOutput();
$this->cache = json_decode($rawConfig, true);
if (is_null($this->cache)){
throw new \UnexpectedValueException('Can not parse ownCloud config. Please check if the current shell user can run occ command.');
throw new \UnexpectedValueException('Can not parse ownCloud config. Please check if the current shell user can run occ command. Raw output: ' . PHP_EOL . $rawConfig);
}
}

Expand Down

0 comments on commit 55dd234

Please sign in to comment.