You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by bh...@apache.org on 2011/03/02 09:54:05 UTC

svn commit: r1076145 - in /shindig/trunk/php: src/gadgets/GadgetFeatureRegistry.php test/gadgets/GadgetHtmlRendererTest.php

Author: bhofmann
Date: Wed Mar  2 08:54:05 2011
New Revision: 1076145

URL: http://svn.apache.org/viewvc?rev=1076145&view=rev
Log:
Fixed php feature registry to prevent ring dependecies between taming and core libraries because in the old implementation every non core library got the core libraries as dependencies automatically

Modified:
    shindig/trunk/php/src/gadgets/GadgetFeatureRegistry.php
    shindig/trunk/php/test/gadgets/GadgetHtmlRendererTest.php

Modified: shindig/trunk/php/src/gadgets/GadgetFeatureRegistry.php
URL: http://svn.apache.org/viewvc/shindig/trunk/php/src/gadgets/GadgetFeatureRegistry.php?rev=1076145&r1=1076144&r2=1076145&view=diff
==============================================================================
--- shindig/trunk/php/src/gadgets/GadgetFeatureRegistry.php (original)
+++ shindig/trunk/php/src/gadgets/GadgetFeatureRegistry.php Wed Mar  2 08:54:05 2011
@@ -212,27 +212,22 @@ class GadgetFeatureRegistry {
   private function processFeatures() {
     // Determine the core features
     $this->coreFeatures = array();
-    foreach ($this->features as $entry) {
-      if (strtolower(substr($entry['name'], 0, strlen('core'))) == 'core') {
-        $this->coreFeatures[$entry['name']] = $entry['name'];
-      }
-    }
-    // And make sure non-core features depend on core.
-    foreach ($this->features as $key => $entry) {
-      if ($entry == null) {
-        continue;
-      }
-      $featureName = strtolower(substr($entry['name'], 0, strlen('core')));
-      if ($featureName != 'core' && $featureName != 'glob' && $entry['name'] != 'shindig.auth') {
-        $this->features[$key]['deps'] = array_merge($entry['deps'], $this->coreFeatures);
+    $sortedFeatures = array();
+    foreach ($this->features as $feature) {
+      if (strtolower(substr($feature['name'], 0, strlen('core'))) == 'core') {
+        $this->coreFeatures[$feature['name']] = $feature['name'];
+        // first add all core features so that they are sorted to the beginning
+        $features[] = $feature['name'];
       }
     }
     // Topologically sort all features according to their dependency
     $features = array();
     foreach ($this->features as $feature) {
+      if (isset($this->coreFeatures[$feature['name']])) {
+        continue;
+      }
       $features[] = $feature['name'];
     }
-    $sortedFeatures = array();
     $reverseDeps = array();
     foreach ($features as $feature) {
       $reverseDeps[$feature] = array();

Modified: shindig/trunk/php/test/gadgets/GadgetHtmlRendererTest.php
URL: http://svn.apache.org/viewvc/shindig/trunk/php/test/gadgets/GadgetHtmlRendererTest.php?rev=1076145&r1=1076144&r2=1076145&view=diff
==============================================================================
--- shindig/trunk/php/test/gadgets/GadgetHtmlRendererTest.php (original)
+++ shindig/trunk/php/test/gadgets/GadgetHtmlRendererTest.php Wed Mar  2 08:54:05 2011
@@ -143,7 +143,7 @@ class GadgetHtmlRendererTest extends PHP
                     $this->fail('two entries with script type extern');
                 }
                 $hasExtern = true;
-                $this->assertEquals(0, strpos($script['content'], '/gadgets/js/views:dynamic-height.js?'));
+                $this->assertEquals(0, strpos($script['content'], '/gadgets/js/dynamic-height:views.js?'));
                 break;
             case 'inline':
                 if ($hasInline) {