Bug 902528

Summary: Scripts from mantis cannot find the configuration file in default installation (send_emails.php,checkin.php)
Product: [Fedora] Fedora Reporter: Jhon H. Caicedo <jhcaiced>
Component: mantisAssignee: Gianluca Sforna <giallu>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: giallu, sven
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-04-01 03:25:29 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jhon H. Caicedo 2013-01-21 21:24:55 UTC
Description of problem:
MantisBT includes some scripts that are meant to be used from the command line, those scripts are located in /usr/share/mantis/scripts, mantis-1.2.12 includes two scripts send_emails.php and checkin.php

The fedora package for mantis uses the enviroment variable MANTIS_CONFIG to change the location of the mantis configuration file (config_inc.php) from /usr/share/mantis to /etc/mantis, however since the enviroment variables are not available to the scripts executed from the command line the scripts mentioned above didn't work in a default installation.

Version-Release number of selected component (if applicable):
mantis-1.2.12-2.fc19

How reproducible:
Always

Steps to Reproduce:
1. Install mantis, configure default settings.
2. Modify /etc/mantis/config_inc.php to enable the option to send emails using a crontab.  $g_email_send_using_cronjob = ON;
3. Attempt to use the script /usr/share/mantis/scripts/send_emails.php to send emails from the mantis queue.
  
Actual results:
When trying to execute send_emails.php, nnthing happens, not an error message, the script just fails silently, because the main script /usr/share/mantis/core.php fails to found the config_inc.php file.

Expected results:
The script should process the email queue of mantis and send the e-mails.

Additional info:
From the experiments I have performed, I can think of the following solutions  for this issue:
- At install of the mantis rpm, create a symbolic link from /usr/share/mantis/config_inc.php to /etc/mantis/config_inc.php, since by default the scripts and tools of mantis search for the config file at this location (/usr/share/mantis/config_inc.php)

- Update the scripts (send_emails.php, checkin.php) to add a line that sets the location of the config_inc.php file, very basic something like:
        putenv('MANTIS_CONFIG=/etc/mantis/config_inc.php');
- A variation of the previous method, some function that process /etc/httpd/conf.d/mantis.conf and extracts the value of MANTIS_CONFIG

Comment 1 Gianluca Sforna 2013-03-22 11:41:45 UTC
Thanks for the report, adding a patch with the putenv seems a good idea.

I'm updating the package for the latest advisories, I'll also include this

Comment 2 Fedora Update System 2013-03-22 17:03:36 UTC
mantis-1.2.14-1.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/mantis-1.2.14-1.fc17

Comment 3 Fedora Update System 2013-03-22 17:04:29 UTC
mantis-1.2.14-1.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/mantis-1.2.14-1.fc18

Comment 4 Fedora Update System 2013-03-24 00:00:56 UTC
Package mantis-1.2.14-1.fc18:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing mantis-1.2.14-1.fc18'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-4319/mantis-1.2.14-1.fc18
then log in and leave karma (feedback).

Comment 5 Fedora Update System 2013-04-01 03:25:31 UTC
mantis-1.2.14-1.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 6 Fedora Update System 2013-04-01 03:31:53 UTC
mantis-1.2.14-1.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.