Page MenuHomePhabricator

resetPageRandom.php: Showing "--from has to be smaller than --to" for every dates
Closed, ResolvedPublic

Description

List of steps to reproduce:

  • Run the docker: docker-compose up -d
  • Run the script: docker-compose exec mediawiki php maintenance/resetPageRandom.php --from 20210901000000 --to 20211018000000

Expected outcome

Since --from's date value is smaller than --to's date value. So script should run with any error.

Actual outcome

"--from has to be smaller than --to" error message.

Cause

I digged into this. $this->getOption( 'from' ) and $this->getOption( 'to' ) always returning int(1) into wfTimestampOrNull function. This cause wfTimestampOrNull function to return string(14) "19700101000001" for both dates.

The main culprit is $this->addOption() as it does not take argument from CLI.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change 722010 had a related patch set uploaded (by Jayprakash12345; author: Jayprakash12345):

[mediawiki/core@master] resetPageRandom.php: Make options to take arguments

https://gerrit.wikimedia.org/r/722010

Change 722010 merged by jenkins-bot:

[mediawiki/core@master] resetPageRandom.php: Fix --from and --to options

https://gerrit.wikimedia.org/r/722010