31
0
mirror of https://github.com/joomla-extensions/patchtester.git synced 2024-06-10 09:12:22 +00:00

Remove references to PTGithub object, replace deprecated method calls

This commit is contained in:
Michael Babker 2014-05-01 07:51:01 -05:00
parent 7b1a342a73
commit 7f7e445722
6 changed files with 3 additions and 109 deletions

View File

@ -1,50 +0,0 @@
<?php
/**
* @package PatchTester
*
* @copyright Copyright (C) 2011 - 2012 Ian MacLennan, Copyright (C) 2013 - 2014 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later
*/
defined('_JEXEC') or die;
/**
* Extended JGithub class allowing additional JGithubObject instances to be used
*
* @property-read PTGithubRepos $repos GitHub API object for repos.
*
* @package PatchTester
* @since 2.0
*/
class PTGithub extends JGithub
{
/**
* @var PTGithubRepos
* @since 2.0
*/
protected $repos;
/**
* Magic method to lazily create API objects
*
* @param string $name Name of property to retrieve
*
* @return JGithubObject GitHub API object (gists, issues, pulls, etc).
*
* @since 2.0
*/
public function __get($name)
{
if ($name == 'repos')
{
if ($this->repos == null)
{
$this->repos = new PTGithubRepos($this->options, $this->client);
}
return $this->repos;
}
return parent::__get($name);
}
}

View File

@ -1,53 +0,0 @@
<?php
/**
* @package PatchTester
*
* @copyright Copyright (C) 2011 - 2012 Ian MacLennan, Copyright (C) 2013 - 2014 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later
*/
/**
* GitHub API Repos class.
*
* @package PatchTester
* @since 2.0
*/
class PTGithubRepos extends JGithubObject
{
/**
* Retrieve information about the specified repository
*
* @param string $user The username or organization name of the repository owner
* @param string $repo The repository to retrieve
*
* @return object
*
* @since 2.0
* @throws DomainException
*/
public function get($user, $repo)
{
$path = '/repos/' . $user . '/' . $repo;
// Send the request.
return $this->processResponse($this->client->get($this->fetchUrl($path)));
}
/**
* List public repositories for the specified user.
*
* @param string $user The username to retrieve repositories for
*
* @return object
*
* @since 2.0
* @throws DomainException
*/
public function getPublicRepos($user)
{
$path = '/users/' . $user . '/repos';
// Send the request.
return $this->processResponse($this->client->get($this->fetchUrl($path)));
}
}

View File

@ -88,7 +88,7 @@ class PatchtesterModelPull extends JModelLegacy
$this->github = new JGithub($options);
// Store the rate data for reuse during this request cycle
$this->rate = $this->github->account->getRateLimit()->rate;
$this->rate = $this->github->authorization->getRateLimit()->rate;
}
/**

View File

@ -71,7 +71,7 @@ class PatchtesterModelPulls extends JModelList
$this->github = new JGithub($options);
// Store the rate data for reuse during this request cycle
$this->rate = $this->github->account->getRateLimit()->rate;
$this->rate = $this->github->authorization->getRateLimit()->rate;
// Check the API rate limit, display a message if over
if ($this->rate->remaining == 0)
@ -322,7 +322,7 @@ class PatchtesterModelPulls extends JModelList
{
if ($this->rate->remaining > 0)
{
return $this->github->repos->get('joomla', 'joomla-cms')->open_issues_count;
return $this->github->repositories->get('joomla', 'joomla-cms')->open_issues_count;
}
else
{

View File

@ -14,8 +14,6 @@ if (!JFactory::getUser()->authorise('core.manage', 'com_patchtester'))
return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
}
JLoader::registerPrefix('PT', __DIR__ . '/helpers');
$controller = JControllerLegacy::getInstance('PatchTester');
$controller->execute(JFactory::getApplication()->input->getCmd('task'));
$controller->redirect();

View File

@ -37,7 +37,6 @@
<folder>assets</folder>
<folder>backups</folder>
<folder>controllers</folder>
<folder>helpers</folder>
<folder>install</folder>
<folder>language</folder>
<folder>models</folder>