$this->mContentLoaded = true;
}
- function getID() { return $this->mTitle->getArticleID(); }
+ function getID() {
+ if( $this->mTitle ) {
+ return $this->mTitle->getArticleID();
+ } else {
+ return 0;
+ }
+ }
function getCount()
{
$s = wfMsg( "redirectedfrom", $redir );
$wgOut->setSubtitle( $s );
}
- $wgOut->checkLastModified( $this->mTouched );
- $this->tryFileCache();
$wgLinkCache->preFill( $this->mTitle );
$wgOut->addWikiText( $text );
$fname = "Article::insertNewArticle";
+ $this->mCountAdjustment = $this->isCountable( $text );
+
$ns = $this->mTitle->getNamespace();
$ttl = $this->mTitle->getDBkey();
$text = $this->preSaveTransform( $text );
$sql = "UPDATE recentchanges SET rc_cur_time='{$now}' " .
"WHERE rc_cur_id=" . $this->getID();
wfQuery( $sql, DB_WRITE, $fname );
-
- if ( $wgEnablePersistentLC ) {
- // Purge link cache for this page
+ global $wgEnablePersistentLC;
+ if ( $wgEnablePersistentLC ) {
+ // Purge link cache for this page
$pageid=$this->getID();
wfQuery("DELETE FROM linkscc WHERE lcc_pageid='{$pageid}'", DB_WRITE);
-
- // This next query just makes sure stub colored links to this page
- // are updated correctly (I think). If performance is more important
- // than real-time updating of stub links, we really should skip
- // this query.
- wfQuery("DELETE linkscc FROM linkscc,links ".
- "WHERE lcc_title=links.l_from AND l_to={$pageid}", DB_WRITE);
- }
-
+ }
}
+
if( $wgDBtransactions ) {
$sql = "COMMIT";
wfQuery( $sql, DB_WRITE );
return;
}
- if ( $wpConfirm ) {
+ if ( $_POST["wpConfirm"] ) {
$this->doDelete();
return;
}
# determine whether this page has earlier revisions
# and insert a warning if it does
# we select the text because it might be useful below
- $sql="SELECT old_text FROM old WHERE old_namespace=0 and old_title='" . wfStrencode($this->mTitle->getPrefixedDBkey())."' ORDER BY inverse_timestamp LIMIT 1";
- $res=wfQuery($sql, DB_READ, $fname);
+ $ns = $this->mTitle->getNamespace();
+ $title = $this->mTitle->getDBkey();
+ $etitle = wfStrencode( $title );
+ $sql = "SELECT old_text FROM old WHERE old_namespace=$ns and old_title='$etitle' ORDER BY inverse_timestamp LIMIT 1";
+ $res = wfQuery( $sql, DB_READ, $fname );
if( ($old=wfFetchObject($res)) && !$wpConfirm ) {
$skin=$wgUser->getSkin();
$wgOut->addHTML("<B>".wfMsg("historywarning"));
$wgOut->addHTML( $skin->historyLink() ."</B><P>");
}
- $sql="SELECT cur_text FROM cur WHERE cur_namespace=0 and cur_title='" . wfStrencode($this->mTitle->getPrefixedDBkey())."'";
+ $sql="SELECT cur_text FROM cur WHERE cur_namespace=$ns and cur_title='$etitle'";
$res=wfQuery($sql, DB_READ, $fname);
if( ($s=wfFetchObject($res))) {
function confirmDelete( $par = "" )
{
global $wgOut;
+ global $wpReason;
wfDebug( "Article::confirmDelete\n" );
<form id=\"deleteconfirm\" method=\"post\" action=\"{$formaction}\">
<table border=0><tr><td align=right>
{$delcom}:</td><td align=left>
-<input type=text size=60 name=\"wpReason\" value=\"{$wpReason}\">
+<input type=text size=60 name=\"wpReason\" value=\"" . htmlspecialchars( $wpReason ) . "\">
</td></tr><tr><td> </td></tr>
<tr><td align=right>
<input type=checkbox name=\"wpConfirm\" value='1' id=\"wpConfirm\">
function doDeleteArticle( $title )
{
- global $wgUser, $wgOut, $wgLang, $wpReason, $wgDeferredUpdateList;
+ global $wgUser, $wgOut, $wgLang, $wpReason, $wgDeferredUpdateList,
+ $wgEnablePersistentLC;
$fname = "Article::doDeleteArticle";
wfDebug( "$fname\n" );
$wgOut->addHTML( "<h2>" . $newcomment . "</h2>\n<hr>\n" );
$this->updateArticle( $s->old_text, $newcomment, 1, $this->mTitle->userIsWatching() );
+ global $wgEnablePersistentLC;
+ if ( $wgEnablePersistentLC ) {
+ wfQuery("DELETE FROM linkscc WHERE lcc_pageid='{$pid}'", DB_WRITE);
+ }
+
$wgOut->returnToMain( false );
}
$this->mTitle->getDBkey() );
array_push( $wgDeferredUpdateList, $u );
- if ( $this->getNamespace == NS_MEDIAWIKI ) {
+ if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
$messageCache = $wgMemc->get( "$wgDBname:messages" );
if (!$messageCache) {
$messageCache = wfLoadAllMessages();
}
$messageCache[$title] = $text;
- $wgMemc->set( "$wgDBname:messages" );
+ $wgMemc->set( "$wgDBname:messages", $messageCache, 86400 );
}
}
}
/* Caching functions */
function tryFileCache() {
+ static $called = false;
+ if( $called ) {
+ wfDebug( " tryFileCache() -- called twice!?\n" );
+ return;
+ }
+ $called = true;
if($this->isFileCacheable()) {
$touched = $this->mTouched;
if( strpos( $this->mContent, "{{" ) !== false ) {