Changeset 11900
- Timestamp:
- 08/30/07 18:49:48 (1 year ago)
- Files:
-
- trunk/midcom/midcom.core/midcom/application.php (modified) (8 diffs)
- trunk/midcom/midcom.core/midcom/baseclasses/components/interface.php (modified) (2 diffs)
- trunk/midcom/midcom.core/midcom/helper/_componentloader.php (modified) (1 diff)
- trunk/midcom/midcom.core/midcom/helper/_styleloader.php (modified) (15 diffs)
- trunk/midcom/midcom.core/midcom/helper/configuration.php (modified) (1 diff)
- trunk/midcom/midcom.core/midcom/services/auth.php (modified) (2 diffs)
- trunk/midcom/midcom.core/midcom/services/cache.php (modified) (2 diffs)
- trunk/midcom/midcom.core/midcom/services/cache/module/content.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/midcom/midcom.core/midcom/application.php
r11889 r11900 767 767 * 768 768 * _process - CANHANDLE->HANDLE || ATTACHMENT_OUTPUT 769 * _c heckobject- CANHANDLE769 * _can_handle - CANHANDLE 770 770 * _loadconfig - CANHANDLE 771 771 * _handle - HANDLE … … 783 783 * Details: The logic will traverse the node tree and for each node it will load 784 784 * the component that is responsible for it. This component gets the chance to 785 * acceppt the request (this is encaspulated in the _c heckobjectcall), which is785 * acceppt the request (this is encaspulated in the _can_handle call), which is 786 786 * basically a call to can_handle. If the component declares to be able to handle 787 787 * the call, its handle function is executed. Depending if the handle was successful … … 924 924 // If so, execute it, if not, continue. 925 925 926 if ($this->_c heckobject($object))926 if ($this->_can_handle($object)) 927 927 { 928 928 $this->_status = MIDCOM_STATUS_HANDLE; … … 1002 1002 * Handle the request. 1003 1003 * 1004 * _handle is called after _c heckobjectdetermined, that1004 * _handle is called after _can_handle determined, that 1005 1005 * a component can handle a request. The URL of the component that is used 1006 1006 * to handle the request is obtained automatically. The parameter $path is … … 1097 1097 * @access private 1098 1098 */ 1099 private function _c heckobject($object)1099 private function _can_handle($object) 1100 1100 { 1101 1101 debug_push_class(__CLASS__, __FUNCTION__); … … 1103 1103 $path = $this->get_context_data(MIDCOM_CONTEXT_COMPONENT); 1104 1104 1105 $adminmode = false;1105 // Request type safety check 1106 1106 if ($this->_context[$this->_currentcontext][MIDCOM_CONTEXT_REQUESTTYPE] != MIDCOM_REQUEST_CONTENT) 1107 1107 { 1108 1108 debug_add("Unkown Request Type encountered:" . $this->_context[$this->current_context][MIDCOM_CONTEXT_REQUESTTYPE], MIDCOM_LOG_ERROR); 1109 debug_pop(); 1109 1110 $this->generate_error(MIDCOM_ERRCRIT, "Unkown Request Type encountered:" . $this->_context[$this->current_context][MIDCOM_CONTEXT_REQUESTTYPE]); 1110 1111 } 1111 1112 1112 $concept_component =& $this->componentloader->get_component_class($path); 1113 if ($concept_component === null) 1113 // Get component interface class 1114 $component_interface =& $this->componentloader->get_interface_class($path); 1115 if ($component_interface === null) 1114 1116 { 1115 1117 $path = 'midcom.core.nullcomponent'; 1116 1118 $this->_set_context_data($path, MIDCOM_CONTEXT_COMPONENT); 1117 $concept_component =& $this->componentloader->get_component_class($path); 1118 } 1119 1119 $component_interface =& $this->componentloader->get_interface_class($path); 1120 } 1121 1122 // Load configuration 1120 1123 $config_obj =& $this->_loadconfig($object); 1121 1124 $config = ($config_obj == false) ? array() : $config_obj->get_all(); 1122 1123 if (! $concept_component->configure($config, $this->_currentcontext, $adminmode)) 1124 { 1125 debug_add ("Component Configuration failed: " . $concept_component->errstr($this->_currentcontext), MIDCOM_LOG_ERROR); 1126 $this->generate_error(MIDCOM_ERRCRIT, "Component Configuration failed: " . $concept_component->errstr($this->_currentcontext)); 1127 } 1128 1129 if ($concept_component->can_handle($object, $this->_parser->argc, $this->_parser->argv, $this->_currentcontext)) 1130 { 1131 debug_add("Component $path will handle request.", MIDCOM_LOG_INFO); 1125 if (! $component_interface->configure($config, $this->_currentcontext)) 1126 { 1127 debug_add ("Component Configuration failed: " . $component_interface->errstr($this->_currentcontext), MIDCOM_LOG_ERROR); 1132 1128 debug_pop(); 1133 return true; 1134 } 1135 else 1136 { 1137 debug_add("Component $path declared unable to handle request.", MIDCOM_LOG_INFO); 1129 $this->generate_error(MIDCOM_ERRCRIT, "Component Configuration failed: " . $component_interface->errstr($this->_currentcontext)); 1130 } 1131 1132 // Make can_handle check 1133 if (!$component_interface->can_handle($object, $this->_parser->argc, $this->_parser->argv, $this->_currentcontext)) 1134 { 1135 debug_add("Component {$path} in {$object->name} declared unable to handle request.", MIDCOM_LOG_INFO); 1138 1136 debug_pop(); 1139 1137 return false; 1140 1138 } 1139 1140 debug_add("Component {$path} in {$object->name} will handle request.", MIDCOM_LOG_INFO); 1141 debug_pop(); 1142 return true; 1141 1143 } 1142 1144 … … 1154 1156 private function & _loadconfig($object) 1155 1157 { 1156 debug_push("midcom_application::_loadconfig");1157 1158 1158 $path = $this->get_context_data(MIDCOM_CONTEXT_COMPONENT); 1159 debug_add("Trying to load configuration for $path", MIDCOM_LOG_DEBUG);1160 1159 $result = new midcom_helper_configuration($object, $path); 1161 1160 return $result; … … 1198 1197 } 1199 1198 1200 $component =& $this->componentloader->get_ component_class($this->get_context_data(MIDCOM_CONTEXT_COMPONENT));1199 $component =& $this->componentloader->get_interface_class($this->get_context_data(MIDCOM_CONTEXT_COMPONENT)); 1201 1200 $component->show_content($this->_currentcontext); 1202 1201 trunk/midcom/midcom.core/midcom/baseclasses/components/interface.php
r11860 r11900 539 539 * @return bool Indication success. 540 540 */ 541 function configure($configuration, $contextid , $adminmode = false)541 function configure($configuration, $contextid) 542 542 { 543 543 // Initialize the context data … … 565 565 566 566 $data['handler'] = null; 567 $data['adminmode'] = $adminmode;568 567 569 568 return true; trunk/midcom/midcom.core/midcom/helper/_componentloader.php
r11816 r11900 491 491 492 492 return $this->_interface_classes[$path]; 493 }494 495 496 /**497 * Returns a reference to an instance of the specified component's498 * COMPONENT class. The component is given in $path as a MidCOM499 * path. Such an instance will be cached by the framework so that500 * only one instance is always active for each component. Missing501 * components will be dynamically loaded into memory.502 *503 *504 * @param string $path The component name.505 * @return mixed A reference to the concept class in question or null if the component is missing.506 * @deprecated This has been deprecated in MidCOM 2.4 in favor of the new component interface classes.507 */508 function & get_component_class($path)509 {510 debug_push_class(__CLASS__, __FUNCTION__);511 debug_add("Warning, this method is deprecated, you should use the new component interface instead.",512 MIDCOM_LOG_DEBUG);513 debug_pop();514 515 global $midcom;516 517 $prefix = $this->path_to_prefix($path);518 // return null if the component is missing.519 if (! $this->is_loaded($path) && ! $this->_load($path))520 {521 debug_pop( );522 $ret = null;523 return $ret;524 }525 526 if (is_null ($this->_component_classes[$path]))527 {528 debug_push("midcom_helper__componentloader::get_component_class");529 530 if ($this->manifests[$path]->purecode)531 {532 $GLOBALS['midcom_errstr'] = "Cannot retrieve the COMPONENT concept of the pure code library $path.";533 debug_add($GLOBALS['midcom_errstr'], MIDCOM_LOG_CRIT);534 $midcom->generate_error(MIDCOM_ERRCRIT, $GLOBALS['midcom_errstr']);535 // This will exit.536 }537 538 debug_add("Instantinating " . $prefix . "_component.", MIDCOM_LOG_DEBUG);539 eval("\$this->_component_classes[\$path] = new " . $prefix . "_component();");540 541 if ($this->_component_classes[$path] === false)542 {543 $GLOBALS['midcom_errstr'] = "Could not instantinate " . $prefix . "_component.";544 debug_add($GLOBALS['midcom_errstr'], MIDCOM_LOG_CRIT);545 $midcom->generate_error(MIDCOM_ERRCRIT, $GLOBALS['midcom_errstr']);546 // This will exit.547 }548 549 debug_pop();550 }551 552 return $this->_component_classes[$path];553 }554 555 /**556 * Returns a reference to an instance of the specified component's557 * Content Admin COMPONENT class. The component is given in $path558 * as a MidCOM path. Such an instance will be cached by the559 * framework so that only one instance is always active for each560 * component. Missing components will be dynamically loaded into561 * memory.562 *563 * @param string $path The component name.564 * @return mixed A reference to the concept class in question.565 * @deprecated This has been deprecated in MidCOM 2.4 in favor of the new component interface classes.566 */567 function & get_contentadmin_class($path)568 {569 debug_push_class(__CLASS__, __FUNCTION__);570 debug_add("Warning, this method is deprecated, you should use the new component interface instead.",571 MIDCOM_LOG_DEBUG);572 debug_pop();573 574 global $midcom;575 $prefix = $this->path_to_prefix($path);576 577 if (! $this->is_loaded($path) && ! $this->_load($path))578 {579 $midcom->generate_error(MIDCOM_ERRCRIT, $GLOBALS['midcom_errstr']);580 // This will exit.581 }582 583 if (is_null ($this->_contentadmin_classes[$path]))584 {585 debug_push("midcom_helper__componentloader::get_contentadmin_class");586 587 if ($this->manifests[$path]->purecode)588 {589 $GLOBALS['midcom_errstr'] = "Cannot retrieve the Content Admin COMPONENT concept of the pure code library $path.";590 debug_add($GLOBALS['midcom_errstr'], MIDCOM_LOG_CRIT);591 $midcom->generate_error(MIDCOM_ERRCRIT, $GLOBALS['midcom_errstr']);592 // This will exit.593 }594 595 if (! class_exists ($prefix . "_contentadmin"))596 {597 $GLOBALS['midcom_errstr'] = "Class " . $prefix . "_contentadmin does not exist.";598 debug_add($GLOBALS['midcom_errstr'], MIDCOM_LOG_CRIT);599 $midcom->generate_error(MIDCOM_ERRCRIT, $GLOBALS['midcom_errstr']);600 // This will exit.601 }602 603 debug_add("Instantinating " . $prefix . "_contentadmin.");604 eval("\$this->_contentadmin_classes[\$path] = new " . $prefix . "_contentadmin();");605 606 if ($this->_contentadmin_classes[$path] === false)607 {608 $GLOBALS['midcom_errstr'] = "Could not instantinate " . $prefix . "_contentadmin.";609 debug_add($GLOBALS['midcom_errstr'], MIDCOM_LOG_CRIT);610 $midcom->generate_error(MIDCOM_ERRCRIT, $GLOBALS['midcom_errstr']);611 // This will exit.612 }613 614 debug_pop();615 }616 617 return $this->_contentadmin_classes[$path];618 }619 620 /**621 * Returns a reference to an instance of the specified component's622 * NAP class. The component is given in $path as a MidCOM623 * path. Such an instance will be cached by the framework so that624 * only one instance is always active for each component. Missing625 * components will be dynamically loaded into memory.626 *627 * @param string $path The component name.628 * @return mixed A reference to the concept class in question.629 * @deprecated This has been deprecated in MidCOM 2.4 in favor of the new component interface classes.630 */631 function & get_nap_class($path)632 {633 debug_push_class(__CLASS__, __FUNCTION__);634 debug_add("Warning, this method is deprecated, you should use the new component ".635 "interface instead. (hint: get_interface_class()) ",636 MIDCOM_LOG_DEBUG);637 debug_pop();638 639 global $midcom;640 641 $prefix = $this->path_to_prefix($path);642 643 if (! $this->is_loaded($path) && ! $this->_load($path))644 {645 $midcom->generate_error(MIDCOM_ERRCRIT, $GLOBALS['midcom_errstr']);646 // This will exit.647 }648 649 if (is_null ($this->_nap_classes[$path]))650 {651 debug_push ("midcom_helper__componentloader::get_nap_class");652 653 if ($this->manifests[$path]->purecode)654 {655 $GLOBALS['midcom_errstr'] = "Cannot retrieve the NAP concept of the pure code library $path.";656 debug_add($GLOBALS['midcom_errstr'], MIDCOM_LOG_CRIT);657 $midcom->generate_error(MIDCOM_ERRCRIT, $GLOBALS['midcom_errstr']);658 // This will exit.659 }660 661 debug_add("Instantinating " . $prefix . "_nap.", MIDCOM_LOG_DEBUG);662 eval("\$this->_nap_classes[\$path] = new " . $prefix . "_nap();");663 664 if ($this->_nap_classes[$path] === false)665 {666 $GLOBALS['midcom_errstr'] = "Could not instantinate " . $prefix . "_nap.";667 debug_add($GLOBALS['midcom_errstr'], MIDCOM_LOG_CRIT);668 $midcom->generate_error(MIDCOM_ERRCRIT, $GLOBALS['midcom_errstr']);669 // This will exit.670 }671 672 debug_pop();673 }674 675 return $this->_nap_classes[$path];676 493 } 677 494 trunk/midcom/midcom.core/midcom/helper/_styleloader.php
r11872 r11900 312 312 if (!is_dir($path)) 313 313 { 314 debug_push_class(__CLASS__, __FUNCTION__); 314 315 debug_add("Directory {$path} not found."); 316 debug_pop(); 315 317 return $elements; 316 318 } … … 320 322 if (!$directory) 321 323 { 324 debug_push_class(__CLASS__, __FUNCTION__); 322 325 debug_add("Failed to read directory {$path}"); 326 debug_pop(); 323 327 return $elements; 324 328 } … … 457 461 { 458 462 debug_push_class(__CLASS__, __FUNCTION__); 459 debug_add(" trying to show '$path' but there is no context set!", MIDCOM_LOG_INFO);463 debug_add("Trying to show '$path' but there is no context set", MIDCOM_LOG_INFO); 460 464 debug_pop(); 461 465 return false; 462 }463 464 if (count($this->_scope) > 0)465 {466 debug_add("style scope is " . $this->_scope[0]);467 466 } 468 467 … … 566 565 function _getComponentStyle($topic) 567 566 { 568 /* this global is set by the urlparser.569 */570 global $midcom_style_inherited;571 debug_push_class(__CLASS__, __FUNCTION__);572 567 573 568 // get user defined style for component 574 575 569 // style inheritance 576 570 // should this be cached somehow? … … 578 572 { 579 573 $_st = $this->get_style_id_from_path($topic->style); 580 debug_add( "topic->style:" . $topic->style . "( $_st )" );581 }582 else if ( isset($midcom_style_inherited)583 && ($midcom_style_inherited))584 {574 } 575 else if ( isset($GLOBALS['midcom_style_inherited']) 576 && ($GLOBALS['midcom_style_inherited'])) 577 { 578 // FIXME: This GLOBALS is set by urlparser. Should be removed 585 579 // get user defined style inherited from topic tree 586 $_st = $this->get_style_id_from_path($midcom_style_inherited); 587 debug_add( 'Inherited styleid:' . $midcom_style_inherited ); 580 $_st = $this->get_style_id_from_path($GLOBALS['midcom_style_inherited']); 588 581 } 589 582 else … … 594 587 { 595 588 $_st = $this->get_style_id_from_path($GLOBALS['midcom_config']['styleengine_default_styles'][$component]); 596 debug_add( 'Component_default styles: ' . $GLOBALS['midcom_config']['styleengine_default_styles'][$component]);597 589 } 598 590 } … … 600 592 if (isset($_st)) 601 593 { 602 debug_add("Current component has user defined style: $_st", MIDCOM_LOG_INFO);603 594 $substyle = $_MIDCOM->get_context_data(MIDCOM_CONTEXT_SUBSTYLE); 604 debug_add( 'Component substyle:' . $substyle );605 595 606 596 if (isset($substyle)) … … 614 604 { 615 605 $_st = $_subst_id; 616 debug_add("Found substyle '$substyle', overriding component's user defined style.", MIDCOM_LOG_INFO);617 }618 else619 {620 debug_add("Substyle '$substyle' not found under {$_st}.", MIDCOM_LOG_INFO);621 606 } 622 607 } … … 624 609 } 625 610 626 debug_pop();627 if (isset($_st)){611 if (isset($_st)) 612 { 628 613 return $_st; 629 } else {630 return false;631 }614 } 615 616 return false; 632 617 } 633 618 … … 717 702 function _merge_styledirs ($component_style) 718 703 { 719 debug_push_class(__CLASS__, __FUNCTION__);720 704 /* first the prepend styles */ 721 705 $this->_styledirs = $this->_styledirs_prepend; … … 725 709 $this->_styledirs = array_merge($this->_styledirs, $this->_styledirs_append); 726 710 $this->_styledirs_count = count($this->_styledirs); 727 debug_pop();728 711 } 729 712 … … 738 721 function enter_context($context) 739 722 { 740 debug_push_class(__CLASS__, __FUNCTION__); 723 741 724 742 725 // set new context and topic 743 726 array_unshift($this->_context, $context); // push into context stack 744 debug_add("entering context $context", MIDCOM_LOG_DEBUG);745 727 746 728 $this->_topic = $_MIDCOM->get_context_data(MIDCOM_CONTEXT_CONTENTTOPIC); … … 754 736 755 737 $this->_merge_styledirs($this->_snippetdir); 756 757 debug_pop();758 738 return true; 759 739 } … … 768 748 function leave_context() 769 749 { 770 debug_push_class(__CLASS__, __FUNCTION__);771 772 debug_add("leaving context " . $this->_context[0], MIDCOM_LOG_DEBUG);773 750 /* does this cause an extra, not needed call to ->parameter ? */ 774 751 $_st = $this->_getComponentStyle($this->_topic); … … 784 761 785 762 $this->_snippetdir = $this->_getComponentSnippetdir($this->_topic); 786 787 debug_pop();788 763 return true; 789 764 } trunk/midcom/midcom.core/midcom/helper/configuration.php
r11660 r11900 200 200 debug_push_class(__CLASS__, __FUNCTION__); 201 201 debug_add("The key {$key} is not present in the global configuration array.", MIDCOM_LOG_INFO); 202 debug_print_r("Current global configuration:", $this->_global);203 202 debug_pop(); 204 203 } trunk/midcom/midcom.core/midcom/services/auth.php
r11856 r11900 519 519 if (! $credencials) 520 520 { 521 debug_add('No new authentication credencials found.');522 debug_pop();523 521 return false; 524 522 } … … 1131 1129 1132 1130 debug_add("Entered SUDO mode for domain {$domain}.", MIDCOM_LOG_INFO); 1133 debug_print_function_stack("SUDO mode at depth {$this->_component_sudo} granted for this caller:");1134 1131 1135 1132 debug_pop(); trunk/midcom/midcom.core/midcom/services/cache.php
r11850 r11900 76 76 function initialize() 77 77 { 78 debug_push_class(__CLASS__, __FUNCTION__);79 80 78 foreach ($GLOBALS['midcom_config']['cache_autoload_queue'] as $name) 81 79 { 82 debug_add("Auto-Loading module {$name}", MIDCOM_LOG_DEBUG);83 80 $this->load_module($name); 84 81 } 85 86 debug_pop();87 82 } 88 83 … … 93 88 function shutdown() 94 89 { 95 debug_push_class(__CLASS__, __FUNCTION__);96 97 90 foreach ($this->_unload_queue as $name) 98 91 { 99 debug_add("Stopping module {$name}", MIDCOM_LOG_INFO);100 92 $this->_modules[$name]->shutdown(); 101 93 } 102 103 debug_pop();104 94 } 105 95 trunk/midcom/midcom.core/midcom/services/cache/module/content.php
r11854 r11900 372 372 if ($this->_uncached) 373 373 { 374 debug_push_class(__CLASS__, __FUNCTION__);375 debug_add('We are in uncached operation, skipping check_hit detection.');376 debug_pop();377 374 return; 378 375 }
