Index: trunk/extensions/MetavidWiki/includes/MV_MagicWords.php |
— | — | @@ -70,11 +70,26 @@ |
71 | 71 | case 'VIDEOBILL': |
72 | 72 | return $this->getBillOut(); |
73 | 73 | break; |
| 74 | + case 'TOTALSTREAMLENGTH': |
| 75 | + return $this->getTotalLength(); |
| 76 | + break; |
74 | 77 | default: |
75 | 78 | return "error: unknown mvData function: <b>{$this->magicTypeKey}</b> <br>"; |
76 | 79 | break; |
77 | 80 | } |
78 | 81 | } |
| 82 | + function getTotalLength(){ |
| 83 | + $dbr = & wfGetDB( DB_READ ); |
| 84 | + $result =& $dbr->query(' SELECT SUM( `duration` ) as `dur` |
| 85 | +FROM `mv_streams` |
| 86 | +WHERE 1 '); |
| 87 | + if ( $dbr->numRows( $result ) == 0 ) { |
| 88 | + return ''; |
| 89 | + } else { |
| 90 | + $row = $dbr->fetchObject( $result ); |
| 91 | + return seconds2Description ( $row->dur); |
| 92 | + } |
| 93 | + } |
79 | 94 | function getBillOut() { |
80 | 95 | // return 'bill results'; |
81 | 96 | if ( $this->params['bill'] != '' ) { |