Topic on Project:Support desk

Help. I accidentally deleted from the page table.

11
Overherenow (talkcontribs)

Hi. So I wanted to remove a page out of the "page_restriction" table but accidentally deleted it from the "page" table. Is there any way to get that "page" table line back? Please tell me there is. Any help would be greatly appreciated.

If I can't recover the row from the "page" table, how could I get the text from the removed page so I could just create a new page with that text.

UPDATE: I am using MediaWiki 1.11.2.

88.130.107.172 (talkcontribs)

Hi!

To find the text of the page, you must know the value from the field "page_latest" in the page table. Information on how to find the text from there are available here: Manual:Page_table#page_latest.

I hope you still know the page name of the page you removed?

Second question: Do you have a backup with this row in the page table still included?

86.173.55.194 (talkcontribs)

Hi please update Mediawiki 1.11.2 to Mediawiki 1.19 if you have php 5.2 or Mediawiki 1.22 if you have php 5.3. Mediawiki 1.11.2 is unsupported and there has been many changes since Mediawiki 1.11.2 was released.

Overherenow (talkcontribs)

I do remember the page name and the page_id. So I will look there in the page_latest table. I don't think I have a backup. I did look at the archive table but nothing was there. I even tried creating a new page and updating the page table with the deleted page_id, but that caused the search page to break. I just have to create that link in the page table to the context of the page.

Beyond the page_latest table, is there any other way to rebuild that row?

Upgrading would be nice but that wouldn't bring the page back. After getting the page back, we will look into upgrading Mediawiki.

88.130.107.172 (talkcontribs)

When you removed the row from the page table, the information from the page_latest field (which is part of that row) will be gone as well.

What you in fact need is the revision number (that is what the page_latest field of the page points you to). With that number you will be able to find the correct text (which btw. is still in your DB).

Another option would be this: If you know a few exact(!) words of wikitext, that were on the page (including styles; sign for sign as you had them in the wikitext), then you can also use MySQL to search the column "old_text" of the text table for this text. In case you see multiple hits after that search and when you read the text in old_text they come from the correct page (and not from another one, which had the search string in it as well), then the one with the highest number in old_id most likely is the newest revision you had.

Overherenow (talkcontribs)

Interesting. In my version of MediaWiki, I don't have a page_latest table. It must be that old. I did look through the text table but I couldn't find anything. The page maybe hasn't been updated in a long time or when I deleted it from the page table, it also got removed from the text table as well. Here are the tables I do have. The ones that are "-"ed, I've looked in.
-archive
categorylinks
externallinks
-filearchive
hitcounter
image
imagelinks
interwiki
ipblocks
job
langlinks
logging
math
objectcache
oldimage
-page
-page_restrictions
-pagelinks
querycache
querycache_info
querycachetwo
-recentchanges
redirect
-revision
searchindex
site_stats
templatelinks
-text
-trackbacks
transcache
user
user_groups
user_newtalk
watchlist

88.130.71.254 (talkcontribs)

Look at my post again: I spoke of the page_latest field; it's no table. In a table you have columns. When you fill rows(!) into a table, then you fill each of the columns with values; per row one value for each column. Now the value of column x in row y is what is called a field.

There are maintenance scripts, which can be used to remove text from the text table, but they are not executed automatically - instead, you must do that manually (if you might want to delete content). If you did not run them manually, your text will still be in the text table and you should be able to find it in the column "old_text". If you do not find it, I think you are somehow searching incorrectly - how do you do it?

151.191.175.230 (talkcontribs)

I ended up just creating a new page with the same name. Oh well.

That's interesting though about the page_latest. I didn't have that number but I still searched the text table with this SQL.
select * from text where old_text like '%Champion%';

But that didn't return the page. I tried other text to make sure my SQL was right and other pages returned.

88.130.71.254 (talkcontribs)

Then try with another word or some other words. I am not 100% sure, but if I remember correctly, searches in MySQL (like the one you do with "LIKE") are case insensitive, if you use collations, which are case insensitive. So if you use something like utf_8_general_ci, the search should be case-insensitive. If you use binary encoding, your search should be case sensitive.

151.191.175.231 (talkcontribs)

I did try different cases and just "%hampion%" and nothing. It's alright. We are just recreating the page.

Thank you for your time and help. I greatly appreciate it.

88.130.102.110 (talkcontribs)

Hmm, ok. However, I still do not understand, why you cannot find the text. Interested in what happened there...

Reply to "Help. I accidentally deleted from the page table."