Ported from the administration repo: https://github.com/owncloud/administration/commit/c67eaa11c04d0989ee9331c97788a0225a82e7f5 and https://github.com/owncloud/administration/commit/41b0f9fa3a9c6183972f971eea3875b98e22217a