Advertisement
Guest User

Untitled

a guest
Aug 11th, 2015
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.24 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4. * The daemon initiator file.
  5. * @package zpanelx
  6. * @subpackage core -> daemon
  7. * @author Bobby Allen (ballen@bobbyallen.me)
  8. * @copyright ZPanel Project (http://www.zpanelcp.com/)
  9. * @link http://www.zpanelcp.com/
  10. * @license GPL (http://www.gnu.org/licenses/gpl.html)
  11. */
  12. set_time_limit(0);
  13.  
  14. $rawPath = str_replace("\\", "/", dirname(__FILE__));
  15. $rootPath = str_replace("/bin", "/", $rawPath);
  16. chdir($rootPath);
  17.  
  18. require_once 'dryden/loader.inc.php';
  19. require_once 'cnf/db.php';
  20. require_once 'inc/dbc.inc.php';
  21.  
  22. $daemonLog = new debug_logger();
  23. $daemonLog->method = "file";
  24. $daemonLog->logcode = "001";
  25.  
  26. if (!runtime_controller::IsCLI())
  27. echo "<pre>";
  28. echo "Daemon is now running...";
  29.  
  30. $daemonLog->detail = "Daemon execution started...";
  31. $daemonLog->writeLog();
  32.  
  33. runtime_hook::Execute("OnStartDaemonRun");
  34. runtime_hook::Execute("OnDaemonRun");
  35. runtime_hook::Execute("OnEndDaemonRun");
  36.  
  37. if (ctrl_options::GetSystemOption('daemon_hourrun') < (time() + 3599)) {
  38. runtime_hook::Execute("OnStartDaemonHour");
  39. runtime_hook::Execute("OnDaemonHour");
  40. runtime_hook::Execute("OnEndDaemonHour");
  41. ctrl_options::SetSystemOption('daemon_hourrun', time());
  42. }
  43.  
  44. if (ctrl_options::GetSystemOption('daemon_dayrun') < (time() - 86399)) {
  45. runtime_hook::Execute("OnStartDaemonDay");
  46. runtime_hook::Execute("OnDaemonDay");
  47. runtime_hook::Execute("OnEndDaemonDay");
  48. ctrl_options::SetSystemOption('daemon_dayrun', time());
  49. }
  50.  
  51. if (ctrl_options::GetSystemOption('daemon_weekrun') < (time() - 604799)) {
  52. runtime_hook::Execute("OnStartDaemonWeek");
  53. runtime_hook::Execute("OnDaemonWeek");
  54. runtime_hook::Execute("OnEndDaemonWeek");
  55. ctrl_options::SetSystemOption('daemon_weekrun', time());
  56. }
  57.  
  58. if (ctrl_options::GetSystemOption('daemon_monthrun') < (time() - 2419199)) {
  59. runtime_hook::Execute("OnStartDaemonMonth");
  60. runtime_hook::Execute("OnDaemonMonth");
  61. runtime_hook::Execute("OnEndDaemonMonth");
  62. ctrl_options::SetSystemOption('daemon_monthrun', time());
  63. }
  64.  
  65. echo "\nDaemon run complete!\n";
  66.  
  67. ctrl_options::SetSystemOption('daemon_lastrun', time());
  68.  
  69. $daemonLog->detail = "Daemon execution completed!";
  70. $daemonLog->writeLog();
  71.  
  72. if (!runtime_controller::IsCLI())
  73. echo "</pre>";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement