Skip to content

Commit

Permalink
chore: rename package-manager to extension-manager
Browse files Browse the repository at this point in the history
  • Loading branch information
SychO9 committed Jan 10, 2024
1 parent 8205ae5 commit 207032f
Show file tree
Hide file tree
Showing 115 changed files with 587 additions and 494 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Package Manager PHP
name: Extension Manager PHP

on: [workflow_dispatch, push, pull_request]

Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"Flarum\\Lock\\": "extensions/lock/src",
"Flarum\\Mentions\\": "extensions/mentions/src",
"Flarum\\Nicknames\\": "extensions/nicknames/src",
"Flarum\\PackageManager\\": "extensions/package-manager/src",
"Flarum\\ExtensionManager\\": "extensions/extension-manager/src",
"Flarum\\Pusher\\": "extensions/pusher/src",
"Flarum\\Statistics\\": "extensions/statistics/src",
"Flarum\\Sticky\\": "extensions/sticky/src",
Expand Down Expand Up @@ -74,7 +74,7 @@
"flarum/markdown": "self.version",
"flarum/mentions": "self.version",
"flarum/nicknames": "self.version",
"flarum/package-manager": "self.version",
"flarum/extension-manager": "self.version",
"flarum/pusher": "self.version",
"flarum/statistics": "self.version",
"flarum/sticky": "self.version",
Expand Down Expand Up @@ -165,7 +165,7 @@
"extensions/markdown",
"extensions/mentions",
"extensions/nicknames",
"extensions/package-manager",
"extensions/extension-manager",
"extensions/pusher",
"extensions/statistics",
"extensions/sticky",
Expand Down
2 changes: 1 addition & 1 deletion extensions/package-manager/LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) Sami Mazouz
Copyright (c) 2024 Stichting Flarum (Flarum Foundation)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
8 changes: 4 additions & 4 deletions extensions/package-manager/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Package Manager
# Extension Manager

