aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kostikov <max@kostikov.co>2019-04-16 17:37:07 +0200
committerMax Kostikov <max@kostikov.co>2019-04-16 17:37:07 +0200
commit5a9c8a9343330a4f7b6249582997bec2acfc121a (patch)
treed1af23c7c14b6fd0eb6123d617fde45aeee46332
parent71f17a233e29a45304f43ee2329bfff1865c6917 (diff)
parent5ba7e5d7d7e32db0803b5bd0f5845d2a1a556f66 (diff)
downloadvolse-hubzilla-5a9c8a9343330a4f7b6249582997bec2acfc121a.tar.gz
volse-hubzilla-5a9c8a9343330a4f7b6249582997bec2acfc121a.tar.bz2
volse-hubzilla-5a9c8a9343330a4f7b6249582997bec2acfc121a.zip
Merge branch 'dev' into 'dev'
Use base image content instead of os_path; fix base images stats See merge request hubzilla/core!1594
-rwxr-xr-xutil/storageconv16
1 files changed, 5 insertions, 11 deletions
diff --git a/util/storageconv b/util/storageconv
index 594ec14fb..9c49787d1 100755
--- a/util/storageconv
+++ b/util/storageconv
@@ -29,7 +29,7 @@ if($argc == 2) {
echo 'Current storage set to: ' . ($storage ? 'filesystem' : 'SQL database') . PHP_EOL;
switch($argv[1]) {
case 'stats':
- $x = q("SELECT COUNT(resource_id) AS qty FROM photo WHERE photo_usage = 0 and os_storage = 1");
+ $x = q("SELECT COUNT(resource_id) AS qty FROM photo WHERE photo_usage = 0 AND os_storage = 1 AND imgscale = 0");
echo 'Local images: ' . $x[0]['qty'] . PHP_EOL;
$x = q("SELECT COUNT(id) AS qty FROM photo WHERE resource_id IN (SELECT DISTINCT resource_id FROM photo WHERE photo_usage = 0 and os_storage = 1) AND imgscale > 0");
echo 'Thumbnails total: ' . $x[0]['qty'] . PHP_EOL;
@@ -45,26 +45,21 @@ if($argc == 2) {
break;
}
- $x = q("SELECT DISTINCT uid, resource_id FROM photo WHERE photo_usage = 0 and os_storage = 1");
+ $x = q("SELECT DISTINCT resource_id, content FROM photo WHERE photo_usage = 0 AND os_storage = 1 AND imgscale = 0");
if($x) {
foreach($x as $xx) {
- $r = q("SELECT channel_address FROM channel WHERE channel_id = %d",
- intval($xx['uid'])
- );
-
- $n = q("SELECT id, imgscale, content, os_path FROM photo WHERE resource_id = '%s' AND os_storage != %d AND imgscale > 0",
+ $n = q("SELECT id, imgscale, content FROM photo WHERE resource_id = '%s' AND os_storage != %d AND imgscale > 0",
dbesc($xx['resource_id']),
$storage
);
- echo count($n) . PHP_EOL;
foreach($n as $nn) {
echo '.';
- $filename = 'store/' . $r[0]['channel_address'] . '/' . $nn['os_path'] . '-' . $nn['imgscale'];
+ $filename = dbunescbin($xx['content']) . '-' . $nn['imgscale'];
if(! file_put_contents($filename, dbunescbin($nn['content']))) {
echo 'Failed to save file ' . $filename . PHP_EOL;
continue;
@@ -90,7 +85,7 @@ if($argc == 2) {
break;
}
- $x = q("SELECT DISTINCT resource_id FROM photo WHERE photo_usage = 0 and os_storage = 1");
+ $x = q("SELECT DISTINCT resource_id FROM photo WHERE photo_usage = 0 AND os_storage = 1 AND imgscale = 0");
if($x) {
foreach($x as $xx) {
@@ -134,4 +129,3 @@ if($argc == 2) {
echo PHP_EOL;
}
-