/** * Constructor - sets output mechanism and arguments for use by command * * @param \Hubzero\Console\Output $output The ouput renderer * @param \Hubzero\Console\Arguments $arguments The command arguments * @return void **/ public function __construct(Output $output, Arguments $arguments) { parent::__construct($output, $arguments); // Overriding default document root? $directory = PATH_ROOT; if ($this->arguments->getOpt('r')) { if (is_dir($this->arguments->getOpt('r')) && is_readable($this->arguments->getOpt('r'))) { $directory = rtrim($this->arguments->getOpt('r'), DS); } else { $this->output->error('Error: Provided directory is not valid'); } } // Try to figure out the mechanism if (is_dir($directory . DS . '.git')) { // Set update source $source = Config::get('repository_source_name', null); $source = $this->arguments->getOpt('source', $source); if (is_null($source) || preg_match('/^[[:alnum:]\\-\\_\\.]*\\/[[:alnum:]\\-\\_\\.]*$/', $source)) { $this->mechanism = new Git($directory, $source); } else { $this->output->error('Sorry, an invalid update mechanism source was provided.'); } } else { $this->output->error('Sorry, this command currently only supports setups managed by GIT'); } }
/** * Constructor - sets output mechanism and arguments for use by command * * @param \Hubzero\Console\Output $output The ouput renderer * @param \Hubzero\Console\Arguments $arguments The command arguments * @return void **/ public function __construct(Output $output, Arguments $arguments) { parent::__construct($output, $arguments); // Do we have a group arg? if ($cname = $this->arguments->getOpt('group')) { $group = \Hubzero\User\Group::getInstance($cname); } else { // Get the current directory $currentDirectory = getcwd(); // Remove web root $currentDirectory = str_replace(PATH_APP, '', $currentDirectory); // Get group upload directory $groupsConfig = \Component::params('com_groups'); $groupsDirectory = trim($groupsConfig->get('uploadpath', '/site/groups'), DS); // Are we within the groups upload path if (strpos($currentDirectory, $groupsDirectory)) { $gid = str_replace($groupsDirectory, '', $currentDirectory); $gid = trim($gid, DS); // Get group instance $group = \Hubzero\User\Group::getInstance($gid); } } // Make sure we have a group & its super! if (isset($group) && $group && $group->isSuperGroup()) { $this->group = $group; } else { $this->output->error('Error: Provided group is not valid'); } }
/** * Constructor - sets output mechanism and arguments for use by command * * @param \Hubzero\Console\Output $output The ouput renderer * @param \Hubzero\Console\Arguments $arguments The command arguments * @return void **/ public function __construct(Output $output, Arguments $arguments) { parent::__construct($output, $arguments); $this->type = $this->arguments->getOpt(3); }