diff options
-rw-r--r-- | Zotlabs/Module/Photo.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Wfinger.php | 2 | ||||
-rw-r--r-- | include/event.php | 7 | ||||
-rwxr-xr-x | util/storageconv | 16 |
4 files changed, 13 insertions, 14 deletions
diff --git a/Zotlabs/Module/Photo.php b/Zotlabs/Module/Photo.php index 6912322aa..37ae03460 100644 --- a/Zotlabs/Module/Photo.php +++ b/Zotlabs/Module/Photo.php @@ -83,7 +83,7 @@ class Photo extends \Zotlabs\Web\Controller { $modified = strtotime($r[0]['edited'] . "Z"); $mimetype = $r[0]['mimetype']; if(intval($r[0]['os_storage'])) - $data = file_get_contents($data); + $data = file_get_contents(dbunescbin($r[0]['content'])); else $data = dbunescbin($r[0]['content']); } diff --git a/Zotlabs/Module/Wfinger.php b/Zotlabs/Module/Wfinger.php index 03275abbc..a19bdbedc 100644 --- a/Zotlabs/Module/Wfinger.php +++ b/Zotlabs/Module/Wfinger.php @@ -128,7 +128,7 @@ class Wfinger extends \Zotlabs\Web\Controller { 'http://webfinger.net/ns/name' => $r[0]['channel_name'], 'http://xmlns.com/foaf/0.1/name' => $r[0]['channel_name'], 'https://w3id.org/security/v1#publicKeyPem' => $r[0]['xchan_pubkey'], - 'http://purl.org/zot/federation' => 'zot' + 'http://purl.org/zot/federation' => 'zot,zot6' ]; foreach($aliases as $alias) diff --git a/include/event.php b/include/event.php index fdb9e1415..77118c329 100644 --- a/include/event.php +++ b/include/event.php @@ -4,8 +4,11 @@ * @brief Event related functions. */ + use Sabre\VObject; +use Zotlabs\Lib\Activity; + use Ramsey\Uuid\Uuid; use Ramsey\Uuid\Exception\UnsatisfiedDependencyException; @@ -65,7 +68,7 @@ function format_event_html($ev) { } function format_event_obj($jobject) { - $event = array(); + $event = []; $object = json_decode($jobject,true); @@ -1046,6 +1049,7 @@ function event_store_item($arr, $event) { 'location' => $arr['location'], 'adjust' => $arr['adjust'], 'content' => format_event_bbcode($arr), + 'attachment' => Activity::encode_attachment($r[0]), 'author' => array( 'name' => $r[0]['xchan_name'], 'address' => $r[0]['xchan_addr'], @@ -1200,6 +1204,7 @@ function event_store_item($arr, $event) { 'location' => $arr['location'], 'adjust' => $arr['adjust'], 'content' => format_event_bbcode($arr), + 'attachment' => Activity::encode_attachment($item_arr), 'author' => array( 'name' => $x[0]['xchan_name'], 'address' => $x[0]['xchan_addr'], 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; } - |