Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
2b48621f23
|
|
@ -194,7 +194,7 @@ class ViewController extends Controller {
|
||||||
$this->eventDispatcher->dispatchTyped(new LoadViewer());
|
$this->eventDispatcher->dispatchTyped(new LoadViewer());
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->initialState->provideInitialState('templates_enabled', ($this->config->getSystemValueString('skeletondirectory', \OC::$SERVERROOT . '/core/skeleton') !== '') || ($this->config->getSystemValueString('templatedirectory', \OC::$SERVERROOT . '/core/skeleton/Templates') !== ''));
|
$this->initialState->provideInitialState('templates_enabled', ($this->config->getSystemValueString('skeletondirectory', '') !== '') || ($this->config->getSystemValueString('templatedirectory', '') !== ''));
|
||||||
$this->initialState->provideInitialState('templates_path', $this->templateManager->hasTemplateDirectory() ? $this->templateManager->getTemplatePath() : false);
|
$this->initialState->provideInitialState('templates_path', $this->templateManager->hasTemplateDirectory() ? $this->templateManager->getTemplatePath() : false);
|
||||||
$this->initialState->provideInitialState('templates', $this->templateManager->listCreators());
|
$this->initialState->provideInitialState('templates', $this->templateManager->listCreators());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ class SampleConversationsService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function initialCreateSamples(string $userId): void {
|
public function initialCreateSamples(string $userId): void {
|
||||||
if (!$this->appConfig->getAppValueBool('create_samples', true)) {
|
if (!$this->appConfig->getAppValueBool('create_samples', false)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
148
install.sh
148
install.sh
|
|
@ -10,7 +10,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
INSTALL_DIR="$SCRIPT_DIR"
|
INSTALL_DIR="$SCRIPT_DIR"
|
||||||
CONFIG_FILE="$INSTALL_DIR/config/config.php"
|
CONFIG_FILE="$INSTALL_DIR/config/config.php"
|
||||||
DATA_DIR="/data"
|
DATA_DIR="/data"
|
||||||
APACHE_USER="www-data"
|
# APACHE_USER задаётся ниже после определения типа веб-сервера (apache2 → www-data, httpd → apache)
|
||||||
|
|
||||||
echo "=========================================="
|
echo "=========================================="
|
||||||
echo "F7cloud Client Installation Script"
|
echo "F7cloud Client Installation Script"
|
||||||
|
|
@ -71,6 +71,33 @@ else
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Пользователь веб-сервера: под Debian/Ubuntu (apache2) — www-data, под RHEL/CentOS (httpd) — apache
|
||||||
|
# Переменная окружения APACHE_USER переопределяет автоопределение
|
||||||
|
if [ -n "${APACHE_USER:-}" ]; then
|
||||||
|
: # уже задан из окружения
|
||||||
|
else
|
||||||
|
if [ "$APACHE_SERVICE" = "httpd" ]; then
|
||||||
|
APACHE_USER="apache"
|
||||||
|
else
|
||||||
|
APACHE_USER="www-data"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
# Проверка, что пользователь существует (на некоторых системах есть только www-data)
|
||||||
|
if ! id "$APACHE_USER" &>/dev/null; then
|
||||||
|
if [ "$APACHE_USER" = "apache" ]; then
|
||||||
|
echo "Пользователь apache не найден, используется www-data"
|
||||||
|
APACHE_USER="www-data"
|
||||||
|
else
|
||||||
|
echo "Пользователь www-data не найден, используется apache"
|
||||||
|
APACHE_USER="apache"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if ! id "$APACHE_USER" &>/dev/null; then
|
||||||
|
echo "Ошибка: не найден пользователь веб-сервера (ни www-data, ни apache). Создайте пользователя или задайте APACHE_USER."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "✓ Пользователь веб-сервера: $APACHE_USER"
|
||||||
|
|
||||||
echo "✓ Apache установлен"
|
echo "✓ Apache установлен"
|
||||||
|
|
||||||
# Включить необходимые модули Apache
|
# Включить необходимые модули Apache
|
||||||
|
|
@ -286,16 +313,10 @@ else
|
||||||
echo "Используется пароль администратора из переменной окружения"
|
echo "Используется пароль администратора из переменной окружения"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Генерация секретов
|
# Создание config.php не выполняем — passwordsalt, secret, instanceid создаст occ maintenance:install
|
||||||
echo "[7/8] Генерация секретов..."
|
echo "[7/8] Подготовка к установке..."
|
||||||
PASSWORD_SALT=$(generate_random)
|
|
||||||
SECRET=$(generate_random)
|
|
||||||
INSTANCE_ID=$(generate_instanceid)
|
|
||||||
|
|
||||||
# Создание config.php
|
# Создать директорию config если нет (occ создаст в ней config.php)
|
||||||
echo "[8/8] Создание config.php..."
|
|
||||||
|
|
||||||
# Создать директорию config если нет
|
|
||||||
mkdir -p "$INSTALL_DIR/config"
|
mkdir -p "$INSTALL_DIR/config"
|
||||||
|
|
||||||
# Бэкап существующего config.php
|
# Бэкап существующего config.php
|
||||||
|
|
@ -304,72 +325,6 @@ if [ -f "$CONFIG_FILE" ]; then
|
||||||
echo "✓ Старый config.php сохранен в бэкап"
|
echo "✓ Старый config.php сохранен в бэкап"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Создать config.php
|
|
||||||
cat > "$CONFIG_FILE" <<EOF
|
|
||||||
<?php
|
|
||||||
\$CONFIG = array (
|
|
||||||
'passwordsalt' => '$PASSWORD_SALT',
|
|
||||||
'secret' => '$SECRET',
|
|
||||||
'trusted_domains' =>
|
|
||||||
array (
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Добавить trusted domains
|
|
||||||
IFS=',' read -ra DOMAINS <<< "$TRUSTED_DOMAINS"
|
|
||||||
for i in "${!DOMAINS[@]}"; do
|
|
||||||
DOMAIN_CLEAN=$(echo "${DOMAINS[$i]}" | xargs)
|
|
||||||
echo " $i => '$DOMAIN_CLEAN'," >> "$CONFIG_FILE"
|
|
||||||
done
|
|
||||||
|
|
||||||
cat >> "$CONFIG_FILE" <<EOF
|
|
||||||
),
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Trusted proxies
|
|
||||||
if [ -n "$TRUSTED_PROXIES" ]; then
|
|
||||||
echo " 'trusted_proxies' => " >> "$CONFIG_FILE"
|
|
||||||
echo " array (" >> "$CONFIG_FILE"
|
|
||||||
IFS=',' read -ra PROXIES <<< "$TRUSTED_PROXIES"
|
|
||||||
for i in "${!PROXIES[@]}"; do
|
|
||||||
PROXY_CLEAN=$(echo "${PROXIES[$i]}" | xargs)
|
|
||||||
echo " $i => '$PROXY_CLEAN'," >> "$CONFIG_FILE"
|
|
||||||
done
|
|
||||||
echo " )," >> "$CONFIG_FILE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
cat >> "$CONFIG_FILE" <<EOF
|
|
||||||
'datadirectory' => '$DATA_DIR',
|
|
||||||
'dbtype' => 'pgsql',
|
|
||||||
'version' => '1.0.0',
|
|
||||||
'dbname' => '$DB_NAME',
|
|
||||||
'dbhost' => '$DB_HOST',
|
|
||||||
'dbport' => '$DB_PORT',
|
|
||||||
'dbtableprefix' => '$DB_PREFIX',
|
|
||||||
'dbuser' => '$DB_USER',
|
|
||||||
'dbpassword' => '$DB_PASSWORD',
|
|
||||||
'installed' => false,
|
|
||||||
'instanceid' => '$INSTANCE_ID',
|
|
||||||
'memcache.local' => '\\\\OC\\\\Memcache\\\\APCu',
|
|
||||||
'memcache.distributed' => '\\\\OC\\\\Memcache\\\\Redis',
|
|
||||||
'memcache.locking' => '\\\\OC\\\\Memcache\\\\Redis',
|
|
||||||
'redis' =>
|
|
||||||
array (
|
|
||||||
'host' => '127.0.0.1',
|
|
||||||
'port' => 6379,
|
|
||||||
'timeout' => 1.5,
|
|
||||||
'dbindex' => 0,
|
|
||||||
),
|
|
||||||
'maintenance' => false,
|
|
||||||
'loglevel' => 0,
|
|
||||||
'overwrite.cli.url' => '$CLI_URL',
|
|
||||||
'htaccess.RewriteBase' => '/',
|
|
||||||
);
|
|
||||||
EOF
|
|
||||||
|
|
||||||
chmod 640 "$CONFIG_FILE"
|
|
||||||
chown root:$APACHE_USER "$CONFIG_FILE"
|
|
||||||
echo "✓ config.php создан"
|
|
||||||
|
|
||||||
# Создание директории данных
|
# Создание директории данных
|
||||||
if [ ! -d "$DATA_DIR" ]; then
|
if [ ! -d "$DATA_DIR" ]; then
|
||||||
mkdir -p "$DATA_DIR"
|
mkdir -p "$DATA_DIR"
|
||||||
|
|
@ -426,19 +381,36 @@ if sudo -u $APACHE_USER php occ maintenance:install \
|
||||||
--admin-pass "$ADMIN_PASSWORD" \
|
--admin-pass "$ADMIN_PASSWORD" \
|
||||||
--data-dir "$DATA_DIR" 2>&1; then
|
--data-dir "$DATA_DIR" 2>&1; then
|
||||||
|
|
||||||
echo "✓ F7cloud успешно инициализирован"
|
echo "✓ F7cloud успешно инициализирован (passwordsalt, secret, instanceid взяты из config, созданного occ)"
|
||||||
|
|
||||||
# Обновить config.php - установить installed => true
|
# Дополнить config.php: trusted_domains, trusted_proxies, redis, overwriteprotocol (passwordsalt, secret, instanceid уже из occ)
|
||||||
if grep -q "'installed' => false" "$CONFIG_FILE"; then
|
PATCH_PHP=$(mktemp)
|
||||||
sed -i "s/'installed' => false/'installed' => true/" "$CONFIG_FILE"
|
cat > "$PATCH_PHP" <<'PATCHEOF'
|
||||||
echo "✓ config.php обновлен (installed => true)"
|
<?php
|
||||||
fi
|
$CONFIG_FILE = $argv[1];
|
||||||
|
$trusted_domains_str = $argv[2];
|
||||||
# Если есть overwriteprotocol, установить https (если прокси использует HTTPS)
|
$trusted_proxies_str = isset($argv[3]) ? $argv[3] : '';
|
||||||
if ! grep -q "overwriteprotocol" "$CONFIG_FILE"; then
|
$cli_url = $argv[4] ?? '';
|
||||||
sed -i "/'htaccess.RewriteBase' => '/a\\ 'overwriteprotocol' => 'https'," "$CONFIG_FILE"
|
$CONFIG = array();
|
||||||
echo "✓ Добавлен overwriteprotocol => https (для работы за прокси)"
|
if (is_file($CONFIG_FILE)) { include $CONFIG_FILE; }
|
||||||
fi
|
$CONFIG['trusted_domains'] = array_values(array_filter(array_map('trim', explode(',', $trusted_domains_str))));
|
||||||
|
$CONFIG['overwrite.cli.url'] = $cli_url;
|
||||||
|
$CONFIG['overwriteprotocol'] = 'https';
|
||||||
|
$CONFIG['htaccess.RewriteBase'] = '/';
|
||||||
|
$CONFIG['memcache.local'] = '\OC\Memcache\APCu';
|
||||||
|
$CONFIG['memcache.distributed'] = '\OC\Memcache\Redis';
|
||||||
|
$CONFIG['memcache.locking'] = '\OC\Memcache\Redis';
|
||||||
|
$CONFIG['redis'] = array('host' => '127.0.0.1', 'port' => 6379, 'timeout' => 1.5, 'dbindex' => 0);
|
||||||
|
$CONFIG['maintenance'] = false;
|
||||||
|
$CONFIG['loglevel'] = 0;
|
||||||
|
if ($trusted_proxies_str !== '') {
|
||||||
|
$CONFIG['trusted_proxies'] = array_values(array_filter(array_map('trim', explode(',', $trusted_proxies_str))));
|
||||||
|
}
|
||||||
|
file_put_contents($CONFIG_FILE, "<?php\n\$CONFIG = " . var_export($CONFIG, true) . ";\n");
|
||||||
|
PATCHEOF
|
||||||
|
php "$PATCH_PHP" "$CONFIG_FILE" "$TRUSTED_DOMAINS" "$TRUSTED_PROXIES" "$CLI_URL" 2>/dev/null && rm -f "$PATCH_PHP" && echo "✓ config.php дополнен (trusted_domains, redis, overwriteprotocol и др.)"
|
||||||
|
chmod 640 "$CONFIG_FILE"
|
||||||
|
chown root:$APACHE_USER "$CONFIG_FILE" 2>/dev/null || true
|
||||||
|
|
||||||
# Включение приложений по умолчанию (mail, office, talk, circles и др.)
|
# Включение приложений по умолчанию (mail, office, talk, circles и др.)
|
||||||
echo ""
|
echo ""
|
||||||
|
|
|
||||||
|
|
@ -328,8 +328,8 @@ class TemplateManager implements ITemplateManager {
|
||||||
|
|
||||||
$defaultSkeletonDirectory = \OC::$SERVERROOT . '/core/skeleton';
|
$defaultSkeletonDirectory = \OC::$SERVERROOT . '/core/skeleton';
|
||||||
$defaultTemplateDirectory = \OC::$SERVERROOT . '/core/skeleton/Templates';
|
$defaultTemplateDirectory = \OC::$SERVERROOT . '/core/skeleton/Templates';
|
||||||
$skeletonPath = $this->config->getSystemValueString('skeletondirectory', $defaultSkeletonDirectory);
|
$skeletonPath = $this->config->getSystemValueString('skeletondirectory', '');
|
||||||
$skeletonTemplatePath = $this->config->getSystemValueString('templatedirectory', $defaultTemplateDirectory);
|
$skeletonTemplatePath = $this->config->getSystemValueString('templatedirectory', '');
|
||||||
$isDefaultSkeleton = $skeletonPath === $defaultSkeletonDirectory;
|
$isDefaultSkeleton = $skeletonPath === $defaultSkeletonDirectory;
|
||||||
$isDefaultTemplates = $skeletonTemplatePath === $defaultTemplateDirectory;
|
$isDefaultTemplates = $skeletonTemplatePath === $defaultTemplateDirectory;
|
||||||
$userLang = $this->l10nFactory->getUserLanguage($this->userManager->get($this->userId));
|
$userLang = $this->l10nFactory->getUserLanguage($this->userManager->get($this->userId));
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@ class OC_Util {
|
||||||
/** @var LoggerInterface $logger */
|
/** @var LoggerInterface $logger */
|
||||||
$logger = \OC::$server->get(LoggerInterface::class);
|
$logger = \OC::$server->get(LoggerInterface::class);
|
||||||
|
|
||||||
$plainSkeletonDirectory = \OC::$server->getConfig()->getSystemValueString('skeletondirectory', \OC::$SERVERROOT . '/core/skeleton');
|
$plainSkeletonDirectory = \OC::$server->getConfig()->getSystemValueString('skeletondirectory', '');
|
||||||
$userLang = \OC::$server->get(IFactory::class)->findLanguage();
|
$userLang = \OC::$server->get(IFactory::class)->findLanguage();
|
||||||
$skeletonDirectory = str_replace('{lang}', $userLang, $plainSkeletonDirectory);
|
$skeletonDirectory = str_replace('{lang}', $userLang, $plainSkeletonDirectory);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user