From 601706b7b5404df97a8e14eb2544d97aaea69f6d Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 25 Dec 2017 14:59:08 -0800 Subject: [PATCH 1/5] cannot use file_get/put_contents in attach_store, must use pipe_streams --- include/attach.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/include/attach.php b/include/attach.php index e94454905..39269eb03 100644 --- a/include/attach.php +++ b/include/attach.php @@ -550,6 +550,7 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) { $type = $f['type']; } else { if(! x($_FILES,'userfile')) { + logger('No source file'); $ret['message'] = t('No source file.'); return $ret; } @@ -590,6 +591,7 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) { intval($channel_id) ); if(! $x) { + logger('update file source not found'); $ret['message'] = t('Cannot locate file to revise/update'); return $ret; } @@ -731,6 +733,7 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) { $maxfilesize = get_config('system','maxfilesize'); if(($maxfilesize) && ($filesize > $maxfilesize)) { + logger('quota_exceeded'); $ret['message'] = sprintf( t('File exceeds size limit of %d'), $maxfilesize); if($remove_when_processed) @unlink($src); @@ -751,6 +754,7 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) { intval($channel['channel_account_id']) ); if(($r) && (($r[0]['total'] + $filesize) > ($limit - $existing_size))) { + logger('service_class limit exceeded'); $ret['message'] = upgrade_message(true) . sprintf(t("You have reached your limit of %1$.0f Mbytes attachment storage."), $limit / 1024000); if($remove_when_processed) @unlink($src); @@ -783,8 +787,15 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) { $os_path = $os_relpath; $display_path = ltrim($pathname . '/' . $filename,'/'); - if($src) - @file_put_contents($os_basepath . $os_relpath,@file_get_contents($src)); + if($src) { + $istream = @fopen($src,'rb'); + $ostream = @fopen($os_basepath . $os_relpath,'wb'); + if($istream && $ostream) { + pipe_streams($istream,$ostream,65535); + fclose($istream); + fclose($ostream); + } + } if(array_key_exists('created', $arr)) $created = $arr['created']; From b507ac1f98e135d9eb85cba4297f02b10ccc3217 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 25 Dec 2017 15:18:12 -0800 Subject: [PATCH 2/5] util/dcp - argument warning when arguments are correct --- util/dcp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/dcp b/util/dcp index 2817ad4f1..677882193 100755 --- a/util/dcp +++ b/util/dcp @@ -14,7 +14,7 @@ require_once('include/attach.php'); cli_startup(); -if($argc <= 3) { +if($argc < 3) { echo "Usage: " . $argv[0] . ' src dstdir' . "\n"; echo 'Always run from the toplevel web directory.' . "\n"; echo 'destination should begin with store/$nickname/desired/path or $nickname/desired/path' . "\n"; From 32dfa4e86879f70d0c0070e28661194c0997d106 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 25 Dec 2017 16:06:24 -0800 Subject: [PATCH 3/5] document that imagick calls/execs ffmpeg for mp4 video thumbnails --- Zotlabs/Thumbs/Video.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Zotlabs/Thumbs/Video.php b/Zotlabs/Thumbs/Video.php index 5e09ef9a3..d0f72bcdd 100644 --- a/Zotlabs/Thumbs/Video.php +++ b/Zotlabs/Thumbs/Video.php @@ -32,12 +32,18 @@ class Video { fclose($ostream); } + /* + * Note: imagick convert may try to call 'ffmpeg' (or other conversion utilities) under + * the covers for this particular operation. If this is not installed or not in the path + * for the web server user, errors may be reported in the web server logs. + */ + $imagick_path = get_config('system','imagick_convert_path'); if($imagick_path && @file_exists($imagick_path)) { $cmd = $imagick_path . ' ' . escapeshellarg(PROJECT_BASE . '/' . $tmpfile . '[0]') . ' -thumbnail ' . $width . 'x' . $height . ' ' . escapeshellarg(PROJECT_BASE . '/' . $outfile); // logger('imagick thumbnail command: ' . $cmd); - exec($cmd); + @exec($cmd); if(! file_exists($outfile)) { logger('imagick scale failed.'); From 1aa9ce8fe5a7c386733fb8a8d534a647624cac39 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 25 Dec 2017 16:25:04 -0800 Subject: [PATCH 4/5] sort cloud directory by 1. is_dir and 2. name until we can figure out a way to request different sort orders --- Zotlabs/Storage/Directory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zotlabs/Storage/Directory.php b/Zotlabs/Storage/Directory.php index 63ff4341c..510d463c1 100644 --- a/Zotlabs/Storage/Directory.php +++ b/Zotlabs/Storage/Directory.php @@ -691,7 +691,7 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota, DAV\IMo } $prefix = ''; - $suffix = ''; + $suffix = ' order by is_dir desc, filename asc '; $r = q("select $prefix id, uid, hash, filename, filetype, filesize, revision, folder, flags, is_dir, created, edited from attach where folder = '%s' and uid = %d $perms $suffix", dbesc($folder), From 5a8efc10d8ebaf5e81009eaaff8b0c5524a04aa3 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 26 Dec 2017 13:19:27 -0800 Subject: [PATCH 5/5] hubzilla issue #945 - directory keywords returned from twkn in standalone mode --- include/taxonomy.php | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/include/taxonomy.php b/include/taxonomy.php index a13a9cf77..a646df28c 100644 --- a/include/taxonomy.php +++ b/include/taxonomy.php @@ -313,12 +313,25 @@ function dir_tagadelic($count = 0) { $count = intval($count); - // Fetch tags - $r = q("select xtag_term as term, count(xtag_term) as total from xtag where xtag_flags = 0 - group by xtag_term order by total desc %s", - ((intval($count)) ? "limit $count" : '') - ); + $dirmode = get_config('system','directory_mode'); + if($dirmode == DIRECTORY_MODE_STANDALONE) { + // Fetch tags + $r = q("select xtag_term as term, count(xtag_term) as total from xtag + left join hubloc on xtag_hash = hubloc_hash + where xtag_flags = 0 and hubloc_url = '%s' + group by xtag_term order by total desc %s", + dbesc(z_root()), + ((intval($count)) ? "limit $count" : '') + ); + } + else { + // Fetch tags + $r = q("select xtag_term as term, count(xtag_term) as total from xtag where xtag_flags = 0 + group by xtag_term order by total desc %s", + ((intval($count)) ? "limit $count" : '') + ); + } if(! $r) return array();