rpms/mantis/devel mantis-1.0.6-private_history.patch, NONE, 1.1 mantis-README.Fedora, NONE, 1.1 mantis.spec, 1.13, 1.14

Gianluca Sforna (giallu) fedora-extras-commits at redhat.com
Tue Jan 9 12:09:52 UTC 2007


Author: giallu

Update of /cvs/extras/rpms/mantis/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv5385

Modified Files:
	mantis.spec 
Added Files:
	mantis-1.0.6-private_history.patch mantis-README.Fedora 
Log Message:
* Tue Jan  8 2007 Gianluca Sforna <giallu gmail com> - 1.0.6-2
- Add some docs
- Add patch for BZ #219937
- Fix rpmlint messages for SRPM


mantis-1.0.6-private_history.patch:

--- NEW FILE mantis-1.0.6-private_history.patch ---
Index: core/history_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/history_api.php,v
retrieving revision 1.34
retrieving revision 1.36
diff -U3 -r1.34 -r1.36
--- core/history_api.php	27 Aug 2005 01:15:59 -0000	1.34
+++ core/history_api.php	26 Sep 2006 01:30:57 -0000	1.36
@@ -6,7 +6,7 @@
 	# See the README and LICENSE files for details
 
 	# --------------------------------------------------------
-	# $Id: history_api.php,v 1.34 2005/08/27 01:15:59 thraxisp Exp $
+	# $Id: history_api.php,v 1.36 2006/09/26 01:30:57 thraxisp Exp $
 	# --------------------------------------------------------
 
 	### History API ###
@@ -102,12 +102,13 @@
 	# Retrieves the raw history events for the specified bug id and returns it in an array
 	# The array is indexed from 0 to N-1.  The second dimension is: 'date', 'userid', 'username',
 	# 'field','type','old_value','new_value'
