Skip to content

Commit

Permalink
add date added to repo's meta, display in REST endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
afragen committed Feb 26, 2025
1 parent 45da009 commit 8dacbf5
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#### [unreleased]
* update to correct format of readme tags
* add correctly formated date/time for `update-api` REST endpoint

#### 12.14.0 / 2025-02-26
* make sure proper release asset headers are added even if access token not set
Expand Down
2 changes: 1 addition & 1 deletion git-updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* Plugin Name: Git Updater
* Plugin URI: https://git-updater.com
* Description: A plugin to automatically update GitHub hosted plugins, themes, and language packs. Additional API plugins available for Bitbucket, GitLab, Gitea, and Gist.
* Version: 12.14.0.1
* Version: 12.14.0.2
* Author: Andy Fragen
* License: MIT
* Domain Path: /languages
Expand Down
1 change: 1 addition & 0 deletions src/Git_Updater/API/API.php
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,7 @@ protected function set_file_info( $response ) {
*/
protected function add_meta_repo_object() {
$this->type->last_updated = $this->type->repo_meta['last_updated'];
$this->type->added = $this->type->repo_meta['added'];
$this->type->is_private = $this->type->repo_meta['private'];
}

Expand Down
1 change: 1 addition & 0 deletions src/Git_Updater/API/GitHub_API.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ public function parse_meta_response( $response ) {
function ( $e ) use ( &$arr ) {
$arr['private'] = $e->private;
$arr['last_updated'] = $e->pushed_at;
$arr['added'] = $e->created_at;
$arr['watchers'] = $e->watchers;
$arr['forks'] = $e->forks;
$arr['open_issues'] = $e->open_issues;
Expand Down
3 changes: 2 additions & 1 deletion src/Git_Updater/REST/REST_API.php
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,8 @@ public function get_api_data( \WP_REST_Request $request ) {
'donate_link' => $repo_data->donate_link,
'banners' => $repo_data->banners,
'icons' => $repo_data->icons,
'last_updated' => $repo_data->last_updated,
'last_updated' => gmdate( 'Y-m-d h:ia T', strtotime( $repo_data->last_updated ) ),
'added' => isset( $repo_data->added ) ? gmdate( 'Y-m-d', strtotime( $repo_data->added ) ) : null,
'num_ratings' => $repo_data->num_ratings,
'rating' => $repo_data->rating,
'active_installs' => $repo_data->downloaded,
Expand Down

0 comments on commit 8dacbf5

Please sign in to comment.