Page MenuHomePhabricator

Art_EdPg.patch

Authored By
bzimport
Nov 21 2014, 8:12 PM
Size
3 KB
Referenced Files
None
Subscribers
None

Art_EdPg.patch

Index: includes/Article.php
===================================================================
RCS file: /cvsroot/wikipedia/phase3/includes/Article.php,v
retrieving revision 1.248.2.10
diff -u -r1.248.2.10 Article.php
--- includes/Article.php 22 Jan 2005 08:33:46 -0000 1.248.2.10
+++ includes/Article.php 29 Jan 2005 13:16:09 -0000
@@ -311,7 +311,6 @@
$oldid = $wgRequest->getVal( 'oldid' );
if ( isset( $oldid ) ) {
- $dbr =& $this->getDB();
$oldid = IntVal( $oldid );
if ( $wgRequest->getVal( 'direction' ) == 'next' ) {
$nextid = $this->mTitle->getNextRevisionID( $oldid );
@@ -601,12 +600,16 @@
global $wgOut;
if ( -1 != $this->mUser ) return;
+ # New or non-existent articles have no user information
+ $id = $this->getID();
+ if ( 0 == $id ) return;
+
$fname = 'Article::loadLastEdit';
$dbr =& $this->getDB();
$s = $dbr->selectRow( 'cur',
array( 'cur_user','cur_user_text','cur_timestamp', 'cur_comment','cur_minor_edit' ),
- array( 'cur_id' => $this->getID() ), $fname, $this->getSelectOptions() );
+ array( 'cur_id' => $id ), $fname, $this->getSelectOptions() );
if ( $s !== false ) {
$this->mUser = $s->cur_user;
Index: includes/EditPage.php
===================================================================
RCS file: /cvsroot/wikipedia/phase3/includes/EditPage.php,v
retrieving revision 1.131.2.5
diff -u -r1.131.2.5 EditPage.php
--- includes/EditPage.php 27 Dec 2004 01:41:34 -0000 1.131.2.5
+++ includes/EditPage.php 29 Jan 2005 13:44:30 -0000
@@ -460,25 +460,29 @@
$wgOut->setOnloadHandler( 'document.editform.wpTextbox1.focus()' );
}
# Prepare a list of templates used by this page
- $db =& wfGetDB( DB_SLAVE );
- $cur = $db->tableName( 'cur' );
- $links = $db->tableName( 'links' );
+ $templates = '';
$id = $this->mTitle->getArticleID();
- $sql = "SELECT cur_namespace,cur_title,cur_id ".
- "FROM $cur,$links WHERE l_to=cur_id AND l_from={$id} and cur_namespace=".NS_TEMPLATE;
- $res = $db->query( $sql, "EditPage::editform" );
-
- if ( $db->numRows( $res ) ) {
- $templates = '<br />'. wfMsg( 'templatesused' ) . '<ul>';
- while ( $row = $db->fetchObject( $res ) ) {
- if ( $titleObj = Title::makeTitle( $row->cur_namespace, $row->cur_title ) ) {
- $templates .= '<li>' . $sk->makeLinkObj( $titleObj ) . '</li>';
+ if ( 0 !== $id ) {
+ $db =& wfGetDB( DB_SLAVE );
+ $cur = $db->tableName( 'cur' );
+ $links = $db->tableName( 'links' );
+ $sql = "SELECT cur_namespace,cur_title,cur_id ".
+ "FROM $cur,$links WHERE l_to=cur_id AND l_from={$id} and cur_namespace=".NS_TEMPLATE;
+ $res = $db->query( $sql, "EditPage::editform" );
+ if ( false !== $res ) {
+ if ( $db->numRows( $res ) ) {
+ $templates = '<br />'. wfMsg( 'templatesused' ) . '<ul>';
+ while ( $row = $db->fetchObject( $res ) ) {
+ if ( $titleObj = Title::makeTitle( $row->cur_namespace, $row->cur_title ) ) {
+ $templates .= '<li>' . $sk->makeLinkObj( $titleObj ) . '</li>';
+ }
+ }
+ $templates .= '</ul>';
}
+ $db->freeResult( $res );
}
- $templates .= '</ul>';
- } else {
- $templates = '';
}
+
$wgOut->addHTML( "
{$toolbar}
<form id=\"editform\" name=\"editform\" method=\"post\" action=\"$action\"

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1410
Default Alt Text
Art_EdPg.patch (3 KB)

Event Timeline