# HG changeset patch # User Dan # Date 1242410634 14400 # Node ID d13fad911955ca3a6cb33e2a1208371dd7b27e2d # Parent aafb9f6806c9db07dc9dd425d9ccde8a393f8c37 Fixed some bugs with history viewing and log display (wrong row counts, failing to provide result resource, etc.); added "view" button to edits in log display; fixed underscores in auto generated titles diff -r aafb9f6806c9 -r d13fad911955 includes/log.php --- a/includes/log.php Fri May 15 13:31:12 2009 -0400 +++ b/includes/log.php Fri May 15 14:03:54 2009 -0400 @@ -53,6 +53,9 @@ case 'action': $this->criteria[] = array($criterion, $value); break; + case 'minor': + $this->criteria[] = array($criterion, intval($value)); + break; case 'within': if ( is_int($value) ) { @@ -134,6 +137,12 @@ $threshold = time() - $value; $where_extra .= "\n AND time_id > $threshold"; break; + case 'minor': + if ( $value == 1 ) + $where_extra .= "\n AND ( minor_edit = 1 OR action != 'edit' )"; + else + $where_extra .= "\n AND minor_edit != 1"; + break; } } if ( !empty($where_bits['user']) ) @@ -155,7 +164,7 @@ $columns = ( $just_page_count ) ? 'COUNT(*)' : 'log_id, action, page_id, namespace, CHAR_LENGTH(page_text) AS revision_size, author, time_id, edit_summary, minor_edit'; $sql = 'SELECT ' . $columns . ' FROM ' . table_prefix . "logs AS l\n" . " WHERE log_type = 'page' AND is_draft != 1$where_extra\n" - . " GROUP BY log_id, action, page_id, namespace, page_text, author, time_id, edit_summary, minor_edit" + . ( $just_page_count ? '' : " GROUP BY log_id, action, page_id, namespace, page_text, author, time_id, edit_summary, minor_edit\n" ) . " ORDER BY time_id DESC $limit;"; return $sql; @@ -296,15 +305,24 @@ if ( $row['action'] == 'edit' && !empty($row['parent_revid']) ) { $html .= '('; - if ( isPage($pagekey) ) - { + $ispage = isPage($pagekey); + + if ( $ispage ) $html .= ''; - } + $html .= $lang->get('pagetools_rc_btn_diff'); - if ( isPage($pagekey) ) - { + + if ( $ispage ) $html .= ''; - } + + if ( $ispage ) + $html .= ', '; + + $html .= $lang->get('pagetools_rc_btn_view'); + + if ( $ispage ) + $html .= ''; + if ( $row['parent_revid'] > 0 && isPage($pagekey) ) { $html .= ', ' . $lang->get('pagetools_rc_btn_undo') . ''; diff -r aafb9f6806c9 -r d13fad911955 includes/namespaces/default.php --- a/includes/namespaces/default.php Fri May 15 13:31:12 2009 -0400 +++ b/includes/namespaces/default.php Fri May 15 14:03:54 2009 -0400 @@ -143,6 +143,7 @@ $this->exists = false; $ns_char = substr($paths->nslist['Special'], -1); $page_name = $this->namespace == 'Article' ? dirtify_page_id($this->page_id) : "{$this->namespace}{$ns_char}" . dirtify_page_id($this->page_id); + $page_name = str_replace('_', ' ', $page_name); $this->title = $page_name; $this->cdata = array( diff -r aafb9f6806c9 -r d13fad911955 includes/pageutils.php --- a/includes/pageutils.php Fri May 15 13:31:12 2009 -0400 +++ b/includes/pageutils.php Fri May 15 14:03:54 2009 -0400 @@ -271,7 +271,9 @@ $prot = ( ( $cdata['protected'] == 2 && $session->user_logged_in && $session->reg_time + 60*60*24*4 < time() ) || $cdata['protected'] == 1) ? true : false; $q = 'SELECT log_id,time_id,date_string,page_id,namespace,author,edit_summary,minor_edit FROM ' . table_prefix.'logs WHERE log_type=\'page\' AND action=\'edit\' AND page_id=\'' . $page_id . '\' AND namespace=\'' . $namespace . '\' AND is_draft != 1 ORDER BY time_id DESC;'; - if(!$db->sql_query($q)) $db->_die('The history data for the page "' . $paths->cpage['name'] . '" could not be selected.'); + if ( !($q = $db->sql_query($q)) ) + $db->_die('The history data for the page "' . $paths->cpage['name'] . '" could not be selected.'); + echo $lang->get('history_page_subtitle') . '

' . $lang->get('history_heading_edits') . '

'; $numrows = $db->numrows(); @@ -300,7 +302,7 @@ $cls = 'row2'; $ticker = 0; - while ( $r = $db->fetchrow() ) + while ( $r = $db->fetchrow($q) ) { $ticker++; diff -r aafb9f6806c9 -r d13fad911955 language/english/tools.json --- a/language/english/tools.json Fri May 15 13:31:12 2009 -0400 +++ b/language/english/tools.json Fri May 15 14:03:54 2009 -0400 @@ -147,6 +147,7 @@ rc_btn_diff: 'diff', rc_btn_hist: 'hist', rc_btn_undo: 'undo', + rc_btn_view: 'view', rc_btn_pm: 'PM', rc_btn_usertalk: 'comment', }, diff -r aafb9f6806c9 -r d13fad911955 plugins/SpecialLog.php --- a/plugins/SpecialLog.php Fri May 15 13:31:12 2009 -0400 +++ b/plugins/SpecialLog.php Fri May 15 14:03:54 2009 -0400 @@ -148,8 +148,10 @@ } $page--; - $rowcount = $log->get_row_count(); - $result_url = makeUrlNS('Special', 'Log/' . rtrim(preg_replace('|/?resultpage=([0-9]+)/?|', '/', $paths->getAllParams()), '/') . '/resultpage=%s', false, true); + $rowcount = $log->get_row_count(); + $paramsbit = rtrim(preg_replace('|/?resultpage=([0-9]+)/?|', '/', $paths->getAllParams()), '/'); + $paramsbit = ( !empty($paramsbit) ) ? "/$paramsbit" : ''; + $result_url = makeUrlNS('Special', 'Log' . $paramsbit . '/resultpage=%s', false, true); $paginator = generate_paginator($page, ceil($rowcount / $pagesize), $result_url); $dataset = $log->get_data($page * $pagesize, $pagesize);