cancelBackup.php
3 years ago
cancelDownload.php
3 years ago
checkBackupCreation.php
3 years ago
checkFreeMigration.php
3 years ago
checkPHPVersionCompatibility.php
3 years ago
checkRestoreCreation.php
3 years ago
chooseProfile.php
3 years ago
cloudDropbox.php
3 years ago
curlChecker.php
3 years ago
deleteBackup.php
3 years ago
downloadBackup.php
3 years ago
getAction.php
3 years ago
getBackupContent.php
3 years ago
getRunningActions.php
3 years ago
hideNotice.php
3 years ago
importBackup.php
3 years ago
isBgUserExists.php
3 years ago
isFeatureAvailable.php
3 years ago
manualBackup.php
3 years ago
modalImport.php
3 years ago
modalManualBackup.php
3 years ago
modalManualRestore.php
3 years ago
modalPrivacy.php
3 years ago
modalReview.php
3 years ago
modalTerms.php
3 years ago
resetStatus.php
3 years ago
restore.php
3 years ago
reviewBannerActions.php
3 years ago
schedule.php
3 years ago
setReviewPopupState.php
3 years ago
settings.php
3 years ago
getBackupContent.php
56 lines
| 1 | <?php |
| 2 | |
| 3 | header('Content-Type: application/json'); |
| 4 | |
| 5 | require_once(dirname(__FILE__) . '/../boot.php'); |
| 6 | //require_once(SG_LIB_PATH . 'SGArchive.php'); |
| 7 | //require_once(SG_BACKUP_PATH . 'SGBackupFiles.php'); |
| 8 | |
| 9 | $backupName = $_GET['backupName']; |
| 10 | $path = isset($_GET["path"]) ? $_GET["path"] : "wp-content/"; |
| 11 | $parent = $path; |
| 12 | $data = array(); |
| 13 | |
| 14 | $disabled = !SGBoot::isFeatureAvailable('SLECTIVE_RESTORE'); |
| 15 | |
| 16 | if ($path == "#") { |
| 17 | $parentNode = array(); |
| 18 | $parentNode["id"] = "/"; |
| 19 | $parentNode["parent"] = "#"; |
| 20 | $parentNode["text"] = "/"; |
| 21 | $parentNode["type"] = "none"; |
| 22 | $parentNode["children"] = true; |
| 23 | $parentNode["state"] = array("selected" => true); |
| 24 | array_push($data, $parentNode); |
| 25 | } else { |
| 26 | if ($path == "/") { |
| 27 | $path = ""; |
| 28 | } else { |
| 29 | $path .= '/'; |
| 30 | } |
| 31 | |
| 32 | $backupPath = SG_BACKUP_DIRECTORY . $backupName; |
| 33 | $backupPath = $backupPath . '/' . $backupName . '.sgbp'; |
| 34 | $backupFiles = new SGBackupFiles(); |
| 35 | $archive = new SGArchive($backupPath, 'r'); |
| 36 | $archive->setDelegate($backupFiles); |
| 37 | $headers = $archive->getArchiveHeaders(); |
| 38 | $filesList = $archive->getFilesList(); |
| 39 | $tree = $archive->getTreefromList($filesList, $path); |
| 40 | |
| 41 | |
| 42 | foreach ($tree as $node) { |
| 43 | $el = array(); |
| 44 | $el["id"] = $path . $node->name; |
| 45 | $el["parent"] = $parent; |
| 46 | $el["text"] = $node->name; |
| 47 | $el["type"] = $node->type; |
| 48 | if ($node->type == "folder") { |
| 49 | $el["children"] = true; |
| 50 | } |
| 51 | array_push($data, $el); |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | echo json_encode($data); |
| 56 |