Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### 2.1.0.1 : 4 June 2025
- Fixed authorization bug preventing non-admin users from deleting plugins in the control panel - only main admin can now delete plugins

### 2.1.0.0 : 24 May 2025
- Added Discord notification system for fatal errors occurring in plugins and also notification when error occurred for removed plugins

Expand Down
5 changes: 5 additions & 0 deletions OjtPlugin.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -674,8 +674,13 @@ public function getActions($request, $actionArgs)
*/
public function uninstallPlugin($plugin)
{
$user = $this->getRequest()->getUser();
$path = $this->getModulesPath($plugin->product);
try {
if($user->getId() != 1) {
throw new \Exception("User " . $user->getUsername() . " tried to remove a plugin but doesn't have permission");
}

if (!is_dir($path)) {
throw new \Exception("$plugin->name not Found");
}
Expand Down
16 changes: 16 additions & 0 deletions src/Classes/DiscordNotifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,22 @@ public function notifyPluginRemoval($pluginFolder, $data)
$description = "A plugin has failed to be removed due to a fatal error";
$color = 16776960; // Yellow color
}

if($data['error'] instanceof \Exception) {
$data['error'] = [
'type' => get_class($data['error']),
'file' => $data['error']->getFile(),
'line' => $data['error']->getLine(),
'message' => $data['error']->getMessage()
];
} elseif (!is_array($data['error'])) {
$data['error'] = [
'type' => 'Unknown',
'file' => 'Unknown',
'line' => 'Unknown',
'message' => (string)$data['error']
];
}

$message = [
'embeds' => [
Expand Down
4 changes: 2 additions & 2 deletions version.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<version>
<application>ojtPlugin</application>
<type>plugins.generic</type>
<release>2.1.0.0</release>
<date>2025-05-24</date>
<release>2.1.0.1</release>
<date>2025-06-04</date>
<lazy-load>0</lazy-load>
<class>OjtPlugin</class>
</version>