Share to:

Bruger:Hebbot/Slet-src

#!/usr/local/bin/perl -w

use strict;

use MediaWiki::Bot;
use Date::Calc qw(:all);

my $user = 'Hebbot';
my $pass = '********';

# create and initialize editor

my $WPDa = MediaWiki::Bot->new();

$WPDa->set_wiki({
    protocol => 'http',
    host => 'da.wikipedia.org',
    path => 'w',
    });
            
$WPDa->login({
    username => $user,
    password => $pass,
    });
        

# action!

my @infiles;
my $final;

my @artikler;
my @kategori;
my @brugere;
my @filer;
my @wikipedia;
my @skabelon;
my @diskussion;

my $countartikler = 0;
my $countfiles = 0;
my $countbrugere = 0;
my $countfiler = 0;
my $countwikipedia = 0;
my $countskabelon = 0;
my $countdiskussion = 0;
my $countkategori = 0;

my $headtext = $WPDa->get_text("Bruger:Hebbot/Slet/Setting:Header");

sub getfilesa($) {

    my @catx = $WPDa->get_pages_in_category(shift);

    foreach my $catf (@catx) {

	if (index($catf, 'Kategori') > -1) {

		if ($catf ne 'Kategori:Kategorisletningsforslag') {
    
		    getfilesb($catf);
	    
		}
	    
	} else {

	    push @infiles, $catf;
	
	}
    }
    
}

sub getfilesb($) {

    my @catx = $WPDa->get_pages_in_category(shift);

    foreach my $catf (@catx) {

	if (index($catf, 'Kategori') > -1) {

	    if ($catf ne 'Kategori:Kategorisletningsforslag') {
    
		getfilesa($catf);
	    
	    }
	    
	} else {

	    push @infiles, $catf;
	
	}
    }
    
}


sub getsletcat($) {

    my @catx = $WPDa->get_pages_in_category(shift);

    foreach my $catf (@catx) {

	push @infiles, $catf;
	
    }
}


getfilesa("Kategori:Sletningsforslag");
getsletcat("Kategori:Kategorisletningsforslag");

@infiles = sort @infiles;

$final .= qq{==Sletningsmarkerede emner==
$headtext

};


foreach my $exitfile (@infiles) {

    if (index($exitfile, 'Bruger') == "0") {

	if (@brugere == 0) {

	    push @brugere, $exitfile;
	    $countbrugere++;

	} elsif ($exitfile ne $brugere[-1]) {
    
	    push @brugere, $exitfile;
	    $countbrugere++;
	
	}

    } elsif (index($exitfile, 'Kategori') == "0") {

	if (@wikipedia == 0) {
	
	    push @kategori, $exitfile;
	    $countkategori++;
	
    	} elsif ($exitfile ne $kategori[-1]) {

	    push @kategori, $exitfile;
	    $countkategori++;

	}

    } elsif (index($exitfile, 'Wikipedia') == "0") {

	if ((index($exitfile, 'Skabeloner/Generelle') == -1) && (index($exitfile, 'Skabeloner/Ophavsret og kilder') == -1) && (index($exitfile, 'Skabeloner/S¯stersider') == -1) && (index($exitfile, 'Wikipedia:Sletningsforslag') == -1)) {

	    if (@wikipedia == 0) {
	
		push @wikipedia, $exitfile;
		$countwikipedia++;
	
    	    } elsif ($exitfile ne $wikipedia[-1]) {

		push @wikipedia, $exitfile;
		$countwikipedia++;

	    }

	}

    } elsif (index($exitfile, 'Skabelon') == "0") {

	if (index($exitfile, 'NowCommons') == -1) {

	    if (@skabelon == 0) {

		push @skabelon, $exitfile;
    		$countskabelon++;

    	    } elsif ($exitfile ne $skabelon[-1]) {

		push @skabelon, $exitfile;
    		$countskabelon++;
	    }
	}

    } elsif (index($exitfile, 'Diskussion') == "0") {

	if (@diskussion == 0) {
	
	    push @diskussion, $exitfile;
	    $countdiskussion++;
	
	} elsif ($exitfile ne $diskussion[-1]) {

	    push @diskussion, $exitfile;
	    $countdiskussion++;

	}

    } elsif (index($exitfile, 'Brugerdiskussion') == "0") {

	if (@diskussion == 0) {
	
	    push @diskussion, $exitfile;
	    $countdiskussion++;
	
	} elsif ($exitfile ne $diskussion[-1]) {

	    push @diskussion, $exitfile;
	    $countdiskussion++;

	}

    } elsif (index($exitfile, 'Fil') == "0") {

	if (@filer == 0) {

	    push @filer, $exitfile;
	    $countfiler++;

	} elsif ($exitfile ne $filer[-1]) {

	    push @filer, $exitfile;
	    $countfiler++;

	}
	
    } else {

	if (@artikler == 0) {
	
    	    push @artikler, $exitfile;
	    $countartikler++;
	
	} elsif ($exitfile ne $artikler[-1]) {

    	    push @artikler, $exitfile;
	    $countartikler++;

	}
    }
}


$final .= "===Oversigt over sletningsmarkerede artikler ($countartikler)===\n\n";

foreach my $exitfile (@artikler) {

        $final .= "# [[$exitfile]] ([[Wikipedia:Sletningsforslag/$exitfile|sletningsforslag]])\n";

}


$final .= "\n\n===Oversigt over sletningsmarkerede kategorier ($countkategori)===\n\n";

foreach my $exitfile (@kategori) {

    $final .= "# [[:$exitfile|$exitfile]] ([[Wikipedia:Sletningsforslag/$exitfile|sletningsforslag]])\n";

}

$final .= "\n\n===Oversigt over sletningsmarkerede skabeloner ($countskabelon)===\n\n";

foreach my $exitfile (@skabelon) {

    $final .= "# [[:$exitfile|$exitfile]] ([[Wikipedia:Sletningsforslag/$exitfile|sletningsforslag]])\n";

}


$final .= "\n\n===Oversigt over sletningsmarkerede filer ($countfiler)===\n\n";

foreach my $exitfile (@filer) {

    $final .= "# [[:$exitfile|$exitfile]] ([[Wikipedia:Sletningsforslag/$exitfile|sletningsforslag]])\n";

}

$final .= "\n\n===Oversigt over sletningsmarkerede emner i Wikipedia-navnerummet ($countwikipedia)===\n\n";

foreach my $exitfile (@wikipedia) {

    $final .= "# [[$exitfile]] ([[Wikipedia:Sletningsforslag/$exitfile|sletningsforslag]])\n";

}


$final .= "\n\n===Oversigt over sletningsmarkerede emner i brugeromrÂderne ($countbrugere)===\n\n";

foreach my $exitfile (@brugere) {

    $final .= "# [[$exitfile]] ([[Wikipedia:Sletningsforslag/$exitfile|sletningsforslag]])\n";

}

$final .= "\n\n===Oversigt over sletningsmarkerede diskussionssider ($countdiskussion)===\n\n";

foreach my $exitfile (@diskussion) {

    $final .= "# [[$exitfile]] ([[Wikipedia:Sletningsforslag/$exitfile|sletningsforslag]])\n";

}


# print $final;

my $counttotal = $countartikler+$countskabelon+$countfiler+$countwikipedia+$countbrugere+$countdiskussion;

$WPDa->edit({
    page => "Bruger:Hebbot/Slet",
    text => $final,
    summary => "Opdatering af oversigt over ".$counttotal." sletningsmarkerede emner (".$countartikler."-".$countkategori."-".$countskabelon."-".$countfiler."-".$countwikipedia."-".$countbrugere."-".$countdiskussion.")",
    });

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.
Prefix: a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9

Portal di Ensiklopedia Dunia

Kembali kehalaman sebelumnya