I’ve been having issues removing some pages on one of our sub wikis that someone on my team created. At the time when those pages were created our Tomcat 8 had not been setup to support \ & / symbols in URLs, which I think is at the root cause of the issue(s).
Here’s what I’ve done up to now and the progress I’ve made:
Page were create using “/” in the name. A page was also create with “/” in the name (probably figured it would do some escape character magic?". Both cause pages that cannot be deleted.
I’ve since then change out Tomcat 8’s catalina.properties file to add support for both \ and /.
I tried accessing the pages but was still unable to do so. I made a quick velocity script to show all the pages:
I then use some code I found a link for on this forum to delete the pages programatically since the URLs were not helpful (cannot use /delete/ method). The snippet was from @vmassol if I am not mistaken.
I was able to remove some of the pages but not all of them.
I check again with the snippet from #3 to see the pages that remain. 3 of them show up in that list and 1 does not.
When all 4 of these are tried in the snippet mentioned in #4, they return the following The document that you’re trying to delete does not exist, nothing will be done.
The three pages that show up using my #3 snippet do not seem to show up in breadcrumbs/navigation (showhidden=true). The one that does not show up in my snippet shows up in the breadcrumbs/navigation though!
I’ve tried recreating that last one and here is what I got (already exists error message):
I’m somewhat out of ideas on what else to try for these last 4 pages. Any ideas anyone?
The URL does not work and cannot be accessed, whether it is by “view”, “delete”, etc. Also, the screenshot is of me trying to create a page (not edit) in the space of that “not existing page” to confirm that my sub wiki does seem to think it exists even though it is thoroughly not accessible by any ways I can think of.
I was thinking maybe if I can create a page there to replace the non existing one I can then delete it proper but I cannot even do that…
Any other ideas?
I tried the velocity script but the pages still show up in bread crumbs/navigation but not in my list from my snippet above. I think that might be an important distinction since otherwise that code seems to list every other page and their children properly that are on that sub-wiki.
I’ve tested the script on other test pages I created for this purpose in the same space as the problematic one and I seem to have no issues having the velocity script delete those.
I added one line to see if the doc exists (calling $xwiki.exists() ). It seems my (newly created for deletion purposes) do exist before deletion and after a refresh do not (as expected).
Unfortunately, the pages I am trying to delete while they do show up in bread crumbs/navigation, they do not show up in my listing of all pages/their children and also do not seem to exist according to that call. But they do on that path when I try to create one there (as seen in the screenshot of my first post).
Kinda at a loss now. This seems to point that the expected path is not the one stored inside the database/XWiki.
Sincerely,
P.-S.: For reference/completeness, here is the modified snippet:
{{velocity}}
#set($document = $xwiki.getDocument('Servo Erector Set (SES) Building System.SES V1 \/ V2 - Hardware.WebHome'))
## Get the internal document
#set($xwikidocument = $document.getDocument())
#set($docExists = $xwiki.exists($xwikidocument))
## Display details on doc
* $document || [[$document>>$xwikidocument]]
* Exists? $docExists
## Remove it
##set($discard = $xwiki.getXWiki().deleteDocument($xwikidocument, false, $xcontext.context))
{{/velocity}}
I guess you need to escape the backslash ‘\’ (i.e. double it) like:
#set($document = $xwiki.getDocument('Servo Erector Set (SES) Building System.SES V1 \\/ V2 - Hardware.WebHome'))
It works for me in that case.
BTW: you need to set the variables in the tomcat setenv.sh or the like, not in catalina.properties, as far as I know. You should be able to access these pages in tomcat without need to delete them.
I’ll be trying this out and so I can finally access those pages in case someone else in my team creates those. I am quite certain the issue was with Tomcat’s handling of / & .