Index: trunk/extensions/MetavidWiki/includes/MV_Index.php |
— | — | @@ -130,6 +130,11 @@ |
131 | 131 | |
132 | 132 | } |
133 | 133 | } |
| 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 | + } |
134 | 139 | /* |
135 | 140 | * removes a single entry by wiki_title name |
136 | 141 | */ |
Index: trunk/extensions/MetavidWiki/includes/MV_Stream.php |
— | — | @@ -55,6 +55,12 @@ |
56 | 56 | function doesStreamExist(){ |
57 | 57 | return $this->db_load_stream(); |
58 | 58 | } |
| 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 | + } |
59 | 65 | function db_load_stream() { |
60 | 66 | global $mvStreamTable; |
61 | 67 | $dbr = & wfGetDB(DB_SLAVE); |
Index: trunk/extensions/MetavidWiki/includes/articlepages/MV_StreamPage.php |
— | — | @@ -120,9 +120,11 @@ |
121 | 121 | $wgOut->output(); |
122 | 122 | } |
123 | 123 | 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', |
126 | 127 | MV_Index::countMVDInRange($this->mvTitle->getStreamId()))); |
| 128 | + } |
127 | 129 | //update text button to delete stream rather than delete stream |
128 | 130 | parent::delete(); |
129 | 131 | } |
Index: trunk/extensions/MetavidWiki/includes/MV_Hooks.php |
— | — | @@ -87,8 +87,8 @@ |
88 | 88 | //remove article with that title: |
89 | 89 | MV_Index::remove_by_wiki_title($article->mTitle->getDBkey()); |
90 | 90 | }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(); |
93 | 93 | } |
94 | 94 | return true; // always return true, in order not to stop MW's hook processing! |
95 | 95 | } |