PicHome 2.0.1
This commit is contained in:
@@ -27,6 +27,8 @@ class Init{
|
||||
$dzz->init_session = false;
|
||||
break;
|
||||
default:
|
||||
$dzz->init_cron = false;
|
||||
$dzz->init_session = false;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ for($i=0;$i<$processnum;$i++) {
|
||||
|
||||
/*$i = 0;
|
||||
$processname = 'DZZ_LOCK_PICHOMEVIDEOCONVERT'.$i;*/
|
||||
$limit = 1;
|
||||
$limit = 10;
|
||||
$start=$i*$limit;
|
||||
/*if (!dzz_process::islocked($processname, 60*15)) {
|
||||
$locked=false;
|
||||
@@ -56,11 +56,11 @@ foreach($convertdata as $v){
|
||||
if(!$convertsate) exit(json_encode( array('error'=>'转换未开启')));
|
||||
if($_GET['id']){
|
||||
$datas = DB::fetch_all("select vr.* from %t vr left join %t r on vr.rid=r.rid left join %t v on v.appid = r.appid where vr.id = %d and vr.status <= 0 and v.isdelete < 1
|
||||
and (v.type = 1 or v.type = 3) order by vr.jobnum asc limit $start,1",array('video_record','pichome_resources','pichome_vapp',$_GET['id']));
|
||||
order by vr.jobnum asc limit $start,1",array('video_record','pichome_resources','pichome_vapp',$_GET['id']));
|
||||
}else{
|
||||
//查询符合执行条件的数据
|
||||
$datas = DB::fetch_all("select vr.* from %t vr left join %t r on vr.rid=r.rid left join %t v on v.appid = r.appid where vr.status <= 0 and v.isdelete < 1
|
||||
and (v.type = 1 or v.type = 3) order by vr.jobnum asc limit $start,$limit",array('video_record','pichome_resources','pichome_vapp'));
|
||||
order by vr.jobnum asc limit $start,$limit",array('video_record','pichome_resources','pichome_vapp'));
|
||||
|
||||
}
|
||||
|
||||
|
||||
64
misc/exportfile.php
Normal file
64
misc/exportfile.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
ignore_user_abort(true);
|
||||
if (!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
@ignore_user_abort(true);
|
||||
@set_time_limit(0);
|
||||
@ini_set('memory_limit', -1);
|
||||
@ini_set('max_execution_time', 0);
|
||||
|
||||
$appid = isset($_GET['appid']) ? trim($_GET['appid']):0;
|
||||
$processname = 'DZZ_EXPORTFILE_LOCK_'.$appid;
|
||||
$locked = true;
|
||||
if (!dzz_process::islocked($processname, 60*15)) {
|
||||
$locked=false;
|
||||
}
|
||||
if ($locked) {
|
||||
exit(json_encode( array('error'=>'进程已被锁定请稍后再试')));
|
||||
}
|
||||
$force = isset($_GET['force']) ? intval($_GET['force']):0;
|
||||
$data = C::t('pichome_vapp')->fetch($appid);
|
||||
|
||||
if(!$data) exit(json_encode(array('error'=>'no data')));
|
||||
|
||||
if($data['state'] != 2 && $data['isdelete'] != 0) exit(json_encode(array('error'=>'is deleted or state is not allow')));
|
||||
if($data['type'] == 0){
|
||||
include_once DZZ_ROOT.'dzz'.BS.'eagle'.BS.'class'.BS.'class_eagleexport.php';
|
||||
//include_once dzz_libfile('eagleexport');
|
||||
$eagleexport = new eagleexport($data);
|
||||
try{
|
||||
$return = $eagleexport->execExport($force);
|
||||
}catch (Exception $e){
|
||||
dzz_process::unlock($processname);
|
||||
}
|
||||
|
||||
}elseif($data['type'] == 1){
|
||||
include_once DZZ_ROOT.'dzz'.BS.'local'.BS.'class'.BS.'class_localexport.php';
|
||||
//include_once dzz_libfile('localexport');
|
||||
$localexport = new localexport($data);
|
||||
//执行导入文件
|
||||
try{
|
||||
$return = $localexport->execExport($force);
|
||||
}catch (Exception $e){
|
||||
dzz_process::unlock($processname);
|
||||
}
|
||||
}elseif ($data['type'] == 2){
|
||||
include_once DZZ_ROOT.'dzz'.BS.'billfish'.BS.'class'.BS.'class_billfishexport.php';
|
||||
$billfishxport = new billfishxport($data);
|
||||
try{
|
||||
$return = $billfishxport->execExport($force);
|
||||
}catch (Exception $e){
|
||||
dzz_process::unlock($processname);
|
||||
}
|
||||
}
|
||||
dzz_process::unlock($processname);
|
||||
|
||||
$data = C::t('pichome_vapp')->fetch($appid);
|
||||
if($data['state'] == 2){
|
||||
dfsockopen(getglobal('localurl') . 'misc.php?mod=exportfile&appid=' . $appid.'&force='.$force, 0, '', '', false, '', 1);
|
||||
}elseif($data['state'] == 3){
|
||||
dfsockopen(getglobal('localurl') . 'misc.php?mod=exportfilecheck&appid=' . $appid, 0, '', '', false, '', 1);
|
||||
}
|
||||
exit('success');
|
||||
|
||||
45
misc/exportfilecheck.php
Normal file
45
misc/exportfilecheck.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
if (!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
@ignore_user_abort(true);
|
||||
@set_time_limit(0);
|
||||
@ini_set('memory_limit', -1);
|
||||
@ini_set('max_execution_time', 0);
|
||||
|
||||
$appid = isset($_GET['appid']) ? trim($_GET['appid']) : 0;
|
||||
$processname = 'DZZ_EXPORTCHECKFILE_LOCK_' . $appid;
|
||||
//dzz_process::unlock($processname);
|
||||
$locked = true;
|
||||
if (!dzz_process::islocked($processname, 60*15)) {
|
||||
$locked = false;
|
||||
}
|
||||
if ($locked) {
|
||||
exit(json_encode(array('error' => '进程已被锁定请稍后再试')));
|
||||
}
|
||||
|
||||
$force = isset($_GET['force']) ? intval($_GET['force']) : 0;
|
||||
$data = C::t('pichome_vapp')->fetch($appid);
|
||||
if (!$data) exit(json_encode(array('error' => 'no data')));
|
||||
if ($data['state'] != 3 && $data['isdelete'] != 0) exit(json_encode(array('error' => 'is deleted or state is not allow')));
|
||||
if ($data['type'] == 0) {
|
||||
include_once DZZ_ROOT.'dzz'.BS.'eagle'.BS.'class'.BS.'class_eagleexport.php';
|
||||
//include_once dzz_libfile('eagleexport');
|
||||
$eagleexport = new eagleexport($data);
|
||||
$return = $eagleexport->execCheckFile();
|
||||
} elseif ($data['type'] == 1) {
|
||||
include_once DZZ_ROOT.'dzz'.BS.'local'.BS.'class'.BS.'class_localexport.php';
|
||||
//include_once dzz_libfile('localexport');
|
||||
$localexport = new localexport($data);
|
||||
$return = $localexport->execCheckFile();
|
||||
}elseif ($data['type'] == 2){
|
||||
include_once DZZ_ROOT.'dzz'.BS.'billfish'.BS.'class'.BS.'class_billfishexport.php';
|
||||
$billfishxport = new billfishxport($data);
|
||||
$return = $billfishxport->execCheckFile();
|
||||
}
|
||||
dzz_process::unlock($processname);
|
||||
$data = C::t('pichome_vapp')->fetch($appid);
|
||||
if($data['state'] == 3){
|
||||
dfsockopen(getglobal('localurl') . 'misc.php?mod=exportfilecheck&appid=' . $appid, 0, '', '', false, '', 1);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ ignore_user_abort(true);
|
||||
if (!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
//runlog('aaaauploadafter',time());
|
||||
//
|
||||
//error_reporting(E_ALL);
|
||||
@@ -19,7 +20,7 @@ for($i=0;$i<$processnum;$i++){
|
||||
break;
|
||||
}
|
||||
}
|
||||
$limit = 1;
|
||||
$limit = 100;
|
||||
$start=$i*$limit;
|
||||
//dzz_process::unlock($processname);
|
||||
if ($locked) {
|
||||
@@ -81,7 +82,7 @@ order by r.dateline desc,mintimes asc limit $start,$limit",array('thumb_record',
|
||||
if($datas){
|
||||
foreach($datas as $v){
|
||||
$processname1 = 'PICHOMEGETTHUMB_'.$v['rid'];
|
||||
// dzz_process::unlock($processname1);
|
||||
//dzz_process::unlock($processname1);
|
||||
//如果当前数据是锁定状态则跳过
|
||||
if (dzz_process::islocked($processname1, 60*5)) {
|
||||
continue;
|
||||
|
||||
41
misc/initexport.php
Normal file
41
misc/initexport.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
if (!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
@ignore_user_abort(true);
|
||||
@set_time_limit(0);
|
||||
@ini_set('memory_limit', -1);
|
||||
@ini_set('max_execution_time', 0);
|
||||
if(getglobal('setting/bbclosed')) exit(json_encode(array('error'=>'站点关闭中,请开启站点后重试')));
|
||||
$appid = isset($_GET['appid']) ? trim($_GET['appid']):0;
|
||||
$force = isset($_GET['force']) ? intval($_GET['force']):0;
|
||||
$data = C::t('pichome_vapp')->fetch($appid);
|
||||
if(!$data) exit(json_encode(array('error'=>'no data')));
|
||||
if(($data['state'] > 1 && $data['state'] < 4) || $data['isdelete'] != 0) exit(json_encode(array('error'=>'export is runing or is deleted')));
|
||||
|
||||
if($data['type'] == 0){
|
||||
include_once DZZ_ROOT.'dzz'.BS.'eagle'.BS.'class'.BS.'class_eagleexport.php';
|
||||
$eagleexport = new eagleexport($data);
|
||||
$return = $eagleexport->initExport();
|
||||
}elseif($data['type'] == 1 ){
|
||||
include_once DZZ_ROOT.'dzz'.BS.'local'.BS.'class'.BS.'class_localexport.php';
|
||||
//include_once dzz_libfile('localexport');
|
||||
$localexport = new localexport($data);
|
||||
$return = $localexport->initExport();
|
||||
}elseif ($data['type'] == 2){
|
||||
if(!extension_loaded('pdo_sqlite')){
|
||||
exit(json_encode(array('error'=>'缺少 pdo_sqlite拓展')));
|
||||
}
|
||||
include_once DZZ_ROOT.'dzz'.BS.'billfish'.BS.'class'.BS.'class_billfishexport.php';
|
||||
$billfishxport = new billfishxport($data);
|
||||
$return = $billfishxport->initExport();
|
||||
}
|
||||
if(isset($return['error'])){
|
||||
exit(json_encode($return));
|
||||
}
|
||||
$data = C::t('pichome_vapp')->fetch($appid);
|
||||
if($data['state'] == 2){
|
||||
dfsockopen(getglobal('localurl') . 'misc.php?mod=exportfile&appid=' . $appid.'&force='.$force, 0, '', '', false, '', 1);
|
||||
}
|
||||
exit(json_encode(array('success'=>true)));
|
||||
|
||||
@@ -34,20 +34,19 @@ if($rid){
|
||||
'swatercontent'=>$wcontent,
|
||||
];
|
||||
C::t('thumb_record')->insert($thumbrecorddata);
|
||||
$videoexts = array('3gp','asf','avi','dv','flv','f4v','m3u8','m4v','mkv','mov','mp4','mpg','mpeg','mts','ogg','rm','rmvb','swf','vob','wmv','webm','mp3','aac','flac','amr','awb','m4a','wma','wav');
|
||||
$exts = explode(',',$_G['config']['pichomeffmpegconvertext']);
|
||||
//如果类型不符合则停止执行
|
||||
if ($exts && !in_array($data['ext'], $videoexts)) exit();
|
||||
if ($exts && !in_array($resourcedata['ext'], $exts)) exit();
|
||||
$pexts = getglobal('config/pichomeplayermediaext') ? explode(',', getglobal('config/pichomeplayermediaext')) : array('mp3', 'mp4', 'webm', 'ogv', 'ogg', 'wav', 'm3u8', 'hls', 'mpg', 'mpeg');
|
||||
if (in_array($data['ext'], $pexts)) {
|
||||
if (in_array($resourcedata['ext'], $pexts)) {
|
||||
exit();
|
||||
} else {
|
||||
|
||||
if ('audio' == getTypeByExt($data['ext'])) {
|
||||
if ('audio' == getTypeByExt($resourcedata['ext'])) {
|
||||
$ext = 'mp3';
|
||||
} else {
|
||||
$ext = 'webm';
|
||||
$ext = 'mp4';
|
||||
}
|
||||
$setarr = ['rid' =>$rid, 'dateline' => TIMESTAMP, 'ctype' => 0,'format'=>$ext,'videoquality'=>0];
|
||||
$setarr = ['rid' =>$rid, 'dateline' => TIMESTAMP, 'ctype' => 0,'format'=>$ext,'videoquality'=>getglobal('config/defaultvideoquality')];
|
||||
$setarr['aid']= $resourcedata['aid'] ? $resourcedata['aid']:0;
|
||||
$ff = C::t('video_record')->insert_data($setarr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user