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
vendor/
composer.lock
tests/tmp/
.phpunit.result.cache

View File

@ -2,4 +2,4 @@
*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.",
"keywords": [
"extensions", "composer", "packages", "manager", "updater"
@ -8,19 +8,22 @@
"license": "MIT",
"authors": [
{
"name": "Sami Mazouz",
"email": "sami.mazouz@flarum.org",
"homepage": "https://sycho9.github.io"
"name": "Flarum",
"email": "info@flarum.org",
"homepage": "https://flarum.org/team"
}
],
"support": {
"issues": "https://github.com/SychO9/flarum-package-manager/issues",
"source": "https://github.com/SychO9/flarum-package-manager"
"issues": "https://github.com/flarum/package-manager/issues",
"source": "https://github.com/flarum/package-manager"
},
"require": {
"flarum/core": "^1.0.0",
"composer/composer": "^2.0"
},
"require-dev": {
"flarum/testing": "^1.0.0"
},
"extra": {
"flarum-extension": {
"title": "Package Manager",
@ -33,7 +36,30 @@
},
"autoload": {
"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
/**
/*
* 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\Foundation\Paths;
use Flarum\Frontend\Document;
use SychO\PackageManager\Exception\ComposerCommandFailedException;
use SychO\PackageManager\Exception\ComposerCommandFailedExceptionHandler;
use SychO\PackageManager\Exception\ComposerRequireFailedException;
use SychO\PackageManager\Exception\ComposerUpdateFailedException;
use SychO\PackageManager\Exception\ExtensionAlreadyInstalledException;
use SychO\PackageManager\Exception\ExtensionNotInstalledException;
use Flarum\PackageManager\Exception\ComposerCommandFailedException;
use Flarum\PackageManager\Exception\ComposerCommandFailedExceptionHandler;
use Flarum\PackageManager\Exception\ComposerRequireFailedException;
use Flarum\PackageManager\Exception\ComposerUpdateFailedException;
use Flarum\PackageManager\Exception\ExtensionAlreadyInstalledException;
use Flarum\PackageManager\Exception\ExtensionNotInstalledException;
return [
(new Extend\Routes('api'))

View File

@ -1,5 +1,5 @@
{
"name": "@sycho/flarum-package-manager",
"name": "@flarum/package-manager",
"version": "0.0.0",
"private": true,
"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) {
this.alertAttrs = {
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() {
return app.translator.trans('sycho-package-manager.admin.failure_modal.title');
return app.translator.trans('flarum-package-manager.admin.failure_modal.title');
}
content() {
return (
<div className="Modal-body">
<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>
</details>
</div>

View File

@ -20,16 +20,16 @@ export default class Installer extends Component {
view(): Mithril.Children {
return (
<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">
{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>,
})}
</p>
<div className="FormControl-container">
<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}>
{app.translator.trans('sycho-package-manager.admin.extensions.proceed')}
{app.translator.trans('flarum-package-manager.admin.extensions.proceed')}
</Button>
</div>
</div>
@ -59,7 +59,7 @@ export default class Installer extends Component {
const extensionId = response.id;
app.alerts.show(
{ 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.reload();

View File

@ -17,17 +17,17 @@ export default class MajorUpdater<T extends MajorUpdaterAttrs = MajorUpdaterAttr
view(vnode: Mithril.Vnode<ComponentAttrs, this>): Mithril.Children {
return (
<div className="Form-group PackageManager-majorUpdate">
<img alt="flarum logo" src={app.forum.attribute('baseUrl') + '/assets/extensions/sycho-package-manager/flarum.svg'} />
<label>{app.translator.trans('sycho-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>
<img alt="flarum logo" src={app.forum.attribute('baseUrl') + '/assets/extensions/flarum-package-manager/flarum.svg'} />
<label>{app.translator.trans('flarum-package-manager.admin.major_updater.title', { version: this.attrs.coreUpdate['latest-major'] })}</label>
<p className="helpText">{app.translator.trans('flarum-package-manager.admin.major_updater.description')}</p>
<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)}>
{app.translator.trans('sycho-package-manager.admin.major_updater.dry_run')}
{app.translator.trans('flarum-package-manager.admin.major_updater.dry_run')}
</Button>
</Tooltip>
<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>
</div>
</div>
@ -48,7 +48,7 @@ export default class MajorUpdater<T extends MajorUpdaterAttrs = MajorUpdaterAttr
errorHandler,
})
.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();
})
.finally(() => {

View File

@ -44,10 +44,10 @@ export default class Updater extends Component {
if (coreUpdate) {
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,
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,
};
@ -55,12 +55,12 @@ export default class Updater extends Component {
return [
<div className="Form-group">
<label>{app.translator.trans('sycho-package-manager.admin.updater.updater_title')}</label>
<p className="helpText">{app.translator.trans('sycho-package-manager.admin.updater.updater_help')}</p>
<label>{app.translator.trans('flarum-package-manager.admin.updater.updater_title')}</label>
<p className="helpText">{app.translator.trans('flarum-package-manager.admin.updater.updater_help')}</p>
{Object.keys(this.lastUpdateCheck).length ? (
<p className="PackageManager-lastUpdatedAt">
<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 className="PackageManager-lastUpdatedAt-value">{humanTime(this.lastUpdateCheck?.checkedAt)}</span>
</p>
@ -73,7 +73,7 @@ export default class Updater extends Component {
loading={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
className="Button"
@ -82,7 +82,7 @@ export default class Updater extends Component {
loading={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>
</div>
{this.isLoading !== null ? (
@ -130,12 +130,12 @@ export default class Updater extends Component {
</div>
</div>
<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
icon="fas fa-arrow-alt-circle-up"
className="Button Button--icon Button--flat"
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>
</div>
@ -195,7 +195,7 @@ export default class Updater extends Component {
errorHandler,
})
.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();
})
.finally(() => {
@ -217,7 +217,7 @@ export default class Updater extends Component {
.then(() => {
app.alerts.show(
{ 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();
})
@ -238,7 +238,7 @@ export default class Updater extends Component {
errorHandler,
})
.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();
})
.finally(() => {

View File

@ -9,15 +9,15 @@ import Updater from './components/Updater';
import isExtensionEnabled from 'flarum/admin/utils/isExtensionEnabled';
import MajorUpdater from './components/MajorUpdater';
app.initializers.add('sycho-package-manager', (app) => {
app.initializers.add('flarum-package-manager', (app) => {
app.extensionData
.for('sycho-package-manager')
.for('flarum-package-manager')
.registerSetting(() => {
if (!app.data.isRequiredDirectoriesWritable) {
return (
<div className="Form-group">
<Alert type="warning" dismissible={false}>
{app.translator.trans('sycho-package-manager.admin.file_permissions')}
{app.translator.trans('flarum-package-manager.admin.file_permissions')}
</Alert>
</div>
);
@ -35,7 +35,7 @@ app.initializers.add('sycho-package-manager', (app) => {
});
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;
}
@ -53,7 +53,7 @@ app.initializers.add('sycho-package-manager', (app) => {
method: 'DELETE',
})
.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');
})
.finally(() => {

View File

@ -14,12 +14,12 @@ export default function (e: any) {
break;
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();
break;
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();
}
}

View File

@ -9,7 +9,7 @@
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;
}

View File

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

View File

@ -1,10 +1,13 @@
<?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 Illuminate\Contracts\Bus\Dispatcher;
@ -13,7 +16,7 @@ use Laminas\Diactoros\Response\JsonResponse;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
use SychO\PackageManager\Command\CheckForUpdates;
use Flarum\PackageManager\Command\CheckForUpdates;
class CheckForUpdatesController implements RequestHandlerInterface
{

View File

@ -1,10 +1,13 @@
<?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\Http\RequestUtil;
@ -12,7 +15,7 @@ use Laminas\Diactoros\Response\EmptyResponse;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Psr\Http\Message\ServerRequestInterface;
use SychO\PackageManager\Command\GlobalUpdate;
use Flarum\PackageManager\Command\GlobalUpdate;
class GlobalUpdateController implements RequestHandlerInterface
{

View File

@ -1,10 +1,17 @@
<?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 SychO\PackageManager\Api\Serializer\TaskSerializer;
use SychO\PackageManager\Task;
use Flarum\PackageManager\Api\Serializer\TaskSerializer;
use Flarum\PackageManager\Task;
use Flarum\Api\Controller\AbstractListController;
use Psr\Http\Message\ServerRequestInterface;
use Tobscure\JsonApi\Document;

View File

@ -1,10 +1,13 @@
<?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\Http\RequestUtil;
@ -13,7 +16,7 @@ use Psr\Http\Message\ResponseInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Illuminate\Support\Arr;
use Psr\Http\Message\ServerRequestInterface;
use SychO\PackageManager\Command\MajorUpdate;
use Flarum\PackageManager\Command\MajorUpdate;
class MajorUpdateController implements RequestHandlerInterface
{

View File

@ -1,10 +1,13 @@
<?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\Http\RequestUtil;
@ -12,7 +15,7 @@ use Laminas\Diactoros\Response\EmptyResponse;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Psr\Http\Message\ServerRequestInterface;
use SychO\PackageManager\Command\MinorFlarumUpdate;
use Flarum\PackageManager\Command\MinorFlarumUpdate;
class MinorFlarumUpdateController implements RequestHandlerInterface
{

View File

@ -1,14 +1,21 @@
<?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\Bus\Dispatcher;
use Flarum\Http\RequestUtil;
use Illuminate\Support\Arr;
use SychO\PackageManager\Api\Serializer\ExtensionSerializer;
use Flarum\PackageManager\Api\Serializer\ExtensionSerializer;
use Psr\Http\Message\ServerRequestInterface;
use SychO\PackageManager\Command\RemoveExtension;
use Flarum\PackageManager\Command\RemoveExtension;
class RemoveExtensionController extends AbstractDeleteController
{

View File

@ -1,14 +1,21 @@
<?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 Laminas\Diactoros\Response\JsonResponse;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Server\RequestHandlerInterface;
use SychO\PackageManager\Api\Serializer\ExtensionSerializer;
use SychO\PackageManager\Command\RequireExtension;
use SychO\PackageManager\Extension\ExtensionUtils;
use Flarum\PackageManager\Api\Serializer\ExtensionSerializer;
use Flarum\PackageManager\Command\RequireExtension;
use Flarum\PackageManager\Extension\ExtensionUtils;
use Flarum\Api\Controller\AbstractCreateController;
use Flarum\Http\RequestUtil;
use Illuminate\Support\Arr;

View File

@ -1,10 +1,13 @@
<?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\Http\RequestUtil;
@ -13,7 +16,7 @@ use Psr\Http\Message\ResponseInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Illuminate\Support\Arr;
use Psr\Http\Message\ServerRequestInterface;
use SychO\PackageManager\Command\UpdateExtension;
use Flarum\PackageManager\Command\UpdateExtension;
class UpdateExtensionController implements RequestHandlerInterface
{

View File

@ -1,6 +1,13 @@
<?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\Extension\Extension;

View File

@ -1,10 +1,13 @@
<?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;

View File

@ -1,15 +1,18 @@
<?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 SychO\PackageManager\Exception\ComposerCommandFailedException;
use SychO\PackageManager\LastUpdateCheck;
use SychO\PackageManager\OutputLogger;
use Flarum\PackageManager\Exception\ComposerCommandFailedException;
use Flarum\PackageManager\LastUpdateCheck;
use Flarum\PackageManager\OutputLogger;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\BufferedOutput;

View File

@ -1,10 +1,13 @@
<?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;

View File

@ -1,17 +1,20 @@
<?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 Flarum\Bus\Dispatcher as FlarumDispatcher;
use Illuminate\Contracts\Events\Dispatcher;
use SychO\PackageManager\Event\FlarumUpdated;
use SychO\PackageManager\Exception\ComposerUpdateFailedException;
use SychO\PackageManager\OutputLogger;
use Flarum\PackageManager\Event\FlarumUpdated;
use Flarum\PackageManager\Exception\ComposerUpdateFailedException;
use Flarum\PackageManager\OutputLogger;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\BufferedOutput;

View File

@ -1,6 +1,13 @@
<?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;

View File

@ -1,15 +1,22 @@
<?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 Flarum\Foundation\Paths;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Support\Arr;
use SychO\PackageManager\Event\FlarumUpdated;
use SychO\PackageManager\Exception\ComposerUpdateFailedException;
use SychO\PackageManager\LastUpdateCheck;
use SychO\PackageManager\OutputLogger;
use Flarum\PackageManager\Event\FlarumUpdated;
use Flarum\PackageManager\Exception\ComposerUpdateFailedException;
use Flarum\PackageManager\LastUpdateCheck;
use Flarum\PackageManager\OutputLogger;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\BufferedOutput;

View File

@ -1,10 +1,13 @@
<?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;

View File

@ -1,17 +1,20 @@
<?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 Illuminate\Contracts\Events\Dispatcher;
use SychO\PackageManager\Event\FlarumUpdated;
use SychO\PackageManager\Exception\ComposerUpdateFailedException;
use SychO\PackageManager\LastUpdateCheck;
use SychO\PackageManager\OutputLogger;
use Flarum\PackageManager\Event\FlarumUpdated;
use Flarum\PackageManager\Exception\ComposerUpdateFailedException;
use Flarum\PackageManager\LastUpdateCheck;
use Flarum\PackageManager\OutputLogger;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\BufferedOutput;

View File

@ -1,10 +1,13 @@
<?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;

View File

@ -1,19 +1,22 @@
<?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 Flarum\Extension\ExtensionManager;
use Illuminate\Contracts\Events\Dispatcher;
use SychO\PackageManager\Exception\ComposerCommandFailedException;
use SychO\PackageManager\Exception\ComposerUpdateFailedException;
use SychO\PackageManager\Exception\ExtensionNotInstalledException;
use SychO\PackageManager\Extension\Event\Removed;
use SychO\PackageManager\OutputLogger;
use Flarum\PackageManager\Exception\ComposerCommandFailedException;
use Flarum\PackageManager\Exception\ComposerUpdateFailedException;
use Flarum\PackageManager\Exception\ExtensionNotInstalledException;
use Flarum\PackageManager\Extension\Event\Removed;
use Flarum\PackageManager\OutputLogger;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\BufferedOutput;

View File

@ -1,10 +1,13 @@
<?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;

View File

@ -1,20 +1,23 @@
<?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 Flarum\Extension\ExtensionManager;
use Illuminate\Contracts\Events\Dispatcher;
use SychO\PackageManager\Exception\ComposerRequireFailedException;
use SychO\PackageManager\Exception\ExtensionAlreadyInstalledException;
use SychO\PackageManager\Extension\Event\Installed;
use SychO\PackageManager\Extension\ExtensionUtils;
use SychO\PackageManager\OutputLogger;
use SychO\PackageManager\RequirePackageValidator;
use Flarum\PackageManager\Exception\ComposerRequireFailedException;
use Flarum\PackageManager\Exception\ExtensionAlreadyInstalledException;
use Flarum\PackageManager\Extension\Event\Installed;
use Flarum\PackageManager\Extension\ExtensionUtils;
use Flarum\PackageManager\OutputLogger;
use Flarum\PackageManager\RequirePackageValidator;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\BufferedOutput;

View File

@ -1,10 +1,13 @@
<?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;

View File

@ -1,21 +1,24 @@
<?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 Flarum\Extension\ExtensionManager;
use Flarum\Settings\SettingsRepositoryInterface;
use Illuminate\Contracts\Events\Dispatcher;
use SychO\PackageManager\Exception\ComposerUpdateFailedException;
use SychO\PackageManager\Exception\ExtensionNotInstalledException;
use SychO\PackageManager\Extension\Event\Updated;
use SychO\PackageManager\OutputLogger;
use SychO\PackageManager\UpdateExtensionValidator;
use SychO\PackageManager\LastUpdateCheck;
use Flarum\PackageManager\Exception\ComposerUpdateFailedException;
use Flarum\PackageManager\Exception\ExtensionNotInstalledException;
use Flarum\PackageManager\Extension\Event\Updated;
use Flarum\PackageManager\OutputLogger;
use Flarum\PackageManager\UpdateExtensionValidator;
use Flarum\PackageManager\LastUpdateCheck;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\BufferedOutput;

View File

@ -1,6 +1,13 @@
<?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
{

View File

@ -1,10 +1,13 @@
<?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;

View File

@ -1,10 +1,13 @@
<?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;

View File

@ -1,10 +1,13 @@
<?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
{

View File

@ -1,10 +1,13 @@
<?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
{

View File

@ -1,10 +1,13 @@
<?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 Flarum\Extension\Extension;

View File

@ -1,10 +1,13 @@
<?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 Flarum\Foundation\KnownError;

View File

@ -1,10 +1,13 @@
<?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
{

View File

@ -1,10 +1,13 @@
<?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;

View File

@ -1,10 +1,13 @@
<?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;

View File

@ -1,10 +1,13 @@
<?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
{

View File

@ -1,10 +1,13 @@
<?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 Flarum\Settings\SettingsRepositoryInterface;
@ -12,7 +15,7 @@ use Illuminate\Support\Str;
class LastUpdateCheck
{
public const KEY = 'sycho-package-manager.last_update_check';
public const KEY = 'flarum-package-manager.last_update_check';
/**
* @var SettingsRepositoryInterface

View File

@ -1,15 +1,18 @@
<?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 Flarum\Database\Console\MigrateCommand;
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\Output\NullOutput;

View File

@ -1,6 +1,13 @@
<?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;

View File

@ -1,10 +1,13 @@
<?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\Console\Application;
@ -18,9 +21,9 @@ use Illuminate\Contracts\Events\Dispatcher;
use Monolog\Formatter\LineFormatter;
use Monolog\Handler\RotatingFileHandler;
use Monolog\Logger;
use SychO\PackageManager\Event\FlarumUpdated;
use SychO\PackageManager\Extension\Event\Updated;
use SychO\PackageManager\Listener\PostUpdateListener;
use Flarum\PackageManager\Event\FlarumUpdated;
use Flarum\PackageManager\Extension\Event\Updated;
use Flarum\PackageManager\Listener\PostUpdateListener;
class PackageManagerServiceProvider extends AbstractServiceProvider
{
@ -32,11 +35,12 @@ class PackageManagerServiceProvider extends AbstractServiceProvider
$composer = new Application();
$composer->setAutoExit(false);
/** @var Paths $paths */
$paths = $container->make(Paths::class);
putenv("COMPOSER_HOME={$paths->storage}/.composer");
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,
// composer 2 doesn't really need this much unless the extensions are very loaded dependency wise,

View File

@ -1,6 +1,13 @@
<?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;

View File

@ -1,6 +1,13 @@
<?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;