file import issues, change min php version in setup

This commit is contained in:
zotlabs 2019-02-25 14:57:19 -08:00
parent 5baa3fa4ef
commit e938b7e71e
2 changed files with 15 additions and 7 deletions

View file

@ -392,8 +392,8 @@ class Setup extends \Zotlabs\Web\Controller {
function check_php(&$phpath, &$checks) {
$help = '';
if(version_compare(PHP_VERSION, '5.5') < 0) {
$help .= t('PHP version 5.5 or greater is required.');
if(version_compare(PHP_VERSION, '7.1') < 0) {
$help .= t('PHP version 7.1 or greater is required.');
$this->check_add($checks, t('PHP version'), false, false, $help);
}

View file

@ -1111,9 +1111,8 @@ function sync_files($channel, $files) {
continue;
if($f['attach']) {
$attachment_stored = false;
foreach($f['attach'] as $att) {
$attachment_stored = false;
convert_oldfields($att,'data','content');
if($att['deleted']) {
@ -1201,12 +1200,14 @@ function sync_files($channel, $files) {
// process/sync a remote rename/move operation
if($orig_attach['content'] !== $newfname) {
if($orig_attach && $orig_attach['content'] && $orig_attach['content'] !== $newfname) {
logger('rename: ' . $orig_attach['content'] . ' -> ' . $newfname);
rename($orig_attach['content'],$newfname);
}
if(! dbesc_array($att))
if(! dbesc_array($att)) {
continue;
}
$str = '';
foreach($att as $k => $v) {
@ -1222,6 +1223,7 @@ function sync_files($channel, $files) {
create_table_from_array('attach',$att);
}
// is this a directory?
if($att['filetype'] === 'multipart/mixed' && $att['is_dir']) {
@ -1230,6 +1232,7 @@ function sync_files($channel, $files) {
continue;
}
else {
// it's a file
// for the sync version of this algorithm (as opposed to 'offline import')
// we will fetch the actual file from the source server so it can be
@ -1242,22 +1245,27 @@ function sync_files($channel, $files) {
'time' => $time,
'resource' => $att['hash'],
'revision' => 0,
'signature' => zot_sign($channel['channel_hash'] . '.' . $time, $channel['channel_prvkey'])
'signature' => Libzot::sign($channel['channel_hash'] . '.' . $time, $channel['channel_prvkey'])
);
$store_path = $newfname;
$fp = fopen($newfname,'w');
if(! $fp) {
logger('failed to open storage file.',LOGGER_NORMAL,LOG_ERR);
continue;
}
$redirects = 0;
$headers = [ 'Accept' => 'application/x-zot+json', 'Sigtoken' => random_string() ];
$headers = HTTPSig::create_sig($headers,$channel['channel_prvkey'], channel_url($channel),true,'sha512');
$x = z_post_url($fetch_url,$parr,$redirects,[ 'filep' => $fp, 'headers' => $headers]);
fclose($fp);
if($x['success']) {