$this->mArticle->mContent = $t ;
$this->mMetaData = $s ;
}
+
+ protected function wasDeletedSinceLastEdit() {
+ /* Note that we rely on the logging table, which hasn't been always there,
+ * but that doesn't matter, because this only applies to brand new
+ * deletes.
+ */
+ if ( $this->deletedSinceEdit )
+ return true;
+ if ( $this->mTitle->isDeleted() ) {
+ $this->lastDelete = $this->getLastDelete();
+ if ( !is_null($this->lastDelete) ) {
+ $deletetime = $this->lastDelete->log_timestamp;
+ if ( ($deletetime - $this->starttime) > 0 ) {
+ $this->deletedSinceEdit = true;
+ }
+ }
+ }
+ return $this->deletedSinceEdit;
+ }
function submit() {
$this->edit();
$this->isCssJsSubpage = $this->mTitle->isCssJsSubpage();
$this->isValidCssJsSubpage = $this->mTitle->isValidCssJsSubpage();
- /* Notice that we can't use isDeleted, because it returns true if article is ever deleted
- * no matter it's current state
- */
- $this->deletedSinceEdit = false;
- if ( $this->edittime != '' ) {
- /* Note that we rely on logging table, which hasn't been always there,
- * but that doesn't matter, because this only applies to brand new
- * deletes. This is done on every preview and save request. Move it further down
- * to only perform it on saves
- */
- if ( $this->mTitle->isDeleted() ) {
- $this->lastDelete = $this->getLastDelete();
- if ( !is_null($this->lastDelete) ) {
- $deletetime = $this->lastDelete->log_timestamp;
- if ( ($deletetime - $this->starttime) > 0 ) {
- $this->deletedSinceEdit = true;
- }
- }
- }
- }
-
# Show applicable editing introductions
if( $this->formtype == 'initial' || $this->firsttime )
$this->showIntro();
# If the article has been deleted while editing, don't save it without
# confirmation
- if ( $this->deletedSinceEdit && !$this->recreate ) {
+ if ( $this->wasDeletedSinceLastEdit() && !$this->recreate ) {
wfProfileOut( "$fname-checks" );
wfProfileOut( $fname );
return self::AS_ARTICLE_WAS_DELETED;
*/
function showEditForm( $formCallback=null ) {
global $wgOut, $wgUser, $wgLang, $wgContLang, $wgMaxArticleSize, $wgTitle;
+
+ # If $wgTitle is null, that means we're in API mode.
+ # Some hook probably called this function without checking
+ # for is_null($wgTitle) first. Bail out right here so we don't
+ # do lots of work just to discard it right after.
+ if(is_null($wgTitle))
+ return;
$fname = 'EditPage::showEditForm';
wfProfileIn( $fname );
$hidden = '';
$recreate = '';
- if ($this->deletedSinceEdit) {
+ if ($this->wasDeletedSinceLastEdit()) {
if ( 'save' != $this->formtype ) {
$wgOut->addWikiMsg('deletedwhileediting');
} else {