User::incEditCountImmediate(): Add explicit IS NOT NULL check
authorKevin Israel <pleasestand@live.com>
Fri, 25 Sep 2015 04:15:14 +0000 (00:15 -0400)
committerUmherirrender <umherirrender_de.wp@web.de>
Tue, 29 Sep 2015 18:52:31 +0000 (18:52 +0000)
commit5577d92bf54efeb8c5196053de5888bfe1eb574e
treea0069b609fa63e558ccf1508ca321ba935475952
parent1806b4c21c2333c478fbaef73b4b786c34fc9ce7
User::incEditCountImmediate(): Add explicit IS NOT NULL check

Within the UPDATE query, if user_editcount IS NULL, user_editcount+1 will
also be NULL, and the change becomes a no-op. So in MySQL, the number of
affected rows would be zero, which is the number of rows that actually
changed.

However, other DBMSs (e.g. PostgreSQL, SQLite) do count no-op changes,
meaning the code would not initialize user_editcount if it were NULL.
Explicitly checking for NULL should ensure consistent behavior across
database types.

Also, if the CLIENT_FOUND_ROWS flag is set when connecting to MySQL, the
server returns "Rows matched:" instead of "Changed:" as the affected row
count. This change would be necessary if MediaWiki, like Drupal, is
changed to use that flag <https://www.drupal.org/node/805858>.

Change-Id: Idac160bae56adc5c5d17f8558c55d87000019741
includes/User.php