Last modified: 2013-11-15 03:38:25 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T59079, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 57079 - Change of page_id when moving makes life difficult
Change of page_id when moving makes life difficult
Status: RESOLVED WORKSFORME
Product: MediaWiki
Classification: Unclassified
Logging (Other open bugs)
unspecified
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-11-14 21:15 UTC by Steven Walling
Modified: 2013-11-15 03:38 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Steven Walling 2013-11-14 21:15:07 UTC
When you move a page, the page_id changes. The new id doesn't show up in the log. While end users can see the old or new page name and namespace, this logging  makes it hard to programmatically hard to track page moves. 

I see two solutions here:

* Don't change the page_id when moving
* Log the new and the old page_id when moving
Comment 1 Steven Walling 2013-11-14 21:17:04 UTC
(In reply to comment #0)
> When you move a page, the page_id changes. The new id doesn't show up in the
> log. While end users can see the old or new page name and namespace, this
> logging  makes it hard to programmatically hard to track page moves. 
> 
> I see two solutions here:
> 
> * Don't change the page_id when moving
> * Log the new and the old page_id when moving

Blergh. Should read: "makes it hard to programmatically track page moves."
Comment 2 Aaron Schulz 2013-11-14 21:43:05 UTC
I don't think the page ID changes, that would require an O(N) update of rev_page that does not exist AFAIK.
Comment 3 Matthew Flaschen 2013-11-14 22:28:53 UTC
It doesn't change based on my local tests:

php> echo Title::newFromText('After move')->getArticleId();
320

php> echo Title::newFromText('After move')->getArticleId();
320

Same is confirmed using wgArticleId.  Can someone provide a way to reproduce this?  Otherwise, I will close as WORKSFORME.
Comment 4 Aaron Halfaker 2013-11-14 22:48:40 UTC
I agree.  It seemed strange to me too.  I just realized that the logging table could be storing the page ID of the redirect that was created.  I'll try to demo the issue.

# Get the last page move in the logging table on enwiki:
> SELECT log_namespace, log_title, log_page, log_params FROM logging WHERE log_action = "move" and log_type = "move" AND log_namespace = 0 ORDER BY log_id DESC LIMIT 1;
+---------------+-----------+----------+------------------------------------------------------------------------+
| log_namespace | log_title | log_page | log_params                                                             |
+---------------+-----------+----------+------------------------------------------------------------------------+
|             0 | Chappo    | 41083072 | a:2:{s:9:"4::target";s:14:"Chappo (album)";s:10:"5::noredir";s:1:"0";} |
+---------------+-----------+----------+------------------------------------------------------------------------+
1 row in set (0.29 sec)


That means "Chappo" was moved to "Chappo (album)".  But the recorded page_id points to a new page that has become a redirect:

> select page_title, page_namespace from page where page_id = 41083072;
+------------+----------------+
| page_title | page_namespace |
+------------+----------------+
| Chappo     |              0 |
+------------+----------------+
1 row in set (0.04 sec)


If you view the content of the article at that page ID, you should see:
---------------------------------
#REDIRECT [[Chappo (album)]]
{{R from move}}
---------------------------------

My proposed solution is to store the page_id of the *moved page* in log_page and optionally store the page_id of the created redirect in the hashed array in log_params.  

This solution is slightly problematic since old code could be relying on the page_id of the redirect page appearing in log_page.  Though, I can't imagine why anyone would be looking for that there.
Comment 5 Aaron Halfaker 2013-11-14 22:56:25 UTC
Sure enough.  log_page = 0 is no redirect is created. 

> SELECT log_id, log_namespace, log_title, log_page, log_params FROM logging WHERE log_action = "move" and log_type = "move" AND log_params LIKE '%"5::noredir";s:1:"1";%' ORDER BY log_id DESC LIMIT 1;
+----------+---------------+----------------------+----------+------------------------------------------------------------+
| log_id   | log_namespace | log_title            | log_page | log_params                                                 |
+----------+---------------+----------------------+----------+------------------------------------------------------------+
| 52627069 |             0 | UCI_(disambiguation) |        0 | a:2:{s:9:"4::target";s:3:"UCI";s:10:"5::noredir";s:1:"1";} |
+----------+---------------+----------------------+----------+------------------------------------------------------------+
1 row in set (0.04 sec)
Comment 6 Steven Walling 2013-11-14 23:03:14 UTC
Resolving per all the comments.
Comment 7 Aaron Schulz 2013-11-14 23:10:15 UTC
Yeah the old page ID makes sense to store, with the new one in params and possibly log_relations.
Comment 8 Matthew Flaschen 2013-11-15 03:38:25 UTC
See bug 57084 for a new report covering the actual issue.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links