mirror of
https://github.com/joomla-extensions/patchtester.git
synced 2024-12-23 03:19:00 +00:00
Working commit - Working out kinks with the updated processing
This commit is contained in:
parent
ec2108d468
commit
07b311e5c4
@ -14,7 +14,7 @@ defined('_JEXEC') or die;
|
||||
* @package PatchTester
|
||||
* @since 2.0
|
||||
*/
|
||||
class PatchtesterControllerPull extends JControllerLegacy
|
||||
class PatchtesterControllerPulls extends JControllerLegacy
|
||||
{
|
||||
/**
|
||||
* Fetch pull request data from GitHub
|
||||
|
@ -13,6 +13,8 @@ COM_PATCHTESTER_COMPONENT_DESC="Joomla! Patch Tester Configuration Values"
|
||||
COM_PATCHTESTER_COMPONENT_LABEL="Joomla! Patch Tester"
|
||||
COM_PATCHTESTER_CONFIGURATION="Joomla! Patch Tester Settings"
|
||||
COM_PATCHTESTER_CONFLICT_S="The patch could not be applied because it conflicts with a previously applied patch: %s"
|
||||
COM_PATCHTESTER_ERROR_APPLIED_PATCHES="Cannot fetch data from GitHub while there are applied patches. Please revert those patches before continuing."
|
||||
COM_PATCHTESTER_ERROR_GITHUB_FETCH="Error retrieving pull requests from GitHub: %s"
|
||||
COM_PATCHTESTER_ERROR_INSERT_DATABASE="Error inserting pull request data into the database: %s"
|
||||
COM_PATCHTESTER_FETCH_SUCCESSFUL="Successfully retrieved pull requests."
|
||||
COM_PATCHTESTER_FIELD_GH_PASSWORD_LABEL="GitHub Account Password"
|
||||
|
@ -192,10 +192,42 @@ class PatchtesterModelPulls extends JModelList
|
||||
// If over the API limit, we can't build this list
|
||||
if ($this->rate->remaining > 0)
|
||||
{
|
||||
$db = $this->getDbo();
|
||||
$pulls = $this->github->pulls->getList($this->getState('github_user'), $this->getState('github_repo'), 'open');
|
||||
// Sanity check, ensure there aren't any applied patches
|
||||
if (count($this->getAppliedPatches()) >= 1)
|
||||
{
|
||||
throw new RuntimeException(JText::_('COM_PATCHTESTER_ERROR_APPLIED_PATCHES'));
|
||||
}
|
||||
|
||||
foreach ($pulls as $i => &$pull)
|
||||
$pulls = array();
|
||||
$page = 0;
|
||||
|
||||
do
|
||||
{
|
||||
$page++;
|
||||
|
||||
try
|
||||
{
|
||||
$items = $this->github->pulls->getList($this->getState('github_user'), $this->getState('github_repo'), 'open', $page, 100);
|
||||
}
|
||||
catch (DomainException $e)
|
||||
{
|
||||
throw new RuntimeException(JText::sprintf('COM_PATCHTESTER_ERROR_GITHUB_FETCH', $e->getMessage()));
|
||||
}
|
||||
|
||||
$count = is_array($items) ? count($items) : 0;
|
||||
|
||||
if ($count)
|
||||
{
|
||||
$pulls = array_merge($pulls, $items);
|
||||
}
|
||||
|
||||
}
|
||||
while ($count);
|
||||
|
||||
// Dump the old data now
|
||||
$this->getDbo()->truncateTable('#__patchtester_pulls');
|
||||
|
||||
foreach ($pulls as &$pull)
|
||||
{
|
||||
// Build the data object to store in the database
|
||||
$data = new stdClass;
|
||||
@ -230,7 +262,7 @@ class PatchtesterModelPulls extends JModelList
|
||||
|
||||
try
|
||||
{
|
||||
$db->insertObject('#__patchtester_pulls', $data, 'id');
|
||||
$this->getDbo()->insertObject('#__patchtester_pulls', $data, 'id');
|
||||
}
|
||||
catch (RuntimeException $e)
|
||||
{
|
||||
|
@ -106,9 +106,9 @@ else :
|
||||
<tbody>
|
||||
<?php if (count($this->items)) :
|
||||
echo $this->loadTemplate('items');
|
||||
else :
|
||||
echo JText::_('COM_PATCHTESTER_NO_ITEMS');
|
||||
endif; ?>
|
||||
else : ?>
|
||||
<td align="center" colspan="6"><?php echo JText::_('COM_PATCHTESTER_NO_ITEMS'); ?></td>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php echo $this->pagination->getListFooter(); ?>
|
||||
|
@ -41,15 +41,9 @@ foreach ($this->items as $i => $item) :
|
||||
<?php if ($item->joomlacode_id) :
|
||||
$title = ' title="Open link::' . JText::_('COM_PATCHTESTER_OPEN_IN_JOOMLACODE') . '"';
|
||||
|
||||
if (is_int($item->joomlacode_id)) :
|
||||
echo '<a href="http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=';
|
||||
echo $item->joomlacode_id . '"' . $title . ' class="modal hasTip" rel="{handler: \'iframe\', size: {x: 900, y: 500}}">';
|
||||
echo '[#' . $item->joomlacode_id . ']</a>';
|
||||
else :
|
||||
echo '<a href="' . $item->joomlacode_id . '"' . $title;
|
||||
echo ' class="modal hasTip" rel="{handler: \'iframe\', size: {x: 900, y: 500}}">';
|
||||
echo '[#joomlacode]</a>';
|
||||
endif;
|
||||
endif; ?>
|
||||
</td>
|
||||
<td class="center">
|
||||
|
Loading…
Reference in New Issue
Block a user