Browse Source

more strings to translate in utils also some fixes in defaults

tags/v7.0.0RC1
Volkan Gezer 10 years ago
parent
commit
ae68a773c0
3 changed files with 72 additions and 60 deletions
  1. 8
    6
      lib/base.php
  2. 5
    2
      lib/private/defaults.php
  3. 59
    52
      lib/private/util.php

+ 8
- 6
lib/base.php View File

} }


public static function checkConfig() { public static function checkConfig() {
$l = OC_L10N::get('lib');
if (file_exists(self::$configDir . "/config.php") if (file_exists(self::$configDir . "/config.php")
and !is_writable(self::$configDir . "/config.php") and !is_writable(self::$configDir . "/config.php")
) { ) {
if (self::$CLI) { 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 $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 "\n";
echo "See " . \OC_Helper::linkToDocs('admin-dir_permissions') . "\n";
echo $l->t('See %s', array(\OC_Helper::linkToDocs('admin-dir_permissions')))."\n";
exit; exit;
} else { } else {
OC_Template::printErrorPage( 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>.'
$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
- 2
lib/private/defaults.php View File

private $defaultBaseUrl; private $defaultBaseUrl;
private $defaultSyncClientUrl; private $defaultSyncClientUrl;
private $defaultDocBaseUrl; private $defaultDocBaseUrl;
private $defaultDocVersion;
private $defaultSlogan; private $defaultSlogan;
private $defaultLogoClaim; private $defaultLogoClaim;
private $defaultMailHeaderColor; private $defaultMailHeaderColor;


function __construct() { function __construct() {
$this->l = OC_L10N::get('core');
$this->l = OC_L10N::get('lib');
$version = OC_Util::getVersion();


$this->defaultEntity = "ownCloud"; /* e.g. company name, used for footers and copyright notices */ $this->defaultEntity = "ownCloud"; /* e.g. company name, used for footers and copyright notices */
$this->defaultName = "ownCloud"; /* short name, used when referring to the software */ $this->defaultName = "ownCloud"; /* short name, used when referring to the software */
$this->defaultBaseUrl = "https://owncloud.org"; $this->defaultBaseUrl = "https://owncloud.org";
$this->defaultSyncClientUrl = "https://owncloud.org/sync-clients/"; $this->defaultSyncClientUrl = "https://owncloud.org/sync-clients/";
$this->defaultDocBaseUrl = "http://doc.owncloud.org"; $this->defaultDocBaseUrl = "http://doc.owncloud.org";
$this->defaultDocVersion = $version[0] . ".0"; // used to generate doc links
$this->defaultSlogan = $this->l->t("web services under your control"); $this->defaultSlogan = $this->l->t("web services under your control");
$this->defaultLogoClaim = ""; $this->defaultLogoClaim = "";
$this->defaultMailHeaderColor = "#1d2d44"; /* header color of mail notifications */ $this->defaultMailHeaderColor = "#1d2d44"; /* header color of mail notifications */
if ($this->themeExist('buildDocLinkToKey')) { if ($this->themeExist('buildDocLinkToKey')) {
return $this->theme->buildDocLinkToKey($key); return $this->theme->buildDocLinkToKey($key);
} }
return $this->getDocBaseUrl() . '/server/6.0/go.php?to=' . $key;
return $this->getDocBaseUrl() . '/server/' . $this->defaultDocVersion . '/go.php?to=' . $key;
} }


/** /**

+ 59
- 52
lib/private/util.php View File

* @return array arrays with error messages and hints * @return array arrays with error messages and hints
*/ */
public static function checkServer() { public static function checkServer() {
$l = OC_L10N::get('lib');
$errors = array(); $errors = array();
$CONFIG_DATADIRECTORY = OC_Config::getValue('datadirectory', OC::$SERVERROOT . '/data'); $CONFIG_DATADIRECTORY = OC_Config::getValue('datadirectory', OC::$SERVERROOT . '/data');


and !is_callable('pg_connect') and !is_callable('pg_connect')
and !is_callable('oci_connect')) { and !is_callable('oci_connect')) {
$errors[] = array( $errors[] = array(
'error'=>'No database drivers (sqlite, mysql, or postgresql) installed.',
'error'=> $l->t('No database drivers (sqlite, mysql, or postgresql) installed.'),
'hint'=>'' //TODO: sane hint 'hint'=>'' //TODO: sane hint
); );
$webServerRestart = true; $webServerRestart = true;
} }


//common hint for all file permissions error messages //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>.';
$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. // Check if config folder is writable.
if(!is_writable(OC::$configDir) or !is_readable(OC::$configDir)) { if(!is_writable(OC::$configDir) or !is_readable(OC::$configDir)) {
$errors[] = array( $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>.'
'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>'))
); );
} }


|| !is_writable(OC_App::getInstallPath()) || !is_writable(OC_App::getInstallPath())
|| !is_readable(OC_App::getInstallPath()) ) { || !is_readable(OC_App::getInstallPath()) ) {
$errors[] = array( $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.'
'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>'))
); );
} }
} }
$errors = array_merge($errors, self::checkDataDirectoryPermissions($CONFIG_DATADIRECTORY)); $errors = array_merge($errors, self::checkDataDirectoryPermissions($CONFIG_DATADIRECTORY));
} else { } else {
$errors[] = array( $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>.'
);
'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)) { } else if(!is_writable($CONFIG_DATADIRECTORY) or !is_readable($CONFIG_DATADIRECTORY)) {
$errors[] = array( $errors[] = array(


if(!OC_Util::isSetLocaleWorking()) { if(!OC_Util::isSetLocaleWorking()) {
$errors[] = array( $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.'
'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 theses locales on your system and restart your webserver.')
); );
} }


$moduleHint = "Please ask your server administrator to install the module.";
$moduleHint = $l->t('Please ask your server administrator to install the module.');
// check if all required php modules are present // check if all required php modules are present
if(!class_exists('ZipArchive')) { if(!class_exists('ZipArchive')) {
$errors[] = array( $errors[] = array(
'error'=>'PHP module zip not installed.',
'error'=> $l->t('PHP module %s not installed.', array('zip')),
'hint'=>$moduleHint 'hint'=>$moduleHint
); );
$webServerRestart = true; $webServerRestart = true;
} }
if(!class_exists('DOMDocument')) { if(!class_exists('DOMDocument')) {
$errors[] = array( $errors[] = array(
'error' => 'PHP module dom not installed.',
'error'=> $l->t('PHP module %s not installed.', array('dom')),
'hint' => $moduleHint 'hint' => $moduleHint
); );
$webServerRestart =true; $webServerRestart =true;
} }
if(!function_exists('xml_parser_create')) { if(!function_exists('xml_parser_create')) {
$errors[] = array( $errors[] = array(
'error' => 'PHP module libxml not installed.',
'error'=> $l->t('PHP module %s not installed.', array('libxml')),
'hint' => $moduleHint 'hint' => $moduleHint
); );
$webServerRestart = true; $webServerRestart = true;
} }
if(!function_exists('ctype_digit')) { if(!function_exists('ctype_digit')) {
$errors[] = array( $errors[] = array(
'error'=>'PHP module ctype is not installed.',
'error'=> $l->t('PHP module %s not installed.', array('ctype')),
'hint'=>$moduleHint 'hint'=>$moduleHint
); );
$webServerRestart = true; $webServerRestart = true;
} }
if(!function_exists('json_encode')) { if(!function_exists('json_encode')) {
$errors[] = array( $errors[] = array(
'error'=>'PHP module JSON is not installed.',
'error'=> $l->t('PHP module %s not installed.', array('JSON')),
'hint'=>$moduleHint 'hint'=>$moduleHint
); );
$webServerRestart = true; $webServerRestart = true;
} }
if(!extension_loaded('gd') || !function_exists('gd_info')) { if(!extension_loaded('gd') || !function_exists('gd_info')) {
$errors[] = array( $errors[] = array(
'error'=>'PHP module GD is not installed.',
'error'=> $l->t('PHP module %s not installed.', array('GD')),
'hint'=>$moduleHint 'hint'=>$moduleHint
); );
$webServerRestart = true; $webServerRestart = true;
} }
if(!function_exists('gzencode')) { if(!function_exists('gzencode')) {
$errors[] = array( $errors[] = array(
'error'=>'PHP module zlib is not installed.',
'error'=> $l->t('PHP module %s not installed.', array('zlib')),
'hint'=>$moduleHint 'hint'=>$moduleHint
); );
$webServerRestart = true; $webServerRestart = true;
} }
if(!function_exists('iconv')) { if(!function_exists('iconv')) {
$errors[] = array( $errors[] = array(
'error'=>'PHP module iconv is not installed.',
'error'=> $l->t('PHP module %s not installed.', array('iconv')),
'hint'=>$moduleHint 'hint'=>$moduleHint
); );
$webServerRestart = true; $webServerRestart = true;
} }
if(!function_exists('simplexml_load_string')) { if(!function_exists('simplexml_load_string')) {
$errors[] = array( $errors[] = array(
'error'=>'PHP module SimpleXML is not installed.',
'error'=> $l->t('PHP module %s not installed.', array('SimpleXML')),
'hint'=>$moduleHint 'hint'=>$moduleHint
); );
$webServerRestart = true; $webServerRestart = true;
} }
if(version_compare(phpversion(), '5.3.3', '<')) { if(version_compare(phpversion(), '5.3.3', '<')) {
$errors[] = array( $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.'
'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; $webServerRestart = true;
} }
if(!defined('PDO::ATTR_DRIVER_NAME')) { if(!defined('PDO::ATTR_DRIVER_NAME')) {
$errors[] = array( $errors[] = array(
'error'=>'PHP PDO module is not installed.',
'error'=> $l->t('PHP module %s not installed.', array('PDO')),
'hint'=>$moduleHint 'hint'=>$moduleHint
); );
$webServerRestart = true; $webServerRestart = true;
|| (strtolower(@ini_get('safe_mode')) == 'true') || (strtolower(@ini_get('safe_mode')) == 'true')
|| (ini_get("safe_mode") == 1 ))) { || (ini_get("safe_mode") == 1 ))) {
$errors[] = array( $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.'
'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; $webServerRestart = true;
} }
if (get_magic_quotes_gpc() == 1 ) { if (get_magic_quotes_gpc() == 1 ) {
$errors[] = array( $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.'
'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; $webServerRestart = true;
} }


if($webServerRestart) { if($webServerRestart) {
$errors[] = array( $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.'
'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.')
); );
} }


