archiving.phtml 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <?php
  2. declare(strict_types=1);
  3. /** @var FreshRSS_View $this */
  4. $this->partial('aside_configure');
  5. ?>
  6. <main class="post">
  7. <h1><?= _t('conf.archiving') ?></h1>
  8. <p class="help"><?= _i('help') ?> <?= _t('conf.archiving.help') ?></p>
  9. <form method="post" action="<?= _url('configure', 'archiving') ?>" data-auto-leave-validation="1">
  10. <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
  11. <div class="form-group">
  12. <label class="group-name" for="ttl_default"><?= _t('conf.archiving.ttl') ?></label>
  13. <div class="group-controls">
  14. <select class="number" name="ttl_default" id="ttl_default" required="required"><?php
  15. $found = false;
  16. foreach ([1200 => '20min', 1500 => '25min', 1800 => '30min', 2700 => '45min',
  17. 3600 => '1h', 5400 => '1.5h', 7200 => '2h', 10800 => '3h', 14400 => '4h', 18800 => '5h', 21600 => '6h', 25200 => '7h', 28800 => '8h',
  18. 36000 => '10h', 43200 => '12h', 64800 => '18h',
  19. 86400 => '1d', 129600 => '1.5d', 172800 => '2d', 259200 => '3d', 345600 => '4d', 432000 => '5d', 518400 => '6d',
  20. 604800 => '1wk'] as $v => $t) {
  21. echo '<option value="' . $v . (FreshRSS_Context::userConf()->ttl_default == $v ? '" selected="selected' : '') . '">' . $t . '</option>';
  22. if (FreshRSS_Context::userConf()->ttl_default == $v) {
  23. $found = true;
  24. }
  25. }
  26. if (!$found) {
  27. echo '<option value="' . intval(FreshRSS_Context::userConf()->ttl_default) . '" selected="selected">'
  28. . intval(FreshRSS_Context::userConf()->ttl_default) . 's</option>';
  29. }
  30. ?></select> (<?= _t('gen.short.by_default') ?>)
  31. </div>
  32. </div>
  33. <p class="alert alert-warn">
  34. <?= _t('conf.archiving.policy_warning') ?>
  35. </p>
  36. <div class="form-group">
  37. <label class="group-name"><?= _t('conf.archiving.policy') ?><br /><small>(<?= _t('gen.short.by_default') ?>)</small></label>
  38. <div class="group-controls">
  39. <label class="checkbox" for="enable_keep_max">
  40. <input type="checkbox" name="enable_keep_max" id="enable_keep_max" value="1"<?=
  41. empty(FreshRSS_Context::userConf()->archiving['keep_max']) ? '' : ' checked="checked"' ?> />
  42. <?= _t('conf.archiving.keep_max') ?>
  43. <?php $keepMax = empty(FreshRSS_Context::userConf()->archiving['keep_max']) ? 200 : FreshRSS_Context::userConf()->archiving['keep_max']; ?>
  44. <input type="number" id="keep_max" name="keep_max" min="0" value="<?= $keepMax ?>" />
  45. </label>
  46. </div>
  47. </div>
  48. <div class="form-group">
  49. <div class="group-controls">
  50. <label class="checkbox" for="enable_keep_period">
  51. <input type="checkbox" name="enable_keep_period" id="enable_keep_period" value="1"<?=
  52. empty(FreshRSS_Context::userConf()->volatile['enable_keep_period']) ? '' : ' checked="checked"' ?> />
  53. <?= _t('conf.archiving.keep_period') ?>
  54. <input type="number" id="keep_period_count" name="keep_period_count" min="0" value="<?= FreshRSS_Context::userConf()->volatile['keep_period_count'] ?>" />
  55. <select class="number" name="keep_period_unit" id="keep_period_unit">
  56. <option></option>
  57. <option value="P1Y" <?= 'P1Y' === FreshRSS_Context::userConf()->volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.years') ?></option>
  58. <option value="P1M" <?= 'P1M' === FreshRSS_Context::userConf()->volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.months') ?></option>
  59. <option value="P1W" <?= 'P1W' === FreshRSS_Context::userConf()->volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.weeks') ?></option>
  60. <option value="P1D" <?= 'P1D' === FreshRSS_Context::userConf()->volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.days') ?></option>
  61. <option value="PT1H" <?= 'PT1H' === FreshRSS_Context::userConf()->volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.hours') ?></option>
  62. </select>
  63. </label>
  64. </div>
  65. </div>
  66. <div class="form-group">
  67. <label class="group-name"><?= _t('conf.archiving.exception') ?><br /><small>(<?= _t('gen.short.by_default') ?>)</small></label>
  68. <div class="group-controls">
  69. <label class="checkbox" for="keep_favourites">
  70. <input type="checkbox" name="keep_favourites" id="keep_favourites" value="1"<?=
  71. FreshRSS_Context::userConf()->archiving['keep_favourites'] !== false ? ' checked="checked"' : '' ?> "/>
  72. <?= _t('conf.archiving.keep_favourites') ?>
  73. </label>
  74. </div>
  75. </div>
  76. <div class="form-group">
  77. <div class="group-controls">
  78. <label class="checkbox" for="keep_labels">
  79. <input type="checkbox" name="keep_labels" id="keep_labels" value="1"<?=
  80. FreshRSS_Context::userConf()->archiving['keep_labels'] !== false ? ' checked="checked"' : '' ?> />
  81. <?= _t('conf.archiving.keep_labels') ?>
  82. </label>
  83. </div>
  84. </div>
  85. <div class="form-group">
  86. <div class="group-controls">
  87. <label class="checkbox" for="keep_unreads">
  88. <input type="checkbox" name="keep_unreads" id="keep_unreads" value="1"<?=
  89. FreshRSS_Context::userConf()->archiving['keep_unreads'] ? ' checked="checked"' : '' ?> />
  90. <?= _t('conf.archiving.keep_unreads') ?>
  91. </label>
  92. </div>
  93. </div>
  94. <div class="form-group">
  95. <div class="group-controls">
  96. <label for="keep_min_default"><?= _t('conf.archiving.keep_min_by_feed') ?>
  97. <input type="number" id="keep_min_default" name="keep_min_default" min="0" value="<?=
  98. FreshRSS_Context::userConf()->archiving['keep_min'] ?>" />
  99. </label>
  100. </div>
  101. </div>
  102. <div class="form-group form-actions">
  103. <div class="group-controls">
  104. <button type="submit" class="btn btn-important"><?= _t('gen.action.submit') ?></button>
  105. <button type="reset" class="btn"><?= _t('gen.action.cancel') ?></button>
  106. </div>
  107. </div>
  108. </form>
  109. <h2><?= _t('conf.archiving.maintenance') ?></h2>
  110. <form method="post" action="<?= _url('entry', 'purge') ?>">
  111. <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
  112. <div class="form-group">
  113. <label class="group-name"><?= _t('conf.user.current') ?></label>
  114. <div class="group-controls">
  115. <?= _t('conf.user.articles_and_size', format_number($this->nb_total), format_bytes($this->size_user)) ?>
  116. </div>
  117. </div>
  118. <div class="form-group">
  119. <div class="group-controls">
  120. <button type="submit" class="btn btn-important confirm"><?= _t('conf.archiving.purge_now') ?></button>
  121. </div>
  122. </div>
  123. </form>
  124. <form method="post" action="<?= _url('entry', 'optimize') ?>">
  125. <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
  126. <div class="form-group">
  127. <div class="group-controls">
  128. <input type="hidden" name="optimiseDatabase" value="1" />
  129. <button type="submit" class="btn btn-important"><?= _t('conf.archiving.optimize') ?></button>
  130. <p class="help"><?= _i('help') ?> <?= _t('conf.archiving.optimize_help') ?></p>
  131. </div>
  132. </div>
  133. </form>
  134. <?php if (FreshRSS_Auth::hasAccess('admin')): ?>
  135. <div class="form-group">
  136. <label class="group-name"><?= _t('conf.user.users') ?></label>
  137. <div class="group-controls">
  138. <?= format_bytes($this->size_total) ?>
  139. </div>
  140. </div>
  141. <?php endif; ?>
  142. </main>