• 0
Sign in to follow this  
Luminesce

Old thread URLs don't work

Question

Posted (edited)

Two examples in my first post here/here (the second link might not work right with default posts per page changed, and both the first and second links ARE the problem, so..), and one in my signature (on light theme) - links to other threads don't redirect or anything at all, they're just completely broken.

 

Ex. https://community.tulpa.info/thread-ask-lumi-s-tulpas

Edited by Luminesce

Hi! I'm Lumi, host of Reisen, Tewi, Flandre and Lucilyn.

Everyone deserves to love and be loved. It's human nature.

My tulpas and I have a Q&A thread, which was the first (and largest) of its kind. Feel free to ask us stuff.

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Everything but some user profiles should be fixed now.  The program I wrote to convert the URLs from mybb's to invision's forgot to check case sensitivity, so while https://community.tulpa.info/thread-Ask-Lumi-s-Tulpas worked (how it was stored in MyBB), the lowercase version did not.

 

For those interested on how it works, I had this script pull the data out and create an index table:

Spoiler

#!/usr/bin/python
#Convert mybb friendly links to ipb
#by pleeb

import MySQLdb
import re

old_url_base = "/"
new_url_base = "community.tulpa.info/"

# Pull in the database
db_mybb = MySQLdb.connect( 
 host="localhost",
  user="XXXX",
  passwd="XXXX",
  db="XXXX"
)
db_ipb = MySQLdb.connect( 
 host="localhost",
  user="XXXX",
  passwd="XXXX",
  db="XXXX"
)

#First we crawl the google_seo table and build redirects from
# all existing entries
cur_mybb = db_mybb.cursor()

# idtype int row[0]
# id is long row[1]
# title is string row[2]

cur_mybb.execute("select idtype,id,url from mybb_google_seo")

#this has tuples of old/new urls
duet_list = []
for row in cur_mybb.fetchall():
	# This will hold old/new URLs
	old_url = None
	new_url = None
	if row[0] == 1:
		old_url = old_url_base + "user-" + str(row[2])
		new_url = new_url_base + "member.php?action=profile&uid=" + str(row[1])
	elif row[0] == 2:
		# I won't know what Announcements use until I disable google seo
		old_url = old_url_base + "announcement-" + str(row[2])
		new_url = new_url_base
	elif row[0] == 3:
		old_url = old_url_base + "forum-" + str(row[2])
		new_url = new_url_base + "forumdisplay.php?fid=" + str(row[1])
	elif row[0] == 4:
		old_url = old_url_base + "thread-" + str(row[2])
		new_url = new_url_base + "showthread.php?tid=" + str(row[1])
	else:
		continue
	duet_list.append((old_url,new_url))

# Now we add in the other URLs from the topics, users, forums, etc.
# For this, we need the ID to build the old URL and the titles to look
#  the new URL in IPB

# Format of old_lists: (type[f/t/u], ID, title)
old_lists = []
cur_mybb.execute("select fid,name from mybb_forums")
for row in cur_mybb.fetchall():
	# remember, format is ('type', 'ID', 'title')
	old_lists.append(('f',row[0],row[1]))

cur_mybb.execute("select uid,username from mybb_users")
for row in cur_mybb.fetchall():
	# remember, format is ('type', 'ID', 'title')
	old_lists.append(('u',row[0],row[1]))

cur_mybb.execute("select tid,subject from mybb_threads")
for row in cur_mybb.fetchall():
	# remember, format is ('type', 'ID', 'title')
	old_lists.append(('t',row[0],row[1]))

# Now that we have the old URL, convert it to the new URL... this is the hard part.
cur_ipb = db_ipb.cursor()

for data_type, data_id, data_title in old_lists:
	if data_type == 'u':
		# User... Find the user in IPB and make the redirect
		#IPB /profile/XXX-words/
		#mybb member.php?action=profile&uid=XX
		old_url = old_url_base + "member.php?action=profile&uid=" + str(data_id)
		# Get the ID and username
		cur_ipb.execute("select member_id,name from core_members where name='" + re.escape(data_title) + "' limit 1")
		for row in cur_ipb.fetchall():
			new_url = new_url_base + "profile/" + str(row[0]) + "-w/"
			break
		else:
			new_url = old_url
	elif data_type == 't':
		# Thread, find the thread in IPB and make the redirect
		#IPB /topic/XXX-words/
		#mybb showthread.php?tid=XXX
		old_url = old_url_base + "showthread.php?tid=" + str(data_id)
		#print "data topic title is: 0" + data_title
		cur_ipb.execute('select tid,title from forums_topics where title="' + re.escape(data_title) + '" limit 1')
		for row in cur_ipb.fetchall():
			new_url = new_url_base + "topic/" + str(row[0]) + "-w/"
			break
		else:
			new_url = old_url
	elif data_type == 'f':
		# Forum- find the forum in IPB and make the redirect
		#IPB /forum/X-words/
		#mybb forumdisplay.php?fid=XXX
		# I'm actually just going to do this one manually
		continue
	else:
		# We should never get here
		continue 
	duet_list.append((old_url,new_url))

