Пример #1
0
/**
 * @param $key
 * @return string url to the online documentation
 */
function link_to_docs($key)
{
    return OC_Helper::linkToDocs($key);
}
Пример #2
0
	/**
	 * check if the current server configuration is suitable for ownCloud
	 *
	 * @param \OCP\IConfig $config
	 * @return array arrays with error messages and hints
	 */
	public static function checkServer(\OCP\IConfig $config) {
		$l = \OC::$server->getL10N('lib');
		$errors = array();
		$CONFIG_DATADIRECTORY = $config->getSystemValue('datadirectory', OC::$SERVERROOT . '/data');

		if (!self::needUpgrade($config) && $config->getSystemValue('installed', false)) {
			// this check needs to be done every time
			$errors = self::checkDataDirectoryValidity($CONFIG_DATADIRECTORY);
		}

		// Assume that if checkServer() succeeded before in this session, then all is fine.
		if (\OC::$server->getSession()->exists('checkServer_succeeded') && \OC::$server->getSession()->get('checkServer_succeeded')) {
			return $errors;
		}

		$webServerRestart = false;
		$setup = new OC_Setup($config);
		$availableDatabases = $setup->getSupportedDatabases();
		if (empty($availableDatabases)) {
			$errors[] = array(
				'error' => $l->t('No database drivers (sqlite, mysql, or postgresql) installed.'),
				'hint' => '' //TODO: sane hint
			);
			$webServerRestart = true;
		}

		//common hint for all file permissions error messages
		$permissionsHint = $l->t('Permissions can usually be fixed by '
			. '%sgiving the webserver write access to the root directory%s.',
			array('<a href="' . \OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">', '</a>'));

		// Check if config folder is writable.
		if (!is_writable(OC::$configDir) or !is_readable(OC::$configDir)) {
			$errors[] = array(
				'error' => $l->t('Cannot write into "config" directory'),
				'hint' => $l->t('This can usually be fixed by '
					. '%sgiving the webserver write access to the config directory%s.',
					array('<a href="' . \OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">', '</a>'))
			);
		}

		// Check if there is a writable install folder.
		if ($config->getSystemValue('appstoreenabled', true)) {
			if (OC_App::getInstallPath() === null
				|| !is_writable(OC_App::getInstallPath())
				|| !is_readable(OC_App::getInstallPath())
			) {
				$errors[] = array(
					'error' => $l->t('Cannot write into "apps" directory'),
					'hint' => $l->t('This can usually be fixed by '
						. '%sgiving the webserver write access to the apps directory%s'
						. ' or disabling the appstore in the config file.',
						array('<a href="' . \OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">', '</a>'))
				);
			}
		}
		// Create root dir.
		if ($config->getSystemValue('installed', false)) {
			if (!is_dir($CONFIG_DATADIRECTORY)) {
				$success = @mkdir($CONFIG_DATADIRECTORY);
				if ($success) {
					$errors = array_merge($errors, self::checkDataDirectoryPermissions($CONFIG_DATADIRECTORY));
				} else {
					$errors[] = array(
						'error' => $l->t('Cannot create "data" directory (%s)', array($CONFIG_DATADIRECTORY)),
						'hint' => $l->t('This can usually be fixed by '
							. '<a href="%s" target="_blank">giving the webserver write access to the root directory</a>.',
							array(OC_Helper::linkToDocs('admin-dir_permissions')))
					);
				}
			} else if (!is_writable($CONFIG_DATADIRECTORY) or !is_readable($CONFIG_DATADIRECTORY)) {
				$errors[] = array(
					'error' => 'Data directory (' . $CONFIG_DATADIRECTORY . ') not writable by ownCloud',
					'hint' => $permissionsHint
				);
			} else {
				$errors = array_merge($errors, self::checkDataDirectoryPermissions($CONFIG_DATADIRECTORY));
			}
		}

		if (!OC_Util::isSetLocaleWorking()) {
			$errors[] = array(
				'error' => $l->t('Setting locale to %s failed',
					array('en_US.UTF-8/fr_FR.UTF-8/es_ES.UTF-8/de_DE.UTF-8/ru_RU.UTF-8/'
						. 'pt_BR.UTF-8/it_IT.UTF-8/ja_JP.UTF-8/zh_CN.UTF-8')),
				'hint' => $l->t('Please install one of these locales on your system and restart your webserver.')
			);
		}

		// Contains the dependencies that should be checked against
		// classes = class_exists
		// functions = function_exists
		// defined = defined
		// If the dependency is not found the missing module name is shown to the EndUser
		$dependencies = array(
			'classes' => array(
				'ZipArchive' => 'zip',
				'DOMDocument' => 'dom',
				'XMLWriter' => 'XMLWriter'
			),
			'functions' => array(
				'xml_parser_create' => 'libxml',
				'mb_detect_encoding' => 'mb multibyte',
				'ctype_digit' => 'ctype',
				'json_encode' => 'JSON',
				'gd_info' => 'GD',
				'gzencode' => 'zlib',
				'iconv' => 'iconv',
				'simplexml_load_string' => 'SimpleXML',
				'hash' => 'HASH Message Digest Framework'
			),
			'defined' => array(
				'PDO::ATTR_DRIVER_NAME' => 'PDO'
			)
		);
		$missingDependencies = array();
		$moduleHint = $l->t('Please ask your server administrator to install the module.');

		foreach ($dependencies['classes'] as $class => $module) {
			if (!class_exists($class)) {
				$missingDependencies[] = $module;
			}
		}
		foreach ($dependencies['functions'] as $function => $module) {
			if (!function_exists($function)) {
				$missingDependencies[] = $module;
			}
		}
		foreach ($dependencies['defined'] as $defined => $module) {
			if (!defined($defined)) {
				$missingDependencies[] = $module;
			}
		}

		foreach($missingDependencies as $missingDependency) {
			$errors[] = array(
				'error' => $l->t('PHP module %s not installed.', array($missingDependency)),
				'hint' => $moduleHint
			);
			$webServerRestart = true;
		}

		if (version_compare(phpversion(), '5.4.0', '<')) {
			$errors[] = array(
				'error' => $l->t('PHP %s or higher is required.', '5.4.0'),
				'hint' => $l->t('Please ask your server administrator to update PHP to the latest version.'
					. ' Your PHP version is no longer supported by ownCloud and the PHP community.')
			);
			$webServerRestart = true;
		}

		/**
		 * PHP 5.6 ships with a PHP setting which throws notices by default for a
		 * lot of endpoints. Thus we need to ensure that the value is set to -1
		 *
		 * FIXME: Due to https://github.com/owncloud/core/pull/13593#issuecomment-71178078
		 * this check is disabled for HHVM at the moment. This should get re-evaluated
		 * at a later point.
		 *
		 * @link https://github.com/owncloud/core/issues/13592
		 */
		if(version_compare(phpversion(), '5.6.0', '>=') &&
			!self::runningOnHhvm() &&
			\OC::$server->getIniWrapper()->getNumeric('always_populate_raw_post_data') !== -1) {
			$errors[] = array(
				'error' => $l->t('PHP is configured to populate raw post data. Since PHP 5.6 this will lead to PHP throwing notices for perfectly valid code.'),
				'hint' => $l->t('To fix this issue set <code>always_populate_raw_post_data</code> to <code>-1</code> in your php.ini')
			);
		}

		if (!self::isAnnotationsWorking()) {
			$errors[] = array(
				'error' => $l->t('PHP is apparently setup to strip inline doc blocks. This will make several core apps inaccessible.'),
				'hint' => $l->t('This is probably caused by a cache/accelerator such as Zend OPcache or eAccelerator.')
			);
		}

		if ($webServerRestart) {
			$errors[] = array(
				'error' => $l->t('PHP modules have been installed, but they are still listed as missing?'),
				'hint' => $l->t('Please ask your server administrator to restart the web server.')
			);
		}

		$errors = array_merge($errors, self::checkDatabaseVersion());

		// Cache the result of this function
		\OC::$server->getSession()->set('checkServer_succeeded', count($errors) == 0);

		return $errors;
	}
Пример #3
0
 /**
  * check if the current server configuration is suitable for ownCloud
  *
  * @return array arrays with error messages and hints
  */
 public static function checkServer()
 {
     $l = \OC::$server->getL10N('lib');
     $errors = array();
     $CONFIG_DATADIRECTORY = OC_Config::getValue('datadirectory', OC::$SERVERROOT . '/data');
     if (!self::needUpgrade() && OC_Config::getValue('installed', false)) {
         // this check needs to be done every time
         $errors = self::checkDataDirectoryValidity($CONFIG_DATADIRECTORY);
     }
     // Assume that if checkServer() succeeded before in this session, then all is fine.
     if (\OC::$server->getSession()->exists('checkServer_succeeded') && \OC::$server->getSession()->get('checkServer_succeeded')) {
         return $errors;
     }
     $webServerRestart = false;
     //check for database drivers
     if (!(is_callable('sqlite_open') or class_exists('SQLite3')) and !is_callable('mysql_connect') and !is_callable('pg_connect') and !is_callable('oci_connect')) {
         $errors[] = array('error' => $l->t('No database drivers (sqlite, mysql, or postgresql) installed.'), 'hint' => '');
         $webServerRestart = true;
     }
     //common hint for all file permissions error messages
     $permissionsHint = $l->t('Permissions can usually be fixed by ' . '%sgiving the webserver write access to the root directory%s.', array('<a href="' . \OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">', '</a>'));
     // Check if config folder is writable.
     if (!is_writable(OC::$configDir) or !is_readable(OC::$configDir)) {
         $errors[] = array('error' => $l->t('Cannot write into "config" directory'), 'hint' => $l->t('This can usually be fixed by ' . '%sgiving the webserver write access to the config directory%s.', array('<a href="' . \OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">', '</a>')));
     }
     // Check if there is a writable install folder.
     if (OC_Config::getValue('appstoreenabled', true)) {
         if (OC_App::getInstallPath() === null || !is_writable(OC_App::getInstallPath()) || !is_readable(OC_App::getInstallPath())) {
             $errors[] = array('error' => $l->t('Cannot write into "apps" directory'), 'hint' => $l->t('This can usually be fixed by ' . '%sgiving the webserver write access to the apps directory%s' . ' or disabling the appstore in the config file.', array('<a href="' . \OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">', '</a>')));
         }
     }
     // Create root dir.
     if (!is_dir($CONFIG_DATADIRECTORY)) {
         $success = @mkdir($CONFIG_DATADIRECTORY);
         if ($success) {
             $errors = array_merge($errors, self::checkDataDirectoryPermissions($CONFIG_DATADIRECTORY));
         } else {
             $errors[] = array('error' => $l->t('Cannot create "data" directory (%s)', array($CONFIG_DATADIRECTORY)), 'hint' => $l->t('This can usually be fixed by ' . '<a href="%s" target="_blank">giving the webserver write access to the root directory</a>.', array(OC_Helper::linkToDocs('admin-dir_permissions'))));
         }
     } else {
         if (!is_writable($CONFIG_DATADIRECTORY) or !is_readable($CONFIG_DATADIRECTORY)) {
             $errors[] = array('error' => 'Data directory (' . $CONFIG_DATADIRECTORY . ') not writable by ownCloud', 'hint' => $permissionsHint);
         } else {
             $errors = array_merge($errors, self::checkDataDirectoryPermissions($CONFIG_DATADIRECTORY));
         }
     }
     if (!OC_Util::isSetLocaleWorking()) {
         $errors[] = array('error' => $l->t('Setting locale to %s failed', array('en_US.UTF-8/fr_FR.UTF-8/es_ES.UTF-8/de_DE.UTF-8/ru_RU.UTF-8/' . 'pt_BR.UTF-8/it_IT.UTF-8/ja_JP.UTF-8/zh_CN.UTF-8')), 'hint' => $l->t('Please install one of these locales on your system and restart your webserver.'));
     }
     // Contains the dependencies that should be checked against
     // classes = class_exists
     // functions = function_exists
     // defined = defined
     // If the dependency is not found the missing module name is shown to the EndUser
     $dependencies = array('classes' => array('ZipArchive' => 'zip', 'DOMDocument' => 'dom'), 'functions' => array('xml_parser_create' => 'libxml', 'mb_detect_encoding' => 'mb multibyte', 'ctype_digit' => 'ctype', 'json_encode' => 'JSON', 'gd_info' => 'GD', 'gzencode' => 'zlib', 'iconv' => 'iconv', 'simplexml_load_string' => 'SimpleXML'), 'defined' => array('PDO::ATTR_DRIVER_NAME' => 'PDO'));
     $missingDependencies = array();
     $moduleHint = $l->t('Please ask your server administrator to install the module.');
     foreach ($dependencies['classes'] as $class => $module) {
         if (!class_exists($class)) {
             $missingDependencies[] = $module;
         }
     }
     foreach ($dependencies['functions'] as $function => $module) {
         if (!function_exists($function)) {
             $missingDependencies[] = $module;
         }
     }
     foreach ($dependencies['defined'] as $defined => $module) {
         if (!defined($defined)) {
             $missingDependencies[] = $module;
         }
     }
     foreach ($missingDependencies as $missingDependency) {
         $errors[] = array('error' => $l->t('PHP module %s not installed.', array($missingDependency)), 'hint' => $moduleHint);
         $webServerRestart = true;
     }
     if (version_compare(phpversion(), '5.3.3', '<')) {
         $errors[] = array('error' => $l->t('PHP %s or higher is required.', '5.3.3'), 'hint' => $l->t('Please ask your server administrator to update PHP to the latest version.' . ' Your PHP version is no longer supported by ownCloud and the PHP community.'));
         $webServerRestart = true;
     }
     if (strtolower(@ini_get('safe_mode')) == 'on' || strtolower(@ini_get('safe_mode')) == 'yes' || strtolower(@ini_get('safe_mode')) == 'true' || ini_get("safe_mode") == 1) {
         $errors[] = array('error' => $l->t('PHP Safe Mode is enabled. ownCloud requires that it is disabled to work properly.'), 'hint' => $l->t('PHP Safe Mode is a deprecated and mostly useless setting that should be disabled. ' . 'Please ask your server administrator to disable it in php.ini or in your webserver config.'));
         $webServerRestart = true;
     }
     if (get_magic_quotes_gpc() == 1) {
         $errors[] = array('error' => $l->t('Magic Quotes is enabled. ownCloud requires that it is disabled to work properly.'), 'hint' => $l->t('Magic Quotes is a deprecated and mostly useless setting that should be disabled. ' . 'Please ask your server administrator to disable it in php.ini or in your webserver config.'));
         $webServerRestart = true;
     }
     if (!self::isAnnotationsWorking()) {
         $errors[] = array('error' => 'PHP is apparently setup to strip inline doc blocks. This will make several core apps inaccessible.', 'hint' => 'This is probably caused by a cache/accelerator such as Zend OPcache or eAccelerator.');
     }
     if ($webServerRestart) {
         $errors[] = array('error' => $l->t('PHP modules have been installed, but they are still listed as missing?'), 'hint' => $l->t('Please ask your server administrator to restart the web server.'));
     }
     $errors = array_merge($errors, self::checkDatabaseVersion());
     // Cache the result of this function
     \OC::$server->getSession()->set('checkServer_succeeded', count($errors) == 0);
     return $errors;
 }
Пример #4
0
 public static function checkConfig()
 {
     $l = \OC::$server->getL10N('lib');
     // Create config in case it does not already exists
     $configFilePath = self::$configDir . '/config.php';
     if (!file_exists($configFilePath)) {
         @touch($configFilePath);
     }
     // Check if config is writable
     $configFileWritable = is_writable($configFilePath);
     if (!$configFileWritable && !OC_Helper::isReadOnlyConfigEnabled() || !$configFileWritable && \OCP\Util::needUpgrade()) {
         if (self::$CLI) {
             echo $l->t('Cannot write into "config" directory!') . "\n";
             echo $l->t('This can usually be fixed by giving the webserver write access to the config directory') . "\n";
             echo "\n";
             echo $l->t('See %s', array(\OC_Helper::linkToDocs('admin-dir_permissions'))) . "\n";
             exit;
         } else {
             OC_Template::printErrorPage($l->t('Cannot write into "config" directory!'), $l->t('This can usually be fixed by ' . '%sgiving the webserver write access to the config directory%s.', array('<a href="' . \OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">', '</a>')));
         }
     }
 }
Пример #5
0
 /**
  * Writes the config file
  *
  * Saves the config to the config file.
  *
  * @throws HintException If the config file cannot be written to
  * @throws \Exception If no file lock can be acquired
  */
 private function writeData()
 {
     // Create a php file ...
     $content = "<?php\n";
     $content .= '$CONFIG = ';
     $content .= var_export($this->cache, true);
     $content .= ";\n";
     touch($this->configFilePath);
     $filePointer = fopen($this->configFilePath, 'r+');
     // Prevent others not to read the config
     chmod($this->configFilePath, 0640);
     // File does not exist, this can happen when doing a fresh install
     if (!is_resource($filePointer)) {
         $url = \OC_Helper::linkToDocs('admin-dir_permissions');
         throw new HintException("Can't write into config directory!", 'This can usually be fixed by ' . '<a href="' . $url . '" target="_blank">giving the webserver write access to the config directory</a>.');
     }
     // Try to acquire a file lock
     if (!flock($filePointer, LOCK_EX)) {
         throw new \Exception(sprintf('Could not acquire an exclusive lock on the config file %s', $this->configFilePath));
     }
     // Write the config and release the lock
     ftruncate($filePointer, 0);
     fwrite($filePointer, $content);
     fflush($filePointer);
     flock($filePointer, LOCK_UN);
     fclose($filePointer);
     // Try invalidating the opcache just for the file we wrote...
     if (!\OC_Util::deleteFromOpcodeCache($this->configFilePath)) {
         // But if that doesn't work, clear the whole cache.
         \OC_Util::clearOpcodeCache();
     }
 }
Пример #6
0
 /**
  * check if the current server configuration is suitable for ownCloud
  *
  * @param \OCP\IConfig $config
  * @return array arrays with error messages and hints
  */
 public static function checkServer(\OCP\IConfig $config)
 {
     $l = \OC::$server->getL10N('lib');
     $errors = array();
     $CONFIG_DATADIRECTORY = $config->getSystemValue('datadirectory', OC::$SERVERROOT . '/data');
     if (!self::needUpgrade($config) && $config->getSystemValue('installed', false)) {
         // this check needs to be done every time
         $errors = self::checkDataDirectoryValidity($CONFIG_DATADIRECTORY);
     }
     // Assume that if checkServer() succeeded before in this session, then all is fine.
     if (\OC::$server->getSession()->exists('checkServer_succeeded') && \OC::$server->getSession()->get('checkServer_succeeded')) {
         return $errors;
     }
     $webServerRestart = false;
     $setup = new \OC\Setup($config, \OC::$server->getIniWrapper(), \OC::$server->getL10N('lib'), new \OC_Defaults(), \OC::$server->getLogger(), \OC::$server->getSecureRandom());
     $availableDatabases = $setup->getSupportedDatabases();
     if (empty($availableDatabases)) {
         $errors[] = array('error' => $l->t('No database drivers (sqlite, mysql, or postgresql) installed.'), 'hint' => '');
         $webServerRestart = true;
     }
     // Check if server running on Windows platform
     if (OC_Util::runningOnWindows()) {
         $errors[] = ['error' => $l->t('Microsoft Windows Platform is not supported'), 'hint' => $l->t('Running ownCloud Server on the Microsoft Windows platform is not supported. We suggest you ' . 'use a Linux server in a virtual machine if you have no option for migrating the server itself. ' . 'Find Linux packages as well as easy to deploy virtual machine images on <a href="%s">%s</a>. ' . 'For migrating existing installations to Linux you can find some tips and a migration script ' . 'in <a href="%s">our documentation</a>.', ['https://owncloud.org/install/', 'owncloud.org/install/', 'https://owncloud.org/?p=8045'])];
     }
     // Check if config folder is writable.
     if (!is_writable(OC::$configDir) or !is_readable(OC::$configDir)) {
         $errors[] = array('error' => $l->t('Cannot write into "config" directory'), 'hint' => $l->t('This can usually be fixed by ' . '%sgiving the webserver write access to the config directory%s.', array('<a href="' . \OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">', '</a>')));
     }
     // Check if there is a writable install folder.
     if ($config->getSystemValue('appstoreenabled', true)) {
         if (OC_App::getInstallPath() === null || !is_writable(OC_App::getInstallPath()) || !is_readable(OC_App::getInstallPath())) {
             $errors[] = array('error' => $l->t('Cannot write into "apps" directory'), 'hint' => $l->t('This can usually be fixed by ' . '%sgiving the webserver write access to the apps directory%s' . ' or disabling the appstore in the config file.', array('<a href="' . \OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">', '</a>')));
         }
     }
     // Create root dir.
     if ($config->getSystemValue('installed', false)) {
         if (!is_dir($CONFIG_DATADIRECTORY)) {
             $success = @mkdir($CONFIG_DATADIRECTORY);
             if ($success) {
                 $errors = array_merge($errors, self::checkDataDirectoryPermissions($CONFIG_DATADIRECTORY));
             } else {
                 $errors[] = array('error' => $l->t('Cannot create "data" directory (%s)', array($CONFIG_DATADIRECTORY)), 'hint' => $l->t('This can usually be fixed by ' . '<a href="%s" target="_blank">giving the webserver write access to the root directory</a>.', array(OC_Helper::linkToDocs('admin-dir_permissions'))));
             }
         } else {
             if (!is_writable($CONFIG_DATADIRECTORY) or !is_readable($CONFIG_DATADIRECTORY)) {
                 //common hint for all file permissions error messages
                 $permissionsHint = $l->t('Permissions can usually be fixed by ' . '%sgiving the webserver write access to the root directory%s.', array('<a href="' . \OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">', '</a>'));
                 $errors[] = array('error' => 'Data directory (' . $CONFIG_DATADIRECTORY . ') not writable by ownCloud', 'hint' => $permissionsHint);
             } else {
                 $errors = array_merge($errors, self::checkDataDirectoryPermissions($CONFIG_DATADIRECTORY));
             }
         }
     }
     if (!OC_Util::isSetLocaleWorking()) {
         $errors[] = array('error' => $l->t('Setting locale to %s failed', array('en_US.UTF-8/fr_FR.UTF-8/es_ES.UTF-8/de_DE.UTF-8/ru_RU.UTF-8/' . 'pt_BR.UTF-8/it_IT.UTF-8/ja_JP.UTF-8/zh_CN.UTF-8')), 'hint' => $l->t('Please install one of these locales on your system and restart your webserver.'));
     }
     // Contains the dependencies that should be checked against
     // classes = class_exists
     // functions = function_exists
     // defined = defined
     // ini = ini_get
     // If the dependency is not found the missing module name is shown to the EndUser
     // When adding new checks always verify that they pass on Travis as well
     // for ini settings, see https://github.com/owncloud/administration/blob/master/travis-ci/custom.ini
     $dependencies = array('classes' => array('ZipArchive' => 'zip', 'DOMDocument' => 'dom', 'XMLWriter' => 'XMLWriter'), 'functions' => ['xml_parser_create' => 'libxml', 'mb_detect_encoding' => 'mb multibyte', 'ctype_digit' => 'ctype', 'json_encode' => 'JSON', 'gd_info' => 'GD', 'gzencode' => 'zlib', 'iconv' => 'iconv', 'simplexml_load_string' => 'SimpleXML', 'hash' => 'HASH Message Digest Framework', 'curl_init' => 'cURL'], 'defined' => array('PDO::ATTR_DRIVER_NAME' => 'PDO'), 'ini' => ['default_charset' => 'UTF-8']);
     $missingDependencies = array();
     $invalidIniSettings = [];
     $moduleHint = $l->t('Please ask your server administrator to install the module.');
     /**
      * FIXME: The dependency check does not work properly on HHVM on the moment
      *        and prevents installation. Once HHVM is more compatible with our
      *        approach to check for these values we should re-enable those
      *        checks.
      */
     $iniWrapper = \OC::$server->getIniWrapper();
     if (!self::runningOnHhvm()) {
         foreach ($dependencies['classes'] as $class => $module) {
             if (!class_exists($class)) {
                 $missingDependencies[] = $module;
             }
         }
         foreach ($dependencies['functions'] as $function => $module) {
             if (!function_exists($function)) {
                 $missingDependencies[] = $module;
             }
         }
         foreach ($dependencies['defined'] as $defined => $module) {
             if (!defined($defined)) {
                 $missingDependencies[] = $module;
             }
         }
         foreach ($dependencies['ini'] as $setting => $expected) {
             if (is_bool($expected)) {
                 if ($iniWrapper->getBool($setting) !== $expected) {
                     $invalidIniSettings[] = [$setting, $expected];
                 }
             }
             if (is_int($expected)) {
                 if ($iniWrapper->getNumeric($setting) !== $expected) {
                     $invalidIniSettings[] = [$setting, $expected];
                 }
             }
             if (is_string($expected)) {
                 if (strtolower($iniWrapper->getString($setting)) !== strtolower($expected)) {
                     $invalidIniSettings[] = [$setting, $expected];
                 }
             }
         }
     }
     foreach ($missingDependencies as $missingDependency) {
         $errors[] = array('error' => $l->t('PHP module %s not installed.', array($missingDependency)), 'hint' => $moduleHint);
         $webServerRestart = true;
     }
     foreach ($invalidIniSettings as $setting) {
         if (is_bool($setting[1])) {
             $setting[1] = $setting[1] ? 'on' : 'off';
         }
         $errors[] = ['error' => $l->t('PHP setting "%s" is not set to "%s".', [$setting[0], var_export($setting[1], true)]), 'hint' => $l->t('Adjusting this setting in php.ini will make ownCloud run again')];
         $webServerRestart = true;
     }
     /**
      * The mbstring.func_overload check can only be performed if the mbstring
      * module is installed as it will return null if the checking setting is
      * not available and thus a check on the boolean value fails.
      *
      * TODO: Should probably be implemented in the above generic dependency
      *       check somehow in the long-term.
      */
     if ($iniWrapper->getBool('mbstring.func_overload') !== null && $iniWrapper->getBool('mbstring.func_overload') === true) {
         $errors[] = array('error' => $l->t('mbstring.func_overload is set to "%s" instead of the expected value "0"', [$iniWrapper->getString('mbstring.func_overload')]), 'hint' => $l->t('To fix this issue set <code>mbstring.func_overload</code> to <code>0</code> in your php.ini'));
     }
     if (!self::isAnnotationsWorking()) {
         $errors[] = array('error' => $l->t('PHP is apparently set up to strip inline doc blocks. This will make several core apps inaccessible.'), 'hint' => $l->t('This is probably caused by a cache/accelerator such as Zend OPcache or eAccelerator.'));
     }
     if (!\OC::$CLI && $webServerRestart) {
         $errors[] = array('error' => $l->t('PHP modules have been installed, but they are still listed as missing?'), 'hint' => $l->t('Please ask your server administrator to restart the web server.'));
     }
     $errors = array_merge($errors, self::checkDatabaseVersion());
     // Cache the result of this function
     \OC::$server->getSession()->set('checkServer_succeeded', count($errors) == 0);
     return $errors;
 }
<div class="ldapSettingControls">
	<input class="ldap_submit" value="<?php 
p($l->t('Save'));
?>
" type="submit">
	<button type="button" class="ldap_action_test_connection" name="ldap_action_test_connection">
		<?php 
p($l->t('Test Configuration'));
?>
	</button>
	<a href="<?php 
p(\OC_Helper::linkToDocs('admin-ldap'));
?>
"
		target="_blank">
		<img src="<?php 
print_unescaped(OCP\Util::imagePath('', 'actions/info.png'));
?>
"
			style="height:1.75ex" />
		<?php 
p($l->t('Help'));
?>
	</a>
</div>
Пример #8
0
 public static function checkConfig()
 {
     $l = \OC::$server->getL10N('lib');
     if (file_exists(self::$configDir . "/config.php") and !is_writable(self::$configDir . "/config.php")) {
         if (self::$CLI) {
             echo $l->t('Cannot write into "config" directory!') . "\n";
             echo $l->t('This can usually be fixed by giving the webserver write access to the config directory') . "\n";
             echo "\n";
             echo $l->t('See %s', array(\OC_Helper::linkToDocs('admin-dir_permissions'))) . "\n";
             exit;
         } else {
             OC_Template::printErrorPage($l->t('Cannot write into "config" directory!'), $l->t('This can usually be fixed by ' . '%sgiving the webserver write access to the config directory%s.', array('<a href="' . \OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">', '</a>')));
         }
     }
 }
Пример #9
0
 /**
  * @brief check if the current server configuration is suitable for ownCloud
  * @return array arrays with error messages and hints
  */
 public static function checkServer()
 {
     $errors = array();
     $CONFIG_DATADIRECTORY = OC_Config::getValue('datadirectory', OC::$SERVERROOT . '/data');
     if (!\OC::needUpgrade() && OC_Config::getValue('installed', false)) {
         // this check needs to be done every time
         $errors = self::checkDataDirectoryValidity($CONFIG_DATADIRECTORY);
     }
     // Assume that if checkServer() succeeded before in this session, then all is fine.
     if (\OC::$session->exists('checkServer_suceeded') && \OC::$session->get('checkServer_suceeded')) {
         return $errors;
     }
     $defaults = new \OC_Defaults();
     $webServerRestart = false;
     //check for database drivers
     if (!(is_callable('sqlite_open') or class_exists('SQLite3')) and !is_callable('mysql_connect') and !is_callable('pg_connect') and !is_callable('oci_connect')) {
         $errors[] = array('error' => 'No database drivers (sqlite, mysql, or postgresql) installed.', 'hint' => '');
         $webServerRestart = true;
     }
     //common hint for all file permissions error messages
     $permissionsHint = 'Permissions can usually be fixed by ' . '<a href="' . OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">giving the webserver write access to the root directory</a>.';
     // Check if config folder is writable.
     if (!is_writable(OC::$SERVERROOT . "/config/") or !is_readable(OC::$SERVERROOT . "/config/")) {
         $errors[] = array('error' => "Can't write into config directory", 'hint' => 'This can usually be fixed by ' . '<a href="' . OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">giving the webserver write access to the config directory</a>.');
     }
     // Check if there is a writable install folder.
     if (OC_Config::getValue('appstoreenabled', true)) {
         if (OC_App::getInstallPath() === null || !is_writable(OC_App::getInstallPath()) || !is_readable(OC_App::getInstallPath())) {
             $errors[] = array('error' => "Can't write into apps directory", 'hint' => 'This can usually be fixed by ' . '<a href="' . OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">giving the webserver write access to the apps directory</a> ' . 'or disabling the appstore in the config file.');
         }
     }
     // Create root dir.
     if (!is_dir($CONFIG_DATADIRECTORY)) {
         $success = @mkdir($CONFIG_DATADIRECTORY);
         if ($success) {
             $errors = array_merge($errors, self::checkDataDirectoryPermissions($CONFIG_DATADIRECTORY));
         } else {
             $errors[] = array('error' => "Can't create data directory (" . $CONFIG_DATADIRECTORY . ")", 'hint' => 'This can usually be fixed by ' . '<a href="' . OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">giving the webserver write access to the root directory</a>.');
         }
     } else {
         if (!is_writable($CONFIG_DATADIRECTORY) or !is_readable($CONFIG_DATADIRECTORY)) {
             $errors[] = array('error' => 'Data directory (' . $CONFIG_DATADIRECTORY . ') not writable by ownCloud', 'hint' => $permissionsHint);
         } else {
             $errors = array_merge($errors, self::checkDataDirectoryPermissions($CONFIG_DATADIRECTORY));
         }
     }
     if (!OC_Util::isSetLocaleWorking()) {
         $errors[] = array('error' => 'Setting locale to en_US.UTF-8/fr_FR.UTF-8/es_ES.UTF-8/de_DE.UTF-8/ru_RU.UTF-8/pt_BR.UTF-8/it_IT.UTF-8/ja_JP.UTF-8/zh_CN.UTF-8 failed', 'hint' => 'Please install one of theses locales on your system and restart your webserver.');
     }
     $moduleHint = "Please ask your server administrator to install the module.";
     // check if all required php modules are present
     if (!class_exists('ZipArchive')) {
         $errors[] = array('error' => 'PHP module zip not installed.', 'hint' => $moduleHint);
         $webServerRestart = true;
     }
     if (!class_exists('DOMDocument')) {
         $errors[] = array('error' => 'PHP module dom not installed.', 'hint' => $moduleHint);
         $webServerRestart = true;
     }
     if (!function_exists('xml_parser_create')) {
         $errors[] = array('error' => 'PHP module libxml not installed.', 'hint' => $moduleHint);
         $webServerRestart = true;
     }
     if (!function_exists('mb_detect_encoding')) {
         $errors[] = array('error' => 'PHP module mb multibyte not installed.', 'hint' => $moduleHint);
         $webServerRestart = true;
     }
     if (!function_exists('ctype_digit')) {
         $errors[] = array('error' => 'PHP module ctype is not installed.', 'hint' => $moduleHint);
         $webServerRestart = true;
     }
     if (!function_exists('json_encode')) {
         $errors[] = array('error' => 'PHP module JSON is not installed.', 'hint' => $moduleHint);
         $webServerRestart = true;
     }
     if (!extension_loaded('gd') || !function_exists('gd_info')) {
         $errors[] = array('error' => 'PHP module GD is not installed.', 'hint' => $moduleHint);
         $webServerRestart = true;
     }
     if (!function_exists('gzencode')) {
         $errors[] = array('error' => 'PHP module zlib is not installed.', 'hint' => $moduleHint);
         $webServerRestart = true;
     }
     if (!function_exists('iconv')) {
         $errors[] = array('error' => 'PHP module iconv is not installed.', 'hint' => $moduleHint);
         $webServerRestart = true;
     }
     if (!function_exists('simplexml_load_string')) {
         $errors[] = array('error' => 'PHP module SimpleXML is not installed.', 'hint' => $moduleHint);
         $webServerRestart = true;
     }
     if (version_compare(phpversion(), '5.3.3', '<')) {
         $errors[] = array('error' => 'PHP 5.3.3 or higher is required.', 'hint' => 'Please ask your server administrator to update PHP to the latest version.' . ' Your PHP version is no longer supported by ownCloud and the PHP community.');
         $webServerRestart = true;
     }
     if (!defined('PDO::ATTR_DRIVER_NAME')) {
         $errors[] = array('error' => 'PHP PDO module is not installed.', 'hint' => $moduleHint);
         $webServerRestart = true;
     }
     if (strtolower(@ini_get('safe_mode')) == 'on' || strtolower(@ini_get('safe_mode')) == 'yes' || strtolower(@ini_get('safe_mode')) == 'true' || ini_get("safe_mode") == 1) {
         $errors[] = array('error' => 'PHP Safe Mode is enabled. ownCloud requires that it is disabled to work properly.', 'hint' => 'PHP Safe Mode is a deprecated and mostly useless setting that should be disabled. ' . 'Please ask your server administrator to disable it in php.ini or in your webserver config.');
         $webServerRestart = true;
     }
     if (get_magic_quotes_gpc() == 1) {
         $errors[] = array('error' => 'Magic Quotes is enabled. ownCloud requires that it is disabled to work properly.', 'hint' => 'Magic Quotes is a deprecated and mostly useless setting that should be disabled. ' . 'Please ask your server administrator to disable it in php.ini or in your webserver config.');
         $webServerRestart = true;
     }
     if ($webServerRestart) {
         $errors[] = array('error' => 'PHP modules have been installed, but they are still listed as missing?', 'hint' => 'Please ask your server administrator to restart the web server.');
     }
     $errors = array_merge($errors, self::checkDatabaseVersion());
     // Cache the result of this function
     \OC::$session->set('checkServer_suceeded', count($errors) == 0);
     return $errors;
 }
Пример #10
0
?>

<div id="postsetupchecks" class="section">
	<h2><?php 
p($l->t('Connectivity Checks'));
?>
</h2>
	<div class="loading"></div>
	<div class="success hidden"><?php 
p($l->t('No problems found'));
?>
</div>
	<div class="errors hidden"></div>
	<div class="hint hidden">
		<span class="setupwarning"><?php 
print_unescaped($l->t('Please double check the <a href=\'%s\'>installation guides</a>.', \OC_Helper::linkToDocs('admin-install')));
?>
</span>
	</div>
</div>

<?php 
foreach ($_['forms'] as $form) {
    print_unescaped($form);
}
?>

<div class="section" id="backgroundjobs">
	<h2 class="inlineblock"><?php 
p($l->t('Cron'));
?>
Пример #11
0
 /**
  * @brief Post installation checks
  */
 public static function postSetupCheck($params)
 {
     // setup was successful -> webdav testing now
     $l = self::getTrans();
     if (OC_Util::isWebDAVWorking()) {
         header("Location: " . OC::$WEBROOT . '/');
     } else {
         $error = $l->t('Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken.');
         $hint = $l->t('Please double check the <a href=\'%s\'>installation guides</a>.', \OC_Helper::linkToDocs('admin-install'));
         OC_Template::printErrorPage($error, $hint);
         exit;
     }
 }
Пример #12
0
 /**
  * Read all app metadata from the info.xml file
  *
  * @param string $appId id of the app or the path of the info.xml file
  * @param boolean $path (optional)
  * @return array|null
  * @note all data is read from info.xml, not just pre-defined fields
  */
 public static function getAppInfo($appId, $path = false)
 {
     if ($path) {
         $file = $appId;
     } else {
         if (isset(self::$appInfo[$appId])) {
             return self::$appInfo[$appId];
         }
         $file = self::getAppPath($appId) . '/appinfo/info.xml';
     }
     $data = array();
     if (!file_exists($file)) {
         return null;
     }
     $content = @file_get_contents($file);
     if (!$content) {
         return null;
     }
     $xml = new SimpleXMLElement($content);
     $data['info'] = array();
     $data['remote'] = array();
     $data['public'] = array();
     foreach ($xml->children() as $child) {
         /**
          * @var $child SimpleXMLElement
          */
         if ($child->getName() == 'remote') {
             foreach ($child->children() as $remote) {
                 /**
                  * @var $remote SimpleXMLElement
                  */
                 $data['remote'][$remote->getName()] = (string) $remote;
             }
         } elseif ($child->getName() == 'public') {
             foreach ($child->children() as $public) {
                 /**
                  * @var $public SimpleXMLElement
                  */
                 $data['public'][$public->getName()] = (string) $public;
             }
         } elseif ($child->getName() == 'types') {
             $data['types'] = array();
             foreach ($child->children() as $type) {
                 /**
                  * @var $type SimpleXMLElement
                  */
                 $data['types'][] = $type->getName();
             }
         } elseif ($child->getName() == 'description') {
             $xml = (string) $child->asXML();
             $data[$child->getName()] = substr($xml, 13, -14);
             //script <description> tags
         } elseif ($child->getName() == 'documentation') {
             foreach ($child as $subChild) {
                 $url = (string) $subChild;
                 // If it is not an absolute URL we assume it is a key
                 // i.e. admin-ldap will get converted to go.php?to=admin-ldap
                 if (!\OC::$server->getHTTPHelper()->isHTTPURL($url)) {
                     $url = OC_Helper::linkToDocs($url);
                 }
                 $data["documentation"][$subChild->getName()] = $url;
             }
         } else {
             $data[$child->getName()] = (string) $child;
         }
     }
     self::$appInfo[$appId] = $data;
     return $data;
 }
Пример #13
0
 public static function checkConfig()
 {
     if (file_exists(OC::$SERVERROOT . "/config/config.php") and !is_writable(OC::$SERVERROOT . "/config/config.php")) {
         $defaults = new OC_Defaults();
         if (self::$CLI) {
             echo "Can't write into config directory!\n";
             echo "This can usually be fixed by giving the webserver write access to the config directory\n";
             echo "\n";
             echo "See " . \OC_Helper::linkToDocs('admin-dir_permissions') . "\n";
             exit;
         } else {
             OC_Template::printErrorPage("Can't write into config directory!", 'This can usually be fixed by ' . '<a href="' . \OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">giving the webserver write access to the config directory</a>.');
         }
     }
 }
Пример #14
0
 /**
  * @brief Writes the config file
  *
  * Saves the config to the config file.
  *
  */
 private function writeData()
 {
     // Create a php file ...
     $content = "<?php\n";
     if ($this->debugMode) {
         $content .= "define('DEBUG',true);\n";
     }
     $content .= '$CONFIG = ';
     $content .= var_export($this->cache, true);
     $content .= ";\n";
     // Write the file
     $result = @file_put_contents($this->configFilename, $content);
     if (!$result) {
         $defaults = new \OC_Defaults();
         $url = \OC_Helper::linkToDocs('admin-dir-permissions');
         throw new HintException("Can't write into config directory!", 'This can usually be fixed by ' . '<a href="' . $url . '" target="_blank">giving the webserver write access to the config directory</a>.');
     }
     // Prevent others not to read the config
     @chmod($this->configFilename, 0640);
     \OC_Util::clearOpcodeCache();
 }