From f22966a28026e2d23113231eb74e3a6cea4d6888 Mon Sep 17 00:00:00 2001 From: Michael Procter Date: Sat, 21 Feb 2015 08:50:38 +0000 Subject: [PATCH 1/5] Show currently configured plugins, for debugging --- plugins/check/index.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/check/index.php b/plugins/check/index.php index 27e9c65..3a12764 100644 --- a/plugins/check/index.php +++ b/plugins/check/index.php @@ -115,5 +115,6 @@ echo('Imagick: ' . $imagick . PHP_EOL); echo('Imagick Active: ' . $settings['imagick'] . PHP_EOL); echo('Imagick Version: ' . $imagickVersion . PHP_EOL); echo('GD Version: ' . $gdVersion['GD Version'] . PHP_EOL); +echo('Plugins: ' . $settings['plugins'] . PHP_EOL); -?> \ No newline at end of file +?> From b34374fcdbe5d2c2e65f1e29893761be383fbc1d Mon Sep 17 00:00:00 2001 From: Michael Procter Date: Sat, 21 Feb 2015 08:52:33 +0000 Subject: [PATCH 2/5] Add plugin trigger for before and after server import --- php/modules/Import.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/php/modules/Import.php b/php/modules/Import.php index c8313bb..657bf1c 100644 --- a/php/modules/Import.php +++ b/php/modules/Import.php @@ -82,6 +82,8 @@ class Import extends Module { $contains['photos'] = false; $contains['albums'] = false; + $plugins->activate(__METHOD__ . ":before", array($albumID, $path)); + # Get all files $files = glob($path . '/*'); @@ -133,6 +135,8 @@ class Import extends Module { } + $plugins->activate(__METHOD__ . ":after", array($albumID, $path)); + if ($contains['photos']===false&&$contains['albums']===false) return 'Warning: Folder empty or no readable files to process!'; if ($contains['photos']===false&&$contains['albums']===true) return 'Notice: Import only contains albums!'; return true; From e17cfe79a35d16da42011dbba18bfe31f2bb5354 Mon Sep 17 00:00:00 2001 From: Michael Procter Date: Sat, 21 Feb 2015 08:53:32 +0000 Subject: [PATCH 3/5] Remove imported photos as promised by warning screen --- php/modules/Import.php | 1 + 1 file changed, 1 insertion(+) diff --git a/php/modules/Import.php b/php/modules/Import.php index 657bf1c..472fdc9 100644 --- a/php/modules/Import.php +++ b/php/modules/Import.php @@ -107,6 +107,7 @@ class Import extends Module { continue; } $contains['photos'] = true; + unlink($file); } else if (is_dir($file)) { From 6bb1859faf025ca7557bf2b660c6c8b75d7c6ac1 Mon Sep 17 00:00:00 2001 From: Michael Procter Date: Tue, 24 Feb 2015 22:13:45 +0000 Subject: [PATCH 4/5] Remove 'unlink' - potentially confusing. --- php/modules/Import.php | 1 - 1 file changed, 1 deletion(-) diff --git a/php/modules/Import.php b/php/modules/Import.php index 472fdc9..657bf1c 100644 --- a/php/modules/Import.php +++ b/php/modules/Import.php @@ -107,7 +107,6 @@ class Import extends Module { continue; } $contains['photos'] = true; - unlink($file); } else if (is_dir($file)) { From 6d25151c7833853169a9b5f3e295ffe97987e4cf Mon Sep 17 00:00:00 2001 From: Michael Procter Date: Tue, 24 Feb 2015 22:15:58 +0000 Subject: [PATCH 5/5] Add comment as to why conventional plugin triggers not used. --- php/modules/Import.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/php/modules/Import.php b/php/modules/Import.php index 657bf1c..799cc4a 100644 --- a/php/modules/Import.php +++ b/php/modules/Import.php @@ -82,6 +82,9 @@ class Import extends Module { $contains['photos'] = false; $contains['albums'] = false; + # Invoke plugins directly, as instance method not valid here + # Note that updated albumId and path explicitly passed, rather + # than using func_get_args() which will only return original ones $plugins->activate(__METHOD__ . ":before", array($albumID, $path)); # Get all files @@ -135,6 +138,9 @@ class Import extends Module { } + # Invoke plugins directly, as instance method not valid here + # Note that updated albumId and path explicitly passed, rather + # than using func_get_args() which will only return original ones $plugins->activate(__METHOD__ . ":after", array($albumID, $path)); if ($contains['photos']===false&&$contains['albums']===false) return 'Warning: Folder empty or no readable files to process!';