Changeset 11792

Show
Ignore:
Timestamp:
08/29/07 11:28:24 (1 year ago)
Author:
tarjei
Message:

Experimental stuff. An unfinished autoloader and the start of the request system. To run the tests, install phpunit3, enter the midcom directory and run phpunit test/url.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/midcom/midcom.core/midcom.php

    r11276 r11792  
    9494 
    9595debug_add("Start of MidCOM run: {$_SERVER['REQUEST_URI']}", MIDCOM_LOG_INFO); 
    96  
    97 /* 
    98 if (! is_null($components)) 
    99 { 
    100     debug_print_r ('PHP_Compat loaded these components:', $components); 
    101 } 
    102  */ 
    103  
    10496/////////////////////////////////// 
    10597// Load first-level supporting code 
     
    108100require('midcom/services/i18n.php'); 
    109101 
     102require('autoload.php'); 
    110103////////////////////////////////////// 
    111104// Load and start up the cache system, 
  • trunk/midcom/midcom.core/midcom/application.php

    r11359 r11792  
    490490 
    491491        // Check the midcom_config ais/site prefixes for absolute local urls 
     492        /* TODO: remove properly 
    492493        if ($GLOBALS['midcom_config']['midcom_ais_url'][0] == '/') 
    493494        { 
     
    502503                . substr($GLOBALS['midcom_config']['midcom_site_url'], 1); 
    503504        } 
    504  
     505        */ 
    505506        debug_pop(); 
    506507    } 
     
    862863            switch ($tmp[MIDCOM_HELPER_URLPARSER_KEY]) 
    863864            { 
     865 
    864866                case "substyle": 
    865867                    $substyle = $tmp[MIDCOM_HELPER_URLPARSER_VALUE]; 
     
    888890                    exit(); 
    889891 
    890                 case "servesnippet": 
    891                     if ($this->_parser->argc > 1) { 
    892                         debug_add("Too many arguments remaining for serve_snippet.", MIDCOM_LOG_ERROR); 
    893                         debug_print_r("Parser object:", $this->_parser); 
    894                         $this->generate_error(MIDCOM_ERRNOTFOUND, "Failed to access snippet: Too many arguments for serve_snippet"); 
    895                     } 
    896                     debug_add("Trying to serve snippet with ID " . $tmp[MIDCOM_HELPER_URLPARSER_VALUE], MIDCOM_LOG_INFO); 
    897                     $snippet = new midcom_baseclasses_database_snippet($tmp[MIDCOM_HELPER_URLPARSER_VALUE]); 
    898                     if (!$snippet)  
    899                     { 
    900                         debug_add("Failed to access snippet: " . mgd_errstr(), MIDCOM_LOG_ERROR); 
    901                         $this->generate_error(MIDCOM_ERRNOTFOUND, "Failed to access snippet: " . mgd_errstr()); 
    902                     } 
    903                     $this->serve_snippet($snippet); 
    904                     $this->finish(); 
    905                     exit(); 
    906  
    907                 case "servesnippetguid": 
    908                     if ($this->_parser->argc > 1) { 
    909                         debug_add("Too many arguments remaining for serve_snippet.", MIDCOM_LOG_ERROR); 
    910                         debug_print_r("Parser object:", $this->_parser); 
    911                         $this->generate_error(MIDCOM_ERRNOTFOUND, "Failed to access snippet: Too many arguments for serve_snippet"); 
    912                     } 
    913                     debug_add("Trying to serve snippet with GUID " . $tmp[MIDCOM_HELPER_URLPARSER_VALUE], MIDCOM_LOG_INFO); 
    914                     $snippet = new midcom_baseclasses_database_snippet($tmp[MIDCOM_HELPER_URLPARSER_VALUE]); 
    915                     if (!$snippet)  
    916                     { 
    917                         debug_add("Failed to access snippet: " . mgd_errstr(), MIDCOM_LOG_ERROR); 
    918                         $this->generate_error(MIDCOM_ERRNOTFOUND, "Failed to access snippet: " . mgd_errstr()); 
    919                     } 
    920                     $this->serve_snippet($snippet); 
    921                     $this->finish(); 
    922                     exit(); 
    923  
    924892                case "cache": 
    925893                    if ($tmp[MIDCOM_HELPER_URLPARSER_VALUE] == "invalidate") 
     
    12121180                    $this->_set_context_data($path,MIDCOM_CONTEXT_COMPONENT); 
    12131181                    $concept_component =& $this->componentloader->get_component_class( $path ); 
     1182        var_dump($concept_component); 
    12141183                } 
    12151184                break; 
  • trunk/midcom/midcom.core/midcom/helper/_componentloader.php

    r11743 r11792  
    346346 
    347347        $compat = false; 
    348         if (class_exists("{$prefix}_midcom")) 
     348        $autoloader = SmartLoader::instance(); 
     349         
     350        if ($autoloader->classExists("{$prefix}_midcom")) 
    349351        { 
    350352            debug_push_class(__CLASS__, __FUNCTION__); 
     
    355357            $compat = true; 
    356358        } 
    357         else if (class_exists("{$prefix}_interface")) 
     359        else if ($autoloader->classExists("{$prefix}_interface")) 
    358360        { 
    359361            $classname = "{$prefix}_interface"; 
     
    368370            debug_pop(); 
    369371            $GLOBALS['midcom_errstr'] = 'No interface class defined.'; 
     372            var_dump("EDING!"); 
     373            var_dump($prefix); 
     374            // problemet her er at jeg ikke fÃ¥r autoloaderen til Ã¥ kjÞre i gang!!! 
    370375            return false; 
    371376        } 
     
    379384            debug_pop(); 
    380385            $GLOBALS['midcom_errstr'] = 'Initialization failed.'; 
     386            throw new Exception("DEPRECIATED!"); 
    381387            return false; 
    382388        } 
     
    550556        } 
    551557 
     558        var_dump($this->_component_classes); 
    552559        return $this->_component_classes[$path]; 
    553560    } 
     
    969976        $this->manifests[$manifest->name] = $manifest; 
    970977 
     978        //var_dump($manifest); 
    971979        // Register Privileges 
    972980        $_MIDCOM->auth->register_default_privileges($manifest->privileges); 
  • trunk/midcom/midcom.core/midcom/helper/_styleloader.php

    r5198 r11792  
    242242            //$mc->destroy(); 
    243243        } 
    244  
    245244        if ($current_style != 0) 
    246245        {