PluginProbe
VikBooking Hotel Booking Engine & PMS / 1.8.16
VikBooking Hotel Booking Engine & PMS v1.8.16
1.8.16 1.8.15 1.8.14 1.8.13 1.8.12 1.8.11 1.8.10 1.8.9 1.8.6 1.8.7 1.8.8 trunk 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 All 37 releases
← All changes | libraries/update/manager.php +54 -0 1.8.6 → 1.8.16 View file →
@@ -511,8 +511,62 @@
511 511 return JFile::copy($dest, $backup_dirs[$dir_key] . DIRECTORY_SEPARATOR . basename($dest));
512 512 }
513 513
514 514 /**
515 + * Trigger called whenever a mirroring file has been deleted.
516 + * Checks if the destination path is recognized, and attempts to
517 + * delete the previously backed up file in order to never restore it.
518 + *
519 + * @param string $dest The path to the file just deleted.
520 + *
521 + * @return boolean True on success.
522 + *
523 + * @since 1.8.12
524 + */
525 + public static function triggerDeletionBackup($dest)
526 + {
527 + // seek the key of the uploaded dir
528 + $dir_key = false;
529 + foreach (self::getUploadBackupDirs(true) as $key => $path) {
530 + if (strpos($dest, $path) !== false) {
531 + $dir_key = $key;
532 + break;
533 + }
534 + }
535 + if (!$dir_key) {
536 + // could not recognize upload dir path from destination file
537 + return false;
538 + }
539 +
540 + // always make sure the upload backup dirs are set for bc with those that installed a previous version of the plugin
541 + if (!self::installUploadBackup()) {
542 + // cannot proceed because backup folders are not set
543 + return false;
544 + }
545 +
546 + // import the File class
547 + JLoader::import('adapter.filesystem.file');
548 +
549 + // get the backup upload dir path for this type of file
550 + $backup_dirs = self::getUploadBackupDirs();
551 + if (!isset($backup_dirs[$dir_key])) {
552 + // do not proceed
553 + return false;
554 + }
555 +
556 + // build the full file path on the mirroring directory
557 + $mirroredFilePath = $backup_dirs[$dir_key] . DIRECTORY_SEPARATOR . basename($dest);
558 +
559 + if (!is_file($mirroredFilePath)) {
560 + // do not proceed
561 + return false;
562 + }
563 +
564 + // delete the file from its backup dir
565 + return JFile::delete($mirroredFilePath);
566 + }
567 +
568 + /**
515 569 * This method should be called after importing a full backup
516 570 * copy from another Vik Booking installation. It recursively
517 571 * parses all the upload backup directories to mirror. This
518 572 * way, installing a future update will be safe.