for old_link, new_link in duet_list:
	print old_link.lower() + ' ' + new_link.lower()

 

Then I stuck this in the vhost area for community.tulpa.info:

Spoiler

	#Load our rewrite database!
	RewriteEngine On
	RewriteMap lowercase int:tolower
	RewriteMap redirects "dbm=db:/link/to/community.tulpa.info/redirects.db"
	RewriteCond     ${redirects:${lowercase:%{REQUEST_URI}|NONE}}     !=""     [NC]
	RewriteRule     ^(.*)   ${redirects:%{REQUEST_URI}}     [R=301]
	#end redirects

 

Not sure why user links aren't working yet, but it may be something that got botched during the conversion.

 

 

Share this post


Link to post
Share on other sites
  • 0

"pid=" links are still broken, meaning all URLs linking to posts over the years now link only to the thread in question. A snippet from my list of reference posts as an example:

 

Quote

Vocality, parroting, doubt, mindvoice, invasive thoughts
Discussing developing a tulpa's unique mindvoice, distinguishing from other thoughts
https://community.tulpa.info/thread-narration-is-it-possible-for-a-tulpa-to-achieve-mindvoice-without-narration?pid=150854#pid150854

Puppeting isn't bad, early vocality, tulpa becoming comfortable with what host likes
https://community.tulpa.info/thread-am-i-doing-things-correctly?pid=167888#pid167888

Quick reply for not parroting
https://community.tulpa.info/thread-those-this-count-as-parroting?pid=203237#pid203237

Can't hear tulpa speak (not yet vocal)
https://community.tulpa.info/thread-sentience-i-do-not-hear-my-tulpa?pid=201936#pid201936

Months without vocality (poor visualization too)
https://community.tulpa.info/thread-ask-lumi-s-tulpas?pid=244423#pid244423

Anti-vocality trap, imagining your tulpa speaking to overcome it
https://community.tulpa.info/thread-blayze-and-kyoko?pid=212293#pid212293

 

And while my massive list of reference posts being broken is itself a tragedy, there's quite a few places on the forum that've linked to numerous other threads that makes this a problem too. Literally any time someone has linked to a post instead of a thread. I know it's fine for like lists of guides and all, but literally all references to posts within 20-60 page threads are basically null now, I have no idea how to find Tewi's huge attempt at lucid dreaming where she practiced All Day Awareness for days straight now, for example, since it's in the middle of a massive thread


Hi! I'm Lumi, host of Reisen, Tewi, Flandre and Lucilyn.

Everyone deserves to love and be loved. It's human nature.

My tulpas and I have a Q&A thread, which was the first (and largest) of its kind. Feel free to ask us stuff.

Share this post


Link to post
Share on other sites
  • 0

We've made a lot of links to earlier posts as well, including links to on-topic posts in LOTPW. We've also saved a lot of other people's posts for reference by "pid=".


At least finding the posts again shouldn't usually be the problem, if we know what we're looking for:


Tewi on All Day Awareness


-Ember


I'm not having fun here anymore, so we've decided to take a bit of a break, starting February 27, 2020. - Ember

 

Ember - Soulbonder, Female, 39 years old, from Georgia, USA . . . . [Our Progress Report] . . . . [How We Switch]

Vesper Dowrin - Insourced Soulbond from London, UK, World of Darkness, Female, born 9 Sep 1964, bonded ~12 May 2017

Iris Ravenlock - Insourced Soulbond from the Winter Court of Faerie, Dresdenverse, Female, born 6 Jun 1982, bonded ~5 Dec 2015

 

'Real isn't how you are made,' said the Skin Horse. 'It's a thing that happens to you.' - The Velveteen Rabbit

Share this post


Link to post
Share on other sites
  • 0

I'll see if I can find a way to grab them and rebuild the redirect tables, I suspect it would cause the amount of them to jump from tens of thousands to several hundreds of thousands though, so I'm not sure HOW WELL or how long it'll take to generate.

 

I'll work on the script this week.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.