Skip to content

Commit

Permalink
revert mostly to 7.5.0 version of Singleton
Browse files Browse the repository at this point in the history
  • Loading branch information
afragen committed Feb 21, 2018
1 parent cc270bc commit f446ec3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 0 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* refactored setting of contributor data for [r42631](https://core.trac.wordpress.org/changeset/42631)
* refactored `ghu-install.js` to vanilla JavaScript
* moved GitLab specific admin notices to `GitLab_API`
* fixed `debug_backtrace()` in `Singleton` to decrease memory footprint

#### 7.5.0 / 2018-01-28
* fixed _View detail_ ratings for large projects with lots of issues
Expand Down
2 changes: 1 addition & 1 deletion github-updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* Plugin Name: GitHub Updater
* Plugin URI: https://github.com/afragen/github-updater
* Description: A plugin to automatically update GitHub, Bitbucket, or GitLab hosted plugins, themes, and language packs. It also allows for remote installation of plugins or themes into WordPress.
* Version: 7.5.0.8
* Version: 7.5.0.9
* Author: Andy Fragen
* License: GNU General Public License v2
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
Expand Down
4 changes: 3 additions & 1 deletion src/Singleton.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ final class Singleton {
*/
public static function get_instance( $class_name, $options = null ) {
static $instance = null;

// TODO shorten syntax for PHP 5.4
$backtrace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS );
$backtrace = debug_backtrace();
$backtrace = $backtrace[1];
$class = isset( $backtrace['class'] ) ? $backtrace['class'] : null;
$class = self::get_class( $class_name, $class );

if ( null === $instance || ! isset( $instance[ $class ] ) ) {
$instance[ $class ] = new $class( $options );
}
Expand Down

0 comments on commit f446ec3

Please sign in to comment.