Skip to content

Commit

Permalink
Merge pull request #94 from jolicode/tweaks
Browse files Browse the repository at this point in the history
Fix permissions on Windows notifiers binaries
  • Loading branch information
pyrech authored May 24, 2023
2 parents a6ceac9 + 39ba3f3 commit 54eaea5
Show file tree
Hide file tree
Showing 27 changed files with 11 additions and 252 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changes between versions

## Not yet released

* Fixed permissions on Windows notifiers binaries

## 2.5.0 (2022-12-24)

* Dropped support for PHP 7.4
Expand Down
Empty file modified bin/notifu/notifu.exe
100644 → 100755
Empty file.
Empty file modified bin/snoreToast/snoretoast-x86.exe
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion example/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@

$result = $notifier->send($notification);

echo 'Notification ', $result ? 'successfully sent' : 'failed', ' with ', get_class($notifier), \PHP_EOL;
echo 'Notification ', $result ? 'successfully sent' : 'failed', ' with ', $notifier::class, \PHP_EOL;
12 changes: 0 additions & 12 deletions src/Notifier/AppleScriptNotifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
*/
class AppleScriptNotifier extends CliBasedNotifier
{
/**
* {@inheritdoc}
*/
public function isSupported(): bool
{
if (OsHelper::isMacOS() && version_compare(OsHelper::getMacOSVersion(), '10.9.0', '>=')) {
Expand All @@ -31,25 +28,16 @@ public function isSupported(): bool
return false;
}

/**
* {@inheritdoc}
*/
public function getBinary(): string
{
return 'osascript';
}

/**
* {@inheritdoc}
*/
public function getPriority(): int
{
return static::PRIORITY_LOW;
}

/**
* {@inheritdoc}
*/
protected function getCommandLineArguments(Notification $notification): array
{
$script = 'display notification "' . str_replace('"', '\\"', $notification->getBody()) . '"';
Expand Down
6 changes: 0 additions & 6 deletions src/Notifier/CliBasedNotifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ abstract class CliBasedNotifier implements Notifier
*/
private int $support = self::SUPPORT_UNKNOWN;

/**
* {@inheritdoc}
*/
public function isSupported(): bool
{
if (self::SUPPORT_UNKNOWN !== $this->support) {
Expand All @@ -56,9 +53,6 @@ public function isSupported(): bool
return false;
}

/**
* {@inheritdoc}
*/
public function send(Notification $notification): bool
{
if (!$notification->getBody()) {
Expand Down
9 changes: 0 additions & 9 deletions src/Notifier/GrowlNotifyNotifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,16 @@
*/
class GrowlNotifyNotifier extends CliBasedNotifier
{
/**
* {@inheritdoc}
*/
public function getBinary(): string
{
return 'growlnotify';
}

/**
* {@inheritdoc}
*/
public function getPriority(): int
{
return static::PRIORITY_HIGH;
}

/**
* {@inheritdoc}
*/
protected function getCommandLineArguments(Notification $notification): array
{
$arguments = [
Expand Down
9 changes: 0 additions & 9 deletions src/Notifier/KDialogNotifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,16 @@
*/
class KDialogNotifier extends CliBasedNotifier
{
/**
* {@inheritdoc}
*/
public function getBinary(): string
{
return 'kdialog';
}

/**
* {@inheritdoc}
*/
public function getPriority(): int
{
return static::PRIORITY_HIGH;
}

/**
* {@inheritdoc}
*/
protected function getCommandLineArguments(Notification $notification): array
{
$arguments = [];
Expand Down
21 changes: 0 additions & 21 deletions src/Notifier/NotifuNotifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,57 +20,36 @@
*/
class NotifuNotifier extends CliBasedNotifier implements BinaryProvider
{
/**
* {@inheritdoc}
*/
public function getBinary(): string
{
return 'notifu';
}

/**
* {@inheritdoc}
*/
public function getPriority(): int
{
return static::PRIORITY_LOW;
}

/**
* {@inheritdoc}
*/
public function canBeUsed(): bool
{
return OsHelper::isWindows() && OsHelper::isWindowsSeven();
}

/**
* {@inheritdoc}
*/
public function getRootDir(): string
{
return \dirname(__DIR__, 2) . '/bin/notifu';
}

/**
* {@inheritdoc}
*/
public function getEmbeddedBinary(): string
{
return 'notifu.exe';
}

/**
* {@inheritdoc}
*/
public function getExtraFiles(): array
{
return [];
}

/**
* {@inheritdoc}
*/
protected function getCommandLineArguments(Notification $notification): array
{
$arguments = [
Expand Down
9 changes: 0 additions & 9 deletions src/Notifier/NotifySendNotifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,16 @@
*/
class NotifySendNotifier extends CliBasedNotifier
{
/**
* {@inheritdoc}
*/
public function getBinary(): string
{
return 'notify-send';
}

/**
* {@inheritdoc}
*/
public function getPriority(): int
{
return static::PRIORITY_MEDIUM;
}

/**
* {@inheritdoc}
*/
protected function getCommandLineArguments(Notification $notification): array
{
$arguments = [];
Expand Down
9 changes: 0 additions & 9 deletions src/Notifier/NullNotifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,16 @@

class NullNotifier implements Notifier
{
/**
* {@inheritdoc}
*/
public function isSupported(): bool
{
return true;
}

/**
* {@inheritdoc}
*/
public function getPriority(): int
{
return static::PRIORITY_LOW;
}

/**
* {@inheritdoc}
*/
public function send(Notification $notification): bool
{
return false;
Expand Down
27 changes: 1 addition & 26 deletions src/Notifier/SnoreToastNotifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,60 +21,38 @@
*/
class SnoreToastNotifier extends CliBasedNotifier implements BinaryProvider
{
/**
* {@inheritdoc}
*/
public function getBinary(): string
{
return 'snoretoast';
}

/**
* {@inheritdoc}
*/
public function getPriority(): int
{
return static::PRIORITY_MEDIUM;
}

/**
* {@inheritdoc}
*/
public function canBeUsed(): bool
{
return
(OsHelper::isWindows() && OsHelper::isWindowsEightOrHigher())
|| OsHelper::isWindowsSubsystemForLinux()
;
|| OsHelper::isWindowsSubsystemForLinux();
}

/**
* {@inheritdoc}
*/
public function getRootDir(): string
{
return \dirname(__DIR__, 2) . '/bin/snoreToast';
}

/**
* {@inheritdoc}
*/
public function getEmbeddedBinary(): string
{
return 'snoretoast-x86.exe';
}

/**
* {@inheritdoc}
*/
public function getExtraFiles(): array
{
return [];
}

/**
* {@inheritdoc}
*/
protected function getCommandLineArguments(Notification $notification): array
{
$arguments = [
Expand All @@ -95,9 +73,6 @@ protected function getCommandLineArguments(Notification $notification): array
return $arguments;
}

/**
* {@inheritdoc}
*/
protected function handleExitCode(Process $process): bool
{
return 0 < $process->getExitCode();
Expand Down
9 changes: 0 additions & 9 deletions src/Notifier/TerminalNotifierNotifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,16 @@
*/
class TerminalNotifierNotifier extends CliBasedNotifier
{
/**
* {@inheritdoc}
*/
public function getBinary(): string
{
return 'terminal-notifier';
}

/**
* {@inheritdoc}
*/
public function getPriority(): int
{
return static::PRIORITY_MEDIUM;
}

/**
* {@inheritdoc}
*/
protected function getCommandLineArguments(Notification $notification): array
{
$arguments = [
Expand Down
24 changes: 1 addition & 23 deletions src/Notifier/ToasterNotifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,52 +22,33 @@
*/
class ToasterNotifier extends CliBasedNotifier implements BinaryProvider
{
/**
* {@inheritdoc}
*/
public function getBinary(): string
{
return 'toast';
}

/**
* {@inheritdoc}
*/
public function getPriority(): int
{
return static::PRIORITY_MEDIUM;
}

/**
* {@inheritdoc}
*/
public function canBeUsed(): bool
{
return
(OsHelper::isWindows() && OsHelper::isWindowsEightOrHigher())
|| OsHelper::isWindowsSubsystemForLinux()
;
|| OsHelper::isWindowsSubsystemForLinux();
}

/**
* {@inheritdoc}
*/
public function getRootDir(): string
{
return \dirname(__DIR__, 2) . '/bin/toaster';
}

/**
* {@inheritdoc}
*/
public function getEmbeddedBinary(): string
{
return 'toast.exe';
}

/**
* {@inheritdoc}
*/
public function getExtraFiles(): array
{
return [
Expand All @@ -76,9 +57,6 @@ public function getExtraFiles(): array
];
}

/**
* {@inheritdoc}
*/
protected function getCommandLineArguments(Notification $notification): array
{
$arguments = [
Expand Down
Loading

0 comments on commit 54eaea5

Please sign in to comment.