set('userAgent', 'PatchTester/3.0'); // Set the default timeout to 120 seconds $options->set('timeout', 120); // Set the API URL $options->set('api.url', 'https://api.github.com'); // If an API token is set in the params, use it for authentication if ($params->get('gh_token', '')) { $options->set('gh.token', $params->get('gh_token', '')); } // Set the username and password if set in the params elseif ($params->get('gh_user', '') && $params->get('gh_password')) { $options->set('api.username', $params->get('gh_user', '')); $options->set('api.password', $params->get('gh_password', '')); } // Display a message about the lowered API limit without credentials else { Factory::getApplication()->enqueueMessage(Text::_('COM_PATCHTESTER_NO_CREDENTIALS'), 'notice'); } return new GitHub($options); } /** * Initializes the CI Settings * * @return Registry * * @since 3.0 */ public static function initializeCISettings() { $params = ComponentHelper::getParams('com_patchtester'); $options = new Registry; // Set CI server address for the request $options->set('server.url', $params->get('ci_server', 'https://ci.joomla.org')); // Set name of the zip archive $options->set('zip.name', 'build.zip'); $options->set('zip.log.name', 'deleted_files.log'); // Set temp archive for extracting and downloading files $options->set('folder.temp', Factory::getConfig()->get('tmp_path')); $options->set('folder.backups', JPATH_COMPONENT . '/backups'); // Set full url for addressing the file $options->set('zip.url', $options->get('server.url') . '/artifacts/joomla-cms/4.0-dev/%s/patchtester/' . $options->get('zip.name')); return $options; } }