Changeset 181


Ignore:
Timestamp:
Nov 5, 2010, 3:23:28 PM (6 years ago)
Author:
david.vanenckevort@…
Message:
  • Fix detection of unset variables in the ini
  • Extend logging
  • Fix setting of the session variables in the 'mytool_' array
  • Fix URL in legacy code
Location:
trunk/src/main/core
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/main/core/etc/apache.conf

    r71 r181  
    3535
    3636  # Directories with the work files
    37   # Each tool will create a sub-directory of work/ and for each job a
     37  # Each tool will create a sub-directory of /tmp and for each job a
    3838  # sub-directory will be created in the tool's directory
    39   <Directory /opt/fgweb/work/*/*/>
     39  # /tmp/simage/101105_130.161.91.143_1288948078.9117
     40  AliasMatch ^/(\w*)/tmp/(\d{6}_\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}_\d{10}\.\d{4})/(.*)$ /tmp/$1/$2/$3
     41  <Directory /etc/*/*/>
    4042    Options None
    4143    Order allow,deny
  • trunk/src/main/core/etc/fgweb.ini

    r177 r181  
    4444[globals]
    4545site_cpu                        = Super fast processor
    46 ;root                           = /opt/fgweb/
     46root                            = /opt/fgweb/
    4747tmp                                     = /tmp
    4848; Do we want to dump the session in the logs? This can be quite a lot of data, so
     
    6262;context                                = /
    6363;context_test           = fgweb_test/
     64
     65[www]
     66; This section is populated on the fly
     67
     68[cgi]
     69; This section is populated on the fly
     70
     71[fgweb]
     72; This section is populated on the fly
    6473
    6574[gbk]
  • trunk/src/main/core/lib/perl/fgweb/var.pm

    r165 r181  
    104104       
    105105        # Sanity checks
     106        my @required_sections = ('url', 'www', 'fgweb', 'cgi');
     107        foreach (@required_sections) {
     108                if (!defined $config->{$_}) {
     109                        die "Required section $_ is missing from the configuration. Please review fgweb.ini.";
     110                }
     111        }
    106112        # Construct site from CGI environment if it is not set in config
    107113        if (!defined $config->{'url'}->{'site'}) {
     
    143149
    144150        # Link tools under key fgweb for backwards compatibility
    145         if (!defined $config->{'fgweb'}) {
    146                 $config->{'fgweb'} = {};
    147         }
    148151        $config->{'fgweb'}->{'p3'} = $config->{'p3'};
    149152        $config->{'fgweb'}->{'bagel'} = $config->{'bagel'};
     
    152155
    153156        # CGI section - construct hardcoded paths
    154         if (!defined $config->{'cgi'}) {
    155                  $config->{'cgi'} = {};
    156         }
    157157        $config->{'cgi'}->{'root'}    = $config->{'globals'}->{'root'}.'/cgi-bin/';
    158158        $config->{'cgi'}->{'tools'}   = $config->{'globals'}->{'root'}.'/tools/';
     
    162162
    163163        # WWW section - construct hardcoded paths
    164         if (!defined $config->{'www'}) {
    165                 $config->{'www'} = {};
    166         }
    167164        $config->{'www'}->{'root'}       = $config->{'globals'}->{'root'}.'/html/';
    168165        $config->{'www'}->{'libjscript'} = $config->{'www'}->{'root'}.'lib/javascript/';
     
    172169
    173170        # URL section - add hardcoded paths
    174         if (!defined $config->{'url'}) {
    175                 $config->{'url'} = {};
    176         }
    177171        $config->{'url'}->{'root'}       = $config->{'url'}->{'site'}.$config->{'url'}->{'context'};
    178172        $config->{'url'}->{'libjscript'} = $config->{'url'}->{'root'}.'lib/javascript/';
  • trunk/src/main/core/lib/php/FGWeb/Page.php

    r172 r181  
    167167                                        $menu[$tool_type][$tool][1] = $progdisplayname;
    168168                                        $menu[$tool_type][$tool][2] = $url;
     169                                        $this->LOG->debug('Menu item - name = '.$menu[$tool_type][$tool][1].' value = '.$menu[$tool_type][$tool][2]);
    169170                                } else {
    170171                                        $this->LOG->warning('Missing variables in '.$info.'.');
  • trunk/src/main/core/lib/php/FGWeb/webpage_parent.php

    r172 r181  
    126126                        } else {
    127127                                // TODO remove the need for global
    128                                 global $work_dir ;
     128                                global $work_dir;
     129                                global $prog_name;
    129130
    130131                                // TODO move these from session.inc.php to member functions of this.
    131132                                if ($this->sessionstart) start_session() ;
    132133                                if ($this->sessiontest)  test_session() ;
    133 
    134                                 $this->register_in_session($work_dir);
     134                                $_SESSION['mytool_'.$work_dir]['tmp_url'] = './'.$work_dir;
     135                                $this->register_in_session('mytool_'.$work_dir);
    135136                                $this->title = $_SESSION['mytool_'.$work_dir]['progdisplayname'] ;
    136137                                // if this page was invoked from another tool, no menu should be shown, referer_tool is the trigger
     
    179180                                $_SESSION[$key]['wait_queue_time'] = isset($wait_queue_time) ? $wait_queue_time : 10;
    180181                                $_SESSION[$key]['max_procs'] = isset($max_procs) ? $max_procs : 1;
     182                                $this->LOG->debug('Registered in session: '.print_r($_SESSION[$key], true));
    181183                        } else {
    182184                                $this->LOG->warning('Missing variables in '.$info);
  • trunk/src/main/core/lib/php/fgweb_functions.inc.php

    r175 r181  
    2626
    2727require_once 'FGWeb/DefaultPages.php';
     28require_once 'FGWeb/Logger.php';
    2829
    2930// ===========================================================
     
    263264    // the menu
    264265    if (empty($nomenu)) {
     266        $LOG = Logger::log_factory();
    265267        if (!empty($_SESSION['loggedin'])) {
    266268            // create accessible program lists from session
     
    277279                                $mytypes[$temp_tooltype][$name][1]=$temp_progdisplayname;
    278280                                $mytypes[$temp_tooltype][$name][2]=$webdir.$name.'/'.$my_startpage;
     281                                $LOG->debug('Menu item - name = '.$mytypes[$temp_tooltype][$name][1].' URL ='.$mytypes[$temp_tooltype][$name][2]);
    279282                        }
    280283            }
  • trunk/src/main/core/lib/php/global_info.inc.php

    r171 r181  
    4545// Local paths
    4646$_SESSION['globals']['root_dir'] = realpath(getenv('FGWEB_DIR')).'/';
    47 $_SESSION['globals']['tmp_dir'] = realpath($config->getValue(Configuration::SECTION_GLOBALS, 'tmp', $_SESSION['globals']['root_dir'].'/work')).'/';
     47$_SESSION['globals']['tmp_dir'] = realpath($config->getValue(Configuration::SECTION_GLOBALS, 'tmp', '/tmp')).'/';
    4848// These are hardcoded to subdirectories under the main fgweb directory
    4949$_SESSION['globals']['cgi_root'] = realpath($_SESSION['globals']['root_dir'].'/cgi-bin').'/';
     
    5757$_SESSION['globals']['www_software'] = $config->getValue(Configuration::SECTION_URL, 'context', '/');
    5858$_SESSION['globals']['www_software_test'] = $config->getValue(Configuration::SECTION_URL, 'context_test', '/test/');
    59 
    60 $root_url = sprintf('http://%s:%s', $_SERVER['SERVER_ADDR'], $_SERVER['SERVER_PORT']);
    61 $_SESSION['globals']['www_root_url'] = $config->getValue(Configuration::SECTION_URL, 'site', $root_url);
     59$_SESSION['globals']['www_root_url'] = $config->getBaseURL();
    6260
    6361// These are hardcoded to subdirectories under the main fgweb directory
    64 $_SESSION['globals']['www_work_url'] = $_SESSION['globals']['www_root_url'].'/work/';
     62//$_SESSION['globals']['www_work_url'] = $_SESSION['globals']['www_root_url'].'/work/';
    6563$_SESSION['globals']['www_lib_url'] = $_SESSION['globals']['www_root_url'].'/lib/';
    6664$_SESSION['globals']['php_lib_url'] = $_SESSION['globals']['www_lib_url'].'php/';
Note: See TracChangeset for help on using the changeset viewer.