aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Storage/Directory.php2
-rw-r--r--Zotlabs/Thumbs/Video.php8
-rw-r--r--include/attach.php15
-rw-r--r--include/taxonomy.php25
-rwxr-xr-xutil/dcp2
5 files changed, 41 insertions, 11 deletions
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),
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.');
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'];
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();
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";