-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcron.php
More file actions
executable file
·82 lines (54 loc) · 1.62 KB
/
cron.php
File metadata and controls
executable file
·82 lines (54 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
/**
* Main grfx cron job file
*
* @package grfx
* @subpackage grfx_Cron
*/
$CRON_TEST = true;
if($CRON_TEST == true)
error_reporting( E_ALL );
/**
* FIRST, Verify there are uploads before loading any sort of process. ---- ---- ---- ---- ----
*/
$uploads = array();
$files = scandir( dirname( __FILE__ ) . '/../../uploads/grfx_uploads/protected/' );
if ( $files ) {
$signature = false;
$filesum = false;
if(file_exists(trailingslashit(grfx_tmp_dir()).'filesum'))
$filesum = file_get_contents (trailingslashit(grfx_tmp_dir()).'filesum');
foreach ( $files as $file ) {
if ( $file == '.' || $file == '..' || $file == '.htaccess' || $file == '.ftpquota' )
continue;
array_push( $uploads, $file );
}
/**
* This little operation writes a unique string to see if our file collection has changed at all
* If it hasn't changed, that means they are sitting there but not queued. We will do a comparison
* to determine whether or not to proceed.
*/
if(!empty($files)){
$signature = md5(implode('', $files));
}
if($signature && $filesum){
if($signature == $filesum)
die(':(');
} else {
file_put_contents(trailingslashit(grfx_tmp_dir()).'filesum', $signature);
}
}
if ( empty( $uploads ) )
die(':)');
/**
* SECOND if files, start to process ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
*/
/**
* Initial Cron Job Setup
*/
function grfx_start_cron(){
$cron = new grfx_Cron();
}
grfx_start_cron();
if($CRON_TEST == true)
grfx_get_memory_use();