Change parameter 'web' to 'url' and take array of array in config instead of : separated values

This commit is contained in:
Brice Maron 2012-06-07 20:36:55 +00:00
parent 9f1c46b6f6
commit 9ec68c819b
5 changed files with 18 additions and 23 deletions

View File

@ -342,7 +342,7 @@ class OC_App{
public static function getAppWebPath($appid) {
foreach(OC::$APPSROOTS as $dir) {
if(file_exists($dir['path'].'/'.$appid)) {
return $dir['web'].'/'.$appid;
return $dir['url'].'/'.$appid;
}
}
return false;

View File

@ -55,7 +55,7 @@ class OC{
*/
public static $THIRDPARTYWEBROOT = '';
/**
* The installation path array of the apps folder on the server (e.g. /srv/http/owncloud) 'real' and web path in 'web'
* The installation path array of the apps folder on the server (e.g. /srv/http/owncloud) 'path' and web path in 'url'
*/
public static $APPSROOTS = array();
/*
@ -161,22 +161,17 @@ class OC{
echo("3rdparty directory not found! Please put the ownCloud 3rdparty folder in the ownCloud folder or the folder above. You can also configure the location in the config.php file.");
exit;
}
// search the apps folder
if(OC_Config::getValue('appsroot', '')<>''){
$real_a = explode(':',OC_Config::getValue('appsroot', ''));
$web_a = explode(':',OC_Config::getValue('appsurl', ''));
foreach($real_a as $k => $path) {
if(!isset($web_a[$k])){
echo("Apps root and appsurl not mathing. You need to have the same number of paths");
exit;
}
OC::$APPSROOTS[] = array('path'=> $path, 'web' => $web_a[$k]);
$config_paths = OC_Config::getValue('apps_paths', array());
if(! empty($config_paths)){
foreach($config_paths as $paths) {
if( isset($paths['url']) && isset($paths['path']))
OC::$APPSROOTS[] = $paths;
}
}elseif(file_exists(OC::$SERVERROOT.'/apps')){
OC::$APPSROOTS[] = array('path'=> OC::$SERVERROOT.'/apps', 'web' => OC::$WEBROOT.'/apps/');
OC::$APPSROOTS[] = array('path'=> OC::$SERVERROOT.'/apps', 'url' => OC::$WEBROOT.'/apps/');
}elseif(file_exists(OC::$SERVERROOT.'/../apps')){
OC::$APPSROOTS[] = array('path'=> rtrim(dirname(OC::$SERVERROOT), '/').'/apps', 'web' => rtrim(dirname(OC::$WEBROOT), '/').'/apps/');
OC::$APPSROOTS[] = array('path'=> rtrim(dirname(OC::$SERVERROOT), '/').'/apps', 'url' => rtrim(dirname(OC::$WEBROOT), '/').'/apps/');
OC::$APPSROOT=rtrim(dirname(OC::$SERVERROOT), '/');
}

View File

@ -28,8 +28,8 @@ class OC_Minimizer_CSS extends OC_Minimizer
$append = false;
foreach( OC::$APPSROOTS as $apps_dir)
{
if($this->appendIfExist($apps_dir['path'], $apps_dir['web'], "$style$fext.css", true)) { $append =true; break; }
elseif($this->appendIfExist($apps_dir['path'], $apps_dir['web'], "$style.css", true )) { $append =true; break; }
if($this->appendIfExist($apps_dir['path'], $apps_dir['url'], "$style$fext.css", true)) { $append =true; break; }
elseif($this->appendIfExist($apps_dir['path'], $apps_dir['url'], "$style.css", true )) { $append =true; break; }
}
if(! $append) {
echo('css file not found: style:'.$script.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT);
@ -65,7 +65,7 @@ class OC_Minimizer_CSS extends OC_Minimizer
$in_root = false;
foreach(OC::$APPSROOTS as $app_root) {
if(strpos($file, $app_root['path']) == 0) {
$in_root = $app_root['web'];
$in_root = $app_root['url'];
break;
}
}

View File

@ -42,8 +42,8 @@ class OC_Minimizer_JS extends OC_Minimizer
$append = false;
foreach( OC::$APPSROOTS as $apps_dir)
{
if($this->appendIfExist($apps_dir['path'], $apps_dir['web'], "$script$fext.js" , true)) { $append =true; break; }
elseif($this->appendIfExist($apps_dir['path'], $apps_dir['web'], "$script.js", true )) { $append =true; break; }
if($this->appendIfExist($apps_dir['path'], $apps_dir['url'], "$script$fext.js" , true)) { $append =true; break; }
elseif($this->appendIfExist($apps_dir['path'], $apps_dir['url'], "$script.js", true )) { $append =true; break; }
}
if(! $append) {
echo('js file not found: script:'.$script.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT);

View File

@ -426,8 +426,8 @@ class OC_Template{
$append = false;
foreach( OC::$APPSROOTS as $apps_dir)
{
if($page->appendIfExist('jsfiles', $apps_dir['path'], $apps_dir['web'], "$script$fext.js" , true)) { $append =true; break; }
elseif($page->appendIfExist('jsfiles', $apps_dir['path'], $apps_dir['web'], "$script.js", true )) { $append =true; break; }
if($page->appendIfExist('jsfiles', $apps_dir['path'], $apps_dir['url'], "$script$fext.js" , true)) { $append =true; break; }
elseif($page->appendIfExist('jsfiles', $apps_dir['path'], $apps_dir['url'], "$script.js", true )) { $append =true; break; }
}
if(! $append) {
echo('js file not found: script:'.$script.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT);
@ -454,8 +454,8 @@ class OC_Template{
$append = false;
foreach( OC::$APPSROOTS as $apps_dir)
{
if($page->appendIfExist('cssfiles', $apps_dir['path'], $apps_dir['web'], "$style$fext.css", true)) { $append =true; break; }
elseif($page->appendIfExist('cssfiles', $apps_dir['path'], $apps_dir['web'], "$style.css", true )) { $append =true; break; }
if($page->appendIfExist('cssfiles', $apps_dir['path'], $apps_dir['url'], "$style$fext.css", true)) { $append =true; break; }
elseif($page->appendIfExist('cssfiles', $apps_dir['path'], $apps_dir['url'], "$style.css", true )) { $append =true; break; }
}
if(! $append) {
echo('css file not found: style:'.$script.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT);