Guten Tag Yavor Nikolov,
am Mittwoch, 2. März 2011 um 16:43 schrieben Sie:

> I think USAGE_MODE_CMDLINE is the right mode to be used with Scmbug.

I don't think so, collectstats.pl etc. are not designed as stand alone
deamons, but applications which are started from a console or cron. As
the problem didn't occur before, USAGE_MODE_CMDLINE shoudl be,
therefore there is code somehwere in Bugzilla which checks the usage
mode and sets it. This should tell what is different between Apache
and SCMBug.

There's a new sub Bugzilla::usage_mode with following documentation:

> =item C<usage_mode>

> Call either C<Bugzilla->usage_mode(Bugzilla::Constants::USAGE_MODE_CMDLINE)>
> or C<Bugzilla->usage_mode(Bugzilla::Constants::USAGE_MODE_XMLRPC)> near the
> beginning of your script to change this flag's default of
> C<Bugzilla::Constants::USAGE_MODE_BROWSER> and to indicate that Bugzilla is
> being called in a non-interactive manner.

The documented default differs to what seems to cause the problem, it
should bew USAGE_MODE_BROWSER, which surely will work as before.

The code:

> sub usage_mode {
>     my ($class, $newval) = @_;
>     if (defined $newval) {
>         if ($newval == USAGE_MODE_BROWSER) {
>             $class->error_mode(ERROR_MODE_WEBPAGE);
>         }
>         elsif ($newval == USAGE_MODE_CMDLINE) {
>             $class->error_mode(ERROR_MODE_DIE);
>         }
>         elsif ($newval == USAGE_MODE_XMLRPC) {
>             $class->error_mode(ERROR_MODE_DIE_SOAP_FAULT);
>         }
>         elsif ($newval == USAGE_MODE_JSON) {
>             $class->error_mode(ERROR_MODE_JSON_RPC);
>         }
>         elsif ($newval == USAGE_MODE_EMAIL) {
>             $class->error_mode(ERROR_MODE_DIE);
>         }
>         elsif ($newval == USAGE_MODE_TEST) {
>             $class->error_mode(ERROR_MODE_TEST);
>         }
>         else {
>             ThrowCodeError('usage_mode_invalid',
>                            {'invalid_usage_mode', $newval});
>         }
>         $class->request_cache->{usage_mode} = $newval;
>     }
>     return $class->request_cache->{usage_mode}
>         || (i_am_cgi()? USAGE_MODE_BROWSER : USAGE_MODE_CMDLINE);
> }

If SCMBug doesn't call usage_mode, it's call in Bugzilla init code
defaults to guessing it itself and this guess will result in
USAGE_MODE_CONSOLE because of the call to i_am_cgi:

> sub i_am_cgi {
>     # I use SERVER_SOFTWARE because it's required to be
>     # defined for all requests in the CGI spec.
>     return exists $ENV{'SERVER_SOFTWARE'} ? 1 : 0;
> }

Adam, could you try to revert your change to Bugzilla and start SCMBug
with the env variable SERVER_SOFTWARE set to 1 in the SCMBug start
script? If this works, Kristis may have to options: Issue a call to
Bugzilla::usage_mode with USAGE_MODE_BROWSER before doing anything
else with Bugzilla or defining the env variable before using Bugzilla.

Mit freundlichen Grüßen,

Thorsten Schöning

-- 
Thorsten Schöning
AM-SoFT IT-Systeme - Hameln | Potsdam | Leipzig
 
Telefon: Potsdam: 0331-743881-0
E-Mail:  [email protected]
Web:     http://www.am-soft.de

AM-SoFT GmbH IT-Systeme, Konsumhof 1-5, 14482 Potsdam
Amtsgericht Potsdam HRB 21278 P, Geschäftsführer: Andreas Muchow

_______________________________________________
scmbug-users mailing list
[email protected]
http://lists.mkgnu.net/cgi-bin/mailman/listinfo/scmbug-users

Reply via email to