activity
activity copied to clipboard
After upgade ownCloud (docker version 9.1.7) to owncloud 10.0.2 activity app no longer shows information
Steps to reproduce
-
ownCloud (docker version 9.1.7) stopped with
docker-compose down
, edited .env to owncloud 10.0.2 and started withdocker compose up -d
Enter to the MariaDB containersudo docker exec -i -t 0975f6b97a67 /bin/bash
0975f6b97a67 - is a container id -
In MariaDB:
mysql -h localhost -u owncloud -powncloud owncloud
ALTER TABLE oc_activity MODIFY subjectparams longtext
ALTER TABLE oc_activity MODIFY messageparams longtext
ALTER TABLE oc_activity MODIFY activity_id bigint(20)
ALTER TABLE oc_activity MODIFY object_id bigint(20);
after query is OK type exit
-
Enter to the owncloud container
sudo docker exec -i -t 0975f6b97a67 /bin/bash
0975f6b97a67 - is a owncloud container id -
change user
su www-data
and./occ upgrade
. After we need to disable maintenance mode./occ maintenance:mode --off
Following actions was needed because of this issues https://github.com/owncloud/core/issues/27755
Expected behaviour
Running containers with oc_activity app
Actual behaviour
Activity app no longer shows information.
ownCloud log (data/owncloud.log)
{"reqId":"X50aUTLbAAcpfzDnO37h","level":3,"time":"2018-02-05T18:43:26+00:00","remoteAddr":"x.x.x.x","user":"roman1","app":"no app in context","method":"POST","url":"\/login","message":"Exception: {\"Exception\":\"Doctrine\\\\DBAL\\\\Exception\\\\UniqueConstraintViolationException\",\"Message\":\"An exception occurred while executing 'INSERT INTO `oc_activity` (`app`, `subject`, `subjectparams`, `message`, `messageparams`, `file`, `link`, `user`, `affecteduser`, `timestamp`, `priority`, `type`, `object_type`, `object_id`) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params [\\\"files\\\", \\\"created_self\\\", \\\"[{\\\\\\\"302933\\\\\\\":\\\\\\\"\\\\\\\"}]\\\", \\\"\\\", \\\"[]\\\", \\\"\\\", \\\"https:\\\\\\\/\\\\\\\/sensitive parameters replaced\\\\\\\/apps\\\\\\\/files\\\\\\\/?dir=\\\", \\\"roman1\\\", \\\"roman1\\\", 1517856206, 30, \\\"file_created\\\", \\\"files\\\", 302933]:\\n\\nSQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY'\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/DBALException.php(128): Doctrine\\\\DBAL\\\\Driver\\\\AbstractMySQLDriver->convertException('An exception oc...', Object(Doctrine\\\\DBAL\\\\Driver\\\\PDOException))\\n#1 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Connection.php(1015): Doctrine\\\\DBAL\\\\DBALException::driverExceptionDuringQuery(Object(Doctrine\\\\DBAL\\\\Driver\\\\PDOMySql\\\\Driver), Object(Doctrine\\\\DBAL\\\\Driver\\\\PDOException), 'INSERT INTO `oc...', Array)\\n#2 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/DB\\\/Connection.php(212): Doctrine\\\\DBAL\\\\Connection->executeUpdate('INSERT INTO `oc...', Array, Array)\\n#3 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Query\\\/QueryBuilder.php(208): OC\\\\DB\\\\Connection->executeUpdate('INSERT INTO `oc...', Array, Array)\\n#4 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/DB\\\/QueryBuilder\\\/QueryBuilder.php(141): Doctrine\\\\DBAL\\\\Query\\\\QueryBuilder->execute()\\n#5 \\\/mnt\\\/data\\\/apps\\\/activity\\\/lib\\\/Data.php(127): OC\\\\DB\\\\QueryBuilder\\\\QueryBuilder->execute()\\n#6 \\\/mnt\\\/data\\\/apps\\\/activity\\\/lib\\\/FilesHooks.php(574): OCA\\\\Activity\\\\Data->send(Object(OC\\\\Activity\\\\Event))\\n#7 \\\/mnt\\\/data\\\/apps\\\/activity\\\/lib\\\/FilesHooks.php(178): OCA\\\\Activity\\\\FilesHooks->addNotificationsForUser('roman1', 'created_self', Array, 302933, '', true, true, 0, 'file_created')\\n#8 \\\/mnt\\\/data\\\/apps\\\/activity\\\/lib\\\/FilesHooks.php(106): OCA\\\\Activity\\\\FilesHooks->addNotificationsForFileAction('\\\/', 'file_created', 'created_self', 'created_by')\\n#9 \\\/mnt\\\/data\\\/apps\\\/activity\\\/lib\\\/FilesHooksStatic.php(45): OCA\\\\Activity\\\\FilesHooks->fileCreate('\\\/')\\n#10 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/legacy\\\/hook.php(105): OCA\\\\Activity\\\\FilesHooksStatic::fileCreate(Array)\\n#11 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Files\\\/View.php(1236): OC_Hook::emit('OC_Filesystem', 'post_create', Array)\\n#12 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Files\\\/View.php(1164): OC\\\\Files\\\\View->runHooks(Array, '\\\/', true)\\n#13 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Files\\\/View.php(262): OC\\\\Files\\\\View->basicOperation('mkdir', '\\\/roman1\\\/files', Array)\\n#14 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Files\\\/Node\\\/Folder.php(156): OC\\\\Files\\\\View->mkdir('\\\/roman1\\\/files')\\n#15 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Files\\\/Node\\\/Root.php(362): OC\\\\Files\\\\Node\\\\Folder->newFolder('\\\/files')\\n#16 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Server.php(969): OC\\\\Files\\\\Node\\\\Root->getUserFolder('roman1')\\n#17 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/User\\\/Session.php(407): OC\\\\Server->getUserFolder('roman1')\\n#18 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/User\\\/Session.php(479): OC\\\\User\\\\Session->prepareUserLogin(true)\\n#19 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/User\\\/Session.php(298): OC\\\\User\\\\Session->loginWithPassword(*** sensitive parameters replaced ***)\\n#20 \\\/var\\\/www\\\/owncloud\\\/core\\\/Controller\\\/LoginController.php(201): OC\\\\User\\\\Session->login(*** sensitive parameters replaced ***)\\n#21 [internal function]: OC\\\\Core\\\\Controller\\\\LoginController->tryLogin(*** sensitive parameters replaced ***)\\n#22 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispatcher.php(159): call_user_func_array(Array, Array)\\n#23 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispatcher.php(89): OC\\\\AppFramework\\\\Http\\\\Dispatcher->executeController(Object(OC\\\\Core\\\\Controller\\\\LoginController), 'tryLogin')\\n#24 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/App.php(98): OC\\\\AppFramework\\\\Http\\\\Dispatcher->dispatch(Object(OC\\\\Core\\\\Controller\\\\LoginController), 'tryLogin')\\n#25 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/Routing\\\/RouteActionHandler.php(46): OC\\\\AppFramework\\\\App::main('LoginController', 'tryLogin', Object(OC\\\\AppFramework\\\\DependencyInjection\\\\DIContainer), Array)\\n#26 [internal function]: OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler->__invoke(Array)\\n#27 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Route\\\/Router.php(342): call_user_func(Object(OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler), Array)\\n#28 \\\/var\\\/www\\\/owncloud\\\/lib\\\/base.php(929): OC\\\\Route\\\\Router->match('\\\/login')\\n#29 \\\/var\\\/www\\\/owncloud\\\/index.php(56): OC::handleRequest()\\n#30 {main}\",\"File\":\"\\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Driver\\\/AbstractMySQLDriver.php\",\"Line\":66}"}
It seems that something was wrong when old oc_activity table was converted to new one because of this error
Duplicate entry '0' for key 'PRIMARY' .
but I am not sure.
This problem is probably caused by changing the column types of the oc_activity
table and omitting the auto_increment
option for the activity_id
column.
That is instead of
ALTER TABLE oc_activity MODIFY activity_id bigint(20);
it needs to be
ALTER TABLE oc_activity MODIFY activity_id bigint(20) AUTO_INCREMENT;
Not sure if MariaDB/MySQL will pick up the correct start value for the auto increment automatically. If you still got no new information in the activity plugin you might need to adjust the auto increment manually by setting it to max(activity_id) + 1
:
MariaDB [owncloud]> SELECT max(activity_id) + 1 FROM oc_activity;
+----------------------+
| max(activity_id) + 1 |
+----------------------+
| 11809 |
+----------------------+
1 row in set (0.00 sec)
MariaDB [owncloud]>ALTER TABLE oc_activity AUTO_INCREMENT=11809;
Confirming this worked for me. Massive thanks @dpeger