r29486 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r29485‎ | r29486 | r29487 >
Date:09:55, 9 January 2008
Author:dale
Status:old
Tags:
Comment:
stream page delete updates streams table & mvd index
Modified paths:
  • /trunk/extensions/MetavidWiki/includes/MV_Hooks.php (modified) (history)
  • /trunk/extensions/MetavidWiki/includes/MV_Index.php (modified) (history)
  • /trunk/extensions/MetavidWiki/includes/MV_Stream.php (modified) (history)
  • /trunk/extensions/MetavidWiki/includes/articlepages/MV_StreamPage.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MetavidWiki/includes/MV_Index.php
@@ -130,6 +130,11 @@
131131
132132 }
133133 }
 134+ function remove_by_stream_id($stream_id){
 135+ global $mvIndexTableName;
 136+ $dbw =& wfGetDB(DB_WRITE);
 137+ $dbw->delete($mvIndexTableName, array('stream_id'=>$stream_id));
 138+ }
134139 /*
135140 * removes a single entry by wiki_title name
136141 */
Index: trunk/extensions/MetavidWiki/includes/MV_Stream.php
@@ -55,6 +55,12 @@
5656 function doesStreamExist(){
5757 return $this->db_load_stream();
5858 }
 59+ //removes the stream from the db:
 60+ function deleteDB(){
 61+ global $mvStreamTable;
 62+ $dbw = & wfGetDB(DB_WRITE);
 63+ $dbw->delete($mvStreamTable, array('id'=>$this->id));
 64+ }
5965 function db_load_stream() {
6066 global $mvStreamTable;
6167 $dbr = & wfGetDB(DB_SLAVE);
Index: trunk/extensions/MetavidWiki/includes/articlepages/MV_StreamPage.php
@@ -120,9 +120,11 @@
121121 $wgOut->output();
122122 }
123123 function delete(){
124 - global $wgOut;
125 - $wgOut->addHTML( wfMsg('mv_stream_delete_warrning',
 124+ global $wgOut, $wgRequest,$wgUser;
 125+ if(!$wgRequest->wasPosted()){
 126+ $wgOut->addHTML( wfMsg('mv_stream_delete_warrning',
126127 MV_Index::countMVDInRange($this->mvTitle->getStreamId())));
 128+ }
127129 //update text button to delete stream rather than delete stream
128130 parent::delete();
129131 }
Index: trunk/extensions/MetavidWiki/includes/MV_Hooks.php
@@ -87,8 +87,8 @@
8888 //remove article with that title:
8989 MV_Index::remove_by_wiki_title($article->mTitle->getDBkey());
9090 }else if($article->mTitle->getNamespace()==MV_NS_STREAM){
91 -
92 -
 91+ MV_Index::remove_by_stream_id($article->mvTitle->mvStream->getStreamId());
 92+ $article->mvTitle->mvStream->deleteDB();
9393 }
9494 return true; // always return true, in order not to stop MW's hook processing!
9595 }

Status & tagging log