Menu

What about Site.Disconnect and similar questions

Help
2015-01-08
2015-01-27
  • Juergen Thomas

    Juergen Thomas - 2015-01-08

    Sorry, the topic "Waht" was posted before I corrected the subject and edited content.

    I dont't find a method like Disconnect or Logout. Under which circumstances is a Site instance disposed? By closing the application? By creating a new instance? After 30 days if the wiki enables to stay logged in?

    On the other side, all WMF projects use Single User Login (SUL) accounts in the meanwhile: login to one project causes logged in to all projects. Is there any problem to use several instances at the same time: siteWBde for de-Wikibooks, siteWPde for de-Wikipedia, siteWBen for en-Wikibooks, and so on?

    My aim as de-WB sysop is: The bot shall delete redirects and pages for speedy deletions. Before deleting the bot has to check what pages link to a specific page. That's no problem inside de-WB. Moreover, there may be links from de-Wikipedia, de-Wikiversity, or en-Wikibooks to the de-WB page. My Bot must work in the following way:

    1. FillFromCategory(speedy deletions) - inside de-WB, therefore using siteWBde
    2. foreach(Page p in pl_WBde)
      1. check the existence of links inside de-WB - using siteWBde - and redirect or remove in de-WB
      2. make a note of external links - using siteWBde
      3. redirect or remove links from de-WP - using siteWPde
      4. redirect or remove links from en-WB - using siteWBen
      5. and so on in other projects
      6. if there's no link left, the bot may delete - using siteWBde - otherwise the bot gives a message and continues

    All external links are saved in a special de-WB page.

    Are there any problems to switch between several site instances? Or would it be better practice to use one site instance after another:

    1. FillFromCategory(speedy deletions) - using siteWBde
    2. redirect or remove links inside de-WB, make a note of external links
    3. redirect or remove links from de-WP - using site WPde - and so on
    4. delete inside de-WB, if possible

    I'ld thank for some explanations using the site class in this situation. Juergen

     
  • CodeDriller

    CodeDriller - 2015-01-24

    Every site must have a corresponding Site object, e.g. Site siteWPde for German Wikipedia, Site siteWPen for English Wikipedia and so on. Don't worry about SUL.

    There is no problem to have many Site objects in your program simultaneously and act using them simultaneously. In fact it is a very common practice to carry out cross-site jobs using several Site objects at the same time.

    Site instance is disposed when it is out of program scope.

    I just would advise against creating several Site objects for the same site in one program, it's not good.

     
  • Juergen Thomas

    Juergen Thomas - 2015-01-27

    Thank you for the explanation. Now I know what to do. Juergen

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.