Template:Auto-outdated: Difference between revisions

added another level to switch function to allow for a two year gap between the current and revision dates
(create actual template for further testing)
 
(added another level to switch function to allow for a two year gap between the current and revision dates)
Line 14: Line 14:
|0={{#expr:{{#time:z|{{#expr:trunc{{#expr:{{CURRENTTIMESTAMP}}*0.000001}}}}}}-{{#time:z|{{#expr:trunc{{#expr:{{REVISIONTIMESTAMP}}*0.000001}}}}}}}}
|0={{#expr:{{#time:z|{{#expr:trunc{{#expr:{{CURRENTTIMESTAMP}}*0.000001}}}}}}-{{#time:z|{{#expr:trunc{{#expr:{{REVISIONTIMESTAMP}}*0.000001}}}}}}}}
|1={{#expr:365-{{#time:z|{{#expr:trunc{{#expr:{{REVISIONTIMESTAMP}}*0.000001}}}}}}+
|1={{#expr:365-{{#time:z|{{#expr:trunc{{#expr:{{REVISIONTIMESTAMP}}*0.000001}}}}}}+
{{#time:z|{{#expr:trunc{{#expr:{{CURRENTTIMESTAMP}}*0.000001}}}}}}}}
|2={{#expr:365 + 365-{{#time:z|{{#expr:trunc{{#expr:{{REVISIONTIMESTAMP}}*0.000001}}}}}}+
{{#time:z|{{#expr:trunc{{#expr:{{CURRENTTIMESTAMP}}*0.000001}}}}}}}}
{{#time:z|{{#expr:trunc{{#expr:{{CURRENTTIMESTAMP}}*0.000001}}}}}}}}
|error1}}|yes|no}}
|error1}}|yes|no}}
Line 37: Line 39:
Besides checking and displaying the Current Alert Status on the template display as either “OKAY” or “Expired” the template will also install a category (Category:Auto-outdated) when the parser functions trip the “Expired” notification.  By routinely checking the above category, all instances of pages that have tripped the expiration date can be reviewed and corrected (resetting the “timer” by updating the article or at least checking it and performing a dummy save).
Besides checking and displaying the Current Alert Status on the template display as either “OKAY” or “Expired” the template will also install a category (Category:Auto-outdated) when the parser functions trip the “Expired” notification.  By routinely checking the above category, all instances of pages that have tripped the expiration date can be reviewed and corrected (resetting the “timer” by updating the article or at least checking it and performing a dummy save).


The parser functions compare the CURRENT TIME STAMP with the REVISION TIME STAMP based on the values using the day of the year value.  Initially a check is performed to determine if the two years are equal so the difference of the values can be determined but if they are not, the days to the end of the previous year are added to the days in the current year.
The parser functions compare the CURRENT TIME STAMP with the REVISION TIME STAMP based on the values using the day of the year value.  Initially a check is performed to determine if the two years are equal so the difference of the values can be determined but if they are not, the days to the end of the previous year are added to the days in the current year. A third result (a two year gap) has been added to allow for set points up to 730 days although greater than 365 days is probably impracticable.


Technically the template parameter could be any number greater than zero but realistically should be limited from 1 to 365 days (as a two year span during the initial check will result in an error).  Although this could be adjusted to include more than the current one year span it is not of a high priority since an article worth tagging with this template should be reviewed at least yearly and there is a possibility that more appropriate parser functions (such as “AgeParse”) may become available with newer versions of MediaWiki.
Technically the template parameter could be any number greater than zero but realistically should be limited from 1 to 365 days (as a three year span during the initial check will result in an error).  Although this could be adjusted to include more than the current two year span it is not of a high priority since an article worth tagging with this template should be reviewed at least yearly and there is a possibility that more appropriate parser functions (such as “AgeParse”) may become available with newer versions of MediaWiki.


Also note that there is currently a 1 day error that will occur in leap years but this calculation is not a critical operation therefore this is not considered important and again, newer parser functions with newer versions of MediaWiki could correct this issue.
Also note that there is currently a 1 day error that will occur in leap years but this calculation is not a critical operation therefore this is not considered important and again, newer parser functions with newer versions of MediaWiki could correct this issue.
3,970

edits