Skip to content

Commit

Permalink
Refactored stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
jaxwilko committed Dec 30, 2024
1 parent 644052f commit 69b11d8
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 72 deletions.
1 change: 0 additions & 1 deletion modules/system/classes/UpdateManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use Illuminate\Support\Facades\App;
use System\Classes\Core\MarketPlaceApi;
use System\Classes\Extensions\PluginManager;
use System\Classes\Extensions\Plugins\PluginVersionManager;
use System\Helpers\Cache as CacheHelper;
use System\Models\Parameter;
use Winter\Storm\Exception\ApplicationException;
Expand Down
1 change: 0 additions & 1 deletion modules/system/classes/extensions/PluginBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Support\ServiceProvider as ServiceProviderBase;
use ReflectionClass;
use System\Classes\Extensions\Plugins\PluginVersionManager;
use System\Classes\VersionYamlProcessor;
use Winter\Storm\Exception\SystemException;
use Winter\Storm\Foundation\Application;
Expand Down
51 changes: 47 additions & 4 deletions modules/system/classes/extensions/PluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
use RecursiveDirectoryIterator;
use RecursiveIteratorIterator;
use System\Classes\ComposerManager;
use System\Classes\Extensions\Plugins\PluginManagerDeprecatedMethodsTrait;
use System\Classes\Extensions\Plugins\PluginVersionManager;
use System\Classes\Extensions\Source\ExtensionSource;
use System\Classes\SettingsManager;
use System\Models\PluginVersion;
Expand All @@ -39,8 +37,6 @@
*/
class PluginManager extends ExtensionManager implements ExtensionManagerInterface
{
use PluginManagerDeprecatedMethodsTrait;

public const EXTENSION_NAME = 'plugin';

/**
Expand Down Expand Up @@ -1375,4 +1371,51 @@ public function resolveIdentifier(ExtensionSource|WinterExtension|string $extens

return null;
}

/**
* Returns an array with all enabled plugins
*
* @return array [$code => $pluginObj]
* @deprecated
*/
public function getPlugins(): array
{
return $this->list();
}

/**
* Tears down a plugin's database tables and rebuilds them.
* @deprecated
*/
public function refreshPlugin(string $id): void
{
$this->refresh($id);
}

/**
* Completely roll back and delete a plugin from the system.
* @deprecated
*/
public function deletePlugin(string $id): void
{
$this->uninstall($id);
}

/**
* Disables the provided plugin using the provided flag (defaults to static::DISABLED_BY_USER)
* @deprecated
*/
public function disablePlugin(PluginBase|string $plugin, string|bool $flag = self::DISABLED_BY_USER): bool
{
return $this->disable($plugin, $flag);
}

/**
* Enables the provided plugin using the provided flag (defaults to static::DISABLED_BY_USER)
* @deprecated
*/
public function enablePlugin(PluginBase|string $plugin, $flag = self::DISABLED_BY_USER): bool
{
return $this->enable($plugin, $flag);
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
<?php

namespace System\Classes\Extensions\Plugins;
namespace System\Classes\Extensions;

use Carbon\Carbon;
use Illuminate\Console\View\Components\Error;
use Illuminate\Console\View\Components\Task;
use Illuminate\Support\Facades\File;
use System\Classes\Extensions\PluginBase;
use System\Classes\Extensions\PluginManager;
use stdClass;
use System\Classes\VersionYamlProcessor;
use Winter\Storm\Database\Updater;
use Winter\Storm\Support\Facades\DB;
use Winter\Storm\Support\Facades\Yaml;
use stdClass;

/**
* Version manager
Expand Down
12 changes: 8 additions & 4 deletions modules/system/classes/extensions/Preserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
namespace System\Classes\Extensions;

use Cms\Classes\Theme;
use System\Classes\Core\InteractsWithZip;
use Illuminate\Support\Facades\Storage;
use System\Traits\InteractsWithZip;
use Winter\Storm\Exception\ApplicationException;
use Winter\Storm\Foundation\Extension\WinterExtension;
use Winter\Storm\Support\Traits\Singleton;

class Preserver
Expand All @@ -20,6 +21,9 @@ class Preserver
Theme::class => 'themes',
];

/**
* @throws ApplicationException
*/
public function store(WinterExtension $extension): string
{
$this->ensureDirectory(static::ROOT_PATH);
Expand All @@ -34,15 +38,15 @@ public function store(WinterExtension $extension): string
'%s%4$s%s%4$s%s',
static::ROOT_PATH,
$type,
$extension->extensionIdentifier(),
$extension->getIdentifier(),
DIRECTORY_SEPARATOR
);

$this->ensureDirectory($extensionArchiveDir);

return $this->packArchive(
$extension->extensionPath(),
Storage::path($extensionArchiveDir . DIRECTORY_SEPARATOR . $extension->extensionVersion())
$extension->getPath(),
Storage::path($extensionArchiveDir . DIRECTORY_SEPARATOR . $extension->getVersion())
);
}

Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion modules/system/console/create/CreateMigration.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace System\Console\Create;

use InvalidArgumentException;
use System\Classes\Extensions\Plugins\PluginVersionManager;
use System\Classes\Extensions\PluginVersionManager;
use System\Console\BaseScaffoldCommand;
use Winter\Storm\Database\Model;
use Winter\Storm\Support\Str;
Expand Down
2 changes: 1 addition & 1 deletion modules/system/tests/bootstrap/PluginManagerTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\BufferedOutput;
use System\Classes\Extensions\PluginManager;
use System\Classes\Extensions\Plugins\PluginVersionManager;
use System\Classes\Extensions\PluginVersionManager;
use System\Classes\UpdateManager;
use Winter\Storm\Database\Model as ActiveRecord;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace System\Classes\Core;
namespace System\Traits;

use Illuminate\Support\Facades\Lang;
use Winter\Storm\Exception\ApplicationException;
Expand Down

0 comments on commit 69b11d8

Please sign in to comment.