Skip to content

Commit aec1ac4

Browse files
release: fixes
- Fixed broken link in the Map settings of the Geo Chart - Fixed the default cron job sync time for data synchronization [PRO]
2 parents be8fbd8 + 812ed5c commit aec1ac4

File tree

9 files changed

+568
-73
lines changed

9 files changed

+568
-73
lines changed

.github/workflows/deploy-wporg.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,9 @@ jobs:
2323
SVN_USERNAME: ${{ secrets.SVN_THEMEISLE_USERNAME }}
2424
- name: Send update to the store
2525
env:
26-
THEMEISLE_ID: ${{ secrets.THEMEISLE_ID }}
27-
THEMEISLE_AUTH: ${{ secrets.THEMEISLE_STORE_AUTH }}
26+
PRODUCT_ID: ${{ secrets.THEMEISLE_ID }}
27+
AUTH_TOKEN: ${{ secrets.THEMEISLE_STORE_AUTH }}
2828
STORE_URL: ${{ secrets.THEMEISLE_STORE_URL }}
2929
BUILD_VERSION: ${{ steps.get_version.outputs.VERSION }}
30-
run: |
31-
if [ ! -z "$THEMEISLE_ID" ]; then
32-
STORE_JSON='{"version": "'$BUILD_VERSION'","id": "'$THEMEISLE_ID'","body": ""}';
33-
echo "$STORE_JSON";
34-
curl -X POST -H 'Cache-Control: no-cache' -H "Content-Type: application/json" -H "x-themeisle-auth: $THEMEISLE_AUTH" --data "$STORE_JSON" "$STORE_URL/wp-json/edd-so/v1/update_changelog/" > /dev/null
35-
fi
30+
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
31+
uses: Codeinwp/action-store-release@main

