Skip to content
This repository has been archived by the owner on Jan 16, 2023. It is now read-only.

Commit

Permalink
hash transient name to comply with character limits
Browse files Browse the repository at this point in the history
  • Loading branch information
valendesigns committed Aug 19, 2014
1 parent 297cc13 commit 0dc6eb7
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions includes/class-github-updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ public function __construct( $config = array() ) {
_doing_it_wrong( __CLASS__, $message , self::VERSION );
return;
}


$this->config['transient_base'] = substr( md5( $this->config['slug'] ), 0, 16 );

$this->set_defaults();

add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'api_check' ) );
Expand Down Expand Up @@ -149,7 +151,6 @@ public function set_defaults() {
$this->config['zip_url'] = $zip_url;
}


if ( ! isset( $this->config['new_version'] ) )
$this->config['new_version'] = $this->get_new_version();

Expand All @@ -174,7 +175,7 @@ public function set_defaults() {

if ( ! isset( $this->config['readme'] ) )
$this->config['readme'] = 'README.md';

}


Expand Down Expand Up @@ -211,7 +212,7 @@ public function http_request_sslverify( $args, $url ) {
* @return int $version the version number
*/
public function get_new_version() {
$version = get_site_transient( $this->config['slug'].'_new_version' );
$version = get_site_transient( $this->config['transient_base'].'_new_version' );

if ( $this->overrule_transients() || ( !isset( $version ) || !$version || '' == $version ) ) {

Expand Down Expand Up @@ -249,7 +250,7 @@ public function get_new_version() {

// refresh every 6 hours
if ( false !== $version )
set_site_transient( $this->config['slug'].'_new_version', $version, 60*60*6 );
set_site_transient( $this->config['transient_base'].'_new_version', $version, 60*60*6 );
}

return $version;
Expand Down Expand Up @@ -286,7 +287,7 @@ public function get_github_data() {
if ( isset( $this->github_data ) && ! empty( $this->github_data ) ) {
$github_data = $this->github_data;
} else {
$github_data = get_site_transient( $this->config['slug'].'_github_data' );
$github_data = get_site_transient( $this->config['transient_base'].'_github_data' );

if ( $this->overrule_transients() || ( ! isset( $github_data ) || ! $github_data || '' == $github_data ) ) {
$github_data = $this->remote_get( $this->config['api_url'] );
Expand All @@ -297,7 +298,7 @@ public function get_github_data() {
$github_data = json_decode( $github_data['body'] );

// refresh every 6 hours
set_site_transient( $this->config['slug'].'_github_data', $github_data, 60*60*6 );
set_site_transient( $this->config['transient_base'].'_github_data', $github_data, 60*60*6 );
}

// Store the data in this class instance for future calls
Expand Down

0 comments on commit 0dc6eb7

Please sign in to comment.