The package manager is a tool that allows you to easily install and manage extensions. It runs [composer](https://getcomposer.org/) under the hood.
The extension manager is a tool that allows you to easily install and manage extensions. It runs [composer](https://getcomposer.org/) under the hood.

## Security

Expand All @@ -10,9 +10,9 @@ This extension is optional and can be removed for those who prefer to manually m

## Troubleshooting

If you have many extensions installed, you may run into memory issues when using the package manager. If this happens, you can use an asynchronous queue that will run the package manager in the background.
If you have many extensions installed, you may run into memory issues when using the extension manager. If this happens, you can use an asynchronous queue that will run the extension manager in the background.

* Simple database queue guide: https://discuss.flarum.org/d/28151-database-queue-the-simplest-queue-even-for-shared-hosting
* (Advanced) Redis queue: https://discuss.flarum.org/d/21873-redis-sessions-cache-queues

You can find detailed logs on the package manager operations in the `storage/logs/composer` directory. Please include the latest log file when reporting issues in the [Flarum support forum](https://discuss.flarum.org/t/support).
You can find detailed logs on the extension manager operations in the `storage/logs/composer` directory. Please include the latest log file when reporting issues in the [Flarum support forum](https://discuss.flarum.org/t/support).
14 changes: 7 additions & 7 deletions extensions/package-manager/composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "flarum/package-manager",
"description": "A Flarum Package Manager.",
"name": "flarum/extension-manager",
"description": "An extension manager to install, update and remove extension packages from the interface (Wrapper around composer).",
"keywords": [
"extensions",
"composer",
Expand All @@ -18,8 +18,8 @@
}
],
"support": {
"issues": "https://github.com/flarum/package-manager/issues",
"source": "https://github.com/flarum/package-manager"
"issues": "https://github.com/flarum/framework/issues",
"source": "https://github.com/flarum/extension-manager"
},
"require": {
"flarum/core": "^1.8",
Expand All @@ -31,7 +31,7 @@
},
"extra": {
"flarum-extension": {
"title": "Package Manager",
"title": "Extension Manager",
"icon": {
"name": "fas fa-box-open",
"backgroundColor": "#117187",
Expand Down Expand Up @@ -69,12 +69,12 @@
},
"autoload": {
"psr-4": {
"Flarum\\PackageManager\\": "src/"
"Flarum\\ExtensionManager\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Flarum\\PackageManager\\Tests\\": "tests/"
"Flarum\\ExtensionManager\\Tests\\": "tests/"
}
},
"scripts": {
Expand Down
34 changes: 17 additions & 17 deletions extensions/package-manager/extend.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* LICENSE file that was distributed with this source code.
*/

namespace Flarum\PackageManager;
namespace Flarum\ExtensionManager;

use Flarum\Extend;
use Flarum\Foundation\Paths;
Expand All @@ -17,43 +17,43 @@

return [
(new Extend\Routes('api'))
->post('/package-manager/extensions', 'package-manager.extensions.require', Api\Controller\RequireExtensionController::class)
->patch('/package-manager/extensions/{id}', 'package-manager.extensions.update', Api\Controller\UpdateExtensionController::class)
->delete('/package-manager/extensions/{id}', 'package-manager.extensions.remove', Api\Controller\RemoveExtensionController::class)
->post('/package-manager/check-for-updates', 'package-manager.check-for-updates', Api\Controller\CheckForUpdatesController::class)
->post('/package-manager/why-not', 'package-manager.why-not', Api\Controller\WhyNotController::class)
->post('/package-manager/minor-update', 'package-manager.minor-update', Api\Controller\MinorUpdateController::class)
->post('/package-manager/major-update', 'package-manager.major-update', Api\Controller\MajorUpdateController::class)
->post('/package-manager/global-update', 'package-manager.global-update', Api\Controller\GlobalUpdateController::class)
->get('/package-manager-tasks', 'package-manager.tasks.index', Api\Controller\ListTasksController::class)
->post('/package-manager/composer', 'package-manager.composer', Api\Controller\ConfigureComposerController::class),
->post('/extension-manager/extensions', 'extension-manager.extensions.require', Api\Controller\RequireExtensionController::class)
->patch('/extension-manager/extensions/{id}', 'extension-manager.extensions.update', Api\Controller\UpdateExtensionController::class)
->delete('/extension-manager/extensions/{id}', 'extension-manager.extensions.remove', Api\Controller\RemoveExtensionController::class)
->post('/extension-manager/check-for-updates', 'extension-manager.check-for-updates', Api\Controller\CheckForUpdatesController::class)
->post('/extension-manager/why-not', 'extension-manager.why-not', Api\Controller\WhyNotController::class)
->post('/extension-manager/minor-update', 'extension-manager.minor-update', Api\Controller\MinorUpdateController::class)
->post('/extension-manager/major-update', 'extension-manager.major-update', Api\Controller\MajorUpdateController::class)
->post('/extension-manager/global-update', 'extension-manager.global-update', Api\Controller\GlobalUpdateController::class)
->get('/extension-manager-tasks', 'extension-manager.tasks.index', Api\Controller\ListTasksController::class)
->post('/extension-manager/composer', 'extension-manager.composer', Api\Controller\ConfigureComposerController::class),

(new Extend\Frontend('admin'))
->css(__DIR__.'/less/admin.less')
->js(__DIR__.'/js/dist/admin.js')
->content(function (Document $document) {
$paths = resolve(Paths::class);

$document->payload['flarum-package-manager.writable_dirs'] = is_writable($paths->vendor)
$document->payload['flarum-extension-manager.writable_dirs'] = is_writable($paths->vendor)
&& is_writable($paths->storage)
&& (! file_exists($paths->storage.'/.composer') || is_writable($paths->storage.'/.composer'))
&& is_writable($paths->base.'/composer.json')
&& is_writable($paths->base.'/composer.lock');

$document->payload['flarum-package-manager.using_sync_queue'] = resolve(Queue::class) instanceof SyncQueue;
$document->payload['flarum-extension-manager.using_sync_queue'] = resolve(Queue::class) instanceof SyncQueue;
}),

new Extend\Locales(__DIR__.'/locale'),

(new Extend\Settings())
->default(Settings\LastUpdateCheck::key(), json_encode(Settings\LastUpdateCheck::default()))
->default(Settings\LastUpdateRun::key(), json_encode(Settings\LastUpdateRun::default()))
->default('flarum-package-manager.queue_jobs', false)
->default('flarum-package-manager.minimum_stability', 'stable')
->default('flarum-package-manager.task_retention_days', 7),
->default('flarum-extension-manager.queue_jobs', '0')
->default('flarum-extension-manager.minimum_stability', 'stable')
->default('flarum-extension-manager.task_retention_days', 7),

(new Extend\ServiceProvider)
->register(PackageManagerServiceProvider::class),
->register(ExtensionManagerServiceProvider::class),

(new Extend\ErrorHandling)
->handler(Exception\ComposerCommandFailedException::class, Exception\ExceptionHandler::class)
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion extensions/package-manager/js/dist/admin.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion extensions/package-manager/js/dist/admin.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion extensions/package-manager/js/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@flarum/package-manager",
"name": "@flarum/extension-manager",
"version": "0.0.0",
"private": true,
"prettier": "@flarum/prettier-config",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,40 +32,40 @@ export default class AuthMethodModal<CustomAttrs extends IAuthMethodModalAttrs =

title(): Mithril.Children {
const context = this.attrs.host ? 'edit' : 'add';
return app.translator.trans(`flarum-package-manager.admin.auth_config.${context}_label`);
return app.translator.trans(`flarum-extension-manager.admin.auth_config.${context}_label`);
}

content(): Mithril.Children {
const types = {
'github-oauth': app.translator.trans('flarum-package-manager.admin.auth_config.types.github-oauth'),
'gitlab-oauth': app.translator.trans('flarum-package-manager.admin.auth_config.types.gitlab-oauth'),
'gitlab-token': app.translator.trans('flarum-package-manager.admin.auth_config.types.gitlab-token'),
bearer: app.translator.trans('flarum-package-manager.admin.auth_config.types.bearer'),
'github-oauth': app.translator.trans('flarum-extension-manager.admin.auth_config.types.github-oauth'),
'gitlab-oauth': app.translator.trans('flarum-extension-manager.admin.auth_config.types.gitlab-oauth'),
'gitlab-token': app.translator.trans('flarum-extension-manager.admin.auth_config.types.gitlab-token'),
bearer: app.translator.trans('flarum-extension-manager.admin.auth_config.types.bearer'),
};

return (
<div className="Modal-body">
<div className="Form-group">
<label>{app.translator.trans('flarum-package-manager.admin.auth_config.add_modal.type_label')}</label>
<label>{app.translator.trans('flarum-extension-manager.admin.auth_config.add_modal.type_label')}</label>
<Select options={types} value={this.type()} onchange={this.type} />
</div>
<div className="Form-group">
<label>{app.translator.trans('flarum-package-manager.admin.auth_config.add_modal.host_label')}</label>
<label>{app.translator.trans('flarum-extension-manager.admin.auth_config.add_modal.host_label')}</label>
<input
className="FormControl"
bidi={this.host}
placeholder={app.translator.trans('flarum-package-manager.admin.auth_config.add_modal.host_placeholder')}
placeholder={app.translator.trans('flarum-extension-manager.admin.auth_config.add_modal.host_placeholder')}
/>
</div>
<div className="Form-group">
<label>{app.translator.trans('flarum-package-manager.admin.auth_config.add_modal.token_label')}</label>
<label>{app.translator.trans('flarum-extension-manager.admin.auth_config.add_modal.token_label')}</label>
<textarea
className="FormControl"
oninput={(e: InputEvent) => this.token((e.target as HTMLTextAreaElement).value)}
rows="6"
placeholder={
this.token().startsWith('unchanged:')
? extractText(app.translator.trans('flarum-package-manager.admin.auth_config.add_modal.unchanged_token_placeholder'))
? extractText(app.translator.trans('flarum-extension-manager.admin.auth_config.add_modal.unchanged_token_placeholder'))
: ''
}
>
Expand All @@ -74,7 +74,7 @@ export default class AuthMethodModal<CustomAttrs extends IAuthMethodModalAttrs =
</div>
<div className="Form-group">
<Button className="Button Button--primary" onclick={this.submit.bind(this)}>
{app.translator.trans('flarum-package-manager.admin.auth_config.add_modal.submit_button')}
{app.translator.trans('flarum-extension-manager.admin.auth_config.add_modal.submit_button')}
</Button>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default class ConfigureAuth extends ConfigureJson<IConfigureJson> {
protected type = 'auth';

title(): Mithril.Children {
return app.translator.trans('flarum-package-manager.admin.auth_config.title');
return app.translator.trans('flarum-extension-manager.admin.auth_config.title');
}

className(): string {
Expand All @@ -27,14 +27,14 @@ export default class ConfigureAuth extends ConfigureJson<IConfigureJson> {
});

return (
<div className="SettingsGroups-content">
<div className="ExtensionManager-SettingsGroups-content">
{hasAuthSettings ? (
authSettings.map((type) => {
const hosts = this.settings[type]();

return (
<div className="Form-group">
<label>{app.translator.trans(`flarum-package-manager.admin.auth_config.types.${type}`)}</label>
<label>{app.translator.trans(`flarum-extension-manager.admin.auth_config.types.${type}`)}</label>
<div className="ConfigureAuth-hosts">
{Object.keys(hosts).map((host) => {
const data = hosts[host] as string | Record<string, string>;
Expand All @@ -58,9 +58,9 @@ export default class ConfigureAuth extends ConfigureJson<IConfigureJson> {
<Button
className="Button Button--icon"
icon="fas fa-trash"
aria-label={app.translator.trans('flarum-package-manager.admin.auth_config.delete_label')}
aria-label={app.translator.trans('flarum-extension-manager.admin.auth_config.delete_label')}
onclick={() => {
if (confirm(extractText(app.translator.trans('flarum-package-manager.admin.auth_config.delete_confirmation')))) {
if (confirm(extractText(app.translator.trans('flarum-extension-manager.admin.auth_config.delete_confirmation')))) {
const newType = { ...this.setting(type)() };
delete newType[host];

Expand All @@ -80,7 +80,7 @@ export default class ConfigureAuth extends ConfigureJson<IConfigureJson> {
);
})
) : (
<span className="helpText">{app.translator.trans('flarum-package-manager.admin.auth_config.no_auth_methods_configured')}</span>
<span className="helpText">{app.translator.trans('flarum-extension-manager.admin.auth_config.no_auth_methods_configured')}</span>
)}
</div>
);
Expand All @@ -99,7 +99,7 @@ export default class ConfigureAuth extends ConfigureJson<IConfigureJson> {
})
}
>
{app.translator.trans('flarum-package-manager.admin.auth_config.add_label')}
{app.translator.trans('flarum-extension-manager.admin.auth_config.add_label')}
</Button>
);

Expand Down
Loading

0 comments on commit 207032f

Please sign in to comment.