It would be ideal if a date range could be set forThe live ArticleInfo (aka "Page History") tool on Wikimedia Cloud Services is at https://xtools.wmflabs.org/articleinfo to restrict it to e.g. all contribs up before 2015, or all contribs during Dec 2016.
XTools version: 3.1.18-80526e0Example result: https://xtools.wmflabs.org/articleinfo/en.wikipedia.org/Hanksy
The XTools code repository: https://github.com/x-tools/xtools
We would like to add date range filtering options to the ArticleInfo tool. Start and end dates are optional, and you should be able to use one and not the other, or both.
The API endpoint does not need to be updated.
The required code changes are somewhat similar to T172003 but considerably more busy work.
Files that need updating:
* The [[ https://github.com/x-tools/xtools/blob/master/app/Resources/views/articleInfo/index.html.twig | ArticleInfo form ]] (see [[ https://github.com/x-tools/xtools/blob/master/app/Resources/views/autoEdits/index.html.twig#L10 | AutoEdits form ]] for example usage of start/end dates)
* The [[ https://github.com/x-tools/xtools/blob/master/src/AppBundle/Controller/ArticleInfoController.php#L130 | resultAction ]] of the ArticleInfoController. This includes:
** Updating the route, see the [[ https://github.com/x-tools/xtools/blob/master/src/AppBundle/Controller/AutomatedEditsController.php#L76-L79 | AutoEditsController ]] for an example.
** Doing some simple logic to normalize the date values, see the [[ https://github.com/x-tools/xtools/blob/master/src/AppBundle/Controller/AutomatedEditsController.php#L100-L112 | AutoEditsController ]] for an example.
* The [[ https://github.com/x-tools/xtools/blob/master/src/Xtools/ArticleInfo.php | ArticleInfo model ]], which needs new class properties for start/end dates.
** Here we also want to update the [[ https://github.com/x-tools/xtools/blob/master/src/Xtools/ArticleInfo.php#L335-L338 | getPageviews ]] to compute pageviews for the requested date range. This is called from the ArticleInfo result page, that part I don't think needs to be changed. Instead, in the model we'll check if either start or end dates are set on the instance, and if so use [[ https://github.com/x-tools/xtools/blob/master/src/Xtools/Page.php#L523 | Page::getPageviews ]], otherwise do the same as we are now by calling [[ https://github.com/x-tools/xtools/blob/master/src/Xtools/Page.php#L542 | getLastPageviews ]] with the number passed in from the view.
* The queries in the [[ https://github.com/x-tools/xtools/blob/master/src/Xtools/ArticleInfoRepository.php | ArticleInfoRepository ]], and the [[ https://github.com/x-tools/xtools/blob/master/src/Xtools/PageRepository.php#L106 | getRevisions ]], [[ https://github.com/x-tools/xtools/blob/master/src/Xtools/PageRepository.php#L138 | getRevisionsStmt ]] and [[ https://github.com/x-tools/xtools/blob/master/src/Xtools/PageRepository.php#L183 | getNumRevisions ]] actions of PageRepository. Note start/end dates are optional, so if the parameters to these actions are blank or null they should not add any clauses to the underlying SQL query.
* The ArticleInfo [[ https://github.com/x-tools/xtools/blob/master/app/Resources/views/articleInfo/result.html.twig | result page ]]. Here if applicable, we can indicate the requested date range in the [[ https://github.com/x-tools/xtools/blob/master/app/Resources/views/articleInfo/result.html.twig#L8-L20 | heading ]].
** Certain things don't apply if the "end date" is not the current date. These would include the "Assessments" and "Bugs" sections.
** Within the "General Statistics" section, we also want to hide the "Assessment" and "Bugs" fields, along with the "Edits in the past..." fields. I guess we should also hide "Average edits per month" and "per year", since they may not apply to smaller date ranges. The "per day" would always apply, however.
** The "Pageviews (60 days)" should just say "Pageviews" if we're working with a date range.
I'm probably forgetting other things... but we can figure it out as we go along.