Problem/Motivation

Currently, the retain hours limit is limited to 999. I may be better to actually unlimit the value with -1 and allow more then 999 for people who wish to (for instance a month instance or something this kind).

Proposed resolution

I suggest using -1 as per usual Drupalism for unlimited.
It takes to add a hook_update_N() method to change 999 setting to -1.
NOTE: N = 10 to allow this patch to run with #2678056: Flood limit to 99 does not actually set to unlimited. patch proposal already using N = 09

User interface changes

Only the form description on admin/config/people/anonymous_publishing_cl

API changes

None

Data model changes

None

CommentFileSizeAuthor
#2 unlimit_retain_time--2678064-2.patch3.47 KBDom.
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Dom. created an issue. See original summary.

Dom.’s picture

Could you please have a review of this patch attached ? Would it be okay ?

Dom.’s picture

  • gisle committed b9c7868 on 7.x-1.x authored by Dom.
    Issue #2678064 by Dom.: Fixed flood limit and retain time to use -1 for...
gisle’s picture

When reviewing, I spotted two tests where you test against a amended (from 999) magic value for "unlimited" as 0 instad of -1. Here are the diffs, followed by what I think the diff should be:

In anonymous_publishing.module:

59c59
<   if ($cl_audodelhours < 999) {
---
>   if ($cl_audodelhours) {

Should be?

59c59
<   if ($cl_audodelhours < 999) {
---
>   if ($cl_audodelhours >= 0) {

In modules/anonymous_publishing_cl.admin.module:

1150c1150
<   $b2 = 999 > $autodelhours ? _anonymous_publishing_email_text('activate', $variables) : '';
---
>   $b2 = $autodelhours ? _anonymous_publishing_email_text('activate', $variables) : '';

Should be?

1150c1150
<   $b2 = 999 > $autodelhours ? _anonymous_publishing_email_text('activate', $variables) : '';
---
>   $b2 = $autodelhours >= 0 ? _anonymous_publishing_email_text('activate', $variables) : '';

I've already commited your patch to the 7.x-1.x branch, but changed those two lines as indicated above. I've also rolled both updates to the "unlimited" variables into a single update.

Please review and either confirm that my changes are correct, or point out what I've misunderstood.

Dom.’s picture

Hi Gisle:

I guess it best should be if ($cl_audodelhours != -1) { in theory.
In practice, the point behind if ($cl_audodelhours) { is that any negative value would fail because if (-2) => FALSE
This is equivalent to your lign if ($cl_audodelhours >= 0) { so you can change by it if you think it is prettier code.

gisle’s picture

In practice, the point behind if ($cl_audodelhours) { is that any negative value would fail because if (-2) => FALSE

This is not correct. Try the following.

$r = -2 ? 'TRUE' : 'FALSE';
debug($r, 'logical value of -2');

On my computer, it produces:

Debug: logical value of -2:
'TRUE'
Dom.’s picture

Oh.. you must be right ! Just change it to $autodelhours >= 0 then !

gisle’s picture

Status: Needs review » Reviewed & tested by the community

Oh.. you must be right ! Just change it to $autodelhours >= 0 then!

I did that 5 hours ago. Commit b9c7868.

Changing status to RTBC.

gisle’s picture

Status: Reviewed & tested by the community » Fixed

This is in release 7.x-1.1.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

Glottus’s picture

This doesn't seem to be working for me using v7-1.1

I get the following error when trying to configure CL settings (leaving this specific option at the desired default -1):

Error message
Number of hours to retain unverified anonymous posts before auto-deletions removes them: must be a positive integer.

Using 0 doesn't work, either, but I don't WANT a positive integer here (implying that my only option is to have unverified content be automatically deleted at some future point).

gisle’s picture

Status: Closed (fixed) » Needs work

Thanks for your report @Glottus. Reopening.

Glottus’s picture

Incidentally, I CAN save the settings by deleting the default provided "-1" and leaving the field blank, but I don't know what effect this will have, nor how to test it, exactly.

  • gisle committed 9e450dd on 7.x-1.x authored by Ronjark
    Issue #2678064 by : Added option to require publisher to set persistent...
gisle’s picture

gisle’s picture

Status: Needs work » Needs review

This is fixed in the latest snapshot of 7.x-1-x-dev.

Please review.

Glottus’s picture

I am now able to set "-1" as an option for the retention time. Thanks!

gisle’s picture

Status: Needs review » Reviewed & tested by the community

Moving to RTBC based on #18.

gisle’s picture

Status: Reviewed & tested by the community » Fixed

Fixed in release 7.x-1.2.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.