Upload a file with FTP daily with hook_cron()

Public

Get raw version
php
  1. function mymodule_cron() {
  2. $curent_time = time();
  3. $last_upload = variable_get('mymodule_last_ftp_upload', 999999);
  4.  
  5. // Only do something if it's been 24 hours
  6. if ($current_time - $last_upload > (24 * 3600)) {
  7. $success = ftp_put(); // Something goes here
  8.  
  9. if ($success) {
  10. variable_set('mymodule_last_ftp_upload', $current_time);
  11. }
  12. }
  13. }