From 25dd9244b994cc10ae99090da0962a964b81567d Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Mon, 31 Oct 2022 12:09:28 -0700 Subject: [PATCH 01/10] Point readme to wiki --- README.md | 33 +++++++++------------------------ appinfo/info.xml | 19 ++++++++----------- 2 files changed, 17 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index e407788a..decb4f9b 100644 --- a/README.md +++ b/README.md @@ -6,16 +6,13 @@ Memories is a photo management app for Nextcloud with advanced features includin - **📸 Timeline**: Sort photos and videos by date taken, parsed from Exif data. - **⏪ Rewind**: Jump to any time in the past instantly and relive your memories. -- **🤖 AI Tagging**: Group photos by people and objects using AI, powered by the [recognize](https://github.com/nextcloud/recognize) app. +- **🤖 AI Tagging**: Group photos by people and objects using AI, powered by [recognize](https://github.com/nextcloud/recognize). - **🖼️ Albums**: Create albums to group photos and videos together. Then share these albums with others. -- **📁 Folders**: Browse your own and shared folders with a similar, efficient timeline. -- **🎦 Slideshow**: View photos from your timeline and folders easily. -- **📱 Mobile Support**: Works on devices of any shape and size through the web app. -- **✏️ Edit Metadata**: Edit Exif dates on photos quickly and easily. -- **📦 Archive**: Store photos you don't want to see in your timeline in a separate folder. -- **📷 RAW Support**: View RAW photos from your camera with the [Camera RAW Previews](https://apps.nextcloud.com/apps/camerarawpreviews) app. - **🫱🏻‍🫲🏻 External Sharing**: Share photos and videos with people outside of your Nextcloud instance. -- **⚡️ Fast**: Memories is extremely fast. Period. More details below. +- **📱 Mobile Support**: Works on devices of any shape and size through the web app. +- **✏️ Edit Metadata**: Edit dates on photos quickly and easily. +- **📦 Archive**: Store photos you don't want to see in your timeline in a separate folder. +- **⚡️ Fast**: Memories is extremely fast. More details below. To get an idea of what memories looks and feels like, check out the [public demo](https://memories-demo.radialapps.com/apps/memories/). Note that the demo is read-only and may be slow since it runs in a low-end free tier VM provided by [Oracle Cloud](https://www.oracle.com/cloud/free/). Photo credits go to [Unsplash](https://unsplash.com/) (for individual credits, refer to each folder). @@ -29,10 +26,10 @@ To get an idea of what memories looks and feels like, check out the [public demo 1. Install the app from the Nextcloud app store. 1. Run `php ./occ memories:index` to generate metadata indices for existing photos. -1. Open the 📷 Memories app in Nextcloud and set the directory containing your photos. Photos from this directory will be displayed in the timeline, including any photos in nested subdirectories. -1. Installing the [preview generator](https://github.com/rullzer/previewgenerator) for pre-generating thumbnails is strongly recommended. +1. Open the 📷 Memories app in Nextcloud and set the directory containing your photos. +1. Perform the recommended [configuration steps](https://github.com/pulsejet/memories/wiki/Extra-Configuration). -## 🏗 Development setup +## 🏗 Development Setup 1. ☁ Clone this into your `apps` folder of your Nextcloud. 1. 👩‍💻 In a terminal, run the command `make dev-setup` to install the dependencies. @@ -42,19 +39,7 @@ To get an idea of what memories looks and feels like, check out the [public demo ## ⚡ Performance -- Once properly configured, Memories is **extremely fast**, possibly one of the fastest web photo viewers. -- On a server with relatively cheap hardware (`Intel Pentium G6400 / 8GB RAM / SSD`), loading the timeline takes only `~400ms` without cache on a laptop (`Intel Core i5-1035G1 / Windows 11 / Chrome`) for a library of `~17000 photos` totaling `100GB`. The test was performed on Nextcloud 24 with `nginx`, `php-fpm` and `mariadb` running in Docker. -- For best performance, install the [preview generator](https://github.com/rullzer/previewgenerator) and make sure HTTP/2 is enabled for your Nextcloud instance. - -## 📝 Notes - -- You may need to configure the Nextcloud preview generator and Imagemagick / ffmpeg to support all types of images and videos (e.g. HEIC). If using the official docker image, add `OC\Preview\HEIC` to `enabledPreviewProviders` in your `config.php`. -- If local time is not found in the photo (especially for videos), the server timezone is used. -- All photos in the timeline _must_ be on a single storage. For example, you cannot have a mounted directory inside your photos directory. -- The app can work with external storage for photos. Just set the mountpoint as the timeline directory. - - If you add any photos from outside Nextcloud, you must run the scan and index commands. - - Indexing may be slow, since all files must be downloaded from the storage. -- The archive feature moves photos to a separate folder called `.archive` at the root of your timeline. You can use this, for example, to move these photos to a cold storage. +Once properly configured, Memories is **extremely fast**, possibly one of the fastest web photo viewers. On a server with relatively cheap hardware (`Intel Pentium G6400 / 8GB RAM / SSD`), loading the timeline takes only `~400ms` without cache on a laptop (`Intel Core i5-1035G1 / Windows 11 / Chrome`) for a library of `~17000 photos` totaling `100GB`. The test was performed on Nextcloud 24 with `nginx`, `php-fpm` and `mariadb` running in Docker. ## Special Thanks diff --git a/appinfo/info.xml b/appinfo/info.xml index 9ea5eae7..b7a81a4c 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -11,25 +11,22 @@ Memories is a photo management app for Nextcloud with advanced features includin - **📸 Timeline**: Sort photos and videos by date taken, parsed from Exif data. - **⏪ Rewind**: Jump to any time in the past instantly and relive your memories. -- **🤖 AI Tagging**: Group photos by people and objects using AI, powered by the [recognize](https://github.com/nextcloud/recognize) app. +- **🤖 AI Tagging**: Group photos by people and objects using AI, powered by [recognize](https://github.com/nextcloud/recognize). - **🖼️ Albums**: Create albums to group photos and videos together. Then share these albums with others. -- **📁 Folders**: Browse your own and shared folders with a similar, efficient timeline. -- **🎦 Slideshow**: View photos from your timeline and folders easily. -- **📱 Mobile Support**: Works on devices of any shape and size through the web app. -- **✏️ Edit Metadata**: Edit Exif dates on photos quickly and easily. -- **📦 Archive**: Store photos you don't want to see in your timeline in a separate folder. -- **📷 RAW Support**: View RAW photos from your camera with the [Camera RAW Previews](https://apps.nextcloud.com/apps/camerarawpreviews) app. - **🫱🏻‍🫲🏻 External Sharing**: Share photos and videos with people outside of your Nextcloud instance. -- **⚡️ Fast**: Memories is extremely fast. Period. +- **📱 Mobile Support**: Works on devices of any shape and size through the web app. +- **✏️ Edit Metadata**: Edit dates on photos quickly and easily. +- **📦 Archive**: Store photos you don't want to see in your timeline in a separate folder. +- **⚡️ Fast**: Memories is extremely fast. To get an idea of what memories looks and feels like, check out the [public demo](https://memories-demo.radialapps.com/apps/memories/). Note that the demo is read-only and may be slow since it runs in a low-end free tier VM provided by [Oracle Cloud](https://www.oracle.com/cloud/free/). Photo credits go to [Unsplash](https://unsplash.com/) (for individual credits, refer to each folder). ## 🚀 Installation -1. Install the app from the Nextcloud app store +1. Install the app from the Nextcloud app store. 1. Run `php ./occ memories:index` to generate metadata indices for existing photos. -1. Open the 📷 Memories app in Nextcloud and set the directory containing your photos. Photos from this directory will be displayed in the timeline, including any photos in nested subdirectories. -1. Installing the [preview generator](https://github.com/rullzer/previewgenerator) for pre-generating thumbnails is strongly recommended. +1. Open the 📷 Memories app in Nextcloud and set the directory containing your photos. +1. Perform the recommended [configuration steps](https://github.com/pulsejet/memories/wiki/Extra-Configuration). ]]> 4.5.2 agpl From ccb9b1d8520ec7c8c542ade2dde90dc0028ff98c Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Mon, 31 Oct 2022 12:11:34 -0700 Subject: [PATCH 02/10] docs: remove performance clutter --- README.md | 6 +----- appinfo/info.xml | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index decb4f9b..03c24a86 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Memories is a photo management app for Nextcloud with advanced features includin - **📱 Mobile Support**: Works on devices of any shape and size through the web app. - **✏️ Edit Metadata**: Edit dates on photos quickly and easily. - **📦 Archive**: Store photos you don't want to see in your timeline in a separate folder. -- **⚡️ Fast**: Memories is extremely fast. More details below. +- **⚡️ Performance**: Memories is extremely fast. To get an idea of what memories looks and feels like, check out the [public demo](https://memories-demo.radialapps.com/apps/memories/). Note that the demo is read-only and may be slow since it runs in a low-end free tier VM provided by [Oracle Cloud](https://www.oracle.com/cloud/free/). Photo credits go to [Unsplash](https://unsplash.com/) (for individual credits, refer to each folder). @@ -37,10 +37,6 @@ To get an idea of what memories looks and feels like, check out the [public demo 1. ✅ Enable the app through the app management of your Nextcloud. 1. ⚒️ (Strongly recommended) use VS Code and install Vetur and Prettier. -## ⚡ Performance - -Once properly configured, Memories is **extremely fast**, possibly one of the fastest web photo viewers. On a server with relatively cheap hardware (`Intel Pentium G6400 / 8GB RAM / SSD`), loading the timeline takes only `~400ms` without cache on a laptop (`Intel Core i5-1035G1 / Windows 11 / Chrome`) for a library of `~17000 photos` totaling `100GB`. The test was performed on Nextcloud 24 with `nginx`, `php-fpm` and `mariadb` running in Docker. - ## Special Thanks Nextcloud team. A lot of this work is based on [Photos](https://github.com/nextcloud/photos). diff --git a/appinfo/info.xml b/appinfo/info.xml index b7a81a4c..154fe8da 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -17,7 +17,7 @@ Memories is a photo management app for Nextcloud with advanced features includin - **📱 Mobile Support**: Works on devices of any shape and size through the web app. - **✏️ Edit Metadata**: Edit dates on photos quickly and easily. - **📦 Archive**: Store photos you don't want to see in your timeline in a separate folder. -- **⚡️ Fast**: Memories is extremely fast. +- **⚡️ Performance**: Memories is extremely fast. To get an idea of what memories looks and feels like, check out the [public demo](https://memories-demo.radialapps.com/apps/memories/). Note that the demo is read-only and may be slow since it runs in a low-end free tier VM provided by [Oracle Cloud](https://www.oracle.com/cloud/free/). Photo credits go to [Unsplash](https://unsplash.com/) (for individual credits, refer to each folder). From 507348dd95ac58a75bb6ef69abb22a4d85d94bd8 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Mon, 31 Oct 2022 12:20:38 -0700 Subject: [PATCH 03/10] Rework readme --- README.md | 24 +++++++++++++++++------- appinfo/info.xml | 6 +++++- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 03c24a86..2b5450c4 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,12 @@ ![Screenshot](appinfo/screenshot.jpg) -## Photo Viewer and Manager +# Memories: Photo Viewer and Manager for Nextcloud + +![GitHub](https://img.shields.io/github/license/pulsejet/memories) +[![e2e](https://github.com/pulsejet/memories/actions/workflows/e2e.yaml/badge.svg)](https://github.com/pulsejet/memories/actions/workflows/e2e.yaml) +[![Demo](https://img.shields.io/badge/demo-online-blue)](https://memories-demo.radialapps.com/apps/memories/) +[![Gitter](https://img.shields.io/gitter/room/pulsejet/memories)](https://gitter.im/pulsejet/memories) +[![GitHub issues](https://img.shields.io/github/issues/pulsejet/memories)](https://github.com/pulsejet/memories/issues) Memories is a photo management app for Nextcloud with advanced features including: @@ -14,13 +20,11 @@ Memories is a photo management app for Nextcloud with advanced features includin - **📦 Archive**: Store photos you don't want to see in your timeline in a separate folder. - **⚡️ Performance**: Memories is extremely fast. -To get an idea of what memories looks and feels like, check out the [public demo](https://memories-demo.radialapps.com/apps/memories/). Note that the demo is read-only and may be slow since it runs in a low-end free tier VM provided by [Oracle Cloud](https://www.oracle.com/cloud/free/). Photo credits go to [Unsplash](https://unsplash.com/) (for individual credits, refer to each folder). +## 🌐 Online Demo -## How to support development - -- **🌟 Star this repository**: This is the easiest way to support the project and costs nothing. -- **🪲 Report bugs**: If you find a bug, please report it on the issue tracker. -- **📝 Contribute**: If you want to contribute, please read file / comment on an issue and ask for guidance. +- To get an idea of what memories looks and feels like, check out the [public demo](https://memories-demo.radialapps.com/apps/memories/). +- Note that the demo is read-only and may be slow since it runs in a low-end free tier VM provided by [Oracle Cloud](https://www.oracle.com/cloud/free/). +- Photo credits go to [Unsplash](https://unsplash.com/) (for individual credits, refer to each folder). ## 🚀 Installation @@ -37,6 +41,12 @@ To get an idea of what memories looks and feels like, check out the [public demo 1. ✅ Enable the app through the app management of your Nextcloud. 1. ⚒️ (Strongly recommended) use VS Code and install Vetur and Prettier. +## How to support development + +1. **🌟 Star this repository**: This is the easiest way to support the project and costs nothing. +1. **🪲 Report bugs**: If you find a bug, please report it on the issue tracker. +1. **📝 Contribute**: If you want to contribute, please read file / comment on an issue and ask for guidance. + ## Special Thanks Nextcloud team. A lot of this work is based on [Photos](https://github.com/nextcloud/photos). diff --git a/appinfo/info.xml b/appinfo/info.xml index 154fe8da..27c1e1f5 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -19,7 +19,11 @@ Memories is a photo management app for Nextcloud with advanced features includin - **📦 Archive**: Store photos you don't want to see in your timeline in a separate folder. - **⚡️ Performance**: Memories is extremely fast. -To get an idea of what memories looks and feels like, check out the [public demo](https://memories-demo.radialapps.com/apps/memories/). Note that the demo is read-only and may be slow since it runs in a low-end free tier VM provided by [Oracle Cloud](https://www.oracle.com/cloud/free/). Photo credits go to [Unsplash](https://unsplash.com/) (for individual credits, refer to each folder). +## 🌐 Online Demo + +- To get an idea of what memories looks and feels like, check out the [public demo](https://memories-demo.radialapps.com/apps/memories/). +- Note that the demo is read-only and may be slow since it runs in a low-end free tier VM provided by [Oracle Cloud](https://www.oracle.com/cloud/free/). +- Photo credits go to [Unsplash](https://unsplash.com/) (for individual credits, refer to each folder). ## 🚀 Installation From 23b3251d999e96edc1d3a61dc8c8585c0123fdd9 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Mon, 31 Oct 2022 12:21:26 -0700 Subject: [PATCH 04/10] docs: shorten title --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2b5450c4..9a740092 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![Screenshot](appinfo/screenshot.jpg) -# Memories: Photo Viewer and Manager for Nextcloud +# Memories: Photo Management for Nextcloud ![GitHub](https://img.shields.io/github/license/pulsejet/memories) [![e2e](https://github.com/pulsejet/memories/actions/workflows/e2e.yaml/badge.svg)](https://github.com/pulsejet/memories/actions/workflows/e2e.yaml) From 1f0a7279cae23484b0c5ccc5a92fdce9ecbb650c Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Mon, 31 Oct 2022 12:22:50 -0700 Subject: [PATCH 05/10] Config before index --- README.md | 2 +- appinfo/info.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9a740092..4dfa1a47 100644 --- a/README.md +++ b/README.md @@ -29,9 +29,9 @@ Memories is a photo management app for Nextcloud with advanced features includin ## 🚀 Installation 1. Install the app from the Nextcloud app store. +1. Perform the recommended [configuration steps](https://github.com/pulsejet/memories/wiki/Extra-Configuration). 1. Run `php ./occ memories:index` to generate metadata indices for existing photos. 1. Open the 📷 Memories app in Nextcloud and set the directory containing your photos. -1. Perform the recommended [configuration steps](https://github.com/pulsejet/memories/wiki/Extra-Configuration). ## 🏗 Development Setup diff --git a/appinfo/info.xml b/appinfo/info.xml index 27c1e1f5..0aa65daf 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -28,9 +28,9 @@ Memories is a photo management app for Nextcloud with advanced features includin ## 🚀 Installation 1. Install the app from the Nextcloud app store. +1. Perform the recommended [configuration steps](https://github.com/pulsejet/memories/wiki/Extra-Configuration). 1. Run `php ./occ memories:index` to generate metadata indices for existing photos. 1. Open the 📷 Memories app in Nextcloud and set the directory containing your photos. -1. Perform the recommended [configuration steps](https://github.com/pulsejet/memories/wiki/Extra-Configuration). ]]> 4.5.2 agpl From 4b337ec418b727d0b10f8f6cfffc5f7363bd9aa2 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Mon, 31 Oct 2022 12:23:42 -0700 Subject: [PATCH 06/10] Fix wiki link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4dfa1a47..f4b37213 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ Memories is a photo management app for Nextcloud with advanced features includin ## 🚀 Installation 1. Install the app from the Nextcloud app store. -1. Perform the recommended [configuration steps](https://github.com/pulsejet/memories/wiki/Extra-Configuration). +1. Perform the recommended [configuration steps](https://github.com/pulsejet/memories/wiki/Configuration). 1. Run `php ./occ memories:index` to generate metadata indices for existing photos. 1. Open the 📷 Memories app in Nextcloud and set the directory containing your photos. From e239d8ba9dd51bf95384497bd3010456bf49b3bc Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Mon, 31 Oct 2022 12:24:37 -0700 Subject: [PATCH 07/10] Shorten demo text --- README.md | 2 +- appinfo/info.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f4b37213..97a6a986 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Memories is a photo management app for Nextcloud with advanced features includin ## 🌐 Online Demo - To get an idea of what memories looks and feels like, check out the [public demo](https://memories-demo.radialapps.com/apps/memories/). -- Note that the demo is read-only and may be slow since it runs in a low-end free tier VM provided by [Oracle Cloud](https://www.oracle.com/cloud/free/). +- The demo is read-only and may be slow (free tier VM from [Oracle Cloud](https://www.oracle.com/cloud/free/)). - Photo credits go to [Unsplash](https://unsplash.com/) (for individual credits, refer to each folder). ## 🚀 Installation diff --git a/appinfo/info.xml b/appinfo/info.xml index 0aa65daf..01a710f3 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -22,7 +22,7 @@ Memories is a photo management app for Nextcloud with advanced features includin ## 🌐 Online Demo - To get an idea of what memories looks and feels like, check out the [public demo](https://memories-demo.radialapps.com/apps/memories/). -- Note that the demo is read-only and may be slow since it runs in a low-end free tier VM provided by [Oracle Cloud](https://www.oracle.com/cloud/free/). +- The demo is read-only and may be slow (free tier VM from [Oracle Cloud](https://www.oracle.com/cloud/free/)). - Photo credits go to [Unsplash](https://unsplash.com/) (for individual credits, refer to each folder). ## 🚀 Installation From defa30f547e43796b9c63e18c740fc04da871fc7 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Mon, 31 Oct 2022 20:21:21 -0700 Subject: [PATCH 08/10] Remove hardcoded mimetype (fix #136) --- lib/Db/TimelineQueryDays.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Db/TimelineQueryDays.php b/lib/Db/TimelineQueryDays.php index bacc6b41..2f708473 100644 --- a/lib/Db/TimelineQueryDays.php +++ b/lib/Db/TimelineQueryDays.php @@ -23,7 +23,7 @@ const CTE_FOLDERS = // CTE to get all folders recursively in the given top folde *PREFIX*filecache f INNER JOIN *PREFIX*cte_folders c ON (f.parent = c.fileid - AND f.mimetype = 2 + AND f.mimetype = (SELECT `id` FROM `*PREFIX*mimetypes` WHERE `mimetype` = "httpd/unix-directory") AND f.fileid <> :excludedFolderId ) )'; From 922e9a5c51a23abfc218ce65f86727e08b2cf3ab Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Mon, 31 Oct 2022 20:56:26 -0700 Subject: [PATCH 09/10] Store fileid as string (objectid) for tags (#118) --- lib/Db/TimelineQueryTags.php | 25 ++---- lib/Db/TimelineWrite.php | 2 + .../Version400503Date20221101033144.php | 86 +++++++++++++++++++ 3 files changed, 93 insertions(+), 20 deletions(-) create mode 100644 lib/Migration/Version400503Date20221101033144.php diff --git a/lib/Db/TimelineQueryTags.php b/lib/Db/TimelineQueryTags.php index 24cef447..45ad5edb 100644 --- a/lib/Db/TimelineQueryTags.php +++ b/lib/Db/TimelineQueryTags.php @@ -33,7 +33,7 @@ trait TimelineQueryTags $query->innerJoin('m', 'systemtag_object_mapping', 'stom', $query->expr()->andX( $query->expr()->eq('stom.objecttype', $query->createNamedParameter('files')), - $query->expr()->eq('stom.objectid', 'm.fileid'), + $query->expr()->eq('stom.objectid', 'm.objectid'), $query->expr()->eq('stom.systemtagid', $query->createNamedParameter($tagId)), )); } @@ -55,20 +55,10 @@ trait TimelineQueryTags )); // WHERE these items are memories indexed photos - $query->innerJoin('stom', 'memories', 'm', $query->expr()->eq('m.fileid', 'stom.objectid')); + $query->innerJoin('stom', 'memories', 'm', $query->expr()->eq('m.objectid', 'stom.objectid')); // WHERE these photos are in the user's requested folder recursively - // This is a hack to speed up the query instead of using joinFilecache - // The problem is objectid is VARCHAR(64) and fileid is BIGINT(20), so a - // join is extremely slow. Instead, we use a subquery to check existence. - // - // https://blog.sqlauthority.com/2010/06/05/sql-server-convert-in-to-exists-performance-talk/ - - $this->addSubfolderJoinParams($query, $folder, false); - $query->innerJoin('m', 'filecache', 'f', $query->expr()->andX( - $query->expr()->eq('f.fileid', 'm.fileid'), - $query->createFunction('EXISTS (SELECT 1 from *PREFIX*cte_folders WHERE *PREFIX*cte_folders.fileid = `f`.parent)') - )); + $query = $this->joinFilecache($query, $folder, true, false); // GROUP and ORDER by tag name $query->groupBy('st.name'); @@ -106,15 +96,10 @@ trait TimelineQueryTags ); // WHERE these items are memories indexed photos - $query->innerJoin('stom', 'memories', 'm', $query->expr()->eq('m.fileid', 'stom.objectid')); + $query->innerJoin('stom', 'memories', 'm', $query->expr()->eq('m.objectid', 'stom.objectid')); // WHERE these photos are in the user's requested folder recursively - // See the function above for an explanation of this hack - $this->addSubfolderJoinParams($query, $folder, false); - $query->innerJoin('m', 'filecache', 'f', $query->expr()->andX( - $query->expr()->eq('f.fileid', 'm.fileid'), - $query->createFunction('EXISTS (SELECT 1 from *PREFIX*cte_folders WHERE *PREFIX*cte_folders.fileid = `f`.parent)') - )); + $query = $this->joinFilecache($query, $folder, true, false); // MAX 4 $query->setMaxResults(4); diff --git a/lib/Db/TimelineWrite.php b/lib/Db/TimelineWrite.php index b0b35a52..20c11b07 100644 --- a/lib/Db/TimelineWrite.php +++ b/lib/Db/TimelineWrite.php @@ -99,6 +99,7 @@ class TimelineWrite if ($prevRow) { // Update existing row + // No need to set objectid again $query->update('memories') ->set('dayid', $query->createNamedParameter($dayId, IQueryBuilder::PARAM_INT)) ->set('datetaken', $query->createNamedParameter($dateTaken, IQueryBuilder::PARAM_STR)) @@ -115,6 +116,7 @@ class TimelineWrite $query->insert('memories') ->values([ 'fileid' => $query->createNamedParameter($fileId, IQueryBuilder::PARAM_INT), + 'objectid' => $query->createNamedParameter((string) $fileId, IQueryBuilder::PARAM_STR), 'dayid' => $query->createNamedParameter($dayId, IQueryBuilder::PARAM_INT), 'datetaken' => $query->createNamedParameter($dateTaken, IQueryBuilder::PARAM_STR), 'mtime' => $query->createNamedParameter($mtime, IQueryBuilder::PARAM_INT), diff --git a/lib/Migration/Version400503Date20221101033144.php b/lib/Migration/Version400503Date20221101033144.php new file mode 100644 index 00000000..dc20d4a5 --- /dev/null +++ b/lib/Migration/Version400503Date20221101033144.php @@ -0,0 +1,86 @@ + + * @author Your name + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +namespace OCA\Memories\Migration; + +use Closure; +use OCP\DB\ISchemaWrapper; +use OCP\IDBConnection; +use OCP\Migration\IOutput; +use OCP\Migration\SimpleMigrationStep; + +/** + * Auto-generated migration step: Please modify to your needs! + */ +class Version400503Date20221101033144 extends SimpleMigrationStep +{ + /** @var IDBConnection */ + private $dbc; + + public function __construct(IDBConnection $dbc) + { + $this->dbc = $dbc; + } + + /** + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` + */ + public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void + { + } + + /** + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` + */ + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper + { + /** @var ISchemaWrapper $schema */ + $schema = $schemaClosure(); + + $table = $schema->getTable('memories'); + + // This is a hack to speed up the tags queries. + // The problem is objectid in systemtags is VARCHAR(64) while fileid in + // filecache and memories is BIGINT(20), so a join is extremely slow, + // because the entire tags table must be scanned for the conversion. + + $table->addColumn('objectid', 'string', [ + 'notnull' => true, + 'length' => 64, + 'default' => '0', // set to real value in postSchemaChange + ]); + + $table->addIndex(['objectid'], 'memories_objectid_index'); + + return $schema; + } + + /** + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` + */ + public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void + { + // Update oc_memories to set objectid equal to fileid for all rows + $this->dbc->executeQuery('UPDATE *PREFIX*memories SET objectid = CAST(fileid AS CHAR)'); + } +} From 5af495c4335f3046ed041fe95fda21b670f31c58 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Mon, 31 Oct 2022 21:06:43 -0700 Subject: [PATCH 10/10] Select on mousedown --- src/components/frame/Folder.vue | 1 + src/components/frame/Photo.vue | 3 ++- src/components/frame/Tag.vue | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/frame/Folder.vue b/src/components/frame/Folder.vue index 002c9d5c..1e36e414 100644 --- a/src/components/frame/Folder.vue +++ b/src/components/frame/Folder.vue @@ -1,5 +1,6 @@