Index: trunk/extensions/MetavidWiki/maintenance/maintenance_util.inc.php |
— | — | @@ -75,11 +75,10 @@ |
76 | 76 | } |
77 | 77 | return $mv_valid_people_cache[$person_key]; |
78 | 78 | } |
79 | | -function append_to_wiki_page( $wgTitle, $append_text, $unique = true ) { |
80 | | - global $botUserName; |
81 | | - if ( $wgTitle->exists() ) { |
82 | | - $wgArticle = new Article( $wgTitle ); |
83 | | - $cur_text = $wgArticle->getContent(); |
| 79 | +function append_to_wiki_page( $title, $append_text, $unique = true ) { |
| 80 | + if ( $title->exists() ) { |
| 81 | + $article = new Article( $title ); |
| 82 | + $cur_text = $article->getContent(); |
84 | 83 | if ( $unique ) { |
85 | 84 | if ( strpos( $cur_text, $append_text ) !== false ) { |
86 | 85 | print "no insert $append_text already present\n"; |
— | — | @@ -89,21 +88,21 @@ |
90 | 89 | $cur_text .= "\n\n" . $append_text; |
91 | 90 | // do the edit: |
92 | 91 | $sum_txt = 'metavid append'; |
93 | | - $wgArticle->doEdit( $cur_text, $sum_txt , EDIT_FORCE_BOT); |
94 | | - print "did append on " . $wgTitle->getDBkey() . "\n"; |
| 92 | + $article->doEdit( $cur_text, $sum_txt , EDIT_FORCE_BOT); |
| 93 | + print "did append on " . $title->getDBkey() . "\n"; |
95 | 94 | } else { |
96 | 95 | print "append request to empty page... creating\n"; |
97 | | - do_update_wiki_page( $wgTitle, $append_text ); |
| 96 | + do_update_wiki_page( $title, $append_text ); |
98 | 97 | } |
99 | 98 | } |
100 | | -function do_update_wiki_page( $wgTitle, $wikiText, $ns = null, $forceUpdate = false ) { |
| 99 | +function do_update_wiki_page( $title, $wikiText, $ns = null, $forceUpdate = false ) { |
101 | 100 | global $botUserName; |
102 | | - if ( !is_object( $wgTitle ) ) { |
| 101 | + if ( !is_object( $title ) ) { |
103 | 102 | // get the title and make sure the first letter is uper case |
104 | | - $wgTitle = Title::makeTitle( $ns, ucfirst( $wgTitle ) ); |
| 103 | + $title = Title::makeTitle( $ns, ucfirst( $title ) ); |
105 | 104 | } |
106 | 105 | |
107 | | - if ( trim( $wgTitle->getDBkey() ) == '' ) { |
| 106 | + if ( trim( $title->getDBkey() ) == '' ) { |
108 | 107 | print "empty title (no insert /update) \n"; |
109 | 108 | return ; |
110 | 109 | } |
— | — | @@ -111,33 +110,33 @@ |
112 | 111 | // make sure the text is utf8 encoded: |
113 | 112 | $wikiText = utf8_encode( $wikiText ); |
114 | 113 | |
115 | | - $wgArticle = new Article( $wgTitle ); |
116 | | - if ( !mvDoMvPage( $wgTitle, $wgArticle, false ) ) { |
117 | | - print "bad title: " . $wgTitle->getNsText() . ':' . $wgTitle->getDBkey() . " no edit"; |
118 | | - if ( $wgTitle->exists() ) { |
| 114 | + $article = new Article( $title ); |
| 115 | + if ( !mvDoMvPage( $title, $article, false ) ) { |
| 116 | + print "bad title: " . $title->getNsText() . ':' . $title->getDBkey() . " no edit"; |
| 117 | + if ( $title->exists() ) { |
119 | 118 | print "remove article"; |
120 | | - $wgArticle->doDeleteArticle( 'bad title' ); |
| 119 | + $article->doDeleteArticle( 'bad title' ); |
121 | 120 | } |
122 | 121 | // some how mvdIndex and mvd pages got out of sync do a separate check for the mvd: |
123 | | - if ( MV_Index::getMVDbyTitle( $wgArticle->mTitle->getDBkey() ) != null ) { |
| 122 | + if ( MV_Index::getMVDbyTitle( $title->getDBkey() ) != null ) { |
124 | 123 | print ', rm mvd'; |
125 | | - MV_Index::remove_by_wiki_title( $wgArticle->mTitle->getDBkey() ); |
| 124 | + MV_Index::remove_by_wiki_title( $title->getDBkey() ); |
126 | 125 | } |
127 | 126 | print "\n"; |
128 | 127 | return ; |
129 | 128 | } |
130 | | - if ( $wgTitle->getNamespace() == MV_NS_MVD && MV_Index::getMVDbyTitle( $wgTitle->getDBkey() ) == null ) { |
| 129 | + if ( $title->getNamespace() == MV_NS_MVD && MV_Index::getMVDbyTitle( $title->getDBkey() ) == null ) { |
131 | 130 | // print "missing assoc mvd ...update \n"; |
132 | 131 | } else { |
133 | | - if ( $wgTitle->exists() ) { |
| 132 | + if ( $title->exists() ) { |
134 | 133 | // if last edit!=mvBot skip (don't overwite peoples improvments') |
135 | | - $rev = & Revision::newFromTitle( $wgTitle ); |
| 134 | + $rev = & Revision::newFromTitle( $title ); |
136 | 135 | if ( $botUserName != $rev->getRawUserText() && !$forceUpdate ) { |
137 | | - print ' skiped page ' . $wgTitle->getNsText() . ':' . $wgTitle->getText() . ' edited by user:' . $rev->getRawUserText() . " != $botUserName \n"; |
| 136 | + print ' skiped page ' . $title->getNsText() . ':' . $title->getText() . ' edited by user:' . $rev->getRawUserText() . " != $botUserName \n"; |
138 | 137 | return ; |
139 | 138 | } |
140 | 139 | // proc article: |
141 | | - $cur_text = $wgArticle->getContent(); |
| 140 | + $cur_text = $article->getContent(); |
142 | 141 | // if its a redirect skip |
143 | 142 | if ( substr( $cur_text, 0, strlen( '#REDIRECT' ) ) == '#REDIRECT' && !$forceUpdate ) { |
144 | 143 | print ' skiped page moved by user:' . $rev->getRawUserText() . "\n"; |
— | — | @@ -145,7 +144,7 @@ |
146 | 145 | } |
147 | 146 | // check if text is identical: |
148 | 147 | if ( trim( $cur_text ) == trim( $wikiText ) ) { |
149 | | - print "text " . $wgTitle->getNsText() . ':' . $wgTitle->getText() . " is identical (no update)\n"; |
| 148 | + print "text " . $title->getNsText() . ':' . $title->getText() . " is identical (no update)\n"; |
150 | 149 | // if force update double check the mvd for consistancy? |
151 | 150 | return ; |
152 | 151 | } |
— | — | @@ -155,7 +154,7 @@ |
156 | 155 | // got here do the edit: |
157 | 156 | $sum_txt = 'metavid bot insert'; |
158 | 157 | |
159 | | - $wgArticle->doEdit( $wikiText, $sum_txt, EDIT_FORCE_BOT ); |
| 158 | + $article->doEdit( $wikiText, $sum_txt, EDIT_FORCE_BOT ); |
160 | 159 | print "did edit on " . $wgTitle->getNsText() . ':' . $wgTitle->getDBkey() . "\n"; |
161 | 160 | // die; |
162 | 161 | } |
Index: trunk/extensions/MetavidWiki/includes/specials/MV_SpecialCRUDStream.php |
— | — | @@ -187,8 +187,8 @@ |
188 | 188 | |
189 | 189 | // insert page |
190 | 190 | $streamTitle = Title::newFromText( $this->stream_name, MV_NS_STREAM ); |
191 | | - $wgArticle = new Article( $streamTitle ); |
192 | | - $status = $wgArticle->doEdit( $this->stream_desc, wfMsg( 'mv_summary_add_stream' ) ); |
| 191 | + $article = new Article( $streamTitle ); |
| 192 | + $status = $article->doEdit( $this->stream_desc, wfMsg( 'mv_summary_add_stream' ) ); |
193 | 193 | if ( $status === true || ( is_object( $status ) && $status->isOK() ) ) { |
194 | 194 | // stream inserted sucesfully report to output |
195 | 195 | $out = wfMsg('mv_stream_added', $sk->makeLinkObj( $streamTitle, $this->stream_name ) ); |
Index: trunk/extensions/MetavidWiki/includes/MV_Hooks.php |
— | — | @@ -243,8 +243,6 @@ |
244 | 244 | * by processing the given title request/namespace |
245 | 245 | */ |
246 | 246 | function mvDoMvPage ( &$title, &$article, $doOutput = true ) { |
247 | | - global $wgOut, $wgTitle, $wgArticle; |
248 | | - |
249 | 247 | //add js |
250 | 248 | mvAddPerNamespaceJS( $title ); |
251 | 249 | |
— | — | @@ -273,7 +271,6 @@ |
274 | 272 | return false; |
275 | 273 | } |
276 | 274 | } |
277 | | - $wgArticle = $article; |
278 | 275 | return true; |
279 | 276 | } |
280 | 277 | function mvCatHook( &$catArticle ) { |