Welcome to Geeklog Thursday, January 21 2021 @ 11:00 am EST

Geeklog Forums

CUSTOM_runSheduledTask()


Status: offline

mystral-kk

Site Admin
Admin
Registered: 19/03/06
Posts: 100
Location:Japan
Hi, all!

I tried using the CUSTOM_runSheduledTask() function in order to backup our database every day with Geeklog-1.4.0sr3. I set $_CONF['cron_schedule_interval'] to 86400 (default) and wrote some code to call backup script in CUSTOM_runSheduledTask(). However, the script was called every few seconds, instead of a day! Shocked

I checked lib-common.php and in the very last part, I found the part which calls CUSTOM_runSheduledTask() indirectly.

if(( DB_getItem( $_TABLES['vars'], 'value', "name='last_scheduled_run'" )
+ $_CONF['cron_schedule_interval'] ) {
PLG_runScheduledTask();
DB_query( "UPDATE {$_TABLES['vars']} SET value=UNIX_TIMESTAMP() WHERE name='last_scheduled_run'" );
}

I guess the above code will work properly only when the {$_TABLES['vars']} table already has the 'last_scheduled_run' value in it, which, I beileve, is not the case. I hope this value will initially be set when instaling Geeklog or you will put some NOTE or WARNING with CUSTOM_runSheduledTask(). Or am I missing something badly?

Cheers!
--
mystral_kk (Geeklog.jp)

-- mystral-kk, "Every cloud has a silver lining."
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 12/01/02
Posts: 13073
Location:Stuttgart, Germany
Quote by mystral_kk: I guess the above code will work properly only when the {$_TABLES['vars']} table already has the 'last_scheduled_run' value in it, which, I beileve, is not the case.

Yeah, that's a bug. That entry is only present in fresh installs of Geeklog 1.4.0, but not when you've upgraded from an earlier version.

So if you don't have that entry, simple create it before you try to use that function.

Oh, and we're going to correct the function name's spelling in 1.4.1 ...

bye, Dirk
 Quote

mystral_kk

Anonymous
Quote by Dirk:
Yeah, that's a bug. That entry is only present in fresh installs of Geeklog 1.4.0, but not when you've upgraded from an earlier version.

So if you don't have that entry, simple create it before you try to use that function.

Oh, and we're going to correct the function name's spelling in 1.4.1 ...


Thank you for your reply. We'll be cautious when upgrading to 1.4.1.

Cheers!
--
mystral_kk (Geeklog.jp)
 Quote

All times are EST. The time is now 11:00 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content