Просмотр файла htmly-2.9.8/system/admin/views/update.html.php

Размер файла: 2.09Kb
  1. <?php if (!defined('HTMLY')) die('HTMLy'); ?>
  2. <?php
  3. use \Kanti\HubUpdater;
  4.  
  5. $CSRF = get_csrf();
  6. $updater = new HubUpdater(array(
  7. 'name' => 'danpros/htmly',
  8. 'prerelease' => !!config("prerelease"),
  9. ));
  10.  
  11. $dir = 'cache/';
  12. if (!is_dir($dir)) {
  13. mkdir($dir, 0775, true);
  14. }
  15. if (defined("JSON_PRETTY_PRINT")) {
  16. file_put_contents(
  17. 'cache/installedVersion.json',
  18. json_encode(array(
  19. "tag_name" => constant('HTMLY_VERSION')
  20. ), JSON_PRETTY_PRINT), LOCK_EX);
  21. } else {
  22. file_put_contents(
  23. 'cache/installedVersion.json',
  24. json_encode(array(
  25. "tag_name" => constant('HTMLY_VERSION')
  26. )), LOCK_EX
  27. );
  28. }
  29.  
  30. if (empty($updater->getNewestInfo())) {
  31. echo '<h2>'.i18n('Update').'</h2><hr>';
  32. echo "Can't check Github server for latest version. You are probably offline.";
  33. } else {
  34. if ($updater->able()) {
  35. $info = $updater->getNewestInfo();
  36. echo '<h2>'.i18n('Update_Available').'</h2><hr>';
  37. echo '<h4>'. $info['name'] .'</h4>';
  38. echo '<p>Version: <strong>'. $info['tag_name'] .'</strong></p>';
  39. echo '<h5>Release Notes</h5>';
  40. echo '<div>';
  41. echo \Michelf\MarkdownExtra::defaultTransform($info['body']);
  42. echo '</div>';
  43. echo '<p><strong>Important:</strong> Please always backup your files before upgrading to newer version.</p>';
  44. echo '<p><a class="btn btn-primary" href="' . site_url() . 'admin/update/now/' . $CSRF . '" alt="' . $info['name'] . '">'.i18n('Update_to').' '. $info['tag_name'] . ' '.i18n('now').'</a></p>';
  45. } else {
  46. echo '<h2>'.i18n('Congrats_You_have_the_latest_version_of_HTMLy').'</h2><hr>';
  47. $info = $updater->getCurrentInfo();
  48. echo '<h4>'. $info['name'] .'</h4>';
  49. echo '<p>Installed Version: <strong>'. $info['tag_name'] .'</strong></p>';
  50. echo '<h5>Release Notes: </h5>';
  51. echo '<div>';
  52. echo \Michelf\MarkdownExtra::defaultTransform($info['body']);
  53. echo '</div>';
  54. echo '<p><a class="btn btn-primary" target="_blank" href="' . $info['html_url'] . '">Read on Github</a></p>';
  55. }
  56. }