Nextcloud

From Lolly's Wiki
Jump to navigationJump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.


Nextcloud

BASH alias

alias occ='sudo --user=www-data /usr/bin/php -f /var/www/nextcloud/occ'
# occ status
  - installed: true
  - version: 19.0.2.2
  - versionstring: 19.0.2
  - edition:

Send calendar events

Set the EventRemindersMode to occ:

# occ config:app:set dav sendEventRemindersMode --value occ

and add a cronjob for the user running he webserver:

# crontab -u www-data -e

# send calendar events every 5 minutes
*/5   * * * * php -f /var/www/nextcloud/occ dav:send-event-reminders

Manual upgrade

Caution when upgrading from Nextcloud 20.0.9 to Nextcloud 21.0.1! If you are using APCu as memcache.local

# occ config:system:get memcache.local
\OC\Memcache\APCu

you have to put this in your php apcu.ini (e.g. /etc/php/7.4/mods-available/apcu.ini):

apc.enable_cli=1

otherwise you will get in memory trouble during upgrade and in my case the server was down because out of memory.

# cd /var/www/nextcloud/updater && sudo -u www-data php updater.phar
# occ db:add-missing-indices

and since version 19:

# occ db:add-missing-columns
# occ db:add-missing-primary-keys
# occ db:convert-filecache-bigint

Answer the questions...

If you have an own theme proceed with this steps:

# occ config:system:set theme --value <your theme>
# occ maintenance:theme:update

And the apps:

# occ app:update --all

Recreate preview directories

Sometimes something happens and you loose your preview subdirectories. This is a shellscript for recreate the dirs. It takes a long time...

#!/bin/bash

owner=www-data
group=www-data
nextcloud_installdir=/var/www/nextcloud


occ=${nextcloud_installdir}/occ
occ_cmd="/usr/bin/sudo --user=${owner} /usr/bin/php -f ${occ}"

nextcloud_instanceid=$(${occ_cmd} config:system:get instanceid)
nextcloud_datadir=$(${occ_cmd} config:system:get datadirectory)

basedir=${nextcloud_datadir}/appdata_${nextcloud_instanceid}/preview
depth=7

function makesubdirs () {
        local basedir=${1}
        local -i depth=${2}

        (( ${depth} == 0 )) && return
        for dir in ${basedir}/{{0..9},{a..f}}
        do
                [ -d ${dir} ] || {
                        mkdir ${dir}
                        chown ${owner}:${group} ${dir}
                        echo ${dir}
                }
                makesubdirs ${dir} $((depth -1))
        done
}

makesubdirs ${basedir} ${depth}

See disclaimer...

Set loglevel from commandline

As written at the documentation you can set the following log levels:

Loglevel to start logging at. Valid values are: 0 = Debug, 1 = Info, 2 = Warning, 3 = Error, and 4 = Fatal. The default value is Warning.

You can do this with occ via:

# occ config:system:set loglevel --type integer --value <log level>

or look for the current setting with:

# occ config:system:get loglevel
2

Some tweaks for the theme to disable several things

/* remove quota */
#quota {
    border: 0;
    clip: rect(0 0 0 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
}


/* remove lost password */
.lost-password-container #lost-password, .lost-password-container #lost-password-back {
    display: none;
}

/* remove contacts menu */
#contactsmenu { display: none; }


/* remove contacts button */
li[data-id="contacts"] {
  display: none;
  visibility : hidden;
  height : 0px;
  width : 0px;
  margin : 0px;
  padding : 0px;
  overflow : hidden;
}

/* remove user button */
li[data-id="core_users"] {
  display: none;
  visibility : hidden;
  height : 0px;
  width : 0px;
  margin : 0px;
  padding : 0px;
  overflow : hidden;
}


/* Get rid of the box at login: This community release of Nextcloud is unsupported and push notifications are limited. */
#body-login .notecard {
  display: none;
  visibility : hidden;
  height : 0px !important;
  width : 0px !important;
  margin : 0px;
  padding : 0px;
  overflow : hidden;
}

/* remove background-image from all pages, but login page */
body:not(#body-login) {
    background-image: none;
}

Memcached

You can import one of the following versions of configfile with

# occ config:import /your_memcache_config_file_like_below.json
Config successfully imported from: /your_memcache_config_file_like_below.json

ip:port

{
  "system": {
    "memcache.distributed": "\\OC\\Memcache\\Memcached",
    "memcached_servers": [
      [
        '127.0.0.1',
        1121
      ]
    ]
  }
}

socket

{
  "system": {
    "memcache.distributed": "\\OC\\Memcache\\Memcached",
    "memcached_servers": [
      [
        "\/run\/memcached\/memcached.sock",
        0
      ]
    ]
  }
}