5

This question refers to FireFox v25 in my case.

A Wiki Workspace used by me, changed its name from

https://wikis.mycompany.com/teamcollab/wiki/MyProduct+Alpha+QA:Test+Automation

to

https://wikis.mycompany.com/teamcollab/wiki/MyProduct+QA:Test+Automation

omitting the word "Alpha" from the Wiki's name and URL.

I am frequently returning to pages on the wiki, by starting to write sections of the page's URL or Title in the address bar, which auto-suggests me relevant pages.

Now, this feature is broken, as all my pages are leading to the wrong URL and as a bonus, I now have duplicates of the new wiki and the old wiki in the history.

Since the History is saved in the

I want to be able to do the following (which is available for Bookmarks)

1) Export all the History I have 2) Manually go into the History and replace the URL and Title contents. 3) Import the new History.

or alternatively, what is a proper sqlite sql query to change the history.

I looked for a suitable Firefox add-on, but couldn't find one so far. This can also be a good option.

Thanks.

RaamEE

3
  • why not find the applicable entries and delete them, then only the new ones will be there Apr 10, 2014 at 13:00
  • I don't want to delete the old ones, because sometimes, instead of looking for a specific wiki page in the wikis search tool (which I know I accessed in the past), It is easier for me to write a few words from the title and voila, there it is. I know its a good page for my search cause I already used it and kept it in the history.
    – RaamEE
    Apr 10, 2014 at 13:32
  • Well, it looks like the question is more of a SQL related question. The file places.sqlite (stackoverflow.com/questions/10179990/…) holds (among other) the history. So I am looking for a SQL query that can do a RegEx text replacement. Alternatively, I can export the following SQL result SELECT * FROM moz_places; and edit an UPDATE query from it, doable but messy. Besides I am not familar with any dependencies between tables.
    – RaamEE
    Apr 10, 2014 at 13:42

3 Answers 3

4

As already answered by "RaamEE". You can follow that approach.

But this is little simple where we can directly run UPDATE command on sqlite(Db of firefox). Update on sqlite is very easy and we can verify the change as well. Just run SELECT command to check the changed history.

Important

  • Quit Firefox.
  • Find Firefox profile folder.
  • Make a backup.

Process on MAC & worked for me

  1. Quit Firefox
  2. cd /Users/{USER_NAME}/Library/Application Support/Firefox/Profiles/oicj7ndj.default (oicj7ndj will be different for you)
  3. Make a backup: cp places.sqlite places.sqlite.bak
  4. Run SQLite: sqlite3 places.sqlite
  5. To change: UPDATE moz_places SET url=replace(url, 'OLD_STRING', 'NEW_STRING') where url like "%OLDSTRING%";
  6. To validate: select * from moz_places where url like "%NEW_STRING%"
  7. quit from SQLite and start Firefox
2

------IMPORTANT------

Save a copy of places.sqlite before you begin. Save 2 copies if needed. Use at your own discretion

------IMPORTANT------

I chose the dirtiest quickest solution. running 400 SQLite UPDATE commands to change 400 records.

1) copy a backup of places.sqlite from /Users/YourUserName/Library/Application Support/Firefox/Profiles/7skm4kzn.default/places.sqlite (MacOS system. The last directory differs between profiles) to places_bak.sqlite

2) run a HERE script to select the records and output into file

#!/bin/bash

sqlite3 places.sqlite << HERE > results.sql
        select id, url from moz_places where url like '%MyProduct+Alpha+QA%';
HERE

3) Use vi and the next substitution to modify the urls (I didn't need to touch the Title)

:%s/\([0-9]*\)|\(.*\)MyProduct+Alpha+QA\(.*\)/UPDATE moz_places SET url='\2MyProduct+QA\3' WHERE id=\1;/gc

This will remove the word "+Alpha" from the URL and create a new set of UPDATE commands which in turn you can dump into the DB file using this HERE script

#!/bin/bash

sqlite3 places.sqlite << HERE
        `cat results.sql`
HERE

4) Copy & Replace the original places.sqlite under your profile path. I suggest you shutdown firefox before overwriting the original file.

1

I had the same question as you had, but it turned out that what was wrong was the question. I found a better approach to deal with the renaming of a wiki: the Redirector web browser plugin.

You can basically have your browser redirect you using regular expressions. The best thing is that not only does it work with history URLs, it also works with any other URL, so if you follow links to the old wiki from anywhere else, they get right too.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .