summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorFrank Karlitschek <karlitschek@kde.org>2011-09-28 13:53:51 +0200
committerFrank Karlitschek <karlitschek@kde.org>2011-09-28 13:53:51 +0200
commitf14a62c87567150f8861a9b22efdc158af62148e (patch)
tree7e9071a7c0cb8881bcb6c9debd7ec971a6b95308 /lib
parentf2a7f230f14e0f30d9ce7ddcc6ad328ac4b0434f (diff)
parent475dd72ea480aa9ac1ad57ef11ff23c91659a857 (diff)
downloadnextcloud-server-f14a62c87567150f8861a9b22efdc158af62148e.tar.gz
nextcloud-server-f14a62c87567150f8861a9b22efdc158af62148e.zip
Merge branch 'master' of gitorious.org:owncloud/owncloud
Diffstat (limited to 'lib')
-rw-r--r--lib/installer.php8
-rw-r--r--lib/setup.php2
-rw-r--r--lib/util.php47
3 files changed, 40 insertions, 17 deletions
diff --git a/lib/installer.php b/lib/installer.php
index 9416a42c972..0febb2cab46 100644
--- a/lib/installer.php
+++ b/lib/installer.php
@@ -243,13 +243,14 @@ class OC_Installer{
* If $enabled is true, apps are installed as enabled.
* If $enabled is false, apps are installed as disabled.
*/
- public static function installShippedApps( $enabled ){
+ public static function installShippedApps(){
$dir = opendir( OC::$SERVERROOT."/apps" );
while( false !== ( $filename = readdir( $dir ))){
if( substr( $filename, 0, 1 ) != '.' and is_dir(OC::$SERVERROOT."/apps/$filename") ){
if( file_exists( OC::$SERVERROOT."/apps/$filename/appinfo/app.php" )){
if(!OC_Installer::isInstalled($filename)){
- OC_Installer::installShippedApp($filename);
+ $info = OC_Installer::installShippedApp($filename);
+ $enabled = isset($info['default_enable']);
if( $enabled ){
OC_Appconfig::setValue($filename,'enabled','yes');
}else{
@@ -265,7 +266,7 @@ class OC_Installer{
/**
* install an app already placed in the app folder
* @param string $app id of the app to install
- * @return bool
+ * @returns array see OC_App::getAppInfo
*/
public static function installShippedApp($app){
//install the database
@@ -279,5 +280,6 @@ class OC_Installer{
}
$info=OC_App::getAppInfo(OC::$SERVERROOT."/apps/$app/appinfo/info.xml");
OC_Appconfig::setValue($app,'installed_version',$info['version']);
+ return $info;
}
}
diff --git a/lib/setup.php b/lib/setup.php
index 7b205acd705..8d3079720cc 100644
--- a/lib/setup.php
+++ b/lib/setup.php
@@ -206,7 +206,7 @@ class OC_Setup {
OC_User::login($username, $password);
//guess what this does
- OC_Installer::installShippedApps(true);
+ OC_Installer::installShippedApps();
//create htaccess files for apache hosts
if (strstr($_SERVER['SERVER_SOFTWARE'], 'Apache')) {
diff --git a/lib/util.php b/lib/util.php
index dea3168e8fc..66a781537ea 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -24,7 +24,7 @@ class OC_Util {
$success=@mkdir($CONFIG_DATADIRECTORY_ROOT);
if(!$success) {
$tmpl = new OC_Template( '', 'error', 'guest' );
- $tmpl->assign('errors',array(1=>array('error'=>"Can't create data directory (".$CONFIG_DATADIRECTORY_ROOT.")",'hint'=>"You can usually fix this by setting the owner of '".OC::$SERVERROOT."' to the user that the web server uses (".exec('whoami').")")));
+ $tmpl->assign('errors',array(1=>array('error'=>"Can't create data directory (".$CONFIG_DATADIRECTORY_ROOT.")",'hint'=>"You can usually fix this by setting the owner of '".OC::$SERVERROOT."' to the user that the web server uses (".OC_Util::checkWebserverUser().")")));
$tmpl->printPage();
exit;
}
@@ -208,28 +208,21 @@ class OC_Util {
}
$CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" );
$CONFIG_DBNAME = OC_Config::getValue( "dbname", "owncloud" );
-
- //try to get the username the httpd server runs on, used in hints
- $stat=stat($_SERVER['DOCUMENT_ROOT']);
- if(is_callable('posix_getpwuid')){
- $serverUser=posix_getpwuid($stat['uid']);
- $serverUser='\''.$serverUser['name'].'\'';
- }else{
- $serverUser='\'www-data\' for ubuntu/debian';//TODO: try to detect the distro and give a guess based on that
- }
+ $serverUser=OC_Util::checkWebserverUser();
//common hint for all file permissons error messages
$permissionsHint="Permissions can usually be fixed by setting the owner of the file or directory to the user the web server runs as ($serverUser)";
//check for correct file permissions
if(!stristr(PHP_OS, 'WIN')){
+ $permissionsModHint="Please change the permissions to 0770 so that the directory cannot be listed by other users.";
$prems=substr(decoct(@fileperms($CONFIG_DATADIRECTORY_ROOT)),-3);
if(substr($prems,-1)!='0'){
OC_Helper::chmodr($CONFIG_DATADIRECTORY_ROOT,0770);
clearstatcache();
$prems=substr(decoct(@fileperms($CONFIG_DATADIRECTORY_ROOT)),-3);
if(substr($prems,2,1)!='0'){
- $errors[]=array('error'=>'Data directory ('.$CONFIG_DATADIRECTORY_ROOT.') is readable from the web<br/>','hint'=>$permissionsHint);
+ $errors[]=array('error'=>'Data directory ('.$CONFIG_DATADIRECTORY_ROOT.') is readable for other users<br/>','hint'=>$permissionsModHint);
}
}
if( OC_Config::getValue( "enablebackup", false )){
@@ -239,7 +232,7 @@ class OC_Util {
clearstatcache();
$prems=substr(decoct(@fileperms($CONFIG_BACKUPDIRECTORY)),-3);
if(substr($prems,2,1)!='0'){
- $errors[]=array('error'=>'Data directory ('.$CONFIG_BACKUPDIRECTORY.') is readable from the web<br/>','hint'=>$permissionsHint);
+ $errors[]=array('error'=>'Data directory ('.$CONFIG_BACKUPDIRECTORY.') is readable for other users<br/>','hint'=>$permissionsModHint);
}
}
}
@@ -250,11 +243,39 @@ class OC_Util {
$errors[]=array('error'=>'Data directory ('.$CONFIG_DATADIRECTORY_ROOT.') not writable by ownCloud<br/>','hint'=>$permissionsHint);
}
- //TODO: check for php modules
+ // check if all required php modules are present
+ if(!class_exists('ZipArchive')){
+ $errors[]=array('error'=>'PHP module ZipArchive not installed.<br/>','hint'=>'Please ask your server administrator to install the module.');
+ }
+
+ if(!function_exists('mb_detect_encoding')){
+ $errors[]=array('error'=>'PHP module mb multibyte not installed.<br/>','hint'=>'Please ask your server administrator to install the module.');
+ }
+ if(!function_exists('ctype_digit')){
+ $errors[]=array('error'=>'PHP module ctype is not installed.<br/>','hint'=>'Please ask your server administrator to install the module.');
+ }
return $errors;
}
+
+ /**
+ * Try to get the username the httpd server runs on, used in hints
+ */
+ public static function checkWebserverUser(){
+ $stat=stat($_SERVER['DOCUMENT_ROOT']);
+ if(is_callable('posix_getpwuid')){
+ $serverUser=posix_getpwuid($stat['uid']);
+ $serverUser='\''.$serverUser['name'].'\'';
+ }elseif(exec('whoami')){
+ $serverUser=exec('whoami');
+ }else{
+ $serverUser='\'www-data\' for ubuntu/debian'; //TODO: try to detect the distro and give a guess based on that
+ }
+ return $serverUser;
+ }
+
+
/**
* Check if the user is logged in, redirects to home if not
*/