From: Tim Starling Date: Tue, 23 Mar 2004 10:29:30 +0000 (+0000) Subject: script to move "custom messages" to the Template namespace X-Git-Tag: 1.3.0beta1~728 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/ajouter.php?a=commitdiff_plain;h=a312dfb6460e6a8e5991aca05be78dd22147aa3d;p=lhc%2Fweb%2Fwiklou.git script to move "custom messages" to the Template namespace --- diff --git a/maintenance/archives/moveCustomMessages.php b/maintenance/archives/moveCustomMessages.php new file mode 100644 index 0000000000..02c2421f6c --- /dev/null +++ b/maintenance/archives/moveCustomMessages.php @@ -0,0 +1,45 @@ + $enValue ) +{ + $title = Title::newFromText( $key ); + $dbkeys[$title->getDBkey()] = 1; +} + +$sql = "SELECT cur_id, cur_title FROM cur WHERE cur_namespace= " . NS_MEDIAWIKI; +$res = wfQuery( $sql, DB_READ ); +$first = true; +while ( $row = wfFetchObject( $res ) ) { + $partial = $row->cur_title; + print "$partial..."; + if ( !array_key_exists( $partial, $dbkeys ) ) { + $ot = Title::makeTitle( NS_MEDIAWIKI, $partial ); + $nt = Title::makeTitle( NS_TEMPLATE, $partial ); + if ( $ot->moveNoAuth( $nt ) === true ) { + print "moved\n"; + } else { + print "not moved\n"; + } + # Clear deferred updates + while ( count( $wgDeferredUpdateList ) ) { + $up = array_pop( $wgDeferredUpdateList ); + $up->doUpdate(); + } + $first = false; + } else { + print "internal\n"; + } +} +if ( $first ) { + print "Nothing to move\n"; +} + +?>