Gruntfile.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ module.exports = function (grunt) {
55
'use strict';
66
grunt.initConfig({
77
wp_readme_to_markdown: {
8-
files: {
9-
'readme.md': 'readme.txt'
8+
plugin: {
9+
files: {
10+
'readme.md': 'readme.txt'
11+
},
1012
},
1113
},
1214
version: {
@@ -37,4 +39,4 @@ module.exports = function (grunt) {
3739
});
3840
grunt.loadNpmTasks('grunt-version');
3941
grunt.loadNpmTasks('grunt-wp-readme-to-markdown');
40-
};
42+
};

classes/Visualizer/Gutenberg/src/Components/Sidebar/MapSettings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class MapSettings extends Component {
6363
<li>
6464
{ __( 'A continent or a sub-continent, specified by its 3-digit code, e.g., \'011\' for Western Africa. ' ) }
6565
<ExternalLink
66-
href="https://google-developers.appspot.com/chart/interactive/docs/gallery/geochart#Continent_Hierarchy"
66+
href="https://developers.google.com/chart/interactive/docs/gallery/geochart#continent-hierarchy-and-codes"
6767
>
6868
{ __( 'More info here.' ) }
6969
</ExternalLink>

classes/Visualizer/Module.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ protected function _addAjaxAction( $tag, $method = '', $methodClass = null, $pri
138138
*
139139
* @access protected
140140
* @param string $tag The name of the filter to hook the $method to.
141-
* @param type $method The name of the method to be called when the filter is applied.
141+
* @param string $method The name of the method to be called when the filter is applied.
142142
* @param int $priority optional. Used to specify the order in which the functions associated with a particular action are executed (default: 10). Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order in which they were added to the action.
143143
* @param int $accepted_args optional. The number of arguments the function accept (default 1).
144144
* @return Visualizer_Module

classes/Visualizer/Module/Setup.php

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public function __construct( Visualizer_Plugin $plugin ) {
4949

5050
$this->_addAction( 'admin_init', 'adminInit' );
5151
$this->_addAction( 'init', 'setupCustomPostTypes' );
52+
$this->_addFilter( 'cron_schedules', 'custom_cron_schedules' );
5253
$this->_addAction( 'plugins_loaded', 'loadTextDomain' );
5354
$this->_addFilter( 'visualizer_logger_data', 'getLoggerData' );
5455
$this->_addFilter( 'visualizer_get_chart_counts', 'getUsage', 10, 2 );
@@ -209,7 +210,7 @@ public function activate( $network_wide ) {
209210
*/
210211
private function activate_on_site() {
211212
wp_clear_scheduled_hook( 'visualizer_schedule_refresh_db' );
212-
wp_schedule_event( strtotime( 'midnight' ) - get_option( 'gmt_offset' ) * HOUR_IN_SECONDS, apply_filters( 'visualizer_chart_schedule_interval', 'hourly' ), 'visualizer_schedule_refresh_db' );
213+
wp_schedule_event( strtotime( 'midnight' ) - get_option( 'gmt_offset' ) * HOUR_IN_SECONDS, apply_filters( 'visualizer_chart_schedule_interval', 'visualizer_ten_minutes' ), 'visualizer_schedule_refresh_db' );
213214
add_option( 'visualizer-activated', true );
214215
$is_fresh_install = get_option( 'visualizer_fresh_install', false );
215216
if ( ! defined( 'TI_CYPRESS_TESTING' ) && false === $is_fresh_install ) {
@@ -281,9 +282,9 @@ public function adminInit() {
281282
/**
282283
* Refresh the specific chart from the db.
283284
*
284-
* @param WP_Post $chart The chart object.
285-
* @param int $chart_id The chart id.
286-
* @param bool $force If this is true, then the chart data will be force refreshed. If false, data will be refreshed only if the chart requests live data.
285+
* @param WP_Post|null $chart The chart object.
286+
* @param int $chart_id The chart id.
287+
* @param bool $force If this is true, then the chart data will be force refreshed. If false, data will be refreshed only if the chart requests live data.
287288
*
288289
* @access public
289290
*/
@@ -391,38 +392,49 @@ public function refresh_db_for_chart( $chart, $chart_id, $force = false ) {
391392
}
392393

393394
/**
394-
* Refresh the db chart.
395+
* Refresh the Database chart type.
395396
*
396397
* @access public
397398
*/
398399
public function refreshDbChart() {
399-
$schedules = get_option( Visualizer_Plugin::CF_DB_SCHEDULE, array() );
400-
if ( ! $schedules ) {
400+
// NOTE: This use a different key from normal schedule. Updated only by Database chart. Check `visualizer_schedule_import` action.
401+
$chart_schedules = get_option( Visualizer_Plugin::CF_DB_SCHEDULE, array() );
402+
if ( ! $chart_schedules ) {
401403
return;
402404
}
405+
403406
if ( ! defined( 'VISUALIZER_DO_NOT_DIE' ) ) {
404407
// define this so that the ajax call does not die
405408
// this means that if the new version of pro and the old version of free are installed, only the first chart will be updated
406409
define( 'VISUALIZER_DO_NOT_DIE', true );
407410
}
408411

409412
$new_schedules = array();
410-
$now = time();
411-
foreach ( $schedules as $chart_id => $time ) {
412-
$new_schedules[ $chart_id ] = $time;
413-
if ( $time > $now ) {
413+
$current_time = time();
414+
foreach ( $chart_schedules as $chart_id => $scheduled_time ) {
415+
416+
// Skip deleted charts.
417+
if ( false === get_post_status( $chart_id ) ) {
418+
continue;
419+
}
420+
421+
$new_schedules[ $chart_id ] = $scheduled_time;
422+
423+
// Should we do an update?
424+
if ( $scheduled_time > $current_time ) {
414425
continue;
415426
}
416427

417-
// if the time is nigh, we force an update.
418428
$this->refresh_db_for_chart( null, $chart_id, true );
429+
419430
// Clear existing chart cache.
420431
$cache_key = Visualizer_Plugin::CF_CHART_CACHE . '_' . $chart_id;
421432
if ( get_transient( $cache_key ) ) {
422433
delete_transient( $cache_key );
423434
}
424-
$hours = get_post_meta( $chart_id, Visualizer_Plugin::CF_DB_SCHEDULE, true );
425-
$new_schedules[ $chart_id ] = time() + $hours * HOUR_IN_SECONDS;
435+
436+
$scheduled_hours = get_post_meta( $chart_id, Visualizer_Plugin::CF_DB_SCHEDULE, true );
437+
$new_schedules[ $chart_id ] = $current_time + $scheduled_hours * HOUR_IN_SECONDS;
426438
}
427439
update_option( Visualizer_Plugin::CF_DB_SCHEDULE, $new_schedules );
428440
}
@@ -443,4 +455,18 @@ public function checkIsExistingUser() {
443455
}
444456
}
445457

458+
/**
459+
* Add custom cron schedules.
460+
*
461+
* @param array $schedules The current schedules options.
462+
* @return array The modified schedules options.
463+
*/
464+
public function custom_cron_schedules( $schedules ) {
465+
$schedules['visualizer_ten_minutes'] = array(
466+
'interval' => 600,
467+
'display' => __( 'Every 10 minutes', 'visualizer' ),
468+
);
469+
470+
return $schedules;
471+
}
446472
}

classes/Visualizer/Render/Sidebar/Type/GoogleCharts/Geo.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ protected function _renderMapSettings() {
122122
esc_html__( 'Configure the region area to display on the map. (Surrounding areas will be displayed as well.) Can be one of the following:', 'visualizer' ) .
123123
'<ul>' .
124124
'<li>' . esc_html__( "'world' - A map of the entire world.", 'visualizer' ) . '</li>' .
125-
'<li>' . sprintf( esc_html__( "A continent or a sub-continent, specified by its %s code, e.g., '011' for Western Africa.", 'visualizer' ), '<a href="https://google-developers.appspot.com/chart/interactive/docs/gallery/geochart#Continent_Hierarchy" target="_blank">3-digit</a>' ) . '</li>' .
125+
'<li>' . sprintf( esc_html__( "A continent or a sub-continent, specified by its %s code, e.g., '011' for Western Africa.", 'visualizer' ), '<a href="https://developers.google.com/chart/interactive/docs/gallery/geochart#continent-hierarchy-and-codes" target="_blank">3-digit</a>' ) . '</li>' .
126126
'<li>' . sprintf( esc_html__( "A country, specified by its %s code, e.g., 'AU' for Australia.", 'visualizer' ), '<a href="http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2" target="_blank">ISO 3166-1 alpha-2</a>' ) . '</li>' .
127127
'<li>' . sprintf( esc_html__( "A state in the United States, specified by its %s code, e.g., 'US-AL' for Alabama. Note that the resolution option must be set to either 'provinces' or 'metros'.", 'visualizer' ), '<a href="http://en.wikipedia.org/wiki/ISO_3166-2:US" target="_blank">ISO 3166-2:US</a>' ) . '</li>' .
128128
'</ul>'

composer.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)