@@ -138,53 +138,54 @@ if( app_opt.pageCount > 0 ) then
138138 print "Unable to load"
139139 else
140140 print "OK"
141- if ( wikicon->LoadPage( sPage, sBodyOld ) <> FALSE ) then
142- if ( wikicon->GetPageID() > 0 ) then
143- if ( wikicon->Login( app_opt.wiki_username, app_opt.wiki_password ) ) = FALSE then
144- print "Unable to login"
141+
142+ '' wikicon->LoadPage() may return FALSE if the page does not
143+ '' yet exist. Test the page ID instead to determine if it
144+ '' is a new page
145+ wikicon->LoadPage( sPage, sBodyOld )
146+ if ( wikicon->GetPageID() > 0 ) then
147+ if ( wikicon->Login( app_opt.wiki_username, app_opt.wiki_password ) ) = FALSE then
148+ print "Unable to login"
149+ else
150+ if ( iComment > 0 ) then
151+ if ( iComment = 1 or sNoteDef = "" ) then
152+ print "Enter note for '" + sPage + "' : " ;
153+ Line input sNote
154+ if trim(sNote) = "" then sNote = "Auto-Update"
155+ sNoteDef = sNote
156+ else
157+ sNote = sNoteDef
158+ end if
145159 else
146- if ( iComment > 0 ) then
147- if ( iComment = 1 or sNoteDef = "" ) then
148- print "Enter note for '" + sPage + "' : " ;
149- Line input sNote
150- if trim(sNote) = "" then sNote = "Auto-Update"
151- sNoteDef = sNote
152- else
153- sNote = sNoteDef
154- end if
160+ if ( sComment > "" ) then
161+ sNote = sComment
162+ elseif ( sNoteDef > "" ) then
163+ sNote = sNoteDef
155164 else
156- if ( sComment > "" ) then
157- sNote = sComment
158- elseif ( sNoteDef > "" ) then
159- sNote = sNoteDef
160- else
161- sNote = ""
162- end if
165+ sNote = ""
163166 end if
167+ end if
164168
165- print "Storing '" + sPage + "' [" + sNote + "] : " ;
169+ print "Storing '" + sPage + "' [" + sNote + "] : " ;
166170
167- if ( wikicon->StorePage( sBody, sNote ) = FALSE ) then
168- print "FAILED"
169- else
170- print "OK"
171- end if
171+ if ( wikicon->StorePage( sBody, sNote ) = FALSE ) then
172+ print "FAILED"
173+ else
174+ print "OK"
172175 end if
176+ end if
177+ else
178+ print "Unable to get existing page ID - will try to store as a new page .."
179+ if ( wikicon->Login( app_opt.wiki_username, app_opt.wiki_password ) ) = FALSE then
180+ print "Unable to login"
173181 else
174- print "Unable to get existing page ID - will try to store as a new page .."
175- if ( wikicon->Login( app_opt.wiki_username, app_opt.wiki_password ) ) = FALSE then
176- print "Unable to login "
182+ print "Storing '" + sPage + "': " ;
183+ if ( wikicon->StoreNewPage( sBody, sPage ) = FALSE ) then
184+ print "FAILED "
177185 else
178- print "Storing '" + sPage + "': " ;
179- if ( wikicon->StoreNewPage( sBody, sPage ) = FALSE ) then
180- print "FAILED"
181- else
182- print "OK"
183- end if
186+ print "OK"
184187 end if
185188 end if
186- else
187- print "Unable to existing page"
188189 end if
189190 end if
190191 next
0 commit comments