您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

server.php 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016 Arthur Schiwon <blizzz@arthur-schiwon.de>
  4. *
  5. * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
  6. *
  7. * @license GNU AGPL version 3 or any later version
  8. *
  9. * This program is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU Affero General Public License as
  11. * published by the Free Software Foundation, either version 3 of the
  12. * License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Affero General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Affero General Public License
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. *
  22. */
  23. /** @var \OCP\IL10N $l */
  24. /** @var array $_ */
  25. ?>
  26. <div class="section" id="backgroundjobs">
  27. <h2 class="inlineblock"><?php p($l->t('Background jobs'));?></h2>
  28. <p class="cronlog inlineblock">
  29. <?php if ($_['lastcron'] !== false) {
  30. $relative_time = relative_modified_date($_['lastcron']);
  31. $maxAgeRelativeTime = relative_modified_date($_['cronMaxAge']);
  32. $formatter = \OC::$server->getDateTimeFormatter();
  33. $absolute_time = $formatter->formatDateTime($_['lastcron'], 'long', 'long');
  34. $maxAgeAbsoluteTime = $formatter->formatDateTime($_['cronMaxAge'], 'long', 'long');
  35. if (time() - $_['lastcron'] > 600) { ?>
  36. <span class="status error"></span>
  37. <span class="crondate" title="<?php p($absolute_time);?>">
  38. <?php p($l->t("Last job execution ran %s. Something seems wrong.", [$relative_time]));?>
  39. </span>
  40. <?php } elseif (time() - $_['cronMaxAge'] > 12*3600) {
  41. if ($_['backgroundjobs_mode'] === 'cron') { ?>
  42. <span class="status warning"></span>
  43. <span class="crondate" title="<?php p($maxAgeAbsoluteTime);?>">
  44. <?php p($l->t("Some jobs haven’t been executed since %s. Please consider increasing the execution frequency.", [$maxAgeRelativeTime]));?>
  45. </span>
  46. <?php } else { ?>
  47. <span class="status error"></span>
  48. <span class="crondate" title="<?php p($maxAgeAbsoluteTime);?>">
  49. <?php p($l->t("Some jobs didn’t execute since %s. Please consider switching to system cron.", [$maxAgeRelativeTime]));?>
  50. </span>
  51. <?php }
  52. } else { ?>
  53. <span class="status success"></span>
  54. <span class="crondate" title="<?php p($absolute_time);?>">
  55. <?php p($l->t("Last job ran %s.", [$relative_time]));?>
  56. </span>
  57. <?php }
  58. } else { ?>
  59. <span class="status error"></span>
  60. <?php p($l->t("Background job didn’t run yet!"));
  61. } ?>
  62. </p>
  63. <a target="_blank" rel="noreferrer noopener" class="icon-info"
  64. title="<?php p($l->t('Open documentation'));?>"
  65. href="<?php p(link_to_docs('admin-background-jobs')); ?>"></a>
  66. <p class="settings-hint"><?php p($l->t('For optimal performance it\'s important to configure background jobs correctly. For bigger instances \'Cron\' is the recommended setting. Please see the documentation for more information.'));?></p>
  67. <form action="#">
  68. <fieldset>
  69. <legend class="hidden-visually"><?php p($l->t('Pick background job setting'));?></legend>
  70. <p>
  71. <input type="radio" name="mode" value="ajax" class="radio"
  72. id="backgroundjobs_ajax" <?php if ($_['backgroundjobs_mode'] === "ajax") {
  73. print_unescaped('checked="checked"');
  74. } ?>>
  75. <label for="backgroundjobs_ajax">AJAX</label><br/>
  76. <em><?php p($l->t("Execute one task with each page loaded")); ?></em>
  77. </p>
  78. <p>
  79. <input type="radio" name="mode" value="webcron" class="radio"
  80. id="backgroundjobs_webcron" <?php if ($_['backgroundjobs_mode'] === "webcron") {
  81. print_unescaped('checked="checked"');
  82. } ?>>
  83. <label for="backgroundjobs_webcron">Webcron</label><br/>
  84. <em><?php p($l->t("cron.php is registered at a webcron service to call cron.php every 5 minutes over HTTP.")); ?></em>
  85. </p>
  86. <p>
  87. <input type="radio" name="mode" value="cron" class="radio"
  88. id="backgroundjobs_cron" <?php if ($_['backgroundjobs_mode'] === "cron") {
  89. print_unescaped('checked="checked"');
  90. }
  91. if (!$_['cli_based_cron_possible']) {
  92. print_unescaped('disabled');
  93. }?>>
  94. <label for="backgroundjobs_cron">Cron</label><br/>
  95. <em><?php p($l->t("Use system cron service to call the cron.php file every 5 minutes.")); ?>
  96. <?php if ($_['cli_based_cron_possible']) {
  97. p($l->t('The cron.php needs to be executed by the system user "%s".', [$_['cli_based_cron_user']]));
  98. } else {
  99. print_unescaped(str_replace(
  100. ['{linkstart}', '{linkend}'],
  101. ['<a href="https://www.php.net/manual/en/book.posix.php">', ' ↗</a>'],
  102. $l->t('To run this you need the PHP POSIX extension. See {linkstart}PHP documentation{linkend} for more details.')
  103. ));
  104. } ?></em>
  105. </p>
  106. </fieldset>
  107. </form>
  108. </div>