name space check fix

This commit is contained in:
v 2018-09-03 17:40:37 +03:00
parent 8fad5b3c18
commit d05b6c16c5

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
":" //# -*- mode: js -*-; exec /usr/bin/env TMPDIR=/tmp node --max-old-space-size=2000 --stack-size=42000 "$0" "$@" ":" //# -*- mode: js -*-; exec /usr/bin/env TMPDIR=/tmp node --max-old-space-size=2000 --stack-size=42000 "$0" "$@"
// node --inspect --debug-brk // node --inspect-brk
"use strict" "use strict"
@ -301,21 +301,21 @@ class NameSpaceSet {
nsList.split( ',' ).map( ns => this.request( ns )) nsList.split( ',' ).map( ns => this.request( ns ))
} }
request ( ns ) { request ( nsIdx ) {
const nsId = this.nameSpaces[ ns ] const ns = this.nameSpaces[ nsIdx ]
if ( ! nsId ) { if ( ! ns ) {
fatal( 'Incorrect name space', ns ) fatal( 'This wiki does not have name space', nsIdx )
return return
} }
if ( ! this.check( nsId )) { if ( ! this.check( ns.id )) {
this.nsUsed.add( nsId ) this.nsUsed.add( ns.id )
this.nsQueue.push( nsId ) this.nsQueue.push( ns.id )
} }
} }
* [Symbol.iterator] () { * [Symbol.iterator] () {
while ( this.nsQueue.length != 0 ) { while ( this.nsQueue.length != 0 ) {
yield this.nsQueue.shift().id yield this.nsQueue.shift()
} }
} }
} }
@ -1047,7 +1047,7 @@ function batchPages ( nameSpace ) {
} }
let redirects = [] let redirects = []
const done = Object.keys( pages ).map( key => { const done = Object.keys( pages ).map( key => {
if ( parseInt( key ) < 0 ) { if ( parseInt( key ) < 0 ) { // no such page
return null return null
} }
const pageInfo = pages[ key ] const pageInfo = pages[ key ]
@ -1062,7 +1062,7 @@ function batchPages ( nameSpace ) {
return null return null
} }
if ( ! command.pages || exclude.test( pageInfo.title )) { if ( ! command.pages || exclude.test( pageInfo.title )) {
log( 'x' , pageInfo.title ) log( 'x', pageInfo.title )
return null return null
} }
log( '#', pageInfo.title ) log( '#', pageInfo.title )