Skip to content

Commit 12be3e4

Browse files
add 'live' option for import from url
1 parent 3eebc68 commit 12be3e4

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

classes/Visualizer/Module/Admin.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ public function addSplChartSchedules( $feature, $chart_id, $plan ) {
109109

110110
switch ( $feature ) {
111111
case 'json':
112+
case 'csv':
112113
// no more schedules if pro is already active.
113114
if ( Visualizer_Module::is_pro() ) {
114115
return;
@@ -117,11 +118,6 @@ public function addSplChartSchedules( $feature, $chart_id, $plan ) {
117118
case 'wp':
118119
// fall-through.
119120
case 'db':
120-
// fall-through.
121-
break;
122-
case 'csv':
123-
// no support for live.
124-
unset( $hours['0'] );
125121
break;
126122
default:
127123
return;

classes/Visualizer/Module/Setup.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,17 @@ public function refresh_db_for_chart( $chart, $chart_id, $force = false ) {
279279
$source = new Visualizer_Source_Json( array( 'url' => $url, 'root' => $root, 'paging' => $paging ) );
280280
$source->refresh( $series );
281281
break;
282+
case 'Visualizer_Source_Csv_Remote':
283+
// check if its a live-data chart or a cached-data chart.
284+
if ( ! $force ) {
285+
$hours = get_post_meta( $chart_id, Visualizer_Plugin::CF_CHART_SCHEDULE, true );
286+
if ( ! empty( $hours ) ) {
287+
// cached, bail!
288+
return $chart;
289+
}
290+
}
291+
do_action( 'visualizer_schedule_import' );
292+
return get_post( $chart_id );
282293
default:
283294
return $chart;
284295
}

0 commit comments

Comments
 (0)