mirror of
https://github.com/joomla-extensions/patchtester.git
synced 2025-01-03 07:12:36 +00:00
Add config for GH username/password
This commit is contained in:
parent
4aef2140c5
commit
56a09778fc
@ -1,34 +1,36 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<config>
|
||||
<fieldset name="component"
|
||||
label="COM_PATCHTESTER_COMPONENT_LABEL"
|
||||
description="COM_PATCHTESTER_COMPONENT_DESC"
|
||||
>
|
||||
<fieldset name="component" label="COM_PATCHTESTER_COMPONENT_LABEL" description="COM_PATCHTESTER_COMPONENT_DESC">
|
||||
|
||||
<field name="org" type="text"
|
||||
default="joomla"
|
||||
description="COM_PATCHTESTER_FIELD_ORG_DESC"
|
||||
label="COM_PATCHTESTER_FIELD_ORG_LABEL"
|
||||
/>
|
||||
<field name="org" type="text" default="joomla"
|
||||
description="COM_PATCHTESTER_FIELD_ORG_DESC"
|
||||
label="COM_PATCHTESTER_FIELD_ORG_LABEL"
|
||||
/>
|
||||
|
||||
<field name="repo" type="text"
|
||||
default="joomla-cms"
|
||||
description="COM_PATCHTESTER_FIELD_REPO_DESC"
|
||||
label="COM_PATCHTESTER_FIELD_REPO_LABEL"
|
||||
/>
|
||||
<field name="repo" type="text" default="joomla-cms"
|
||||
description="COM_PATCHTESTER_FIELD_REPO_DESC"
|
||||
label="COM_PATCHTESTER_FIELD_REPO_LABEL"
|
||||
/>
|
||||
|
||||
</fieldset>
|
||||
<field name="gh_user" type="text"
|
||||
description="COM_PATCHTESTER_FIELD_GH_USER_DESC"
|
||||
label="COM_PATCHTESTER_FIELD_GH_USER_LABEL"
|
||||
/>
|
||||
|
||||
<fieldset name="permissions"
|
||||
description="JCONFIG_PERMISSIONS_DESC"
|
||||
label="JCONFIG_PERMISSIONS_LABEL"
|
||||
>
|
||||
<field name="gh_password" type="password"
|
||||
description="COM_PATCHTESTER_FIELD_GH_PASSWORD_DESC"
|
||||
label="COM_PATCHTESTER_FIELD_GH_PASSWORD_LABEL"
|
||||
/>
|
||||
</fieldset>
|
||||
|
||||
<field name="rules" type="rules"
|
||||
component="com_patchtester"
|
||||
filter="rules"
|
||||
validate="rules"
|
||||
label="JCONFIG_PERMISSIONS_LABEL"
|
||||
section="component"/>
|
||||
</fieldset>
|
||||
<fieldset name="permissions" description="JCONFIG_PERMISSIONS_DESC" label="JCONFIG_PERMISSIONS_LABEL">
|
||||
|
||||
<field name="rules" type="rules"
|
||||
component="com_patchtester"
|
||||
filter="rules"
|
||||
validate="rules"
|
||||
label="JCONFIG_PERMISSIONS_LABEL"
|
||||
section="component"
|
||||
/>
|
||||
</fieldset>
|
||||
</config>
|
||||
|
@ -1,3 +1,5 @@
|
||||
COM_PATCHTESTER="Patch Tester"
|
||||
COM_PATCHTESTER_CONFIGURATION="Patch Tester Settings"
|
||||
COM_PATCHTESTER_NOT_APPLIED="Not Applied"
|
||||
COM_PATCHTESTER_APPLIED="Applied"
|
||||
COM_PATCHTESTER_REVERT_PATCH="Revert Patch"
|
||||
@ -5,10 +7,14 @@ COM_PATCHTESTER_APPLY_PATCH="Apply Patch"
|
||||
COM_PATCHTESTER_TEST_THIS_PATCH="Test This Patch"
|
||||
COM_PATCHTESTER_COMPONENT_LABEL="Patch Tester"
|
||||
COM_PATCHTESTER_COMPONENT_DESC="Patch Tester Configuration Values"
|
||||
COM_PATCHTESTER_FIELD_ORG_LABEL="Github Username"
|
||||
COM_PATCHTESTER_FIELD_ORG_DESC="Name of account on Github of which to monitor pull requests"
|
||||
COM_PATCHTESTER_FIELD_REPO_LABEL="Github Repository"
|
||||
COM_PATCHTESTER_FIELD_REPO_DESC="Name of repository on Github of which to monitor pull requests"
|
||||
COM_PATCHTESTER_FIELD_ORG_LABEL="GitHub Username"
|
||||
COM_PATCHTESTER_FIELD_ORG_DESC="Name of account on GitHub of which to monitor pull requests"
|
||||
COM_PATCHTESTER_FIELD_REPO_LABEL="GitHub Repository"
|
||||
COM_PATCHTESTER_FIELD_REPO_DESC="Name of repository on GitHub of which to monitor pull requests"
|
||||
COM_PATCHTESTER_FIELD_GH_USER_LABEL="GitHub Account"
|
||||
COM_PATCHTESTER_FIELD_GH_USER_DESC="Name of account on GitHub of which to authenticate to the API with"
|
||||
COM_PATCHTESTER_FIELD_GH_PASSWORD_LABEL="GitHub Account Password"
|
||||
COM_PATCHTESTER_FIELD_GH_PASSWORD_DESC="Password for the account entered in the "_QQ_"GitHub Account"_QQ_" field"
|
||||
COM_PATCHTESTER_JOOMLACODE_ISSUE="Joomlacode Issue"
|
||||
COM_PATCHTESTER_PULL_ID="Pull ID"
|
||||
COM_PATCHTESTER_SEARCH_IN_PULL_ID="Pull ID"
|
||||
@ -22,6 +28,7 @@ COM_PATCHTESTER_FILE_DELETED_DOES_NOT_EXIST_S="The file marked for deletion does
|
||||
COM_PATCHTESTER_FILE_MODIFIED_DOES_NOT_EXIST_S="The file marked for modification does not exist: %s"
|
||||
COM_PATCHTESTER_API_LIMIT_ACTION="The GitHub API rate limit has been reached for this resource, could not connect to GitHub to perform the requested action. The rate limit will reset at %s"
|
||||
COM_PATCHTESTER_API_LIMIT_LIST="The GitHub API rate limit has been reached for this resource, could not connect to GitHub for updated data. The rate limit will reset at %s"
|
||||
COM_PATCHTESTER_NO_CREDENTIALS="No user credentials are saved, this will allow only 60 requests to the GitHub API per hour. Saving user credentials will allow 5,000 requests per hour."
|
||||
|
||||
COM_PATCHTESTER_OPEN_IN_GITHUB="Open in GitHub"
|
||||
COM_PATCHTESTER_OPEN_IN_JOOMLACODE="Open in JoomlaCode"
|
||||
|
@ -53,7 +53,18 @@ class PatchtesterModelPull extends JModelLegacy
|
||||
$this->transport = JHttpFactory::getHttp($options, 'curl');
|
||||
|
||||
// Set up the Github object
|
||||
$this->github = new PTGithub;
|
||||
$params = JComponentHelper::getParams('com_patchtester');
|
||||
|
||||
$options = new JRegistry;
|
||||
|
||||
// Set the username and password if set in the params
|
||||
if ($params->get('gh_user', '') && $params->get('gh_password'))
|
||||
{
|
||||
$options->set('api.username', $params->get('gh_user', ''));
|
||||
$options->set('api.password', $params->get('gh_password', ''));
|
||||
}
|
||||
|
||||
$this->github = new PTGithub($options);
|
||||
|
||||
// Store the rate data for reuse during this request cycle
|
||||
$this->rate = $this->github->account->getRateLimit()->rate;
|
||||
|
@ -53,7 +53,23 @@ class PatchtesterModelPulls extends JModelList
|
||||
parent::__construct($config);
|
||||
|
||||
// Set up the Github object
|
||||
$this->github = new PTGithub;
|
||||
$params = JComponentHelper::getParams('com_patchtester');
|
||||
|
||||
$options = new JRegistry;
|
||||
|
||||
// Set the username and password if set in the params
|
||||
if ($params->get('gh_user', '') && $params->get('gh_password'))
|
||||
{
|
||||
$options->set('api.username', $params->get('gh_user', ''));
|
||||
$options->set('api.password', $params->get('gh_password', ''));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Display a message about the lowered API limit without credentials
|
||||
JFactory::getApplication()->enqueueMessage(JText::_('COM_PATCHTESTER_NO_CREDENTIALS'), 'notice');
|
||||
}
|
||||
|
||||
$this->github = new PTGithub($options);
|
||||
|
||||
// Store the rate data for reuse during this request cycle
|
||||
$this->rate = $this->github->account->getRateLimit()->rate;
|
||||
@ -61,7 +77,7 @@ class PatchtesterModelPulls extends JModelList
|
||||
// Check the API rate limit, display a message if over
|
||||
if ($this->rate->remaining == 0)
|
||||
{
|
||||
JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_PATCHTESTER_API_LIMIT_LIST', JFactory::getDate($this->rate->reset)));
|
||||
JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_PATCHTESTER_API_LIMIT_LIST', JFactory::getDate($this->rate->reset)), 'notice');
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user