1
0
mirror of https://github.com/flarum/core.git synced 2025-07-26 19:20:21 +02:00

Move to flarum

This commit is contained in:
SychO9
2021-10-21 10:52:51 +01:00
parent 7e174dd08a
commit a144c026f3
53 changed files with 363 additions and 171 deletions

View File

@@ -1,3 +1,5 @@
js/node_modules js/node_modules
vendor/ vendor/
composer.lock composer.lock
tests/tmp/
.phpunit.result.cache

View File

@@ -2,4 +2,4 @@
*An Experiment.* *An Experiment.*
Read: https://github.com/SychO9/flarum-package-manager/wiki Read: https://github.com/flarum/package-manager/wiki

View File

@@ -1,5 +1,5 @@
{ {
"name": "sycho/flarum-package-manager", "name": "flarum/package-manager",
"description": "A Flarum Package Manager.", "description": "A Flarum Package Manager.",
"keywords": [ "keywords": [
"extensions", "composer", "packages", "manager", "updater" "extensions", "composer", "packages", "manager", "updater"
@@ -8,19 +8,22 @@
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{ {
"name": "Sami Mazouz", "name": "Flarum",
"email": "sami.mazouz@flarum.org", "email": "info@flarum.org",
"homepage": "https://sycho9.github.io" "homepage": "https://flarum.org/team"
} }
], ],
"support": { "support": {
"issues": "https://github.com/SychO9/flarum-package-manager/issues", "issues": "https://github.com/flarum/package-manager/issues",
"source": "https://github.com/SychO9/flarum-package-manager" "source": "https://github.com/flarum/package-manager"
}, },
"require": { "require": {
"flarum/core": "^1.0.0", "flarum/core": "^1.0.0",
"composer/composer": "^2.0" "composer/composer": "^2.0"
}, },
"require-dev": {
"flarum/testing": "^1.0.0"
},
"extra": { "extra": {
"flarum-extension": { "flarum-extension": {
"title": "Package Manager", "title": "Package Manager",
@@ -33,7 +36,30 @@
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"SychO\\PackageManager\\": "src/" "Flarum\\PackageManager\\": "src/"
} }
},
"autoload-dev": {
"psr-4": {
"Flarum\\PackageManager\\Tests\\": "tests/"
}
},
"scripts": {
"test": [
"@test:unit",
"@test:integration"
],
"test:unit": "phpunit -c tests/phpunit.unit.xml",
"test:integration": "phpunit -c tests/phpunit.integration.xml",
"test:setup": [
"@php tests/integration/setup.php",
"cd $FLARUM_TEST_TMP_DIR_LOCAL && composer install"
]
},
"scripts-descriptions": {
"test": "Runs all tests.",
"test:unit": "Runs all unit tests.",
"test:integration": "Runs all integration tests.",
"test:setup": "Sets up a database for use with integration tests. Execute this only once."
} }
} }

View File

