From 89795fe8430756d770f7c2b3ba91e0c6ee7b4c64 Mon Sep 17 00:00:00 2001 From: Daniel Neto Date: Mon, 10 Jul 2023 09:15:28 -0300 Subject: [PATCH] Add option to execute a code, every minute, or hour, or day or month --- plugin/AVideoPlugin.php | 39 ++++++++++++++++++++++++++++++++++++++ plugin/Plugin.abstract.php | 12 ++++++++++++ 2 files changed, 51 insertions(+) diff --git a/plugin/AVideoPlugin.php b/plugin/AVideoPlugin.php index 7f508da72b..42f1cde525 100644 --- a/plugin/AVideoPlugin.php +++ b/plugin/AVideoPlugin.php @@ -2848,6 +2848,45 @@ class AVideoPlugin self::YPTend("{$value['dirName']}::" . __FUNCTION__); } } + + public static function executeEveryHour() + { + $plugins = Plugin::getAllEnabled(); + foreach ($plugins as $value) { + self::YPTstart(); + $p = static::loadPlugin($value['dirName']); + if (is_object($p)) { + $p->executeEveryHour(); + } + self::YPTend("{$value['dirName']}::" . __FUNCTION__); + } + } + + public static function executeEveryDay() + { + $plugins = Plugin::getAllEnabled(); + foreach ($plugins as $value) { + self::YPTstart(); + $p = static::loadPlugin($value['dirName']); + if (is_object($p)) { + $p->executeEveryDay(); + } + self::YPTend("{$value['dirName']}::" . __FUNCTION__); + } + } + + public static function executeEveryMonth() + { + $plugins = Plugin::getAllEnabled(); + foreach ($plugins as $value) { + self::YPTstart(); + $p = static::loadPlugin($value['dirName']); + if (is_object($p)) { + $p->executeEveryMonth(); + } + self::YPTend("{$value['dirName']}::" . __FUNCTION__); + } + } } class YouPHPTubePlugin extends AVideoPlugin diff --git a/plugin/Plugin.abstract.php b/plugin/Plugin.abstract.php index 9a9d0ced4f..002b834c56 100644 --- a/plugin/Plugin.abstract.php +++ b/plugin/Plugin.abstract.php @@ -749,6 +749,18 @@ abstract class PluginAbstract { function executeEveryMinute() { + } + + function executeEveryHour() { + + } + + function executeEveryDay() { + + } + + function executeEveryMonth() { + } /**