public function buildMetadataPath($sugarcrm_path, $metadata_path)
 {
     if ($metadata_path === $this->getMetadataFileDefault()) {
         if ($sugarcrm_path !== null) {
             $metadata_path = Utils::makeConfigPathRelative($sugarcrm_path, self::METADATA_PATH);
         }
     }
     return $metadata_path;
 }
 public function buildRelsPath($sugarcrm_path, $rels_path)
 {
     if ($rels_path === $this->getRelsFileDefault()) {
         if ($sugarcrm_path !== null) {
             $rels_path = Utils::makeConfigPathRelative($sugarcrm_path, self::RELS_PATH);
         }
     }
     return $rels_path;
 }
Esempio n. 3
0
 /**
  * @dataProvider pathProvider
  */
 public function testGetRelativePath($expected, $config_path, $option_path, $current_directory)
 {
     $actual = Utils::makeConfigPathRelative($config_path, $option_path, $current_directory);
     $this->assertEquals($expected, $actual);
 }
Esempio n. 4
0
 /**
  * Generate all the rows by getting the hooks from sugarcrm
  *
  * @param string  $module
  * @param bool    $compact
  * @param integer $numCols
  *
  * @return array
  */
 protected function generateTableRows($module, $compact, $numCols)
 {
     $validModules = array_keys($this->getService('sugarcrm.entrypoint')->getBeansList());
     try {
         $logicHook = new LogicHook($this->getService('sugarcrm.entrypoint'));
         $hooksList = $logicHook->getModuleHooks($module);
     } catch (BeanNotFoundException $e) {
         $msg = "Unknown module '{$module}'. Valid modules are:" . PHP_EOL;
         $msg .= '    - ' . implode(PHP_EOL . '    - ', $validModules);
         throw new \InvalidArgumentException($msg);
     }
     $tableData = array();
     if (empty($hooksList)) {
         $tableData[] = array(new TableCell('<error>No Hooks for that module</error>', array('colspan' => $numCols)));
     }
     $hooksComs = $logicHook->getModulesLogicHooksDef();
     $procHooks = 0;
     $nbHooks = count($hooksList);
     foreach ($hooksList as $type => $hooks) {
         $com = array_key_exists($type, $hooksComs) ? $hooksComs[$type] : 'No description';
         $tableData[] = array(new TableCell("<comment>{$type} ({$com})</comment>", array('colspan' => $numCols)));
         foreach ($hooks as $hook) {
             $hook['Description'] = Utils::newLineEveryXWords($hook['Description'], 5);
             // Remove useless fields if in compact mode
             if ($compact) {
                 unset($hook['File']);
                 unset($hook['Class']);
                 unset($hook['Defined In']);
             }
             $tableData[] = array_values($hook);
         }
         // Create a separator if I am not
         if (++$procHooks < $nbHooks) {
             $tableData[] = new TableSeparator();
         }
     }
     return $tableData;
 }
Esempio n. 5
0
 public function getRelativePath($conf_path, $sugar_path)
 {
     $conf_path = Path::getDirectory($conf_path);
     return Utils::makeConfigPathRelative($conf_path, $sugar_path);
 }