@@ -1,20 +1,23 @@
<?php <?php
/** /*
* This file is part of Flarum.
* *
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/ */
namespace SychO\PackageManager; namespace Flarum\PackageManager;
use Flarum\Extend; use Flarum\Extend;
use Flarum\Foundation\Paths; use Flarum\Foundation\Paths;
use Flarum\Frontend\Document; use Flarum\Frontend\Document;
use SychO\PackageManager\Exception\ComposerCommandFailedException; use Flarum\PackageManager\Exception\ComposerCommandFailedException;
use SychO\PackageManager\Exception\ComposerCommandFailedExceptionHandler; use Flarum\PackageManager\Exception\ComposerCommandFailedExceptionHandler;
use SychO\PackageManager\Exception\ComposerRequireFailedException; use Flarum\PackageManager\Exception\ComposerRequireFailedException;
use SychO\PackageManager\Exception\ComposerUpdateFailedException; use Flarum\PackageManager\Exception\ComposerUpdateFailedException;
use SychO\PackageManager\Exception\ExtensionAlreadyInstalledException; use Flarum\PackageManager\Exception\ExtensionAlreadyInstalledException;
use SychO\PackageManager\Exception\ExtensionNotInstalledException; use Flarum\PackageManager\Exception\ExtensionNotInstalledException;
return [ return [
(new Extend\Routes('api')) (new Extend\Routes('api'))

View File

@@ -1,5 +1,5 @@
{ {
"name": "@sycho/flarum-package-manager", "name": "@flarum/package-manager",
"version": "0.0.0", "version": "0.0.0",
"private": true, "private": true,
"prettier": "@flarum/prettier-config", "prettier": "@flarum/prettier-config",

View File

@@ -15,7 +15,7 @@ export default class ComposerFailureModal<T extends Attrs = Attrs> extends Modal
if (this.attrs.error.guessed_cause) { if (this.attrs.error.guessed_cause) {
this.alertAttrs = { this.alertAttrs = {
type: 'error', type: 'error',
content: app.translator.trans(`sycho-package-manager.admin.failure_modal.guessed_cause.${this.attrs.error.guessed_cause}`), content: app.translator.trans(`flarum-package-manager.admin.failure_modal.guessed_cause.${this.attrs.error.guessed_cause}`),
}; };
} }
} }
@@ -25,14 +25,14 @@ export default class ComposerFailureModal<T extends Attrs = Attrs> extends Modal
} }
title() { title() {
return app.translator.trans('sycho-package-manager.admin.failure_modal.title'); return app.translator.trans('flarum-package-manager.admin.failure_modal.title');
} }
content() { content() {
return ( return (
<div className="Modal-body"> <div className="Modal-body">
<details> <details>
<summary>{app.translator.trans('sycho-package-manager.admin.failure_modal.show_composer_output')}</summary> <summary>{app.translator.trans('flarum-package-manager.admin.failure_modal.show_composer_output')}</summary>
<pre className="ComposerFailureModal-output">{this.attrs.error.output}</pre> <pre className="ComposerFailureModal-output">{this.attrs.error.output}</pre>
</details> </details>
</div> </div>

View File

@@ -20,16 +20,16 @@ export default class Installer extends Component {
view(): Mithril.Children { view(): Mithril.Children {
return ( return (
<div className="Form-group"> <div className="Form-group">
<label htmlFor="install-extension">{app.translator.trans('sycho-package-manager.admin.extensions.install')}</label> <label htmlFor="install-extension">{app.translator.trans('flarum-package-manager.admin.extensions.install')}</label>
<p className="helpText"> <p className="helpText">
{app.translator.trans('sycho-package-manager.admin.extensions.install_help', { {app.translator.trans('flarum-package-manager.admin.extensions.install_help', {
extiverse: <a href="https://extiverse.com">extiverse.com</a>, extiverse: <a href="https://extiverse.com">extiverse.com</a>,
})} })}
</p> </p>
<div className="FormControl-container"> <div className="FormControl-container">
<input className="FormControl" id="install-extension" placeholder="vendor/package-name" bidi={this.packageName} /> <input className="FormControl" id="install-extension" placeholder="vendor/package-name" bidi={this.packageName} />
<Button className="Button" icon="fas fa-download" onclick={this.onsubmit.bind(this)} loading={this.isLoading}> <Button className="Button" icon="fas fa-download" onclick={this.onsubmit.bind(this)} loading={this.isLoading}>
{app.translator.trans('sycho-package-manager.admin.extensions.proceed')} {app.translator.trans('flarum-package-manager.admin.extensions.proceed')}
</Button> </Button>
</div> </div>
</div> </div>
@@ -59,7 +59,7 @@ export default class Installer extends Component {
const extensionId = response.id; const extensionId = response.id;
app.alerts.show( app.alerts.show(
{ type: 'success' }, { type: 'success' },
app.translator.trans('sycho-package-manager.admin.extensions.successful_install', { extension: extensionId }) app.translator.trans('flarum-package-manager.admin.extensions.successful_install', { extension: extensionId })
); );
window.location.href = `${app.forum.attribute('adminUrl')}#/extension/${extensionId}`; window.location.href = `${app.forum.attribute('adminUrl')}#/extension/${extensionId}`;
window.location.reload(); window.location.reload();

View File

@@ -17,17 +17,17 @@ export default class MajorUpdater<T extends MajorUpdaterAttrs = MajorUpdaterAttr
view(vnode: Mithril.Vnode<ComponentAttrs, this>): Mithril.Children { view(vnode: Mithril.Vnode<ComponentAttrs, this>): Mithril.Children {
return ( return (
<div className="Form-group PackageManager-majorUpdate"> <div className="Form-group PackageManager-majorUpdate">
<img alt="flarum logo" src={app.forum.attribute('baseUrl') + '/assets/extensions/sycho-package-manager/flarum.svg'} /> <img alt="flarum logo" src={app.forum.attribute('baseUrl') + '/assets/extensions/flarum-package-manager/flarum.svg'} />
<label>{app.translator.trans('sycho-package-manager.admin.major_updater.title', { version: this.attrs.coreUpdate['latest-major'] })}</label> <label>{app.translator.trans('flarum-package-manager.admin.major_updater.title', { version: this.attrs.coreUpdate['latest-major'] })}</label>
<p className="helpText">{app.translator.trans('sycho-package-manager.admin.major_updater.description')}</p> <p className="helpText">{app.translator.trans('flarum-package-manager.admin.major_updater.description')}</p>
<div className="PackageManager-updaterControls"> <div className="PackageManager-updaterControls">
<Tooltip text={app.translator.trans('sycho-package-manager.admin.major_updater.dry_run_help')}> <Tooltip text={app.translator.trans('flarum-package-manager.admin.major_updater.dry_run_help')}>
<Button className="Button" icon="fas fa-vial" onclick={this.update.bind(this, true)}> <Button className="Button" icon="fas fa-vial" onclick={this.update.bind(this, true)}>
{app.translator.trans('sycho-package-manager.admin.major_updater.dry_run')} {app.translator.trans('flarum-package-manager.admin.major_updater.dry_run')}
</Button> </Button>
</Tooltip> </Tooltip>
<Button className="Button" icon="fas fa-play" onclick={this.update.bind(this, false)}> <Button className="Button" icon="fas fa-play" onclick={this.update.bind(this, false)}>
{app.translator.trans('sycho-package-manager.admin.major_updater.update')} {app.translator.trans('flarum-package-manager.admin.major_updater.update')}
</Button> </Button>
</div> </div>
</div> </div>
@@ -48,7 +48,7 @@ export default class MajorUpdater<T extends MajorUpdaterAttrs = MajorUpdaterAttr
errorHandler, errorHandler,
}) })
.then(() => { .then(() => {
app.alerts.show({ type: 'success' }, app.translator.trans('sycho-package-manager.admin.update_successful')); app.alerts.show({ type: 'success' }, app.translator.trans('flarum-package-manager.admin.update_successful'));
window.location.reload(); window.location.reload();
}) })
.finally(() => { .finally(() => {

View File

@@ -44,10 +44,10 @@ export default class Updater extends Component {
if (coreUpdate) { if (coreUpdate) {
core = { core = {
title: app.translator.trans('sycho-package-manager.admin.updater.flarum'), title: app.translator.trans('flarum-package-manager.admin.updater.flarum'),
version: app.data.settings.version, version: app.data.settings.version,
icon: { icon: {
backgroundImage: `url(${app.forum.attribute('baseUrl')}/assets/extensions/sycho-package-manager/flarum.svg`, backgroundImage: `url(${app.forum.attribute('baseUrl')}/assets/extensions/flarum-package-manager/flarum.svg`,
}, },
newPackageUpdate: coreUpdate, newPackageUpdate: coreUpdate,
}; };
@@ -55,12 +55,12 @@ export default class Updater extends Component {
return [ return [
<div className="Form-group"> <div className="Form-group">
<label>{app.translator.trans('sycho-package-manager.admin.updater.updater_title')}</label> <label>{app.translator.trans('flarum-package-manager.admin.updater.updater_title')}</label>
<p className="helpText">{app.translator.trans('sycho-package-manager.admin.updater.updater_help')}</p> <p className="helpText">{app.translator.trans('flarum-package-manager.admin.updater.updater_help')}</p>
{Object.keys(this.lastUpdateCheck).length ? ( {Object.keys(this.lastUpdateCheck).length ? (
<p className="PackageManager-lastUpdatedAt"> <p className="PackageManager-lastUpdatedAt">
<span className="PackageManager-lastUpdatedAt-label"> <span className="PackageManager-lastUpdatedAt-label">
{app.translator.trans('sycho-package-manager.admin.updater.last_update_checked_at')} {app.translator.trans('flarum-package-manager.admin.updater.last_update_checked_at')}
</span> </span>
<span className="PackageManager-lastUpdatedAt-value">{humanTime(this.lastUpdateCheck?.checkedAt)}</span> <span className="PackageManager-lastUpdatedAt-value">{humanTime(this.lastUpdateCheck?.checkedAt)}</span>
</p> </p>
@@ -73,7 +73,7 @@ export default class Updater extends Component {
loading={this.isLoading === 'check'} loading={this.isLoading === 'check'}
disabled={this.isLoading !== null && this.isLoading !== 'check'} disabled={this.isLoading !== null && this.isLoading !== 'check'}
> >
{app.translator.trans('sycho-package-manager.admin.updater.check_for_updates')} {app.translator.trans('flarum-package-manager.admin.updater.check_for_updates')}
</Button> </Button>
<Button <Button
className="Button" className="Button"
@@ -82,7 +82,7 @@ export default class Updater extends Component {
loading={this.isLoading === 'global-update'} loading={this.isLoading === 'global-update'}
disabled={this.isLoading !== null && this.isLoading !== 'global-update'} disabled={this.isLoading !== null && this.isLoading !== 'global-update'}
> >
{app.translator.trans('sycho-package-manager.admin.updater.run_global_update')} {app.translator.trans('flarum-package-manager.admin.updater.run_global_update')}
</Button> </Button>
</div> </div>
{this.isLoading !== null ? ( {this.isLoading !== null ? (
@@ -130,12 +130,12 @@ export default class Updater extends Component {
</div> </div>
</div> </div>
<div className="PackageManager-extension-controls"> <div className="PackageManager-extension-controls">
<Tooltip text={app.translator.trans('sycho-package-manager.admin.extensions.update')}> <Tooltip text={app.translator.trans('flarum-package-manager.admin.extensions.update')}>
<Button <Button
icon="fas fa-arrow-alt-circle-up" icon="fas fa-arrow-alt-circle-up"
className="Button Button--icon Button--flat" className="Button Button--icon Button--flat"
onclick={isCore ? this.updateCoreMinor.bind(this) : this.updateExtension.bind(this, extension)} onclick={isCore ? this.updateCoreMinor.bind(this) : this.updateExtension.bind(this, extension)}
aria-label={app.translator.trans('sycho-package-manager.admin.extensions.update')} aria-label={app.translator.trans('flarum-package-manager.admin.extensions.update')}
/> />
</Tooltip> </Tooltip>
</div> </div>
@@ -195,7 +195,7 @@ export default class Updater extends Component {
errorHandler, errorHandler,
}) })
.then(() => { .then(() => {
app.alerts.show({ type: 'success' }, app.translator.trans('sycho-package-manager.admin.update_successful')); app.alerts.show({ type: 'success' }, app.translator.trans('flarum-package-manager.admin.update_successful'));
window.location.reload(); window.location.reload();
}) })
.finally(() => { .finally(() => {
@@ -217,7 +217,7 @@ export default class Updater extends Component {
.then(() => { .then(() => {
app.alerts.show( app.alerts.show(
{ type: 'success' }, { type: 'success' },
app.translator.trans('sycho-package-manager.admin.extensions.successful_update', { extension: extension.extra['flarum-extension'].title }) app.translator.trans('flarum-package-manager.admin.extensions.successful_update', { extension: extension.extra['flarum-extension'].title })
); );
window.location.reload(); window.location.reload();
}) })
@@ -238,7 +238,7 @@ export default class Updater extends Component {
errorHandler, errorHandler,
}) })
.then(() => { .then(() => {
app.alerts.show({ type: 'success' }, app.translator.trans('sycho-package-manager.admin.updater.global_update_successful')); app.alerts.show({ type: 'success' }, app.translator.trans('flarum-package-manager.admin.updater.global_update_successful'));
window.location.reload(); window.location.reload();
}) })
.finally(() => { .finally(() => {

View File

@@ -9,15 +9,15 @@ import Updater from './components/Updater';
import isExtensionEnabled from 'flarum/admin/utils/isExtensionEnabled'; import isExtensionEnabled from 'flarum/admin/utils/isExtensionEnabled';
import MajorUpdater from './components/MajorUpdater'; import MajorUpdater from './components/MajorUpdater';
app.initializers.add('sycho-package-manager', (app) => { app.initializers.add('flarum-package-manager', (app) => {
app.extensionData app.extensionData
.for('sycho-package-manager') .for('flarum-package-manager')
.registerSetting(() => { .registerSetting(() => {
if (!app.data.isRequiredDirectoriesWritable) { if (!app.data.isRequiredDirectoriesWritable) {
return ( return (
<div className="Form-group"> <div className="Form-group">
<Alert type="warning" dismissible={false}> <Alert type="warning" dismissible={false}>
{app.translator.trans('sycho-package-manager.admin.file_permissions')} {app.translator.trans('flarum-package-manager.admin.file_permissions')}
</Alert> </Alert>
</div> </div>
); );
@@ -35,7 +35,7 @@ app.initializers.add('sycho-package-manager', (app) => {
}); });
extend(ExtensionPage.prototype, 'topItems', function (items) { extend(ExtensionPage.prototype, 'topItems', function (items) {
if (this.extension.id === 'sycho-package-manager' || isExtensionEnabled(this.extension.id)) { if (this.extension.id === 'flarum-package-manager' || isExtensionEnabled(this.extension.id)) {
return; return;
} }
@@ -53,7 +53,7 @@ app.initializers.add('sycho-package-manager', (app) => {
method: 'DELETE', method: 'DELETE',
}) })
.then(() => { .then(() => {
app.alerts.show({ type: 'success' }, app.translator.trans('sycho-package-manager.admin.extensions.successful_remove')); app.alerts.show({ type: 'success' }, app.translator.trans('flarum-package-manager.admin.extensions.successful_remove'));
window.location = app.forum.attribute('adminUrl'); window.location = app.forum.attribute('adminUrl');
}) })
.finally(() => { .finally(() => {

View File

@@ -14,12 +14,12 @@ export default function (e: any) {
break; break;
case 'extension_already_installed': case 'extension_already_installed':
app.alerts.show({ type: 'error' }, app.translator.trans('sycho-package-manager.admin.exceptions.extension_already_installed')); app.alerts.show({ type: 'error' }, app.translator.trans('flarum-package-manager.admin.exceptions.extension_already_installed'));
app.modal.close(); app.modal.close();
break; break;
case 'extension_not_installed': case 'extension_not_installed':
app.alerts.show({ type: 'error' }, app.translator.trans('sycho-package-manager.admin.exceptions.extension_not_installed')); app.alerts.show({ type: 'error' }, app.translator.trans('flarum-package-manager.admin.exceptions.extension_not_installed'));
app.modal.close(); app.modal.close();
} }
} }

View File

@@ -9,7 +9,7 @@
white-space: break-spaces; white-space: break-spaces;
} }
.sycho-package-manager-Page .ExtensionPage-settings .Form-group:last-child { .flarum-package-manager-Page .ExtensionPage-settings .Form-group:last-child {
display: none; display: none;
} }

View File

@@ -1,4 +1,4 @@
sycho-package-manager: flarum-package-manager:
admin: admin:
exceptions: exceptions:
extension_already_installed: Extension is already installed. extension_already_installed: Extension is already installed.

View File

@@ -1,10 +1,13 @@
<?php <?php
/** /*
* This file is part of Flarum.
* *
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/ */
namespace SychO\PackageManager\Api\Controller; namespace Flarum\PackageManager\Api\Controller;
use Flarum\Http\RequestUtil; use Flarum\Http\RequestUtil;
use Illuminate\Contracts\Bus\Dispatcher; use Illuminate\Contracts\Bus\Dispatcher;
@@ -13,7 +16,7 @@ use Laminas\Diactoros\Response\JsonResponse;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface; use Psr\Http\Server\RequestHandlerInterface;
use SychO\PackageManager\Command\CheckForUpdates; use Flarum\PackageManager\Command\CheckForUpdates;
class CheckForUpdatesController implements RequestHandlerInterface class CheckForUpdatesController implements RequestHandlerInterface
{ {

View File

@@ -1,10 +1,13 @@
<?php <?php
/** /*
* This file is part of Flarum.
* *
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/ */
namespace SychO\PackageManager\Api\Controller; namespace Flarum\PackageManager\Api\Controller;
use Flarum\Bus\Dispatcher; use Flarum\Bus\Dispatcher;
use Flarum\Http\RequestUtil; use Flarum\Http\RequestUtil;
@@ -12,7 +15,7 @@ use Laminas\Diactoros\Response\EmptyResponse;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
use Psr\Http\Server\RequestHandlerInterface; use Psr\Http\Server\RequestHandlerInterface;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;
use SychO\PackageManager\Command\GlobalUpdate; use Flarum\PackageManager\Command\GlobalUpdate;
class GlobalUpdateController implements RequestHandlerInterface class GlobalUpdateController implements RequestHandlerInterface
{ {

View File

@@ -1,10 +1,17 @@
<?php <?php
namespace SychO\PackageManager\Api\Controller; /*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PackageManager\Api\Controller;
use Flarum\Http\RequestUtil; use Flarum\Http\RequestUtil;
use SychO\PackageManager\Api\Serializer\TaskSerializer; use Flarum\PackageManager\Api\Serializer\TaskSerializer;
use SychO\PackageManager\Task; use Flarum\PackageManager\Task;
use Flarum\Api\Controller\AbstractListController; use Flarum\Api\Controller\AbstractListController;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;
use Tobscure\JsonApi\Document; use Tobscure\JsonApi\Document;

View File

@@ -1,10 +1,13 @@
<?php <?php
/** /*
* This file is part of Flarum.
* *
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/ */
namespace SychO\PackageManager\Api\Controller; namespace Flarum\PackageManager\Api\Controller;
use Flarum\Bus\Dispatcher; use Flarum\Bus\Dispatcher;
use Flarum\Http\RequestUtil; use Flarum\Http\RequestUtil;
@@ -13,7 +16,7 @@ use Psr\Http\Message\ResponseInterface;
use Psr\Http\Server\RequestHandlerInterface; use Psr\Http\Server\RequestHandlerInterface;
use Illuminate\Support\Arr; use Illuminate\Support\Arr;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;
use SychO\PackageManager\Command\MajorUpdate; use Flarum\PackageManager\Command\MajorUpdate;
class MajorUpdateController implements RequestHandlerInterface class MajorUpdateController implements RequestHandlerInterface
{ {

View File

@@ -1,10 +1,13 @@
<?php <?php
/** /*
* This file is part of Flarum.
* *
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/ */
namespace SychO\PackageManager\Api\Controller; namespace Flarum\PackageManager\Api\Controller;
use Flarum\Bus\Dispatcher; use Flarum\Bus\Dispatcher;
use Flarum\Http\RequestUtil; use Flarum\Http\RequestUtil;
@@ -12,7 +15,7 @@ use Laminas\Diactoros\Response\EmptyResponse;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
use Psr\Http\Server\RequestHandlerInterface; use Psr\Http\Server\RequestHandlerInterface;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;
use SychO\PackageManager\Command\MinorFlarumUpdate; use Flarum\PackageManager\Command\MinorFlarumUpdate;
class MinorFlarumUpdateController implements RequestHandlerInterface class MinorFlarumUpdateController implements RequestHandlerInterface
{ {

View File

@@ -1,14 +1,21 @@
<?php <?php
namespace SychO\PackageManager\Api\Controller; /*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PackageManager\Api\Controller;
use Flarum\Api\Controller\AbstractDeleteController; use Flarum\Api\Controller\AbstractDeleteController;
use Flarum\Bus\Dispatcher; use Flarum\Bus\Dispatcher;
use Flarum\Http\RequestUtil; use Flarum\Http\RequestUtil;
use Illuminate\Support\Arr; use Illuminate\Support\Arr;
use SychO\PackageManager\Api\Serializer\ExtensionSerializer; use Flarum\PackageManager\Api\Serializer\ExtensionSerializer;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;
use SychO\PackageManager\Command\RemoveExtension; use Flarum\PackageManager\Command\RemoveExtension;
class RemoveExtensionController extends AbstractDeleteController class RemoveExtensionController extends AbstractDeleteController
{ {

View File

@@ -1,14 +1,21 @@
<?php <?php
namespace SychO\PackageManager\Api\Controller; /*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PackageManager\Api\Controller;
use Flarum\Bus\Dispatcher; use Flarum\Bus\Dispatcher;
use Laminas\Diactoros\Response\JsonResponse; use Laminas\Diactoros\Response\JsonResponse;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
use Psr\Http\Server\RequestHandlerInterface; use Psr\Http\Server\RequestHandlerInterface;
use SychO\PackageManager\Api\Serializer\ExtensionSerializer; use Flarum\PackageManager\Api\Serializer\ExtensionSerializer;
use SychO\PackageManager\Command\RequireExtension; use Flarum\PackageManager\Command\RequireExtension;
use SychO\PackageManager\Extension\ExtensionUtils; use Flarum\PackageManager\Extension\ExtensionUtils;
use Flarum\Api\Controller\AbstractCreateController; use Flarum\Api\Controller\AbstractCreateController;
use Flarum\Http\RequestUtil; use Flarum\Http\RequestUtil;
use Illuminate\Support\Arr; use Illuminate\Support\Arr;

View File

@@ -1,10 +1,13 @@
<?php <?php
/** /*
* This file is part of Flarum.
* *
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/ */
namespace SychO\PackageManager\Api\Controller; namespace Flarum\PackageManager\Api\Controller;
use Flarum\Bus\Dispatcher; use Flarum\Bus\Dispatcher;
use Flarum\Http\RequestUtil; use Flarum\Http\RequestUtil;
@@ -13,7 +16,7 @@ use Psr\Http\Message\ResponseInterface;
use Psr\Http\Server\RequestHandlerInterface; use Psr\Http\Server\RequestHandlerInterface;
use Illuminate\Support\Arr; use Illuminate\Support\Arr;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;
use SychO\PackageManager\Command\UpdateExtension; use Flarum\PackageManager\Command\UpdateExtension;
class UpdateExtensionController implements RequestHandlerInterface class UpdateExtensionController implements RequestHandlerInterface
{ {

View File

@@ -1,6 +1,13 @@
<?php <?php
namespace SychO\PackageManager\Api\Serializer; /*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PackageManager\Api\Serializer;
use Flarum\Api\Serializer\AbstractSerializer; use Flarum\Api\Serializer\AbstractSerializer;
use Flarum\Extension\Extension; use Flarum\Extension\Extension;

View File

@@ -1,10 +1,13 @@
<?php <?php
/** /*
* This file is part of Flarum.
* *
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/ */
namespace SychO\PackageManager\Command; namespace Flarum\PackageManager\Command;
use Flarum\User\User; use Flarum\User\User;

View File

@@ -1,15 +1,18 @@
<?php <?php
/** /*
* This file is part of Flarum.
* *
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/ */
namespace SychO\PackageManager\Command; namespace Flarum\PackageManager\Command;
use Composer\Console\Application; use Composer\Console\Application;
use SychO\PackageManager\Exception\ComposerCommandFailedException; use Flarum\PackageManager\Exception\ComposerCommandFailedException;
use SychO\PackageManager\LastUpdateCheck; use Flarum\PackageManager\LastUpdateCheck;
use SychO\PackageManager\OutputLogger; use Flarum\PackageManager\OutputLogger;
use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\BufferedOutput; use Symfony\Component\Console\Output\BufferedOutput;

View File

@@ -1,10 +1,13 @@
<?php <?php
/** /*
* This file is part of Flarum.
* *
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/ */
namespace SychO\PackageManager\Command; namespace Flarum\PackageManager\Command;
use Flarum\User\User; use Flarum\User\User;

View File

@@ -1,17 +1,20 @@
<?php <?php
/** /*
* This file is part of Flarum.
* *
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/ */
namespace SychO\PackageManager\Command; namespace Flarum\PackageManager\Command;
use Composer\Console\Application; use Composer\Console\Application;
use Flarum\Bus\Dispatcher as FlarumDispatcher; use Flarum\Bus\Dispatcher as FlarumDispatcher;
use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Contracts\Events\Dispatcher;
use SychO\PackageManager\Event\FlarumUpdated; use Flarum\PackageManager\Event\FlarumUpdated;
use SychO\PackageManager\Exception\ComposerUpdateFailedException; use Flarum\PackageManager\Exception\ComposerUpdateFailedException;
use SychO\PackageManager\OutputLogger; use Flarum\PackageManager\OutputLogger;
use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\BufferedOutput; use Symfony\Component\Console\Output\BufferedOutput;

View File

@@ -1,6 +1,13 @@
<?php <?php
namespace SychO\PackageManager\Command; /*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PackageManager\Command;
use Flarum\User\User; use Flarum\User\User;

View File

@@ -1,15 +1,22 @@
<?php <?php
namespace SychO\PackageManager\Command; /*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PackageManager\Command;
use Composer\Console\Application; use Composer\Console\Application;
use Flarum\Foundation\Paths; use Flarum\Foundation\Paths;
use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Support\Arr; use Illuminate\Support\Arr;
use SychO\PackageManager\Event\FlarumUpdated; use Flarum\PackageManager\Event\FlarumUpdated;
use SychO\PackageManager\Exception\ComposerUpdateFailedException; use Flarum\PackageManager\Exception\ComposerUpdateFailedException;
use SychO\PackageManager\LastUpdateCheck; use Flarum\PackageManager\LastUpdateCheck;
use SychO\PackageManager\OutputLogger; use Flarum\PackageManager\OutputLogger;
use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\BufferedOutput; use Symfony\Component\Console\Output\BufferedOutput;

View File

@@ -1,10 +1,13 @@
<?php <?php
/** /*
* This file is part of Flarum.
* *
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/ */
namespace SychO\PackageManager\Command; namespace Flarum\PackageManager\Command;
use Flarum\User\User; use Flarum\User\User;

View File

@@ -1,17 +1,20 @@
<?php <?php
/** /*
* This file is part of Flarum.
* *
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/ */
namespace SychO\PackageManager\Command; namespace Flarum\PackageManager\Command;
use Composer\Console\Application; use Composer\Console\Application;
use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Contracts\Events\Dispatcher;
use SychO\PackageManager\Event\FlarumUpdated; use Flarum\PackageManager\Event\FlarumUpdated;
use SychO\PackageManager\Exception\ComposerUpdateFailedException; use Flarum\PackageManager\Exception\ComposerUpdateFailedException;
use SychO\PackageManager\LastUpdateCheck; use Flarum\PackageManager\LastUpdateCheck;
use SychO\PackageManager\OutputLogger; use Flarum\PackageManager\OutputLogger;
use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\BufferedOutput; use Symfony\Component\Console\Output\BufferedOutput;

View File

@@ -1,10 +1,13 @@
<?php <?php
/** /*
* This file is part of Flarum.
* *
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/ */
namespace SychO\PackageManager\Command; namespace Flarum\PackageManager\Command;
use Flarum\User\User; use Flarum\User\User;

View File

@@ -1,19 +1,22 @@
<?php <?php
/** /*
* This file is part of Flarum.
* *
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/ */
namespace SychO\PackageManager\Command; namespace Flarum\PackageManager\Command;
use Composer\Console\Application; use Composer\Console\Application;
use Flarum\Extension\ExtensionManager; use Flarum\Extension\ExtensionManager;
use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Contracts\Events\Dispatcher;
use SychO\PackageManager\Exception\ComposerCommandFailedException; use Flarum\PackageManager\Exception\ComposerCommandFailedException;
use SychO\PackageManager\Exception\ComposerUpdateFailedException; use Flarum\PackageManager\Exception\ComposerUpdateFailedException;
use SychO\PackageManager\Exception\ExtensionNotInstalledException; use Flarum\PackageManager\Exception\ExtensionNotInstalledException;
use SychO\PackageManager\Extension\Event\Removed; use Flarum\PackageManager\Extension\Event\Removed;
use SychO\PackageManager\OutputLogger; use Flarum\PackageManager\OutputLogger;
use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\BufferedOutput; use Symfony\Component\Console\Output\BufferedOutput;

View File

@@ -1,10 +1,13 @@
<?php <?php
/** /*
* This file is part of Flarum.
* *
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/ */
namespace SychO\PackageManager\Command; namespace Flarum\PackageManager\Command;
use Flarum\User\User; use Flarum\User\User;

View File

@@ -1,20 +1,23 @@
<?php <?php
/** /*
* This file is part of Flarum.
* *
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/ */
namespace SychO\PackageManager\Command; namespace Flarum\PackageManager\Command;
use Composer\Console\Application; use Composer\Console\Application;
use Flarum\Extension\ExtensionManager; use Flarum\Extension\ExtensionManager;
use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Contracts\Events\Dispatcher;
use SychO\PackageManager\Exception\ComposerRequireFailedException; use Flarum\PackageManager\Exception\ComposerRequireFailedException;
use SychO\PackageManager\Exception\ExtensionAlreadyInstalledException; use Flarum\PackageManager\Exception\ExtensionAlreadyInstalledException;
use SychO\PackageManager\Extension\Event\Installed; use Flarum\PackageManager\Extension\Event\Installed;
use SychO\PackageManager\Extension\ExtensionUtils; use Flarum\PackageManager\Extension\ExtensionUtils;
use SychO\PackageManager\OutputLogger; use Flarum\PackageManager\OutputLogger;
use SychO\PackageManager\RequirePackageValidator; use Flarum\PackageManager\RequirePackageValidator;
use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\BufferedOutput; use Symfony\Component\Console\Output\BufferedOutput;

View File

@@ -1,10 +1,13 @@
<?php <?php
/** /*
* This file is part of Flarum.
* *
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/ */
namespace SychO\PackageManager\Command; namespace Flarum\PackageManager\Command;
use Flarum\User\User; use Flarum\User\User;

View File

@@ -1,21 +1,24 @@
<?php <?php
/** /*
* This file is part of Flarum.
* *
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/ */
namespace SychO\PackageManager\Command; namespace Flarum\PackageManager\Command;
use Composer\Console\Application; use Composer\Console\Application;
use Flarum\Extension\ExtensionManager; use Flarum\Extension\ExtensionManager;
use Flarum\Settings\SettingsRepositoryInterface; use Flarum\Settings\SettingsRepositoryInterface;
use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Contracts\Events\Dispatcher;
use SychO\PackageManager\Exception\ComposerUpdateFailedException; use Flarum\PackageManager\Exception\ComposerUpdateFailedException;
use SychO\PackageManager\Exception\ExtensionNotInstalledException; use Flarum\PackageManager\Exception\ExtensionNotInstalledException;
use SychO\PackageManager\Extension\Event\Updated; use Flarum\PackageManager\Extension\Event\Updated;
use SychO\PackageManager\OutputLogger; use Flarum\PackageManager\OutputLogger;
use SychO\PackageManager\UpdateExtensionValidator; use Flarum\PackageManager\UpdateExtensionValidator;
use SychO\PackageManager\LastUpdateCheck; use Flarum\PackageManager\LastUpdateCheck;
use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\BufferedOutput; use Symfony\Component\Console\Output\BufferedOutput;

View File

@@ -1,6 +1,13 @@
<?php <?php
namespace SychO\PackageManager\Event; /*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PackageManager\Event;
class FlarumUpdated class FlarumUpdated
{ {

View File

@@ -1,10 +1,13 @@
<?php <?php
/** /*
* This file is part of Flarum.
* *
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/ */
namespace SychO\PackageManager\Exception; namespace Flarum\PackageManager\Exception;
use Exception; use Exception;

View File

@@ -1,10 +1,13 @@
<?php <?php
/** /*
* This file is part of Flarum.
* *
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/ */
namespace SychO\PackageManager\Exception; namespace Flarum\PackageManager\Exception;
use Flarum\Foundation\ErrorHandling\HandledError; use Flarum\Foundation\ErrorHandling\HandledError;

View File

@@ -1,10 +1,13 @@
<?php <?php
/** /*
* This file is part of Flarum.
* *
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/ */
namespace SychO\PackageManager\Exception; namespace Flarum\PackageManager\Exception;
class ComposerRequireFailedException extends ComposerCommandFailedException class ComposerRequireFailedException extends ComposerCommandFailedException
{ {

View File

@@ -1,10 +1,13 @@
<?php <?php
/** /*
* This file is part of Flarum.
* *
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/ */
namespace SychO\PackageManager\Exception; namespace Flarum\PackageManager\Exception;
class ComposerUpdateFailedException extends ComposerCommandFailedException class ComposerUpdateFailedException extends ComposerCommandFailedException
{ {

View File

@@ -1,10 +1,13 @@
<?php <?php
/** /*
* This file is part of Flarum.
* *
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/ */
namespace SychO\PackageManager\Exception; namespace Flarum\PackageManager\Exception;
use Exception; use Exception;
use Flarum\Extension\Extension; use Flarum\Extension\Extension;

View File

@@ -1,10 +1,13 @@
<?php <?php
/** /*
* This file is part of Flarum.
* *
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/ */
namespace SychO\PackageManager\Exception; namespace Flarum\PackageManager\Exception;
use Exception; use Exception;
use Flarum\Foundation\KnownError; use Flarum\Foundation\KnownError;

View File

@@ -1,10 +1,13 @@
<?php <?php
/** /*
* This file is part of Flarum.
* *
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/ */
namespace SychO\PackageManager\Extension\Event; namespace Flarum\PackageManager\Extension\Event;
class Installed class Installed
{ {

View File

@@ -1,10 +1,13 @@
<?php <?php
/** /*
* This file is part of Flarum.
* *
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/ */
namespace SychO\PackageManager\Extension\Event; namespace Flarum\PackageManager\Extension\Event;
use Flarum\Extension\Extension; use Flarum\Extension\Extension;

View File

@@ -1,10 +1,13 @@
<?php <?php
/** /*
* This file is part of Flarum.
* *
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/ */
namespace SychO\PackageManager\Extension\Event; namespace Flarum\PackageManager\Extension\Event;
use Flarum\Extension\Extension; use Flarum\Extension\Extension;

View File

@@ -1,10 +1,13 @@
<?php <?php
/** /*
* This file is part of Flarum.
* *
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/ */
namespace SychO\PackageManager\Extension; namespace Flarum\PackageManager\Extension;
class ExtensionUtils class ExtensionUtils
{ {

View File

@@ -1,10 +1,13 @@
<?php <?php
/** /*
* This file is part of Flarum.
* *
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/ */
namespace SychO\PackageManager; namespace Flarum\PackageManager;
use Carbon\Carbon; use Carbon\Carbon;
use Flarum\Settings\SettingsRepositoryInterface; use Flarum\Settings\SettingsRepositoryInterface;
@@ -12,7 +15,7 @@ use Illuminate\Support\Str;
class LastUpdateCheck class LastUpdateCheck
{ {
public const KEY = 'sycho-package-manager.last_update_check'; public const KEY = 'flarum-package-manager.last_update_check';
/** /**
* @var SettingsRepositoryInterface * @var SettingsRepositoryInterface

View File

@@ -1,15 +1,18 @@
<?php <?php
/** /*
* This file is part of Flarum.
* *
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/ */
namespace SychO\PackageManager\Listener; namespace Flarum\PackageManager\Listener;
use Composer\Command\ClearCacheCommand; use Composer\Command\ClearCacheCommand;
use Flarum\Database\Console\MigrateCommand; use Flarum\Database\Console\MigrateCommand;
use Flarum\Foundation\Console\AssetsPublishCommand; use Flarum\Foundation\Console\AssetsPublishCommand;
use SychO\PackageManager\Event\FlarumUpdated; use Flarum\PackageManager\Event\FlarumUpdated;
use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\NullOutput; use Symfony\Component\Console\Output\NullOutput;

View File

@@ -1,6 +1,13 @@
<?php <?php
namespace SychO\PackageManager; /*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PackageManager;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;

View File

@@ -1,10 +1,13 @@
<?php <?php
/** /*
* This file is part of Flarum.
* *
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/ */
namespace SychO\PackageManager; namespace Flarum\PackageManager;
use Composer\Config; use Composer\Config;
use Composer\Console\Application; use Composer\Console\Application;
@@ -18,9 +21,9 @@ use Illuminate\Contracts\Events\Dispatcher;
use Monolog\Formatter\LineFormatter; use Monolog\Formatter\LineFormatter;
use Monolog\Handler\RotatingFileHandler; use Monolog\Handler\RotatingFileHandler;
use Monolog\Logger; use Monolog\Logger;
use SychO\PackageManager\Event\FlarumUpdated; use Flarum\PackageManager\Event\FlarumUpdated;
use SychO\PackageManager\Extension\Event\Updated; use Flarum\PackageManager\Extension\Event\Updated;
use SychO\PackageManager\Listener\PostUpdateListener; use Flarum\PackageManager\Listener\PostUpdateListener;
class PackageManagerServiceProvider extends AbstractServiceProvider class PackageManagerServiceProvider extends AbstractServiceProvider
{ {
@@ -32,11 +35,12 @@ class PackageManagerServiceProvider extends AbstractServiceProvider
$composer = new Application(); $composer = new Application();
$composer->setAutoExit(false); $composer->setAutoExit(false);
/** @var Paths $paths */
$paths = $container->make(Paths::class); $paths = $container->make(Paths::class);
putenv("COMPOSER_HOME={$paths->storage}/.composer"); putenv("COMPOSER_HOME={$paths->storage}/.composer");
putenv("COMPOSER={$paths->base}/composer.json"); putenv("COMPOSER={$paths->base}/composer.json");
Config::$defaultConfig['vendor-dir'] = $paths->base.'/vendor'; Config::$defaultConfig['vendor-dir'] = $paths->vendor;
// When running simple require, update and remove commands on packages, // When running simple require, update and remove commands on packages,
// composer 2 doesn't really need this much unless the extensions are very loaded dependency wise, // composer 2 doesn't really need this much unless the extensions are very loaded dependency wise,

View File

@@ -1,6 +1,13 @@
<?php <?php
namespace SychO\PackageManager; /*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PackageManager;
use Flarum\Foundation\AbstractValidator; use Flarum\Foundation\AbstractValidator;

View File

@@ -1,6 +1,13 @@
<?php <?php
namespace SychO\PackageManager; /*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\PackageManager;
use Flarum\Foundation\AbstractValidator; use Flarum\Foundation\AbstractValidator;