-

phpBB cron

Support for phpBB3, phpBB3 Modifications, and phpBB3 styles
Forum rules
Bugs go in the Bug Tracker

phpBB cron

Postby femu » Sun Dec 12, 2010 5:20 am

Hi EXreaction,

I have built a tool, where I need the functionality from a cron. I saw, that you use in your DB Backup tool the phpBB internal function and I tried to make it similar for my mod. So I did following:

Opened includes/functions.php, searched:
Code: Select all
      if ($cron_type)
      {
         $template->assign_var('RUN_CRON_TASK', '<img src="' . append_sid($phpbb_root_path . 'cron.' . $phpEx, 'cron_type=' . $cron_type) . '" width="1" height="1" alt="cron" />');


and ADDED BEFORE:
Code: Select all
      else if ((time() + ($config['chart_server_time'] * 3600)) > ($config['chart_start_time'] + $config['chart_period']))
      {
         // run dm charts reset
         $cron_type = 'dm_chart_reset';
      }


Then I opened cron.php and searched:
Code: Select all
}

// Unloading cache and closing db after having done the dirty work.
if ($use_shutdown_function)


and ADDED BEFORE:
Code: Select all
   // Run DM Charts reset
   case 'dm_chart_reset' :
      include($phpbb_root_path . 'includes/functions_dm_music_charts.' . $phpEx);

      if ($use_shutdown_function)
      {
         register_shutdown_function('dm_chart_reset');
      }
      else
      {
         check_charts_reset();
      }
   break;


So all looks similar to your DB Backup. The only thing is now, that it seems not to start the function check_charts_reset() .... :oops:

Is there probably something else I need to take care of? I made it earlier with a "manual" call of a cronjob php file and an external provider, who starts the job. But I have the feeling, it's more easier with the phpBB internal feature ...

Thanks,
Felix
femu
Donor
Donor
 
Posts: 50
Joined: Sat Aug 16, 2008 8:41 am
Blog: View Blog (0)

Re: phpBB cron

Postby EXreaction » Sun Dec 12, 2010 11:03 am

Does it get to the case at all?
Grateful for the mods I've built? Then donate!
User avatar
EXreaction
Site Owner
Site Owner
 
Posts: 4996
Joined: Wed Jun 28, 2006 5:08 pm
Blog: View Blog (53)

Re: phpBB cron

Postby femu » Sun Dec 12, 2010 11:11 am

I think not really .. I tried following:

Code: Select all
      else if (time() > 1292173200)
      {
         echo "Test";
         // run dm charts reset
         $cron_type = 'dm_chart_reset';
      }


If time() is really bigger, then the echo line is shown. But it seems not to go to the case. I added there an echo line too, but this is not shown ...
femu
Donor
Donor
 
Posts: 50
Joined: Sat Aug 16, 2008 8:41 am
Blog: View Blog (0)

Re: phpBB cron

Postby EXreaction » Sun Dec 12, 2010 3:59 pm

I would recommend asking in the mod writers forum on phpBB.com, someone there will probably have more time to help you than I do.
Grateful for the mods I've built? Then donate!
User avatar
EXreaction
Site Owner
Site Owner
 
Posts: 4996
Joined: Wed Jun 28, 2006 5:08 pm
Blog: View Blog (53)

Re: phpBB cron

Postby femu » Sun Dec 12, 2010 9:04 pm

Got it. I compared with other crons above in the cron.php and changed the "job" to following:

Code: Select all
   // Run DM Charts reset
   case 'dm_chart_reset' :
      include($phpbb_root_path . 'includes/functions_dm_music_charts.' . $phpEx);

      if ((time() + ($config['chart_server_time'] * 3600)) > ($config['chart_start_time'] + $config['chart_period']))
      {
         check_charts_reset();
      }
   break;


And this works. So the if ($use_shutdown_function) seems not to work for my mod ... Whatever this is used for :D
femu
Donor
Donor
 
Posts: 50
Joined: Sat Aug 16, 2008 8:41 am
Blog: View Blog (0)


Return to phpBB3 Support



Who is online

Users browsing this forum: No registered users and 2 guests