delinquent_files/demon.php

changeset 8
38415be9f910
parent 6
8b4e205ffc94
child 9
43902b1af1b9
equal deleted inserted replaced
7:0d6c71adcee9 8:38415be9f910
77 foreach ( $namespaces AS $namespace ) { 77 foreach ( $namespaces AS $namespace ) {
78 if ( $namespace == $o->gil_page_namespace_id ) return true ; 78 if ( $namespace == $o->gil_page_namespace_id ) return true ;
79 } 79 }
80 } 80 }
81 return false ; 81 return false ;
82 }
83
84 ## page content forbidding bots, like {{nobots}} or {{bots|deny=..us..}}
85 function isForbiddenPage ( $content ) {
86 if ( preg_match( '\{\{nobots\}\}|\{\{bots\s*\|\s*deny=([^}]*CommonsDelinker|all)', $content) ) return true;
87 return false;
82 } 88 }
83 89
84 function getRecentDeletedFiles ( $max_ts ) { 90 function getRecentDeletedFiles ( $max_ts ) {
85 # Open Commons database replica 91 # Open Commons database replica
86 $db_co = $this->getCommonsDB() ; 92 $db_co = $this->getCommonsDB() ;
400 } 406 }
401 407
402 $rev_id = $revision->getId() ; 408 $rev_id = $revision->getId() ;
403 $text = $revision->getContent()->getData() ; 409 $text = $revision->getContent()->getData() ;
404 410
411 if ( $this->isForbiddenPage( $text ) ) {
412 $this->d->info("Skipping forbidden (nobots) page $e->wiki: $e->page");
413 $this->setDone( $e->id, 2, "Change forbidden (nobots)" );
414 return;
415 }
416
405 $file = $e->file ; 417 $file = $e->file ;
406 $pattern = $this->matcher->matcher_prepare_pattern( $file ); 418 $pattern = $this->matcher->matcher_prepare_pattern( $file );
407 419
408 $new_text = $text ; 420 $new_text = $text ;
409 421

mercurial