archiving.phtml 8.0 KB

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