aboutsummaryrefslogtreecommitdiffstats
path: root/include/import.php
diff options
context:
space:
mode:
authorAndrew Manning <tamanning@zoho.com>2016-07-17 11:52:21 -0400
committerAndrew Manning <tamanning@zoho.com>2016-07-17 11:52:21 -0400
commit6c5086a933451969b72890c9b703d6ee141f9d9f (patch)
treea1ab7453ecf16a97c6904e244c9f3338d26cd370 /include/import.php
parent99354ac57622002c0bbd820235d03321406f8d39 (diff)
downloadvolse-hubzilla-6c5086a933451969b72890c9b703d6ee141f9d9f.tar.gz
volse-hubzilla-6c5086a933451969b72890c9b703d6ee141f9d9f.tar.bz2
volse-hubzilla-6c5086a933451969b72890c9b703d6ee141f9d9f.zip
Added functions to check cloud files path and return path with hashed names
Diffstat (limited to 'include/import.php')
-rw-r--r--include/import.php23
1 files changed, 18 insertions, 5 deletions
diff --git a/include/import.php b/include/import.php
index 3dfe9c7c9..ac52cc9cf 100644
--- a/include/import.php
+++ b/include/import.php
@@ -1218,8 +1218,8 @@ function convert_oldfields(&$arr,$old,$new) {
}
}
-function scan_webpage_elements($path, $type) {
-
+function scan_webpage_elements($path, $type, $cloud = false) {
+ $channel = \App::get_channel();
$dirtoscan = $path;
switch ($type) {
case 'page':
@@ -1237,6 +1237,9 @@ function scan_webpage_elements($path, $type) {
default :
return array();
}
+ if($cloud) {
+ $dirtoscan = get_dirpath_by_cloudpath($channel, $dirtoscan);
+ }
$elements = [];
if (is_dir($dirtoscan)) {
$dirlist = scandir($dirtoscan);
@@ -1247,15 +1250,25 @@ function scan_webpage_elements($path, $type) {
}
$folder = $dirtoscan . '/' . $element;
if (is_dir($folder)) {
- $jsonfilepath = $folder . '/' . $json_filename;
+ if($cloud) {
+ $jsonfilepath = get_filename_by_cloudname($json_filename, $channel, $folder);
+ } else {
+ $jsonfilepath = $folder . '/' . $json_filename;
+ }
if (is_file($jsonfilepath)) {
$metadata = json_decode(file_get_contents($jsonfilepath), true);
- $metadata['path'] = $folder . '/' . $metadata['contentfile'];
+ if($cloud) {
+ $contentfilename = get_filename_by_cloudname($metadata['contentfile'], $channel, $folder);
+ $metadata['path'] = $folder . '/' . $contentfilename;
+ } else {
+ $contentfilename = $metadata['contentfile'];
+ $metadata['path'] = $folder . '/' . $contentfilename;
+ }
if ($metadata['contentfile'] === '') {
logger('Invalid ' . $type . ' content file');
return false;
}
- $content = file_get_contents($folder . '/' . $metadata['contentfile']);
+ $content = file_get_contents($folder . '/' . $contentfilename);
if (!$content) {
logger('Failed to get file content for ' . $metadata['contentfile']);
return false;