-
Notifications
You must be signed in to change notification settings - Fork 98
/
Copy pathchkupdatethumb.php
61 lines (52 loc) · 2.21 KB
/
chkupdatethumb.php
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
<?php
ignore_user_abort(true);
if (!defined('IN_OAOOA')) {
exit('Access Denied');
}
@set_time_limit(0);
ini_set('memory_limit', -1);
@ini_set('max_execution_time', 0);
global $_G;
$thumbsize = $_G['setting']['thumbsize'];
$wp = $_G['setting']['IsWatermarkstatus'] ? intval($_G['setting']['watermarkstatus']):0;//水印位置
$wt = $_G['setting']['IsWatermarkstatus'] ? $_G['setting']['watermarktype']:0;//水印类型
$wcontent = $_G['setting']['IsWatermarkstatus'] ? $_G['setting']['waterimg']:'';//水印内容
$appids = [''];
$appdata = [];
foreach(DB::fetch_all("select appid,path,`type` from %t where (`type` = %d or `type` = %d )and isdelete < 1",array('pichome_vapp',1,3,1)) as $v){
if($v['type'] == 3 || IO::checkfileexists($v['path'],1)){
$appids[] = $v['appid'];
$appdata[$v['appid']] = $v;
}
}
if(empty($appids)){
exit('success');
}
$locked = true;
$processname = 'DZZ_LOCK_PICHOMEGETTHUMBCHECK';
if (!dzz_process::islocked($processname, 60*15)) {
$locked=false;
}
$limit = 1000;
$start=$i*$limit;
//dzz_process::unlock($processname);
if ($locked) {
exit(json_encode( array('error'=>'进程已被锁定请稍后再试')));
}
$checktime = TIMESTAMP - 300;
$datas = DB::fetch_all("select * from %t where (schk = 0 or lchk = 0) and checktime < %d order by checktime asc limit $start,$limit",array('thumb_record',$checktime));
foreach ($datas as $v) {
$setarr = ['checktime'=>TIMESTAMP];
//更新当前数据获取缩略图执行次数和时间
if ($v['swidth'] != $thumbsize['small']['width'] || $v['sheight'] != $thumbsize['small']['height'] ||
$v['swaterposition'] != $wp || $v['swatertype'] != $wt || $v['swatercontent'] != $wcontent) {
$setarr['schk'] = 1;
}
if ($v['lwidth'] != $thumbsize['large']['width'] || $v['lheight'] != $thumbsize['large']['height'] ||
$v['lwaterposition'] != $wp || $v['lwatertype'] != $wt || $v['lwatercontent'] != $wcontent) {
//C::t('thumb_record')->update($v['rid'],array('ltimes'=>intval($v['ltimes'])+1,'ldateline'=>TIMESTAMP));
$setarr['lchk'] = 1;
}
C::t('thumb_record')->update($v['rid'],$setarr);
}
dzz_process::unlock($processname);