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/system/install.php +154 -1 1.6.4 → 1.8.16 View file →
@@ -426,8 +426,9 @@
426 426 );
427 427 }
428 428
429 429 // make sure no time limits will impact the process to restore the necessary files
430 + ignore_user_abort(true);
430 431 set_time_limit(0);
431 432
432 433 // enter maintenance mode for the current version
433 434 JFile::write($maintenance_file_path, VIKBOOKING_SOFTWARE_VERSION);
@@ -478,8 +479,160 @@
478 479 }
479 480 }
480 481
481 482 /**
483 + * Helper method used to obtain the list of breaking
484 + * changes registered within the wordpress options.
485 + *
486 + * @return array
487 + *
488 + * @since 1.6.5
489 + */
490 + public static function getBreakingChanges()
491 + {
492 + // get existing breaking changes
493 + $files = get_option('vikbooking_breaking_changes');
494 + // decode from JSON
495 + return (array) ($files ? json_decode($files, true) : null);
496 + }
497 +
498 + /**
499 + * Helper method used to register a list of breaking
500 + * changes within the wordpress options.
501 + *
502 + * @param array $files The files to register.
503 + *
504 + * @return void
505 + *
506 + * @since 1.6.5
507 + */
508 + public static function registerBreakingChanges(array $files)
509 + {
510 + if ($files)
511 + {
512 + // get existing files
513 + $existing = static::getBreakingChanges();
514 +
515 + foreach ($files as $client => $list)
516 + {
517 + if (!$list)
518 + {
519 + // ignore in case the list is empty
520 + continue;
521 + }
522 +
523 + if (!isset($existing[$client]))
524 + {
525 + // no client set, register it right now
526 + $existing[$client] = (array) $list;
527 + }
528 + else
529 + {
530 + // client already set, merge existing with new ones (get rid of duplicates)
531 + $existing[$client] = array_values(array_unique(array_merge($existing[$client], (array) $list)));
532 + }
533 + }
534 +
535 + // register within an option the breaking changes
536 + update_option('vikbooking_breaking_changes', json_encode($existing));
537 + }
538 + }
539 +
540 + /**
541 + * Helper method used to unregister a list of breaking
542 + * changes within the wordpress options.
543 + *
544 + * @param string|array|null $files The file(s) to unregister.
545 + * Leave empty to clear all the files.
546 + *
547 + * @return void
548 + *
549 + * @since 1.6.5
550 + */
551 + public static function unregisterBreakingChanges($files = null)
552 + {
553 + if ($files)
554 + {
555 + $existing = static::getBreakingChanges();
556 +
557 + // scan all the provided files
558 + foreach ((array) $files as $file)
559 + {
560 + // search path under each client
561 + foreach ($existing as $client => $list)
562 + {
563 + // get index of the specified file
564 + $index = array_search($file, $list);
565 +
566 + if ($index === false)
567 + {
568 + // path not found, ignore
569 + continue;
570 + }
571 +
572 + // remove path at the specified index
573 + array_splice($existing[$client], $index, 1);
574 +
575 + if (!$existing[$client])
576 + {
577 + // remove client as there are no more pending overrides
578 + unset($existing[$client]);
579 + }
580 + }
581 + }
582 +
583 + if ($existing)
584 + {
585 + // update breaking changes in case the list is not empty
586 + update_option('vikbooking_breaking_changes', json_encode($existing));
587 + }
588 + else
589 + {
590 + // directly delete the breaking changes option otherwise
591 + static::unregisterBreakingChanges();
592 + }
593 + }
594 + else
595 + {
596 + // clear breaking changes
597 + delete_option('vikbooking_breaking_changes');
598 + }
599 + }
600 +
601 + /**
602 + * Helper method used to show the breaking changes to
603 + * the administrator. This method will have no effect
604 + * in case the logged-in user is not an administrator.
605 + *
606 + * @return void
607 + *
608 + * @since 1.6.5
609 + */
610 + public static function showBreakingChanges()
611 + {
612 + // make sure the user is an administrator
613 + if (JFactory::getUser()->authorise('core.admin', 'com_vikbooking'))
614 + {
615 + // retieve breaking changes list, if any
616 + $bc = static::getBreakingChanges();
617 +
618 + if ($bc)
619 + {
620 + // use layout to render the warning message
621 + $warn = JLayoutHelper::render(
622 + 'html.overrides.bc',
623 + ['files' => $bc],
624 + null,
625 + ['component' => 'com_vikbooking']
626 + );
627 +
628 + // enqueue warning to be displayed
629 + JFactory::getApplication()->enqueueMessage($warn, 'warning');
630 + }
631 + }
632 + }
633 +
634 + /**
482 635 * Method used to check for any installation message to show.
483 636 *
484 637 * @return void
485 638 */
@@ -525,9 +678,9 @@
525 678 </p>
526 679 </div>
527 680
528 681 <script type="text/javascript">
529 - jQuery(document).ready(function() {
682 + jQuery(function() {
530 683 jQuery('#vbo-update-warning').on('click', '.notice-dismiss', function(event, el) {
531 684 var numWeeks = 1;
532 685 if (typeof localStorage !== 'undefined') {
533 686 numWeeks = localStorage.getItem('vbo_update_warning_hide_count');