fixes for restore from backup file
This commit is contained in:
parent
6279ad4730
commit
382c314af0
5 changed files with 14 additions and 11 deletions
|
@ -60,13 +60,13 @@ class DocTools
|
||||||
public static function deleteFolder($path)
|
public static function deleteFolder($path)
|
||||||
{
|
{
|
||||||
if (!empty($path) && is_dir($path)) {
|
if (!empty($path) && is_dir($path)) {
|
||||||
$dir = new RecursiveDirectoryIterator(
|
$dir = new \RecursiveDirectoryIterator(
|
||||||
$path,
|
$path,
|
||||||
RecursiveDirectoryIterator::SKIP_DOTS
|
\RecursiveDirectoryIterator::SKIP_DOTS
|
||||||
); //upper dirs are not included,otherwise DISASTER HAPPENS :)
|
); //upper dirs are not included,otherwise DISASTER HAPPENS :)
|
||||||
$files = new RecursiveIteratorIterator(
|
$files = new RecursiveIteratorIterator(
|
||||||
$dir,
|
$dir,
|
||||||
RecursiveIteratorIterator::CHILD_FIRST
|
\RecursiveIteratorIterator::CHILD_FIRST
|
||||||
);
|
);
|
||||||
foreach ($files as $f) {
|
foreach ($files as $f) {
|
||||||
if (is_file($f)) {
|
if (is_file($f)) {
|
||||||
|
|
|
@ -4,7 +4,7 @@ namespace brain\utility
|
||||||
|
|
||||||
use Psr\Http\Message\UploadedFileInterface;
|
use Psr\Http\Message\UploadedFileInterface;
|
||||||
|
|
||||||
define("MAXIMUM_FILESIZE", "10485760"); //10 MB
|
//define("MAXIMUM_FILESIZE", "10485760"); //10 MB
|
||||||
class FileUploader
|
class FileUploader
|
||||||
{
|
{
|
||||||
public static function uploadFile(string $directory, $file)
|
public static function uploadFile(string $directory, $file)
|
||||||
|
|
|
@ -106,6 +106,7 @@ class SetUp
|
||||||
|
|
||||||
$backup = $request->getUploadedFiles();
|
$backup = $request->getUploadedFiles();
|
||||||
$file = $backup["backup-upload"];
|
$file = $backup["backup-upload"];
|
||||||
|
//NOTE: If this fails check 'post_max_size' in php.ini
|
||||||
$size = $file->getSize();
|
$size = $file->getSize();
|
||||||
$name = $file->getClientFileName();
|
$name = $file->getClientFileName();
|
||||||
|
|
||||||
|
@ -113,7 +114,7 @@ class SetUp
|
||||||
$file->moveTo("../content" . "/" . $name);
|
$file->moveTo("../content" . "/" . $name);
|
||||||
|
|
||||||
//open it and get files to verify user
|
//open it and get files to verify user
|
||||||
$zip = new ZipArchive();
|
$zip = new \ZipArchive();
|
||||||
if ($zip->open("../content" . "/" . $name) === true) {
|
if ($zip->open("../content" . "/" . $name) === true) {
|
||||||
$folks = json_decode($zip->getFromName("settings/folks.json"), true);
|
$folks = json_decode($zip->getFromName("settings/folks.json"), true);
|
||||||
$found = find($folks, ["handle" => $body["restore_member_handle"]]);
|
$found = find($folks, ["handle" => $body["restore_member_handle"]]);
|
||||||
|
|
|
@ -1199,8 +1199,11 @@ const API_ACCESS_BAD = 'apiUseNotAuthorized';
|
||||||
method = REQUEST_TYPE_POST;
|
method = REQUEST_TYPE_POST;
|
||||||
type = CONTENT_TYPE_FORM;
|
type = CONTENT_TYPE_FORM;
|
||||||
data = new FormData(form);
|
data = new FormData(form);
|
||||||
var result, err;
|
this._request(url, event, method, type, data).then((result)=>{
|
||||||
return;
|
resolve(result);
|
||||||
|
}).catch((err)=>{
|
||||||
|
reject(err);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -1770,7 +1773,7 @@ class PostEditor {
|
||||||
exports.default = PostEditor;
|
exports.default = PostEditor;
|
||||||
PostEditor.uploadFiles = [];
|
PostEditor.uploadFiles = [];
|
||||||
|
|
||||||
},{"../../libraries/FipamoAdminAPI":"6M96o","./MaintenanceManager":"kY7L1","../events/DataEvent":"edzJV","../actions/PageActions":"5t6eY","../events/EditorEvent":"dW8iq","../ui/TextEditor":"bMFpA","../ui/Notifications":"fmUxI","@parcel/transformer-js/src/esmodule-helpers.js":"ciiiV","../ui/FileManager":"kp4D5"}],"5t6eY":[function(require,module,exports) {
|
},{"../../libraries/FipamoAdminAPI":"6M96o","./MaintenanceManager":"kY7L1","../events/DataEvent":"edzJV","../actions/PageActions":"5t6eY","../events/EditorEvent":"dW8iq","../ui/TextEditor":"bMFpA","../ui/Notifications":"fmUxI","../ui/FileManager":"kp4D5","@parcel/transformer-js/src/esmodule-helpers.js":"ciiiV"}],"5t6eY":[function(require,module,exports) {
|
||||||
var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
|
var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
|
||||||
parcelHelpers.defineInteropFlag(exports);
|
parcelHelpers.defineInteropFlag(exports);
|
||||||
var _stringUtils = require("../utils/StringUtils");
|
var _stringUtils = require("../utils/StringUtils");
|
||||||
|
@ -2035,7 +2038,7 @@ class TextEditor extends _eventEmitterDefault.default {
|
||||||
}
|
}
|
||||||
exports.default = TextEditor;
|
exports.default = TextEditor;
|
||||||
|
|
||||||
},{"../events/DataEvent":"edzJV","caret-pos":"9lzNv","../events/EventEmitter":"cbFNs","../events/EditorEvent":"dW8iq","@parcel/transformer-js/src/esmodule-helpers.js":"ciiiV","prismjs/components/prism-core":"cps8h","prismjs/components/prism-markup":"dIns2","prismjs/components/prism-markdown":"gqRFx"}],"9lzNv":[function(require,module,exports) {
|
},{"../events/DataEvent":"edzJV","caret-pos":"9lzNv","../events/EventEmitter":"cbFNs","../events/EditorEvent":"dW8iq","prismjs/components/prism-core":"cps8h","prismjs/components/prism-markup":"dIns2","prismjs/components/prism-markdown":"gqRFx","@parcel/transformer-js/src/esmodule-helpers.js":"ciiiV"}],"9lzNv":[function(require,module,exports) {
|
||||||
var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
|
var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
|
||||||
parcelHelpers.defineInteropFlag(exports);
|
parcelHelpers.defineInteropFlag(exports);
|
||||||
parcelHelpers.export(exports, "getOffset", ()=>getOffset1
|
parcelHelpers.export(exports, "getOffset", ()=>getOffset1
|
||||||
|
@ -5576,7 +5579,7 @@ class FileManager {
|
||||||
}
|
}
|
||||||
exports.default = FileManager;
|
exports.default = FileManager;
|
||||||
|
|
||||||
},{"sortablejs":"fLJM6","../utils/DataUtils":"lpIyf","@parcel/transformer-js/src/esmodule-helpers.js":"ciiiV","./Notifications.js":"fmUxI"}],"fLJM6":[function(require,module,exports) {
|
},{"sortablejs":"fLJM6","../utils/DataUtils":"lpIyf","./Notifications.js":"fmUxI","@parcel/transformer-js/src/esmodule-helpers.js":"ciiiV"}],"fLJM6":[function(require,module,exports) {
|
||||||
var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
|
var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
|
||||||
parcelHelpers.defineInteropFlag(exports);
|
parcelHelpers.defineInteropFlag(exports);
|
||||||
parcelHelpers.export(exports, "MultiDrag", ()=>MultiDragPlugin
|
parcelHelpers.export(exports, "MultiDrag", ()=>MultiDragPlugin
|
||||||
|
|
|
@ -102,7 +102,6 @@ class MaintenanceManager {
|
||||||
method = REQUEST_TYPE_POST;
|
method = REQUEST_TYPE_POST;
|
||||||
type = CONTENT_TYPE_FORM;
|
type = CONTENT_TYPE_FORM;
|
||||||
data = new FormData(form);
|
data = new FormData(form);
|
||||||
return;
|
|
||||||
this._request(url, event, method, type, data)
|
this._request(url, event, method, type, data)
|
||||||
.then(result => {
|
.then(result => {
|
||||||
resolve(result);
|
resolve(result);
|
||||||
|
|
Loading…
Reference in a new issue