Page MenuHomePhabricator

Art_EdPg.patch

Authored By
bzimport
Nov 21 2014, 8:12 PM
Size
2 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.265
diff -u -r1.265 Article.php
--- includes/Article.php 30 Jan 2005 19:46:48 -0000 1.265
+++ includes/Article.php 3 Feb 2005 13:34:32 -0000
@@ -479,12 +479,16 @@
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( array( 'revision', 'page') ,
array( 'rev_user','rev_user_text','rev_timestamp', 'rev_comment','rev_minor_edit' ),
- array( 'page_id' => $this->getID(), 'page_latest=rev_id' ), $fname, $this->getSelectOptions() );
+ array( 'page_id' => $id, 'page_latest=rev_id' ), $fname, $this->getSelectOptions() );
if ( $s !== false ) {
$this->mUser = $s->rev_user;
Index: includes/EditPage.php
===================================================================
RCS file: /cvsroot/wikipedia/phase3/includes/EditPage.php,v
retrieving revision 1.142
diff -u -r1.142 EditPage.php
--- includes/EditPage.php 31 Dec 2004 14:53:56 -0000 1.142
+++ includes/EditPage.php 3 Feb 2005 13:42:02 -0000
@@ -541,24 +541,27 @@
$wgOut->setOnloadHandler( 'document.editform.wpTextbox1.focus()' );
}
# Prepare a list of templates used by this page
- $db =& wfGetDB( DB_SLAVE );
- $page = $db->tableName( 'page' );
- $links = $db->tableName( 'links' );
+ $templates = '';
$id = $this->mTitle->getArticleID();
- $sql = "SELECT page_namespace,page_title,page_id ".
- "FROM $page,$links WHERE l_to=page_id AND l_from={$id} and page_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->page_namespace, $row->page_title ) ) {
- $templates .= '<li>' . $sk->makeLinkObj( $titleObj ) . '</li>';
+ if ( 0 !== $id ) {
+ $db =& wfGetDB( DB_SLAVE );
+ $page = $db->tableName( 'page' );
+ $links = $db->tableName( 'links' );
+ $sql = "SELECT page_namespace,page_title,page_id ".
+ "FROM $page,$links WHERE l_to=page_id AND l_from={$id} and page_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->page_namespace, $row->page_title ) ) {
+ $templates .= '<li>' . $sk->makeLinkObj( $titleObj ) . '</li>';
+ }
+ }
+ $templates .= '</ul>';
}
+ $db->freeResult( $res );
}
- $templates .= '</ul>';
- } else {
- $templates = '';
}
global $wgLivePreview, $wgStylePath;

File Metadata

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

Event Timeline