I am working with a company where my login to the wiki is not a sysop. I am reading through many records and updating them based on changes in other systems. Sometimes my program tries to update a page that it doesn't have access to because the admin has protected the page (its read-only). Is there any way I can find out if a page is protected before I try to write it out? (Even though I have put exception handling around the save code, after 2 failed saves I get a connection error to the wiki).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
There is no such built-in method. But if you really need it, you can easily create it by yourself. You can use GetPageHTM() function to get HTML source of a page and then search for edit link in HTML source before calling Save() function. Something like that:
In version 3.11, I don't find a method like GetPageHTM() that returns HTML source. Using API:Properties and API:Meta I created a partial solution and post it in a new topic "Check page restrictions" in Open Discussion. Juergen
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am working with a company where my login to the wiki is not a sysop. I am reading through many records and updating them based on changes in other systems. Sometimes my program tries to update a page that it doesn't have access to because the admin has protected the page (its read-only). Is there any way I can find out if a page is protected before I try to write it out? (Even though I have put exception handling around the save code, after 2 failed saves I get a connection error to the wiki).
There is no such built-in method. But if you really need it, you can easily create it by yourself. You can use GetPageHTM() function to get HTML source of a page and then search for edit link in HTML source before calling Save() function. Something like that:
In version 3.11, I don't find a method like GetPageHTM() that returns HTML source. Using API:Properties and API:Meta I created a partial solution and post it in a new topic "Check page restrictions" in Open Discussion. Juergen
In version 3.x the method GetPageHTM() was renamed to GetWebPage().
Thank you, I'll check whether the content helps. Juergen