Example #1
0
 /**
  * Check for an installed module
  *
  * @return void
  */
 public function checkModulessingle()
 {
     $module = new Module();
     $file = $_GET['path'];
     $result = $module->checkForModule($this->url, $_GET['path']);
     if ($result) {
         $this->respond(array(isset($module->files[$file]) ? $module->files[$file] : '<!-- how did this happen -->'));
     }
 }
Example #2
0
 /**
  * Execute command
  *
  * @param InputInterface  $input
  * @param OutputInterface $output
  *
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $all = $input->getOption('show-modules');
     $module = new Module();
     $module->setRequest($this->request);
     $found = $notFound = [];
     foreach ($module->checkForModules() as $name => $exists) {
         if ($exists) {
             $found[] = [$name, '<bg=green>Yes</bg=green>'];
         } else {
             $notFound[] = [$name, 'No'];
         }
     }
     if (empty($found) && !$all) {
         return $this->out('Installed Modules', 'No detectable modules were found');
     }
     if ($all) {
         $found = array_merge($found, $notFound);
     }
     $this->out('Installed Modules', [['type' => 'table', 'data' => [['Module', 'Installed'], $found]]]);
 }
Example #3
0
 /**
  * Execute command
  *
  * @param InputInterface  $input
  * @param OutputInterface $output
  *
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $all = $input->getOption('show-modules');
     $module = new Module();
     $module->setRequest($this->request);
     $found = $notFound = array();
     foreach ($module->checkForModules($this->url) as $name => $exists) {
         if ($exists) {
             $found[] = array($name, '<bg=green>Yes</bg=green>');
         } else {
             $notFound[] = array($name, 'No');
         }
     }
     if (empty($found) && !$all) {
         if ($input->getOption('json')) {
             $this->output->write(json_encode(['error' => 'No detectable modules were found']));
         } else {
             $this->writeHeader('Installed Modules');
             $this->output->writeln('No detectable modules were found');
         }
         return;
     }
     if ($all) {
         $found = array_merge($found, $notFound);
     }
     if ($input->getOption('json')) {
         $return = [];
         foreach ($found as $f) {
             $return[$f[0]] = $f[1] == "No" ? "no" : "yes";
         }
         $this->output->write(json_encode($return));
     } else {
         $this->writeHeader('Installed Modules');
         $table = new Table($this->output);
         $table->setHeaders(array('Module', 'Installed'))->setRows($found)->render();
     }
 }
Example #4
0
 /**
  * Check for files known to be associated with a module
  *
  * @param boolean $all
  *
  * @return void
  */
 protected function checkModules($all = false)
 {
     $this->writeHeader('Installed Modules');
     $module = new Module();
     $module->setRequest($this->request);
     $found = $notFound = array();
     foreach ($module->checkForModules($this->url) as $name => $exists) {
         if ($exists) {
             $found[] = array($name, '<bg=green>Yes</bg=green>');
         } else {
             $notFound[] = array($name, 'No');
         }
     }
     if (empty($found) && !$all) {
         $this->output->writeln('No detectable modules were found');
         return;
     }
     if ($all) {
         $found = array_merge($found, $notFound);
     }
     $table = new Table($this->output);
     $table->setHeaders(array('Module', 'Installed'))->setRows($found)->render();
 }
Example #5
0
 /**
  * Check for an installed module
  *
  * @return void
  */
 public function checkModulessingle()
 {
     $module = new Module();
     $module->setRequest($this->request);
     $file = $_GET['path'];
     $files = $module->getFiles();
     $result = $module->checkForModule($_GET['path']);
     if ($result) {
         $this->respond([isset($files[$file]) ? $files[$file] : '<!-- how did this happen -->']);
     }
 }