Index: trunk/extensions/MetavidWiki/maintenance/updateTables.sql.php |
— | — | @@ -1,91 +0,0 @@ |
2 | | -<? |
3 | | -/* |
4 | | -*will update tables to new database schema (once we have a more or less stable version) |
5 | | -* |
6 | | -* |
7 | | -*table code: |
8 | | - |
9 | | - |
10 | | -CREATE TABLE IF NOT EXISTS `mv_mvd_index` ( |
11 | | - `id` int(10) unsigned NOT NULL auto_increment, |
12 | | - `wiki_title` varchar(100) collate utf8_unicode_ci NOT NULL, |
13 | | - `mvd_type` varchar(32) collate utf8_unicode_ci NOT NULL, |
14 | | - `stream_id` int(11) NOT NULL, |
15 | | - `start_time` int(7) unsigned NOT NULL, |
16 | | - `end_time` int(7) unsigned default NULL, |
17 | | - `text` text collate utf8_unicode_ci NOT NULL, |
18 | | - PRIMARY KEY (`id`), |
19 | | - UNIQUE KEY `wiki_title` (`wiki_title`), |
20 | | - KEY `mvd_type` (`mvd_type`), |
21 | | - KEY `stream_id` (`stream_id`), |
22 | | - KEY `stream_time_start` (`start_time`,`end_time`), |
23 | | - FULLTEXT KEY `text` (`text`) |
24 | | -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='metavid data index' AUTO_INCREMENT=5545 ; |
25 | | - |
26 | | - |
27 | | - |
28 | | -CREATE TABLE IF NOT EXISTS `mv_streams` ( |
29 | | - `id` int(10) unsigned NOT NULL auto_increment, |
30 | | - `name` varchar(48) collate utf8_unicode_ci NOT NULL, |
31 | | - `state` enum('available','available_more_otw','live','otw','failed') collate utf8_unicode_ci default NULL, |
32 | | - `date_start_time` int(10) default NULL, |
33 | | - `duration` int(7) default NULL, |
34 | | - UNIQUE KEY `id` (`id`), |
35 | | - UNIQUE KEY `name` (`name`), |
36 | | - KEY `adj_start_time` (`date_start_time`), |
37 | | - KEY `state` (`state`) |
38 | | -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=13 ; |
39 | | - |
40 | | - |
41 | | - |
42 | | -CREATE TABLE IF NOT EXISTS `mv_stream_files` ( |
43 | | - `id` int(10) unsigned NOT NULL auto_increment, |
44 | | - `stream_id` int(10) unsigned NOT NULL, |
45 | | - `base_offset` int(10) default NULL, |
46 | | - `duration` int(9) default NULL, |
47 | | - `path_type` enum('mvprime','cap1','ext_cspan','ext_archive_org','ext_url') character set utf8 collate utf8_unicode_ci NOT NULL, |
48 | | - `file_desc_msg` varchar(255) character set utf8 collate utf8_unicode_ci NOT NULL, |
49 | | - `path` text character set utf8 collate utf8_unicode_ci NOT NULL, |
50 | | - UNIQUE KEY `id` (`id`), |
51 | | - KEY `stream_id` (`stream_id`) |
52 | | -) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='base urls for path types are hard coded' AUTO_INCREMENT=16 ; |
53 | | - |
54 | | - |
55 | | - |
56 | | -CREATE TABLE IF NOT EXISTS `mv_stream_images` ( |
57 | | - `id` int(11) NOT NULL auto_increment, |
58 | | - `stream_id` int(11) NOT NULL, |
59 | | - `time` int(11) NOT NULL, |
60 | | - PRIMARY KEY (`id`), |
61 | | - KEY `stream_id` (`stream_id`,`time`) |
62 | | -) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='time to images table' AUTO_INCREMENT=1 ; |
63 | | - |
64 | | - CREATE TABLE IF NOT EXISTS `mv_url_cache` ( |
65 | | -`id` INT UNSIGNED NOT NULL AUTO_INCREMENT , |
66 | | -`url` VARCHAR( 255 ) NOT NULL , |
67 | | -`post_vars` TEXT NULL , |
68 | | -`req_time` INT NOT NULL , |
69 | | -`result` TEXT NULL , |
70 | | -INDEX ( `url` ) , |
71 | | -UNIQUE ( |
72 | | -`id` |
73 | | -) |
74 | | -) ENGINE = MYISAM COMMENT = 'simple url cache (as to not tax external services too much) ' |
75 | | - |
76 | | -*/ |
77 | | -?> |
\ No newline at end of file |
Index: trunk/extensions/MetavidWiki/maintenance/mv_tables.sql |
— | — | @@ -0,0 +1,98 @@ |
| 2 | +-- metavid tables |
| 3 | +-- |
| 4 | +-- stores the most recent mysql schema |
| 5 | + |
| 6 | +SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; |
| 7 | + |
| 8 | +-- |
| 9 | +-- Database: `mvWiki` |
| 10 | +-- |
| 11 | + |
| 12 | +-- -------------------------------------------------------- |
| 13 | + |
| 14 | +-- |
| 15 | +-- Table structure for table `mv_mvd_index` |
| 16 | +-- |
| 17 | + |
| 18 | +CREATE TABLE IF NOT EXISTS `mv_mvd_index` ( |
| 19 | + `id` int(10) unsigned NOT NULL auto_increment, |
| 20 | + `wiki_title` varchar(100) collate utf8_unicode_ci NOT NULL, |
| 21 | + `mvd_type` varchar(32) collate utf8_unicode_ci NOT NULL, |
| 22 | + `stream_id` int(11) NOT NULL, |
| 23 | + `start_time` int(7) unsigned NOT NULL, |
| 24 | + `end_time` int(7) unsigned default NULL, |
| 25 | + `text` text collate utf8_unicode_ci NOT NULL, |
| 26 | + PRIMARY KEY (`id`), |
| 27 | + UNIQUE KEY `wiki_title` (`wiki_title`), |
| 28 | + KEY `mvd_type` (`mvd_type`), |
| 29 | + KEY `stream_id` (`stream_id`), |
| 30 | + KEY `stream_time_start` (`start_time`,`end_time`), |
| 31 | + FULLTEXT KEY `text` (`text`) |
| 32 | +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='metavid data index' AUTO_INCREMENT=0 ; |
| 33 | + |
| 34 | +-- -------------------------------------------------------- |
| 35 | + |
| 36 | +-- |
| 37 | +-- Table structure for table `mv_streams` |
| 38 | +-- |
| 39 | + |
| 40 | +CREATE TABLE IF NOT EXISTS `mv_streams` ( |
| 41 | + `id` int(10) unsigned NOT NULL auto_increment, |
| 42 | + `name` varchar(48) collate utf8_unicode_ci NOT NULL, |
| 43 | + `state` enum('available','available_more_otw','live','otw','failed') collate utf8_unicode_ci default NULL, |
| 44 | + `date_start_time` int(10) default NULL, |
| 45 | + `duration` int(7) default NULL, |
| 46 | + UNIQUE KEY `id` (`id`), |
| 47 | + UNIQUE KEY `name` (`name`), |
| 48 | + KEY `adj_start_time` (`date_start_time`), |
| 49 | + KEY `state` (`state`) |
| 50 | +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=15 ; |
| 51 | + |
| 52 | +-- -------------------------------------------------------- |
| 53 | + |
| 54 | +-- |
| 55 | +-- Table structure for table `mv_stream_files` |
| 56 | +-- |
| 57 | + |
| 58 | +CREATE TABLE IF NOT EXISTS `mv_stream_files` ( |
| 59 | + `id` int(10) unsigned NOT NULL auto_increment, |
| 60 | + `stream_id` int(10) unsigned NOT NULL, |
| 61 | + `base_offset` int(10) NOT NULL default '0', |
| 62 | + `duration` int(9) NOT NULL, |
| 63 | + `file_desc_msg` varchar(255) character set utf8 collate utf8_unicode_ci NOT NULL, |
| 64 | + `path_type` enum('url_anx','wiki_title') character set utf8 collate utf8_bin NOT NULL default 'url_anx', |
| 65 | + `path` text character set utf8 collate utf8_unicode_ci NOT NULL, |
| 66 | + UNIQUE KEY `id` (`id`), |
| 67 | + KEY `stream_id` (`stream_id`) |
| 68 | +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='base urls for path types are hard coded' AUTO_INCREMENT=0 ; |
| 69 | + |
| 70 | +-- -------------------------------------------------------- |
| 71 | + |
| 72 | +-- |
| 73 | +-- Table structure for table `mv_stream_images` |
| 74 | +-- |
| 75 | + |
| 76 | +CREATE TABLE IF NOT EXISTS `mv_stream_images` ( |
| 77 | + `id` int(11) NOT NULL auto_increment, |
| 78 | + `stream_id` int(11) NOT NULL, |
| 79 | + `time` int(11) NOT NULL, |
| 80 | + PRIMARY KEY (`id`), |
| 81 | + KEY `stream_id` (`stream_id`,`time`) |
| 82 | +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='time to images table' AUTO_INCREMENT=0 ; |
| 83 | + |
| 84 | +-- -------------------------------------------------------- |
| 85 | + |
| 86 | +-- |
| 87 | +-- Table structure for table `mv_url_cache` |
| 88 | +-- |
| 89 | + |
| 90 | +CREATE TABLE IF NOT EXISTS `mv_url_cache` ( |
| 91 | + `id` int(10) unsigned NOT NULL auto_increment, |
| 92 | + `url` varchar(255) NOT NULL, |
| 93 | + `post_vars` text, |
| 94 | + `req_time` int(11) NOT NULL, |
| 95 | + `result` text, |
| 96 | + UNIQUE KEY `id` (`id`), |
| 97 | + KEY `url` (`url`) |
| 98 | +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='simple url cache (as to not tax external services too much) ' AUTO_INCREMENT=10 ; |
| 99 | + |
Index: trunk/extensions/MetavidWiki/maintenance/mv_update.php |
— | — | @@ -0,0 +1,65 @@ |
| 2 | +<? |
| 3 | +//eventually should fix to use mediaWiki format |
| 4 | +//for now just has little scripts for doing database operations |
| 5 | + |
| 6 | +//include commandLine.inc from the mediaWiki maintance dir: |
| 7 | +require_once ('../../../maintenance/commandLine.inc'); |
| 8 | + |
| 9 | +$dbclass = 'Database' . ucfirst( $wgDBtype ) ; |
| 10 | +# Attempt to connect to the database as a privileged user |
| 11 | +# This will vomit up an error if there are permissions problems |
| 12 | +$wgDatabase = new $dbclass( $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname, 1 ); |
| 13 | + |
| 14 | + |
| 15 | +//do mvd_index text removal update: |
| 16 | +//check if mvd_index has text field |
| 17 | +$page_id_added=false; |
| 18 | +if(!$wgDatabase->fieldExists($mvIndexTableName, 'page_id')){ |
| 19 | + print "$mvIndexTableName missing `page_id`...adding\n "; |
| 20 | + $page_id_added=true; |
| 21 | + //add page_id |
| 22 | + $wgDatabase->query("ALTER TABLE `$mvIndexTableName` ADD `mv_page_id` INT( 10 ) UNSIGNED NOT NULL AFTER `id`"); |
| 23 | +} |
| 24 | +//if we added do lookups |
| 25 | +if($page_id_added){ |
| 26 | + $sql = "SELECT SQL_CALC_FOUND_ROWS `id`, `wiki_title` FROM `$mvIndexTableName`"; |
| 27 | + $result = $wgDatabase->query($sql); |
| 28 | + echo 'updating '.$wgDatabase->numRows($result) . " mvd rows \n"; |
| 29 | + $c = $wgDatabase->numRows($result); |
| 30 | + $i=$j=0; |
| 31 | + $page_table = $wgDatabase->tableName( 'page' ); |
| 32 | + while($mvd_row = $wgDatabase->fetchObject( $result )){ |
| 33 | + $sql_pid = "SELECT `page_id` FROM $page_table " . |
| 34 | + "WHERE `page_title`='{$mvd_row->wiki_title}' " . |
| 35 | + "AND `page_namespace`=".MV_NS_MVD.' LIMIT 1'; |
| 36 | + $pid_res = $wgDatabase->query($sql_pid); |
| 37 | + if($wgDatabase->numRows($pid_res)!=0){ |
| 38 | + $pid_row = $wgDatabase->fetchObject($pid_res); |
| 39 | + $upSql = "UPDATE `$mvIndexTableName` SET `mv_page_id`=$pid_row->page_id " . |
| 40 | + "WHERE `id`={$mvd_row->id} LIMIT 1"; |
| 41 | + $wgDatabase->query($upSql); |
| 42 | + }else{ |
| 43 | + print "ERROR: mvd row:{$mvd_row->wiki_title} missing page\n "; |
| 44 | + die; |
| 45 | + } |
| 46 | + //status updates: |
| 47 | + if($i==100){ |
| 48 | + print "on $j of $c mvd rows\n"; |
| 49 | + $i=0; |
| 50 | + } |
| 51 | + $i++; |
| 52 | + $j++; |
| 53 | + } |
| 54 | + //now we can drop id and add PRIMARY to mv_page_id |
| 55 | + print "DROP id COLUMN from $mvIndexTableName ..."; |
| 56 | + $wgDatabase->query("ALTER TABLE `$mvIndexTableName` DROP PRIMARY KEY, DROP COLUMN `id`, DROP COLUMN `text`"); |
| 57 | + print "done\n"; |
| 58 | + |
| 59 | + //now add UNIQUE to mv_mvd_index |
| 60 | + print "ADD PRIMARY to mv_page_id ..."; |
| 61 | + $wgDatabase->query("ALTER TABLE `$mvIndexTableName` ADD PRIMARY KEY(`mv_page_id`)"); |
| 62 | + print "done\n"; |
| 63 | + |
| 64 | +} |
| 65 | + |
| 66 | +?> |
\ No newline at end of file |
Index: trunk/extensions/MetavidWiki/includes/MV_Index.php |
— | — | @@ -107,7 +107,7 @@ |
108 | 108 | global $mvIndexTableName, $mvDefaultClipLength; |
109 | 109 | $dbr =& wfGetDB(DB_SLAVE); |
110 | 110 | |
111 | | - $sql = "SELECT `id`, `mvd_type`, `wiki_title`, `stream_id`, `start_time`, `end_time` " . |
| 111 | + $sql = "SELECT `mv_page_id` as `id`, `mvd_type`, `wiki_title`, `stream_id`, `start_time`, `end_time` " . |
112 | 112 | "FROM {$dbr->tableName($mvIndexTableName)} " . |
113 | 113 | "WHERE `stream_id`={$stream_id} "; |
114 | 114 | if($mvd_type!='all'){ |
— | — | @@ -145,7 +145,7 @@ |
146 | 146 | return true; |
147 | 147 | } |
148 | 148 | function doFiltersQuery(&$filters){ |
149 | | - global $mvIndexTableName, $mvDefaultClipLength, $wgRequest, $mvDo_SQL_CALC_FOUND_ROWS; |
| 149 | + global $mvIndexTableName, $mvDefaultClipLength, $wgRequest, $mvDo_SQL_CALC_FOUND_ROWS, $mvSpokenByInSearchResult; |
150 | 150 | $dbr =& wfGetDB(DB_SLAVE); |
151 | 151 | //organize the queries (group full-text searches and category/attributes) |
152 | 152 | //if the attribute is not a numerical just add it to the fulltext query |
— | — | @@ -155,7 +155,8 @@ |
156 | 156 | $selOpt = ($mvDo_SQL_CALC_FOUND_ROWS)?'SQL_CALC_FOUND_ROWS':''; |
157 | 157 | |
158 | 158 | list( $this->limit, $this->offset ) = $wgRequest->getLimitOffset( 20, 'searchlimit' ); |
159 | | - |
| 159 | + //print_r($filters); |
| 160 | + //print_r($_GET); |
160 | 161 | foreach($filters as $f){ |
161 | 162 | //proocc and or for fulltext: |
162 | 163 | if(!isset($f['a']))$f['a']='and'; |
— | — | @@ -195,6 +196,7 @@ |
196 | 197 | break; |
197 | 198 | } |
198 | 199 | } |
| 200 | + $searchindexTable = $dbr->tableName( 'searchindex' ); |
199 | 201 | $ret_ary = array(); |
200 | 202 | //only run the top range query if we have no secondary query |
201 | 203 | if($toplq!='' && $ftq==''){ |
— | — | @@ -203,18 +205,27 @@ |
204 | 206 | if($snq!='')$andstr.='AND'; |
205 | 207 | //@@todo we should only look in annotative layer for top level queries? ... |
206 | 208 | //@@todo paging for top level queries? ... 100 stream limit is probably ok |
207 | | - $sql = "SELECT `id`, `stream_id`,`start_time`,`end_time`, `wiki_title`, `text` |
| 209 | + //@@ no spoken by attribute for 'anno_en' mvd_type |
| 210 | + $sql = "SELECT `mv_page_id` as `id`, `stream_id`,`start_time`,`end_time`, `wiki_title`, $searchindexTable.`si_text` as `text` |
208 | 211 | FROM `$mvIndexTableName` |
| 212 | + JOIN $searchindexTable ON `$mvIndexTableName`.`mv_page_id` = $searchindexTable.`si_page` |
209 | 213 | WHERE $snq $andstr `mvd_type`='Anno_en' |
210 | | - AND MATCH (text) |
| 214 | + AND MATCH ($searchindexTable.`si_text`) |
211 | 215 | AGAINST('$toplq' IN BOOLEAN MODE) |
212 | 216 | LIMIT 0, 100"; |
213 | | - //echo "topQ: $sql \n\n"; |
| 217 | + echo "topQ: $sql \n\n"; |
214 | 218 | $top_result = $dbr->query($sql); |
215 | 219 | if($dbr->numRows($top_result)==0)return array(); |
216 | 220 | //set up ranges sql query |
217 | | - $sql="SELECT $selOpt `id`, `stream_id`,`start_time`,`end_time`, `wiki_title`, `text` |
218 | | - FROM `$mvIndexTableName` WHERE "; |
| 221 | + $sql="SELECT $selOpt `mv_page_id` as `id`, `stream_id`,`start_time`,`end_time`, `wiki_title`, $searchindexTable.`si_text` as `text` "; |
| 222 | + if($mvSpokenByInSearchResult)$sql.=",`smw_relations`.`object_title` as `spoken_by` "; |
| 223 | + $sql.="FROM `$mvIndexTableName` " . |
| 224 | + "JOIN $searchindexTable ON `$mvIndexTableName`.`mv_page_id` = $searchindexTable.`si_page` "; |
| 225 | + if($mvSpokenByInSearchResult){ |
| 226 | + $sql.="LEFT JOIN `smw_relations` ON (`mv_mvd_index`.`mv_page_id`=`smw_relations`.`subject_id` " . |
| 227 | + "AND `smw_relations`.`relation_title`='Spoken_By') "; |
| 228 | + } |
| 229 | + $sql.="WHERE "; |
219 | 230 | $or=''; |
220 | 231 | $sql.='( '; |
221 | 232 | while($row = $dbr->fetchObject( $top_result )){ |
— | — | @@ -239,16 +250,24 @@ |
240 | 251 | }else{ |
241 | 252 | //add the top query to the base query: |
242 | 253 | $ftq.=$toplq; |
243 | | - $sql = "SELECT $selOpt `id`,`stream_id`,`start_time`,`end_time`, `wiki_title`, `text` |
244 | | - FROM `$mvIndexTableName` |
245 | | - WHERE $snq "; |
| 254 | + $sql = "SELECT $selOpt `mv_page_id` as `id`,`stream_id`,`start_time`,`end_time`, `wiki_title`, $searchindexTable.`si_text` AS `text` "; |
| 255 | + if($mvSpokenByInSearchResult)$sql.=",`smw_relations`.`object_title` as `spoken_by` "; |
| 256 | + $sql.="FROM `$mvIndexTableName` |
| 257 | + JOIN $searchindexTable ON `$mvIndexTableName`.`mv_page_id` = $searchindexTable.`si_page` "; |
| 258 | + |
| 259 | + //include spoken by relation in results (LEFT JOIN should not be *that* costly ) |
| 260 | + if($mvSpokenByInSearchResult){ |
| 261 | + $sql.="LEFT JOIN `smw_relations` ON (`mv_mvd_index`.`mv_page_id`=`smw_relations`.`subject_id` " . |
| 262 | + "AND `smw_relations`.`relation_title`='Spoken_By') "; |
| 263 | + } |
| 264 | + $sql.="WHERE $snq "; |
246 | 265 | if($ftq!=''){ |
247 | | - $sql.=" MATCH (text) |
| 266 | + $sql.=" MATCH ( $searchindexTable.`si_text` ) |
248 | 267 | AGAINST('$ftq' IN BOOLEAN MODE) "; |
249 | 268 | } |
250 | 269 | $sql.="LIMIT {$this->offset}, {$this->limit} "; |
251 | 270 | } |
252 | | - //echo "SQL:".$sql; |
| 271 | + echo "SQL:".$sql; |
253 | 272 | $result = $dbr->query($sql); |
254 | 273 | |
255 | 274 | $this->numResults=$dbr->numRows($result); |
— | — | @@ -349,6 +368,28 @@ |
350 | 369 | } |
351 | 370 | $ret_ary[$row->stream_id][]=$new_srange; |
352 | 371 | } |
| 372 | + function getMVDbyId($id, $fields='*'){ |
| 373 | + global $mvIndexTableName; |
| 374 | + $dbr =& wfGetDB(DB_SLAVE); |
| 375 | + $result = $dbr->select( $mvIndexTableName, $fields, |
| 376 | + array('mv_page_id'=>$id) ); |
| 377 | + if($dbr->numRows($result)==0){ |
| 378 | + return array(); |
| 379 | + }else{ |
| 380 | + return $dbr->fetchObject( $result ); |
| 381 | + } |
| 382 | + } |
| 383 | + function getMVDbyTitle($title_key, $fields='*'){ |
| 384 | + global $mvIndexTableName; |
| 385 | + $dbr =& wfGetDB(DB_SLAVE); |
| 386 | + $result = $dbr->select( $mvIndexTableName, $fields, |
| 387 | + array('wiki_title'=>$title_key) ); |
| 388 | + if($dbr->numRows($result)==0){ |
| 389 | + return null; |
| 390 | + }else{ |
| 391 | + return $dbr->fetchObject( $result ); |
| 392 | + } |
| 393 | + } |
353 | 394 | function update_index_title($old_title, $new_title){ |
354 | 395 | global $mvIndexTableName; |
355 | 396 | |
— | — | @@ -366,35 +407,13 @@ |
367 | 408 | $mvd_row = MV_Index::getMVDbyTitle( $old_title ); |
368 | 409 | $dbw =& wfGetDB(DB_WRITE); |
369 | 410 | $dbw->update($mvIndexTableName, $update_ary, |
370 | | - array('id'=>$mvd_row->id)); |
| 411 | + array('mv_page_id'=>$mvd_row->mv_page_id)); |
371 | 412 | }else{ |
372 | 413 | //print "NOT VALID MOVE"; |
373 | 414 | //@@todo better error handling (tyring to move a MVD data into bad request form) |
374 | 415 | throw new MWException("Invalid Page name for MVD namespace \n"); |
375 | 416 | } |
376 | 417 | } |
377 | | - function getMVDbyId($id, $fields='*'){ |
378 | | - global $mvIndexTableName; |
379 | | - $dbr =& wfGetDB(DB_SLAVE); |
380 | | - $result = $dbr->select( $mvIndexTableName, $fields, |
381 | | - array('id'=>$id) ); |
382 | | - if($dbr->numRows($result)==0){ |
383 | | - return array(); |
384 | | - }else{ |
385 | | - return $dbr->fetchObject( $result ); |
386 | | - } |
387 | | - } |
388 | | - function getMVDbyTitle($title_key, $fields='*'){ |
389 | | - global $mvIndexTableName; |
390 | | - $dbr =& wfGetDB(DB_SLAVE); |
391 | | - $result = $dbr->select( $mvIndexTableName, $fields, |
392 | | - array('wiki_title'=>$title_key) ); |
393 | | - if($dbr->numRows($result)==0){ |
394 | | - return null; |
395 | | - }else{ |
396 | | - return $dbr->fetchObject( $result ); |
397 | | - } |
398 | | - } |
399 | 418 | /* |
400 | 419 | * update_index_page updates the `mv_mvd_index` table (on MVD namespace saves) |
401 | 420 | */ |
— | — | @@ -412,8 +431,7 @@ |
413 | 432 | 'mvd_type'=>$mvTitle->getTypeMarker(), |
414 | 433 | 'stream_id'=>$mvTitle->getStreamId(), |
415 | 434 | 'start_time'=>$mvTitle->getStartTimeSeconds(), |
416 | | - 'end_time'=>$mvTitle->getEndTimeSeconds(), |
417 | | - 'text'=> $text |
| 435 | + 'end_time'=>$mvTitle->getEndTimeSeconds(), |
418 | 436 | ); |
419 | 437 | |
420 | 438 | $dbw =& wfGetDB(DB_WRITE); |
— | — | @@ -421,7 +439,7 @@ |
422 | 440 | return $dbw->insert( $mvIndexTableName , $insAry); |
423 | 441 | }else{ |
424 | 442 | $dbw->update($mvIndexTableName, $insAry, |
425 | | - array('id'=>$mvd_row->id)); |
| 443 | + array('mv_page_id'=>$mvd_row->mv_page_id)); |
426 | 444 | } |
427 | 445 | } |
428 | 446 | } |
Index: trunk/extensions/MetavidWiki/includes/specials/MV_SpecialMediaSearch.php |
— | — | @@ -221,13 +221,12 @@ |
222 | 222 | $mvd_out .=' '; |
223 | 223 | $mvdTitle = Title::MakeTitle(MV_NS_MVD, $mvd->wiki_title); |
224 | 224 | $mvd_out .= $sk->makeKnownLinkObj($mvdTitle, '<img border="0" src="' . $mvgScriptPath . '/skins/images/run_mediawiki.png">', '', '', '', '', ' title="' . wfMsg('mv_view_wiki_page') . '" '); |
225 | | - |
226 | | - //@@todo is it faster to hit the semantic media db or run the regEx ? |
| 225 | + |
227 | 226 | $mvd_out.='<span id="mvr_desc_'.$mvd->id.'">'; |
228 | | - $smw_properties = MV_Overlay::get_and_strip_semantic_tags($mvd->text); |
229 | | - if(isset($smw_properties['Spoken By'])){ |
230 | | - $ptitle = Title::MakeTitle(NS_MAIN, $smw_properties['Spoken By']); |
231 | | - $mvd_out.=' '.$sk->makeKnownLinkObj($ptitle, $smw_properties['Spoken By']); |
| 227 | + |
| 228 | + if(isset($mvd->spoken_by)){ |
| 229 | + $ptitle = Title::MakeTitle(NS_MAIN, $mvd->spoken_by); |
| 230 | + $mvd_out.=' '.$sk->makeKnownLinkObj($ptitle, $mvd->spoken_by); |
232 | 231 | } |
233 | 232 | if(!isset($mvd->toplq))$mvd->toplq=false; |
234 | 233 | //output short desc send partial regEx: |
— | — | @@ -372,7 +371,7 @@ |
373 | 372 | //return "<li>{$link} ({$size}){$extract}</li>\n"; |
374 | 373 | return $extract; |
375 | 374 | } |
376 | | - //output expanded request with retired title text |
| 375 | + //output expanded request via mvd_id |
377 | 376 | function expand_wt($mvd_id, $terms_ary) { |
378 | 377 | global $wgOut,$mvgIP; |
379 | 378 | global $mvDefaultSearchVideoPlaybackRes; |
— | — | @@ -386,7 +385,7 @@ |
387 | 386 | |
388 | 387 | list($vWidth, $vHeight) = explode('x', $mvDefaultSearchVideoPlaybackRes); |
389 | 388 | $embedHTML='<span style="float:left;width:'.($vWidth+20).'px">' . |
390 | | - $mvTitle->getEmbedVideoHtml($mvd_id, $mvDefaultSearchVideoPlaybackRes) . |
| 389 | + $mvTitle->getEmbedVideoHtml('vid_'.$mvd_id, $mvDefaultSearchVideoPlaybackRes) . |
391 | 390 | '</span>'; |
392 | 391 | $wgOut->clearHTML(); |
393 | 392 | |
— | — | @@ -488,7 +487,7 @@ |
489 | 488 | function getResultsBar(){ |
490 | 489 | $o='<div class="mv_result_bar">'; |
491 | 490 | if($this->numResultsFound){ |
492 | | - $re = ($this->numResultsFound < $this->limit+$this->offset)?$this->numResultsFound:($this->limit+$this->offset); |
| 491 | + $re = ($this->limit+$this->offset > $this->numResultsFound)?$this->numResultsFound:($this->limit+$this->offset); |
493 | 492 | $o.=wfMsg('mv_results_found_for',$this->offset,$re , number_format($this->numResultsFound)); |
494 | 493 | } |
495 | 494 | $o.=$this->getFilterDesc(); |
Index: trunk/extensions/MetavidWiki/includes/MV_Title.php |
— | — | @@ -24,7 +24,7 @@ |
25 | 25 | |
26 | 26 | |
27 | 27 | var $hasMVDType = false; |
28 | | - |
| 28 | + var $dispVideoPlayerTime=false; |
29 | 29 | //a pointer to the mvStream |
30 | 30 | var $mvStream = null; |
31 | 31 | var $wiki_title=''; |
— | — | @@ -231,14 +231,19 @@ |
232 | 232 | $vid_id=($vid_id=='')?'':'id="'.$vid_id.'"'; |
233 | 233 | list($vWidth, $vHeight) = explode('x', $size); |
234 | 234 | $stream_web_url = $this->getWebStreamURL(); |
235 | | - if($stream_web_url){ |
236 | | - return '<span id="mv_videoPlayerTime">'.$this->getStartTime().' to '. |
237 | | - $this->getEndTime() . |
238 | | - '</span>'. |
239 | | - '<'.$tag.' '.$vid_id.' thumbnail="'.$this->getStreamImageURL($size, null, $force_server).'" '. |
| 235 | + if($stream_web_url){ |
| 236 | + $o=''; |
| 237 | + if($this->dispVideoPlayerTime){ |
| 238 | + $o.='<span id="mv_videoPlayerTime">'.$this->getStartTime().' to '. |
| 239 | + $this->getEndTime() . |
| 240 | + '</span>'; |
| 241 | + } |
| 242 | + $o.='<'.$tag.' '.$vid_id.' thumbnail="'.$this->getStreamImageURL($size, null, $force_server).'" '. |
240 | 243 | 'src="'.$stream_web_url .'" ' . |
241 | 244 | 'style="width:'.$vWidth.'px;height:'.$vHeight.'px" '. |
242 | | - 'controls="true" embed_link="true" />'; |
| 245 | + 'controls="true" embed_link="true" />'; |
| 246 | + |
| 247 | + return $o; |
243 | 248 | }else{ |
244 | 249 | return wfMsg('mv_error_stream_missing'); |
245 | 250 | } |
Index: trunk/extensions/MetavidWiki/includes/MV_ImageGallery.php |
— | — | @@ -52,7 +52,7 @@ |
53 | 53 | |
54 | 54 | //remap MVD namespace links into the Stream view (so contextual metadata is present) |
55 | 55 | if($nt->getNamespace() == MV_NS_MVD ){ |
56 | | - $nt = Title::MakeTitle(MV_NS_STREAM,$mvTitle->getNearStreamName(0) ); |
| 56 | + $nt = Title::MakeTitle(MV_NS_STREAM,$mvTitle->getWikiTitle() ); |
57 | 57 | } |
58 | 58 | $vidH = round($this->mWidths*$mvDefaultAspectRatio); |
59 | 59 | $vidRes = $this->mWidths.'x'.$vidH; |
Index: trunk/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_SequenceTools.php |
— | — | @@ -72,7 +72,7 @@ |
73 | 73 | $out.= $row->name.'|'.$streamTitle->getStreamNameText(). |
74 | 74 | '|'.$streamTitle->getStreamImageURL('icon') . |
75 | 75 | '|'.$row->duration . |
76 | | - '|'.$streamTitle->getEmbedVideoHtml('seq', $mvDefaultSearchVideoPlaybackRes, 'video', 'http://metavid.ucsc.edu/image_media/'). "\n"; |
| 76 | + '|'.$streamTitle->getEmbedVideoHtml('vid_seq', $mvDefaultSearchVideoPlaybackRes, 'video', 'http://metavid.ucsc.edu/image_media/'). "\n"; |
77 | 77 | } |
78 | 78 | //$out.='</ul>'; |
79 | 79 | //return people people in the Person Category |
Index: trunk/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_VideoPlayer.php |
— | — | @@ -26,7 +26,8 @@ |
27 | 27 | $out=''; |
28 | 28 | //give the stream the request information: |
29 | 29 | $mvTitle= & $this->mv_interface->article->mvTitle; |
30 | | - //check if media is availible: |
| 30 | + //check if media is availible: |
| 31 | + $mvTitle->dispVideoPlayerTime=true; |
31 | 32 | return $mvTitle->getEmbedVideoHtml('embed_vid'); |
32 | 33 | } |
33 | 34 | function render_menu(){ |
Index: trunk/extensions/MetavidWiki/includes/MV_DefaultSettings.php |
— | — | @@ -17,11 +17,18 @@ |
18 | 18 | //include the global functions & init the extension |
19 | 19 | include_once('MV_GlobalFunctions.php'); |
20 | 20 | |
| 21 | +########################## |
| 22 | +# semanticWiki integration options |
| 23 | +########################## |
| 24 | +//if you want to include spoken by relation in search results: |
| 25 | +$mvSpokenByInSearchResult = true; |
21 | 26 | |
22 | | -###### |
| 27 | + |
| 28 | +######################### |
23 | 29 | # metavid paths |
24 | 30 | # @@todo clean up with internal handlers for annodex and images |
25 | 31 | # use the mediaWiki defaults for storage of media |
| 32 | +########################## |
26 | 33 | |
27 | 34 | //define the image location: |
28 | 35 | //$mvImageWebLoc ='http://metavid.ucsc.edu/image_media/'; |
Index: trunk/extensions/MetavidWiki/languages/MV_Messages.php |
— | — | @@ -19,7 +19,7 @@ |
20 | 20 | 'mv_ogg_high_quality' => 'High Quality ogg theora, hosted on metavid', |
21 | 21 | 'mv_archive_org_link' => 'Links into Archive.org mpeg2 originals', |
22 | 22 | |
23 | | - 'mv_error_stream_missing' => '<span class="error">Error: There is no video stream associated with this metadata.</span><br />Please report this to the site administrator.<br /><i>stream metadata interface is disabled</i>', |
| 23 | + 'mv_error_stream_missing' => '<span class="error">Error: There is no video file associated with this stream.</span><br />Please report this to the site administrator.', |
24 | 24 | |
25 | 25 | #add/edit stream text: |
26 | 26 | 'mv_stream_meta' => 'Stream Page', |
Index: trunk/extensions/MetavidWiki/skins/mv_search.js |
— | — | @@ -56,6 +56,17 @@ |
57 | 57 | })); |
58 | 58 | //update the input name: |
59 | 59 | $j('#mv_person_input_'+inx).attr('name', 'f['+inx+'][v]'); |
| 60 | + //for more logical default behavior: |
| 61 | + //default to OR if any other "spoken by" are present in list else AND |
| 62 | + var default_sel_inx=0; |
| 63 | + $j('.mv_search_select').each(function(){ |
| 64 | + if(this.id!='mvsel_t_'+inx){ |
| 65 | + if(this.value=='spoken_by'){ |
| 66 | + default_sel_inx=1; //set to OR |
| 67 | + } |
| 68 | + } |
| 69 | + }) |
| 70 | + $j('#mvsel_a_'+inx).get(0).selectedIndex=default_sel_inx; |
60 | 71 | mv_add_person_ac(inx); |
61 | 72 | break; |
62 | 73 | case 'smw_property': |