private static function readData() {
if( self::$init ) {
return true;
}
$the_default_config = OC::$SERVERROOT."/config/config.php";
// read all file in config dir ending by config.php
$config_files = glob( OC::$SERVERROOT."/config/*.config.php");
if(is_array($config_files)){
//Filter only regular files
$config_files = array_filter($config_files, 'is_file');
//Sort array naturally :
natsort($config_files);
// Add default config
array_unshift($config_files, $the_default_config);
}else{
$config_files[] = $the_default_config;
}
//Include file and merge config
foreach($config_files as $file){
include $file;
if( isset( $CONFIG ) && is_array( $CONFIG )) {
self::$cache = array_merge(self::$cache, $CONFIG);
}
}
// We cached everything
self::$init = true;
return true;
}
Unfortunately I could not find any bugs related to file upload during my testing (but I did not look really hard so I might have missed them). If you can give me some details I'll try and see if I can do anything about it. If not I'll just let the owncloud devs know about the fixed readData function.
]]>There were some bugs on the file upload page, so I dowgraded from owncloud-git (version 6.x pre-alpa) to owncloud (version 5.0.7) and now everything is working perfect! Unfortunately I cannot test your suggestions without again upgrading to owncloud-git.
Again, thanks a lot for help!
]]>BTW this is something you could try
private static function readData() {
if( self::$init ) {
return true;
}
// read all file in config dir ending by config.php
$config_files = glob( OC::$SERVERROOT."/config/*.config.php");
if(is_array($config_files)){
//Filter only regular files
$config_files = array_filter($config_files, 'is_file');
//Sort array naturally :
natsort($config_files);
}else{
//Create an empty array so we can add the default config later
$config_files = array();
}
// Add default config
array_unshift($config_files,OC::$SERVERROOT."/config/config.php");
//Include file and merge config
foreach($config_files as $file){
include $file;
if( isset( $CONFIG ) && is_array( $CONFIG )) {
self::$cache = array_merge(self::$cache, $CONFIG);
}
}
// We cached everything
self::$init = true;
return true;
}
It would be interesting to see if it works if there are other config files besides the default one (especially since I left the dot in the glob function, it should work but I haven't tested it).
]]>Tried adding the var_dump() call before the foreach, and the output in the browser is "NULL". OC::$SERVERROOT is "/usr/share/webapps/owncloud" (I have displayed it by again using var_dump()). Inside "/usr/share/webapps/owncloud/config" (I have skipped the dot before "config", I suppose it is PHP stuff I can ignore) there are two files: "config.php" and "config.sample.php" I suppose config.php file should be returned by the glob functions, but it is not.
I have tried adding var_dump($config_files) after the glob function this way:
// read all file in config dir ending by config.php
$config_files = glob( OC::$SERVERROOT."/config/*.config.php");
var_dump($config_files);
And displayed value in the browser was "bool(false)". So I tried removing the dot '.' before config.php, and it started working! Unfortunately pages are not properly rendered, I'll have a look to see if I can guess why.
]]>Invalid argument supplied for foreach()
usually means bad code: the array given to foreach is no array (because something went wrong) and noone made sure to check.
Unfortunately I can't really tell you where the problem is though, since the config.php file php complains about looks fine. You might add
var_dump($config_files);
right before line 146 and see what gets passed to foreach. http://php.net/manual/en/function.var-dump.php
Is there something else in OC::$SERVERROOT."/config/" besides the default config file?
]]>Then I installed owncloud-git from AUR, followed owncloud wiki section, and now I can access owncloud setup on http://<server_ip>. The setup page asks me to create an admin account. I write the admin username and password, then the page stays some seconds showing a "Finishing" indication, and goes back to the admin account creation page. And this loop goes forever.
The first time I accessed owncloud setup page, it complained about .htaccess file not working, so googling I found I had to set "AllowOverride All" in the Directory section of httpd.conf. Did it and the .htaccess warning dissapeared, but I got still the same result: an infinite loop trying to create admin account.
Then googled a bit more, and found some users with the same problem, pointing out that you have to provide a session.save_path in the php.ini file. Tried this setting session.save_path to "/tmp" and to "/usr/share/webapps/owncloud/sessions" (+ chown http.http) with no luck. I have verified session data is properly written to the configured session directory, so maybe that is not the problem.
Browsing owncloud.log file, each time I try to create the admin account, the following messages are added:
{"app":"core","message":"setting locale to en_US.UTF-8\/en_US.UTF8 failed. Support is probably not installed on your system","level":3,"time":"July 01, 2013 09:00:11"}
{"app":"PHP","message":"Invalid argument supplied for foreach() at \/usr\/share\/webapps\/owncloud\/lib\/config.php#146","level":4,"time":"July 01, 2013 09:00:11"}
{"app":"core","message":"setting locale to en_US.UTF-8\/en_US.UTF8 failed. Support is probably not installed on your system","level":3,"time":"July 01, 2013 09:00:11"}
{"app":"PHP","message":"Invalid argument supplied for foreach() at \/usr\/share\/webapps\/owncloud\/lib\/config.php#146","level":4,"time":"July 01, 2013 09:00:11"}
{"app":"PHP","message":"Invalid argument supplied for foreach() at \/usr\/share\/webapps\/owncloud\/lib\/config.php#146","level":4,"time":"July 01, 2013 09:00:22"}
{"app":"core","message":"setting locale to en_US.UTF-8\/en_US.UTF8 failed. Support is probably not installed on your system","level":3,"time":"July 01, 2013 09:00:22"}
{"app":"PHP","message":"Invalid argument supplied for foreach() at \/usr\/share\/webapps\/owncloud\/lib\/config.php#146","level":4,"time":"July 01, 2013 09:00:22"}
{"app":"core","message":"setting locale to en_US.UTF-8\/en_US.UTF8 failed. Support is probably not installed on your system","level":3,"time":"July 01, 2013 09:00:22"}
{"app":"PHP","message":"Invalid argument supplied for foreach() at \/usr\/share\/webapps\/owncloud\/lib\/config.php#146","level":4,"time":"July 01, 2013 09:00:22"}
{"app":"PHP","message":"Invalid argument supplied for foreach() at \/usr\/share\/webapps\/owncloud\/lib\/config.php#146","level":4,"time":"July 01, 2013 09:00:22"}
{"app":"core","message":"setting locale to en_US.UTF-8\/en_US.UTF8 failed. Support is probably not installed on your system","level":3,"time":"July 01, 2013 09:00:22"}
{"app":"core","message":"setting locale to en_US.UTF-8\/en_US.UTF8 failed. Support is probably not installed on your system","level":3,"time":"July 01, 2013 09:00:23"}
{"app":"PHP","message":"Invalid argument supplied for foreach() at \/usr\/share\/webapps\/owncloud\/lib\/config.php#146","level":4,"time":"July 01, 2013 09:00:23"}
{"app":"core","message":"setting locale to en_US.UTF-8\/en_US.UTF8 failed. Support is probably not installed on your system","level":3,"time":"July 01, 2013 09:00:23"}
{"app":"PHP","message":"Invalid argument supplied for foreach() at \/usr\/share\/webapps\/owncloud\/lib\/config.php#146","level":4,"time":"July 01, 2013 09:00:23"}
{"app":"PHP","message":"Invalid argument supplied for foreach() at \/usr\/share\/webapps\/owncloud\/lib\/config.php#146","level":4,"time":"July 01, 2013 09:00:23"}
{"app":"PHP","message":"Invalid argument supplied for foreach() at \/usr\/share\/webapps\/owncloud\/lib\/config.php#146","level":4,"time":"July 01, 2013 09:00:23"}
I suppose the locale related messages can be ignored. I have the system configured with es_ES locale, and owncloud pages are displayed in spanish. What worries me are the "Invalid argument supplied for foreach()" messages. Maybe there is the problem, but I do not know how to fix it . I have also noticed that time shown lacks the GMT+2 adjust. Where it shows 09:00:23, time in my machine was 11:00:23. I don't know if this behaviour is normal or not. I configured "date.timezone = Europe/Madrid" in php.ini, but that doesn't make a difference.
Anyone using owncloud here? Any suggestions are welcome.
EDIT: edited /etc/locale.gen, added en_US.UTF-8 locale, ran locale-gen and all the locale errors are gone, but the last 3 errors remain and I am still trapped in the admin account creation loop.
]]>