[PerlWikiBot] SF.net SVN: perlwikibot:[83] trunk/no-interwiki
Status: Pre-Alpha
Brought to you by:
rotemliss
From: <am...@us...> - 2009-09-29 13:25:18
|
Revision: 83 http://perlwikibot.svn.sourceforge.net/perlwikibot/?rev=83&view=rev Author: amire80 Date: 2009-09-29 13:25:11 +0000 (Tue, 29 Sep 2009) Log Message: ----------- Refactoring empty pages handling. Modified Paths: -------------- trunk/no-interwiki/cv.strings.txt trunk/no-interwiki/prepare_noiw_list.pl Modified: trunk/no-interwiki/cv.strings.txt =================================================================== --- trunk/no-interwiki/cv.strings.txt 2009-09-27 12:41:34 UTC (rev 82) +++ trunk/no-interwiki/cv.strings.txt 2009-09-29 13:25:11 UTC (rev 83) @@ -23,7 +23,8 @@ type тĕс # MW specials -REDIRECT куçару +#REDIRECT куçару +REDIRECT перенаправление # Namespaces User Хутшăнакан Modified: trunk/no-interwiki/prepare_noiw_list.pl =================================================================== --- trunk/no-interwiki/prepare_noiw_list.pl 2009-09-27 12:41:34 UTC (rev 82) +++ trunk/no-interwiki/prepare_noiw_list.pl 2009-09-29 13:25:11 UTC (rev 83) @@ -463,55 +463,40 @@ say $page_counter; } - last PAGE - if ($option{stop_after} - and $page_counter > $option{stop_after}); - - next PAGE - if ($page_counter < $option{start_from}); - - my $page_namespace = namespace($page_ref); - my $page_title = $page_ref->title(); - my $page_text_ref = $page_ref->text(); - - if (not defined $page_text_ref) { - WARN('ref to page text undefined, skipping'); - $statistics{'ref to page text undefined'}++; - next PAGE; + if ( $option{stop_after} + and $page_counter > $option{stop_after}) + { + last PAGE; } - if (not defined ${$page_text_ref}) { - WARN('page text undefined, skipping'); - $statistics{'page text undefined'}++; - next PAGE; - } + my $page_text_ref = $page_ref->text(); - if (${$page_text_ref} eq q()) { - WARN('page text empty, skipping'); - $statistics{'page text empty'}++; + if ( + $page_counter < $option{start_from} + or not defined ${$page_text_ref} # must be tested before redirect + or not is_in_namespace($page_ref, @INCLUDE_NAMESPACES) + or is_redirect($page_ref) + ) + { next PAGE; } - if (not is_in_namespace($page_ref, @INCLUDE_NAMESPACES)) { - next PAGE; - } + my $page_namespace = namespace($page_ref); + $namespace_count{$page_namespace}++; - if (my $redirect_type = is_redirect($page_ref)) { - $statistics{"redirect - $redirect_type"}++; - DEBUG("\n$page_title - $redirect_type redirect"); - next PAGE; - } + my $page_title = $page_ref->title(); + INFO("\n* processing $page_counter - ", $page_title); + # TODO: Be more precise here. # Portal pages which have a '/' in their name are probably # internal and do not need interwiki links. if (is_in_namespace($page_ref, 'Portal') and $page_title =~ m{/}xms) { + INFO('internal portal, skipping'); + $statistics{'internal portal'}++; next PAGE; } - $namespace_count{$page_namespace}++; - INFO("\n* processing $page_counter - ", $page_title); - # A simple sanity check: is the no_iw template anywhere around here? my $has_template_no_iw = (${$page_text_ref} =~ $SIMPLE_NO_IW_CHECK_RE); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |