37
37
use OCA \Backup \Exceptions \RestoringPointNotFoundException ;
38
38
use OCA \Backup \Model \BackupEvent ;
39
39
use OCA \Backup \Service \ConfigService ;
40
+ use OCA \Backup \Service \CronService ;
40
41
use OCA \Backup \Service \FilesService ;
41
42
42
43
/**
@@ -54,6 +55,9 @@ class Event extends TimedJob {
54
55
/** @var FilesService */
55
56
private $ filesService ;
56
57
58
+ /** @var CronService */
59
+ private $ cronService ;
60
+
57
61
/** @var ConfigService */
58
62
private $ configService ;
59
63
@@ -63,17 +67,20 @@ class Event extends TimedJob {
63
67
*
64
68
* @param EventRequest $eventRequest
65
69
* @param FilesService $filesService
70
+ * @param CronService $cronService
66
71
* @param ConfigService $configService
67
72
*/
68
73
public function __construct (
69
74
EventRequest $ eventRequest ,
70
75
FilesService $ filesService ,
76
+ CronService $ cronService ,
71
77
ConfigService $ configService
72
78
) {
73
79
$ this ->setInterval (1 );
74
80
75
81
$ this ->eventRequest = $ eventRequest ;
76
82
$ this ->filesService = $ filesService ;
83
+ $ this ->cronService = $ cronService ;
77
84
$ this ->configService = $ configService ;
78
85
}
79
86
@@ -82,6 +89,10 @@ public function __construct(
82
89
* @param $argument
83
90
*/
84
91
protected function run ($ argument ) {
92
+ if (!$ this ->cronService ->isRealCron ()) {
93
+ return ;
94
+ }
95
+
85
96
foreach ($ this ->eventRequest ->getQueue () as $ event ) {
86
97
if ($ event ->getType () === 'ScanLocalFolder ' ) {
87
98
$ this ->scanLocalFolder ($ event );
0 commit comments