Non-core contributed modules

Analyse effect of using $_SERVER['SERVER_NAME']

Details

  • Affected Branches:
    MOODLE_19_STABLE

Description

used in config-wpi.php - need to check to see if this consistently reports the correct url and if there's a better way of specifying/obtaining this via parameters.xml

Activity

Hide
Dan Marsden added a comment -

Feedback from Testing team:
If Moodle is installed in a Web site other than the Default Web Site, the user isn't able to access the application. There's a redirect that happens on the first run that sends the user to the admin index page. This redirect isn't picking up the port number portion of the URL. The line in the config.php file that's causing the failed redirect is:

$CFG->wwwroot = 'http://'.$_SERVER['SERVER_NAME'].substr($app, strpos($app, '/'))

on my local copy, I changed that line to include the server port and everything worked fine:

$CFG->wwwroot = 'http://'.$_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].substr($app, strpos($app, '/'));

Show
Dan Marsden added a comment - Feedback from Testing team: If Moodle is installed in a Web site other than the Default Web Site, the user isn't able to access the application. There's a redirect that happens on the first run that sends the user to the admin index page. This redirect isn't picking up the port number portion of the URL. The line in the config.php file that's causing the failed redirect is: $CFG->wwwroot = 'http://'.$_SERVER['SERVER_NAME'].substr($app, strpos($app, '/')) on my local copy, I changed that line to include the server port and everything worked fine: $CFG->wwwroot = 'http://'.$_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].substr($app, strpos($app, '/'));

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated: