more debugging

This commit is contained in:
Harald Milz 2019-03-23 08:30:33 +01:00
parent a91fb9cded
commit f4ac8ac7b4
2 changed files with 10 additions and 6 deletions

View file

@ -42,6 +42,7 @@ function gcal_import_worker()
$table = $wpdb->prefix.GCAL_TABLE;
$structure = "SELECT gcal_category from $table ;";
$categories = $wpdb->query($structure);
file_put_contents ('/tmp/categories.txt', var_dump ($categories));
foreach ( $categories as $category) {
error_log ("found category $category");
gcal_import_process_category($category);
@ -63,7 +64,7 @@ function gcal_import_process_category($category) {
// will this also work with a proxy? After all, it does a file_get_contents internally.
$result = $cal->parse($link);
$file = "/tmp/$category-array.txt";
file_put_contents ($file, print_r ($result, TRUE));
file_put_contents ($file, var_dump ($result));
}

View file

@ -41,6 +41,10 @@ define ('GCAL_TABLE', 'gcal_import');
*
*/
// The real work goes here.
require_once dirname( __FILE__ ) . "/gcal-import-worker.php";
add_action( 'gcal_import_worker_hook', 'gcal_import_worker' );
/**
* Initializes the plugin and creates a table
*
@ -76,6 +80,9 @@ function gcal_import_activate()
}
*/
// do it once now!
gcal_import_worker;
// and start the scheduler;
if ( ! wp_next_scheduled( 'gcal_import_worker_hook' ) ) {
wp_schedule_event( time(), 'hourly', 'gcal_import_worker_hook' );
}
@ -86,7 +93,6 @@ function gcal_import_activate()
register_activation_hook( __FILE__, 'gcal_import_activate' );
/**
* Deactivate unregisters the housekeeping function.
*
@ -97,7 +103,7 @@ register_activation_hook( __FILE__, 'gcal_import_activate' );
function gcal_import_deactivate()
{
error_log ("gcal_import_deactivate started");
wp_clear_scheduled_hook('gcal_import_cron_hook' );
wp_clear_scheduled_hook('gcal_import_worker_hook' );
error_log ("gcal_import_deactivate finished");
}
@ -146,9 +152,6 @@ function gcal_import_admin()
}
// The real work goes here.
require_once dirname( __FILE__ ) . "/gcal-import-worker.php";
add_action( 'gcal_import_worker_hook', 'gcal_import_worker' );