Ubuntu and Owncloud

# version
SELECT * FROM `oc_appconfig` WHERE configkey = 'lastupdateResult';

# data directory setup
sudo touch owncloud_data/.ocdata

# permissions
# owner www-data is for php5-fpm which runs as www-data:www-data
# group www-data is for nginx which runs with group www-data
sudo chown -R ************ owncloud
sudo chown -R ************ owncloud_data
sudo chmod -R 770 owncloud
sudo chmod -R 770 owncloud_data

# pisaprobleme
ln -sv /********/apps/opt/apache-htdocs/pisaprobleme/ /********/apps/opt/php-pages/owncloud_data/**********/
chown -h ************ /********/apps/opt/php-pages/owncloud_data/**********/pisaprobleme

# upgrade script for owncloud
upgradeOwnCloud() {
	cd $HOME/apps/opt/php-pages
	echo "current path: `pwd`"
	$HOME/bin/php-fpm.sh stop
	local OC_VER=9.0.0

	if [ ! -e owncloud-$OC_VER.zip ]; then
		wget https://download.owncloud.org/community/owncloud-$OC_VER.zip
	fi

	if [ ! -d owncloud-before-upgrade-to-$OC_VER ]; then
		mv -v owncloud owncloud-before-upgrade-to-$OC_VER
		cp -r owncloud_data owncloud_data-before-upgrade-to-$OC_VER
		unzip -q owncloud-$OC_VER.zip
		cp -v owncloud-before-upgrade-to-$OC_VER/config/config.php owncloud/config/
		sudo chown -R ************ owncloud
		sudo chmod -R 770 owncloud
	fi

	echo -e "\nIf you are using 3rd party applications, look in your new owncloud/apps/ directory to see if they are there."
	echo "If not, copy them from your old apps/ directory to your new one. Make sure the directory permissions of your"
	echo -e "third party application directories are the same as for the other ones.\n"

	$HOME/bin/php-fpm.sh start
	mysql -u owncloud702 -powncloud702 -e "SELECT * FROM owncloud702.oc_appconfig WHERE configkey = 'lastupdateResult'"
	# {"version":"9.0.0.19","versionstring":"ownCloud 9.0.0","url":"https:\/\/download.owncloud.org\/community\/owncloud-9.0.0.zip","web":"https:\/\/doc.owncloud.org\/server\/9.0\/admin_manual\/maintenance\/manual_upgrade.html"}
	# https://doc.owncloud.org/server/9.0/admin_manual/maintenance/manual_upgrade.html
	echo -e "\nMake sure owncloud-db's version is the same with $HOME/apps/opt/php-pages/owncloud/config/config.php!"
	local CONFIG_VER="`grep -nr version $HOME/apps/opt/php-pages/owncloud/config/config.php | awk '{print $4;}'`"
	echo "config.php: $CONFIG_VER"

	echo -e "\nNow do these:\n\ncd $HOME/apps/opt/php-pages/owncloud\nphp occ upgrade\nsudo chown -R ************ .\nsudo chmod -R 770 .\n"
#	cd $HOME/apps/opt/php-pages/owncloud
#	echo "current path: `pwd`"
#	php occ upgrade
#	sudo chown -R ************ .
#	sudo chmod -R 770 .
#	cd $HOME
}

# How to create a soft link visible in files
# - create in directory .../owncloud_data/user-name/files the desired soft link (e.g. my-soft-link-to-dir1)
# - go to owncloud files web page and create the directory my-soft-link-to-dir1
# - you'll get the error saying my-soft-link-to-dir1 already exists but now my-soft-link-to-dir1 will be accessible

ERROR (owncloud/occ files:scan -v --all)
	Home storage for user mama not writable
	Make sure you're running the scan command only as the user the web server runs as
SOLUTION
	change in owncloud/lib/private/Files/Utils/Scanner.php to this:
	if ($storage->file_exists('') or $storage->getCache()->inCache('')) {
		if (0 === strpos($storage->getId(), 'shared::')) {
			$this->logger->error('Scanner.php scan, it\'s a shared file: ' . $storage->getId());
			continue;
		}
		$this->logger->error('Scanner.php scan, Storage id: ' . $storage->getId() . ', Storage localFile: ' . $storage->getLocalFile(''));
		throw new ForbiddenException();
	} else {// if the root exists in neither the cache nor the storage the user isn't setup yet
		break;
	}

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.