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
checkPHPVersionCompatibility.php
35 lines
| 1 | <?php |
| 2 | |
| 3 | require_once(dirname(__FILE__) . '/../boot.php'); |
| 4 | require_once(SG_LIB_PATH . 'BackupGuard/Core/SGBGArchive.php'); |
| 5 | |
| 6 | if (backupGuardIsAjax() && count($_POST)) { |
| 7 | try { |
| 8 | $name = sanitize_text_field($_POST['bname']); |
| 9 | $name = backupGuardRemoveSlashes($name); |
| 10 | $path = SG_BACKUP_DIRECTORY . $name . '/' . $name . '.sgbp'; |
| 11 | |
| 12 | $archive = new SGBGArchive($path); |
| 13 | $archive->open('r'); |
| 14 | $headers = $archive->getHeaders(); |
| 15 | |
| 16 | if (isset($headers['phpVersion'])) { |
| 17 | $oldPHPVersion = $headers['phpVersion']; |
| 18 | $currentVersion = phpversion(); |
| 19 | |
| 20 | // Drop the last digits of version (e.g. 5.3.3 will be 5) by explicit casting from string to int. This will check the migrations like php 5.x.x -> 7.x.x |
| 21 | if ((int) $oldPHPVersion != (int) $currentVersion) { |
| 22 | die(json_encode(array( |
| 23 | 'warning' => 'Warning: The backup has been captured for php ' . $oldPHPVersion . ' whereas your server is running php ' . $currentVersion . '. If you’re sure the website is compatible with php ' . $currentVersion . ', please confirm to start the restoration.' |
| 24 | ))); |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | die(json_encode(array())); |
| 29 | } catch (Exception $e) { |
| 30 | die(json_encode(array( |
| 31 | 'error' => $e->getMessage() |
| 32 | ))); |
| 33 | } |
| 34 | } |
| 35 |