aboutsummaryrefslogtreecommitdiffstats
path: root/include/import.php
diff options
context:
space:
mode:
authorAndrew Manning <tamanning@zoho.com>2016-08-20 21:08:15 -0400
committerAndrew Manning <tamanning@zoho.com>2016-08-20 21:08:15 -0400
commit1c61e316b477460f05b263b9a01cc5d37b5e8cb6 (patch)
treefc151860f3899135ec1d5303c21e31e0618b911f /include/import.php
parent2d42d587388aeaedf8b53b2b56b3b4ccda37af03 (diff)
downloadvolse-hubzilla-1c61e316b477460f05b263b9a01cc5d37b5e8cb6.tar.gz
volse-hubzilla-1c61e316b477460f05b263b9a01cc5d37b5e8cb6.tar.bz2
volse-hubzilla-1c61e316b477460f05b263b9a01cc5d37b5e8cb6.zip
Block export and re-import works. Fixed bug where layout content was not being imported properly.
Diffstat (limited to 'include/import.php')
-rw-r--r--include/import.php55
1 files changed, 53 insertions, 2 deletions
diff --git a/include/import.php b/include/import.php
index a62747d9b..10664aa53 100644
--- a/include/import.php
+++ b/include/import.php
@@ -1311,9 +1311,15 @@ function scan_webpage_elements($path, $type, $cloud = false) {
return false;
}
$content = file_get_contents($folder . '/' . $contentfilename);
+ logger('contentfile: ' . $folder . '/' . $contentfilename, LOGGER_DEBUG);
+ logger('content: ' . $content, LOGGER_DEBUG);
if (!$content) {
- logger('Failed to get file content for ' . $metadata['contentfile']);
- return false;
+ if(is_readable($folder . '/' . $contentfilename)) {
+ $content = '';
+ } else {
+ logger('Failed to get file content for ' . $metadata['contentfile']);
+ return false;
+ }
}
$elements[] = $metadata;
}
@@ -1403,6 +1409,10 @@ function scan_webpage_elements($path, $type, $cloud = false) {
}
// Import the actual element content
$arr['body'] = file_get_contents($element['path']);
+ if($arr['item_type'] === ITEM_TYPE_PDL) {
+ logger(' body: ' . $arr['body'], LOGGER_DEBUG);
+ logger(' path: ' . $element['path'], LOGGER_DEBUG);
+ }
// The element owner is the channel importing the elements
$arr['owner_xchan'] = get_observer_hash();
// The author is either the owner or whomever was specified
@@ -1573,6 +1583,47 @@ function get_webpage_elements($channel, $type = 'all') {
break;
}
+ case 'blocks':
+ $elements['blocks'] = null;
+ $owner = $channel['channel_id'];
+
+ $sql_extra = item_permissions_sql($owner);
+
+
+ $r = q("select iconfig.iid, iconfig.k, iconfig.v, mid, title, body, mimetype, created, edited from iconfig
+ left join item on iconfig.iid = item.id
+ where uid = %d and iconfig.cat = 'system' and iconfig.k = 'BUILDBLOCK'
+ and item_type = %d order by item.created desc",
+ intval($owner),
+ intval(ITEM_TYPE_BLOCK)
+ );
+
+ $blocks = null;
+
+ if($r) {
+ $elements['blocks'] = array();
+ $blocks = array();
+ foreach($r as $rr) {
+ unobscure($rr);
+
+ $elements['blocks'][] = array(
+ 'type' => 'block',
+ 'title' => $rr['title'],
+ 'body' => $rr['body'],
+ 'created' => $rr['created'],
+ 'edited' => $rr['edited'],
+ 'mimetype' => $rr['mimetype'],
+ 'name' => $rr['v'],
+ 'mid' => $rr['mid']
+ );
+ }
+
+ }
+
+ if($type !== 'all') {
+ break;
+ }
+
default:
break;
}