Author: chabotc
Date: Fri May 23 06:02:53 2008
New Revision: 659526
URL: http://svn.apache.org/viewvc?rev=659526&view=rev
Log:
Features seem to be broken since we have the opensocial-0.8, -current etc...
part 1 of 2 to fix it (and some debugging message, will be removed aaap)
Modified:
incubator/shindig/trunk/php/src/gadgets/JsFeatureLoader.php
incubator/shindig/trunk/php/src/gadgets/JsLibrary.php
Modified: incubator/shindig/trunk/php/src/gadgets/JsFeatureLoader.php
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/JsFeatureLoader.php?rev=659526&r1=659525&r2=659526&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/JsFeatureLoader.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/JsFeatureLoader.php Fri May 23
06:02:53 2008
@@ -37,13 +37,27 @@
return $entries;
}
+ private function sortFeaturesFiles($feature1, $feature2)
+ {
+ $feature1 = basename(str_replace('/feature.xml','', $feature1));
+ $feature2 = basename(str_replace('/feature.xml','', $feature2));
+ if ($feature1 == $feature2) {
+ return 0;
+ }
+ return ($feature1 < $feature2) ? -1 : 1;
+ }
+
private function loadFiles($path, &$features)
{
- foreach (glob("$path/*") as $file) {
- $file = realpath($file.'/feature.xml');
- if (file_exists($file) && is_readable($file)) {
- $feature = $this->processFile($file);
- if ($feature != null) {
+ $featuresFile = $path.'/features.txt';
+ if (file_exists($featuresFile) && is_readable($featuresFile)) {
+ $files = explode("\n",
file_get_contents($featuresFile));
+ // custom sort, else core.io seems to bubble up before
core, which breaks the dep chain order
+ usort($files, array($this,'sortFeaturesFiles'));
+ foreach ($files as $file) {
+ if (!empty($file) && strpos($file,
'feature.xml') !== false && substr($file, 0, 1) != '#' && substr($file, 0, 2)
!= '//') {
+ $file = realpath($path.'/../'.$file);
+ $feature = $this->processFile($file);
$features[$feature->name] = $feature;
}
}
@@ -56,7 +70,7 @@
$feature = null;
if (file_exists($file) && is_file($file) && is_readable($file))
{
if (($content = @file_get_contents($file))) {
- $feature = $this->parse($content,
dirname($file) . '/');
+ $feature = $this->parse($content,
dirname($file));
}
}
return $feature;
Modified: incubator/shindig/trunk/php/src/gadgets/JsLibrary.php
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/JsLibrary.php?rev=659526&r1=659525&r2=659526&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/JsLibrary.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/JsLibrary.php Fri May 23 06:02:53
2008
@@ -55,7 +55,9 @@
}
$this->loaded = true;
}
- return $this->content;
+ //FIXME purely for debugging, remove this asap!
+ // puts a //LIB: <name of feature> above the JS of the feature
+ return "\n\n//LIB: ".$this->featureName."\n".$this->content;
}
public function getFeatureName()