-	function history_get_raw_events_array( $p_bug_id ) {
+	function history_get_raw_events_array( $p_bug_id, $p_user_id=NULL ) {
 		$t_mantis_bug_history_table	= config_get( 'mantis_bug_history_table' );
 		$t_mantis_user_table		= config_get( 'mantis_user_table' );
 		$t_history_order			= config_get( 'history_order' );
 		$c_bug_id					= db_prepare_int( $p_bug_id );
-
+		$t_user_id = (( NULL == $p_user_id) ? auth_get_current_user_id() : $p_userid);
+		
 		# grab history and display by date_modified then field_name
 		# @@@ by MASC I guess it's better by id then by field_name. When we have more history lines with the same
 		# date, it's better to respect the storing order otherwise we should risk to mix different information
@@ -122,20 +123,49 @@
 		$raw_history_count = db_num_rows( $result );
 		$raw_history = array();
 
-		for ( $i=0; $i < $raw_history_count; ++$i ) {
+		$t_private_bugnote_threshold	= config_get( 'private_bugnote_threshold' );
+		$t_private_bugnote_visible = access_has_bug_level( 
+			config_get( 'private_bugnote_threshold' ), $p_bug_id, $t_user_id );
+			
+		for ( $i=0,$j=0; $i < $raw_history_count; ++$i ) {
 			$row = db_fetch_array( $result );
 			extract( $row, EXTR_PREFIX_ALL, 'v' );
 
-			$raw_history[$i]['date']	= db_unixtimestamp( $v_date_modified );
-			$raw_history[$i]['userid']	= $v_user_id;
+			// check that the item should be visible to the user
+			// custom fields
+			$t_field_id = custom_field_get_id_from_name( $v_field_name );
+			if ( false !== $t_field_id && 
+					!custom_field_has_read_access( $t_field_id, $p_bug_id, $t_user_id ) ) {
+				continue; 
+			}
+			// bugnotes
+			if ( $t_user_id != $v_user_id ) { // bypass if user originated note
+				if ( ( $v_type == BUGNOTE_ADDED ) ||
+					( $v_type == BUGNOTE_UPDATED ) ||
+					( $v_type == BUGNOTE_DELETED ) ) {
+						if ( !$t_private_bugnote_visible && 
+							( bugnote_get_field( $v_old_value, 'view_state' ) == VS_PRIVATE ) ) {
+								continue;
+						}
+				}
+				if ( $v_type == BUGNOTE_STATE_CHANGED ) {
+					if ( !$t_private_bugnote_visible && 
+							( bugnote_get_field( $v_new_value, 'view_state' ) == VS_PRIVATE ) ) {
+						continue;
+					}
+				}
+			}
+			$raw_history[$j]['date']	= db_unixtimestamp( $v_date_modified );
+			$raw_history[$j]['userid']	= $v_user_id;
 
 			# user_get_name handles deleted users, and username vs realname
-			$raw_history[$i]['username'] = user_get_name( $v_user_id );
+			$raw_history[$j]['username'] = user_get_name( $v_user_id );
 
-			$raw_history[$i]['field']		= $v_field_name;
-			$raw_history[$i]['type']		= $v_type;
-			$raw_history[$i]['old_value']	= $v_old_value;
-			$raw_history[$i]['new_value']	= $v_new_value;
+			$raw_history[$j]['field']		= $v_field_name;
+			$raw_history[$j]['type']		= $v_type;
+			$raw_history[$j]['old_value']	= $v_old_value;
+			$raw_history[$j]['new_value']	= $v_new_value;
+			$j++;
 		} # end for loop
 
 		return $raw_history;


--- NEW FILE mantis-README.Fedora ---
Fedora specific installation notes

Mantis require a database to function; use the following steps to
configure mantis to work with MySQL:

1. install MySQL packages
    yum install mysql-server

2. start MySQL server 
    /etc/init.d/mysqld start

WARNING: the default MySQL configuration has a "root" account with no password.
         Please have a look to the MySQL documentation to add a proper password
         and/or a separate account for mantis usage.

3. point your browser to:
    https://localhost/mantis/admin/install.php
   to create an empty DB.

WARNING: A DEFAULT ADMINISTRATOR level account is created.  The account name
and password are administrator / root.  Use this when you first login to
Mantis. Immediately go to Manage and create at least one administrator level
account.  Immediately after that DISABLE or DELETE the administrator account.  
You can recreate it but you should delete the account to prevent the 
cookie_string from being used to trick the package.  It would be even better 
to rename the account or delete it permanently.  REMEMBER: After setting up 
the package, REMOVE the default administrator account.


Index: mantis.spec
===================================================================
RCS file: /cvs/extras/rpms/mantis/devel/mantis.spec,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- mantis.spec	2 Nov 2006 22:04:50 -0000	1.13
+++ mantis.spec	9 Jan 2007 12:09:22 -0000	1.14
@@ -1,37 +1,40 @@
 # $Id$
 
-%global pkgdir		%_datadir/%name
-%global cfgdir		%_sysconfdir/%name
-%global httpconfdir	%_sysconfdir/httpd/conf.d
-
-Summary:	Web-based bugtracking system
-Name:		mantis
-Version:	1.0.6
-Release:	1%{dist}
-License:	GPL
-Group:		Applications/Internet
-URL:		http://www.mantisbugtracker.com/
-BuildArch:	noarch
-Source0:	http://download.sourceforge.net/sourceforge/mantisbt/%{name}-%{version}.tar.gz
-Patch0:		mantis-1.0.0a3-iis.patch
-Patch1:		mantis-0.19.2-noexamplecom.patch
-Patch2:		mantis-1.0.0rc2-noadmin.patch
-BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-
-BuildRequires:	diffutils
-Requires:	php
-Requires:	mantis-config
+%global pkgdir        %{_datadir}/%{name}
+%global cfgdir        %{_sysconfdir}/%{name}
+%global httpconfdir    %{_sysconfdir}/httpd/conf.d
+
+Summary:    Web-based bugtracking system
+Name:       mantis
+Version:    1.0.6
+Release:    2%{dist}
+License:    GPL
+Group:      Applications/Internet
+URL:        http://www.mantisbt.org/
+BuildArch:  noarch
+Source0:    http://download.sourceforge.net/sourceforge/mantisbt/%{name}-%{version}.tar.gz
+Source1:    mantis-README.Fedora
+
+Patch0:     mantis-1.0.0a3-iis.patch
+Patch1:     mantis-0.19.2-noexamplecom.patch
+Patch2:     mantis-1.0.0rc2-noadmin.patch
+Patch3:     mantis-1.0.6-private_history.patch
+BuildRoot:  %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+
+BuildRequires:    diffutils
+Requires:   php
+Requires:   mantis-config
 
 %package config-httpd
-Summary:	Mantis configuration for Apache httpd
-Group:		Applications/Internet
-Source10:	mantis-httpd.conf
-Provides:	mantis-config = httpd
-Requires:	mantis = %{version}-%{release}
-Requires:	%{httpconfdir}
-Requires:	mod_ssl
-Requires(post):		httpd
-Requires(postun):	httpd
+Summary:    Mantis configuration for Apache httpd
+Group:      Applications/Internet
+Source10:   mantis-httpd.conf
+Provides:   mantis-config = httpd
+Requires:   mantis = %{version}-%{release}
+Requires:   %{httpconfdir}
+Requires:   mod_ssl
+Requires(post): httpd
+Requires(postun): httpd
 
 
 %description
@@ -52,11 +55,17 @@
 %patch0 -p1 -b .iis
 %patch1 -p1 -b .noexamplecom
 %patch2 -p1 -b .noadmin
+%patch3 -p0 -b .privatenotes
+
+cp %{SOURCE1} ./README.Fedora
 
 chmod -x *.php
 rm -rf packages
 
 
+%build
+
+
 %install
 rm -rf "${RPM_BUILD_ROOT}"
 
@@ -67,9 +76,9 @@
 
 
 find ${RPM_BUILD_ROOT} \( \
-	-name '*.noexamplecom' -o -name '*.iis' -o -name '*.noadmin' -o -name '*.#.*' -o \
-	-name '.cvsignore' \
-	\) -print0 | xargs -0 rm -f
+    -name '*.noexamplecom' -o -name '*.iis' -o -name '*.noadmin' -o -name '*.#.*' -o \
+    -name '.cvsignore' \
+    \) -print0 | xargs -0 rm -f
 
 ## Do not rename; the *existence* of this file will be checked to
 ## determine if mantis is offline
@@ -77,31 +86,31 @@
 mv ${RPM_BUILD_ROOT}%{pkgdir}/config_inc.php.sample     ${RPM_BUILD_ROOT}%{cfgdir}/config_inc.php
 
 for i in $(find ${RPM_BUILD_ROOT} -type f -regex '.*\.\(php\|txt\|gif\|png\|css\|htm\|dtd\|xsl\|sql\|js\|bak\|xml\|zip\)$' -perm +0111); do
-	case $i in
-		(*.php)
-			if ! sed '1p;d' "$i" | grep -q '^#!'; then
-			   chmod a-x "$i"
-			elif sed '1p;d' "$i" | grep -q '/usr/local/bin/php'; then
-			   sed -i -e '1s!/usr/local/bin/php!/usr/bin/php!' "$i"
-			fi
-			;;
-		(*.bak)		rm -f "$i";;
-		(*)		chmod a-x "$i";;
-	esac
+    case $i in
+        (*.php)
+            if ! sed '1p;d' "$i" | grep -q '^#!'; then
+               chmod a-x "$i"
+            elif sed '1p;d' "$i" | grep -q '/usr/local/bin/php'; then
+               sed -i -e '1s!/usr/local/bin/php!/usr/bin/php!' "$i"
+            fi
+            ;;
+        (*.bak)        rm -f "$i";;
+        (*)        chmod a-x "$i";;
+    esac
 done
 
 chmod -x ${RPM_BUILD_ROOT}%{pkgdir}/{doc/*,core/phpmailer/{README,LICENSE}}
 
-ln -s %{cfgdir}/config_inc.php	 ${RPM_BUILD_ROOT}%{pkgdir}/config_inc.php
+ln -s %{cfgdir}/config_inc.php     ${RPM_BUILD_ROOT}%{pkgdir}/config_inc.php
 ln -s %{cfgdir}/mantis_offline.php ${RPM_BUILD_ROOT}%{pkgdir}/mantis_offline.php
 
 
 ## The httpd config-files
 function subst() {
-	f=${RPM_BUILD_ROOT}$1
-	sed -e 's!/usr/share/mantis!%{pkgdir}!g' "$f" >"$f".tmp
-	cmp -s "$f" "$f.tmp" || cat "$f.tmp" >"$f"
-	rm -f "$f.tmp"
+    f=${RPM_BUILD_ROOT}$1
+    sed -e 's!/usr/share/mantis!%{pkgdir}!g' "$f" >"$f".tmp
+    cmp -s "$f" "$f.tmp" || cat "$f.tmp" >"$f"
+    rm -f "$f.tmp"
 }
 
 %{__install} -d ${RPM_BUILD_ROOT}%{httpconfdir}
@@ -125,7 +134,7 @@
 %{pkgdir}
 %attr(-,root,apache) %dir %{cfgdir}
 %attr(0640,root,apache) %config(noreplace) %{cfgdir}/*
-
+%doc doc/{LICENSE,ChangeLog,CREDITS,CUSTOMIZATION} README.Fedora
 
 %files config-httpd
 %defattr(-,root,root,-)
@@ -133,6 +142,11 @@
 
 
 %changelog
+* Tue Jan  8 2007 Gianluca Sforna <giallu gmail com> - 1.0.6-2
+- Add some docs
+- Add patch for BZ #219937
+- Fix rpmlint messages for SRPM
+
 * Thu Nov  2 2006 Gianluca Sforna <giallu gmail com> - 1.0.6-1
 - updated to 1.0.6
 




More information about the scm-commits mailing list