* @return array errors array * @return array errors array
*/ */
public static function checkDatabaseVersion() { public static function checkDatabaseVersion() {
$l = OC_L10N::get('lib');
$errors = array(); $errors = array();
$dbType = \OC_Config::getValue('dbtype', 'sqlite'); $dbType = \OC_Config::getValue('dbtype', 'sqlite');
if ($dbType === 'pgsql') { if ($dbType === 'pgsql') {
$version = $data['server_version']; $version = $data['server_version'];
if (version_compare($version, '9.0.0', '<')) { if (version_compare($version, '9.0.0', '<')) {
$errors[] = array( $errors[] = array(
'error' => 'PostgreSQL >= 9 required',
'hint' => 'Please upgrade your database version'
'error' => $l->t('PostgreSQL >= 9 required'),
'hint' => $l->t('Please upgrade your database version')
); );
} }
} }
} catch (\Doctrine\DBAL\DBALException $e) { } catch (\Doctrine\DBAL\DBALException $e) {
\OCP\Util::logException('core', $e); \OCP\Util::logException('core', $e);
$errors[] = array( $errors[] = array(
'error' => 'Error occurred while checking PostgreSQL version',
'hint' => 'Please make sure you have PostgreSQL >= 9 or check the logs for more information about the error'
'error' => $l->t('Error occurred while checking PostgreSQL version'),
'hint' => $l->t('Please make sure you have PostgreSQL >= 9 or'
.' check the logs for more information about the error')
); );
} }
} }
* @return array arrays with error messages and hints * @return array arrays with error messages and hints
*/ */
public static function checkDataDirectoryPermissions($dataDirectory) { public static function checkDataDirectoryPermissions($dataDirectory) {
$l = OC_L10N::get('lib');
$errors = array(); $errors = array();
if (self::runningOnWindows()) { if (self::runningOnWindows()) {
//TODO: permissions checks for windows hosts //TODO: permissions checks for windows hosts
} else { } else {
$permissionsModHint = 'Please change the permissions to 0770 so that the directory'
.' cannot be listed by other users.';
$permissionsModHint = $l->t('Please change the permissions to 0770 so that the directory'
.' cannot be listed by other users.');
$perms = substr(decoct(@fileperms($dataDirectory)), -3); $perms = substr(decoct(@fileperms($dataDirectory)), -3);
if (substr($perms, -1) != '0') { if (substr($perms, -1) != '0') {
chmod($dataDirectory, 0770); chmod($dataDirectory, 0770);
$perms = substr(decoct(@fileperms($dataDirectory)), -3); $perms = substr(decoct(@fileperms($dataDirectory)), -3);
if (substr($perms, 2, 1) != '0') { if (substr($perms, 2, 1) != '0') {
$errors[] = array( $errors[] = array(
'error' => 'Data directory ('.$dataDirectory.') is readable for other users',
'error' => $l->t('Data directory (%s) is readable by other users', array($dataDirectory)),
'hint' => $permissionsModHint 'hint' => $permissionsModHint
); );
} }
* @return bool true if the data directory is valid, false otherwise * @return bool true if the data directory is valid, false otherwise
*/ */
public static function checkDataDirectoryValidity($dataDirectory) { public static function checkDataDirectoryValidity($dataDirectory) {
$l = OC_L10N::get('lib');
$errors = array(); $errors = array();
if (!file_exists($dataDirectory.'/.ocdata')) { if (!file_exists($dataDirectory.'/.ocdata')) {
$errors[] = array( $errors[] = array(
'error' => 'Data directory (' . $dataDirectory . ') is invalid',
'hint' => 'Please check that the data directory contains a file' .
' ".ocdata" in its root.'
'error' => $l->t('Data directory (%s) is invalid', array($dataDirectory)),
'hint' => $l->t('Please check that the data directory contains a file' .
' ".ocdata" in its root.')
); );
} }
return $errors; return $errors;

Loading…
Cancel
Save