mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-23 06:48:41 +00:00
always pass
This commit is contained in:
parent
b034c617fd
commit
c560be94ba
|
|
@ -118,7 +118,7 @@ final class ApplicationManager
|
|||
|
||||
// @var class-string<InstallerAbstract> $class
|
||||
$class = \str_replace('/', '\\', $classPath);
|
||||
$class::install($this->app->dbPool, $info, $this->app->appSettings);
|
||||
$class::install($this->app, $info, $this->app->appSettings);
|
||||
|
||||
return true;
|
||||
} catch (\Throwable $t) {
|
||||
|
|
@ -150,7 +150,7 @@ final class ApplicationManager
|
|||
|
||||
// @var class-string<UninstallerAbstract> $class
|
||||
$class = \str_replace('/', '\\', $classPath);
|
||||
$class::uninstall($this->app->dbPool, $info, $this->app->appSettings);
|
||||
$class::uninstall($this->app, $info, $this->app->appSettings);
|
||||
|
||||
$this->uninstallFiles($source);
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ abstract class InstallerAbstract
|
|||
/**
|
||||
* Install app.
|
||||
*
|
||||
* @param DatabasePool $dbPool Database instance
|
||||
* @param ApplicationAbstract $app Application
|
||||
* @param ApplicationInfo $info App info
|
||||
* @param SettingsInterface $cfgHandler Settings/Configuration handler
|
||||
*
|
||||
|
|
@ -49,10 +49,10 @@ abstract class InstallerAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function install(DatabasePool $dbPool, ApplicationInfo $info, SettingsInterface $cfgHandler) : void
|
||||
public static function install(ApplicationAbstract $app, ApplicationInfo $info, SettingsInterface $cfgHandler) : void
|
||||
{
|
||||
self::createTables($dbPool, $info);
|
||||
self::activate($dbPool, $info);
|
||||
self::createTables($app->dbPool, $info);
|
||||
self::activate($app, $info);
|
||||
self::installTheme(static::PATH . '/..', 'Default');
|
||||
}
|
||||
|
||||
|
|
@ -125,14 +125,14 @@ abstract class InstallerAbstract
|
|||
/**
|
||||
* Activate after install.
|
||||
*
|
||||
* @param DatabasePool $dbPool Database instance
|
||||
* @param ApplicationAbstract $app Application
|
||||
* @param ApplicationInfo $info App info
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static function activate(DatabasePool $dbPool, ApplicationInfo $info) : void
|
||||
protected static function activate(ApplicationAbstract $app, ApplicationInfo $info) : void
|
||||
{
|
||||
if (($path = \realpath(static::PATH)) === false) {
|
||||
return; // @codeCoverageIgnore
|
||||
|
|
@ -147,7 +147,7 @@ abstract class InstallerAbstract
|
|||
throw new \UnexpectedValueException($class); // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
$class::activate($dbPool, $info);
|
||||
$class::activate($app, $info);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace phpOMS\Module;
|
||||
|
||||
use phpOMS\Application\ApplicationAbstract;
|
||||
use phpOMS\Application\ApplicationInfo;
|
||||
use phpOMS\Autoloader;
|
||||
use phpOMS\Config\SettingsInterface;
|
||||
|
|
@ -41,7 +42,7 @@ abstract class InstallerAbstract
|
|||
/**
|
||||
* Install module.
|
||||
*
|
||||
* @param DatabasePool $dbPool Database instance
|
||||
* @param ApplicationAbstract $app Application
|
||||
* @param ModuleInfo $info Module info
|
||||
* @param SettingsInterface $cfgHandler Settings/Configuration handler
|
||||
*
|
||||
|
|
@ -49,10 +50,10 @@ abstract class InstallerAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function install(DatabasePool $dbPool, ModuleInfo $info, SettingsInterface $cfgHandler) : void
|
||||
public static function install(ApplicationAbstract $app, ModuleInfo $info, SettingsInterface $cfgHandler) : void
|
||||
{
|
||||
self::createTables($dbPool, $info);
|
||||
self::activate($dbPool, $info);
|
||||
self::createTables($app->dbPool, $info);
|
||||
self::activate($app, $info);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -86,14 +87,14 @@ abstract class InstallerAbstract
|
|||
/**
|
||||
* Activate after install.
|
||||
*
|
||||
* @param DatabasePool $dbPool Database instance
|
||||
* @param ApplicationAbstract $app Application
|
||||
* @param ModuleInfo $info Module info
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static function activate(DatabasePool $dbPool, ModuleInfo $info) : void
|
||||
protected static function activate(ApplicationAbstract $app, ModuleInfo $info) : void
|
||||
{
|
||||
if (($path = \realpath(static::PATH)) === false) {
|
||||
return; // @codeCoverageIgnore
|
||||
|
|
@ -108,7 +109,7 @@ abstract class InstallerAbstract
|
|||
throw new \UnexpectedValueException($class); // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
$class::activate($dbPool, $info);
|
||||
$class::activate($app, $info);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -398,7 +398,7 @@ final class ModuleManager
|
|||
}
|
||||
|
||||
/** @var $class DeactivateAbstract */
|
||||
$class::deactivate($this->app->dbPool, $info);
|
||||
$class::deactivate($this->app, $info);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -450,7 +450,7 @@ final class ModuleManager
|
|||
}
|
||||
|
||||
/** @var $class ActivateAbstract */
|
||||
$class::activate($this->app->dbPool, $info);
|
||||
$class::activate($this->app, $info);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -568,7 +568,7 @@ final class ModuleManager
|
|||
}
|
||||
|
||||
/** @var $class UninstallerAbstract */
|
||||
$class::uninstall($this->app->dbPool, $info);
|
||||
$class::uninstall($this->app, $info);
|
||||
|
||||
if (isset($this->installed[$module])) {
|
||||
unset($this->installed[$module]);
|
||||
|
|
@ -607,7 +607,7 @@ final class ModuleManager
|
|||
}
|
||||
|
||||
/** @var InstallerAbstract $class */
|
||||
$class::install($this->app->dbPool, $info, $this->app->appSettings);
|
||||
$class::install($this->app, $info, $this->app->appSettings);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -631,7 +631,7 @@ final class ModuleManager
|
|||
$from = \str_replace('/', '\\', $from);
|
||||
|
||||
$class = $from . '\\Admin\\Install\\' . $for;
|
||||
$class::install($this->modulePath, $this->app);
|
||||
$class::install($this->app, $this->modulePath);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace phpOMS\Module;
|
||||
|
||||
use phpOMS\Application\ApplicationAbstract;
|
||||
use phpOMS\Application\ApplicationInfo;
|
||||
use phpOMS\DataStorage\Database\DatabasePool;
|
||||
use phpOMS\System\File\Local\Directory;
|
||||
|
|
@ -46,14 +47,14 @@ abstract class StatusAbstract
|
|||
/**
|
||||
* Deactivate module.
|
||||
*
|
||||
* @param DatabasePool $dbPool Database instance
|
||||
* @param ApplicationAbstract $app Application
|
||||
* @param ModuleInfo $info Module info
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function activate(DatabasePool $dbPool, ModuleInfo $info) : void
|
||||
public static function activate(ApplicationAbstract $app, ModuleInfo $info) : void
|
||||
{
|
||||
self::activateRoutes($info);
|
||||
self::activateHooks($info);
|
||||
|
|
@ -176,14 +177,14 @@ abstract class StatusAbstract
|
|||
/**
|
||||
* Deactivate module.
|
||||
*
|
||||
* @param DatabasePool $dbPool Database instance
|
||||
* @param ApplicationAbstract $app Application
|
||||
* @param ModuleInfo $info Module info
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function deactivate(DatabasePool $dbPool, ModuleInfo $info) : void
|
||||
public static function deactivate(ApplicationAbstract $app, ModuleInfo $info) : void
|
||||
{
|
||||
self::deactivateRoutes($info);
|
||||
self::deactivateHooks($info);
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace phpOMS\Module;
|
||||
|
||||
use phpOMS\Application\ApplicationAbstract;
|
||||
use phpOMS\DataStorage\Database\DatabasePool;
|
||||
use phpOMS\DataStorage\Database\Query\Builder;
|
||||
use phpOMS\DataStorage\Database\Schema\Builder as SchemaBuilder;
|
||||
|
|
@ -39,31 +40,31 @@ abstract class UninstallerAbstract
|
|||
/**
|
||||
* Install module.
|
||||
*
|
||||
* @param DatabasePool $dbPool Database instance
|
||||
* @param ApplicationAbstract $app Application
|
||||
* @param ModuleInfo $info Module info
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function uninstall(DatabasePool $dbPool, ModuleInfo $info) : void
|
||||
public static function uninstall(ApplicationAbstract $app, ModuleInfo $info) : void
|
||||
{
|
||||
self::deactivate($dbPool, $info);
|
||||
self::dropTables($dbPool, $info);
|
||||
self::unregisterFromDatabase($dbPool, $info);
|
||||
self::deactivate($app, $info);
|
||||
self::dropTables($app->dbPool, $info);
|
||||
self::unregisterFromDatabase($app->dbPool, $info);
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate after install.
|
||||
*
|
||||
* @param DatabasePool $dbPool Database instance
|
||||
* @param ApplicationAbstract $app Application
|
||||
* @param ModuleInfo $info Module info
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static function deactivate(DatabasePool $dbPool, ModuleInfo $info) : void
|
||||
protected static function deactivate(ApplicationAbstract $app, ModuleInfo $info) : void
|
||||
{
|
||||
if (($path = \realpath(static::PATH)) === false) {
|
||||
return; // @codeCoverageIgnore
|
||||
|
|
@ -74,7 +75,7 @@ abstract class UninstallerAbstract
|
|||
|
||||
/** @var StatusAbstract $class */
|
||||
$class = \str_replace('/', '\\', $classPath);
|
||||
$class::deactivate($dbPool, $info);
|
||||
$class::deactivate($app, $info);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -229,7 +229,7 @@ final class UriFactory
|
|||
\parse_str($urlStructure['query'], $urlStructure['query']);
|
||||
|
||||
foreach ($urlStructure['query'] as $para => $query) {
|
||||
if ($query === '' && \stripos($url, $para . '=') !== false) {
|
||||
if (($query === '' && \stripos($url, $para . '=') !== false) || $query === '---') {
|
||||
unset($urlStructure['query'][$para]);
|
||||
}
|
||||
}
|
||||
|
|
@ -249,7 +249,7 @@ final class UriFactory
|
|||
. (isset($urlStructure['path']) && !empty($urlStructure['path'])
|
||||
? $urlStructure['path'] : '')
|
||||
. (isset($urlStructure['query']) && !empty($urlStructure['query'])
|
||||
? '?' . \http_build_query($urlStructure['query']) : '')
|
||||
? '?' . \rtrim(\str_replace('=&', '&', \http_build_query($urlStructure['query'])), '=') : '')
|
||||
. (isset($urlStructure['fragment']) && !empty($urlStructure['fragment'])
|
||||
? '#' . \str_replace('\#', '#', $urlStructure['fragment']) : '');
|
||||
|
||||
|
|
@ -288,7 +288,7 @@ final class UriFactory
|
|||
$parsed = \preg_replace_callback('(\{[\/#\?%@\.\$][a-zA-Z0-9\-]*\})', function ($match) use ($toMatch) {
|
||||
$match = \substr($match[0], 1, \strlen($match[0]) - 2);
|
||||
|
||||
return $toMatch[$match] ?? self::$uri[$match] ?? '';
|
||||
return $toMatch[$match] ?? self::$uri[$match] ?? '---';
|
||||
}, $uri);
|
||||
|
||||
return self::unique($parsed ?? '');
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ namespace phpOMS\tests\Module;
|
|||
require_once __DIR__ . '/../Autoloader.php';
|
||||
|
||||
use Model\CoreSettings;
|
||||
use phpOMS\Application\ApplicationAbstract;
|
||||
use phpOMS\DataStorage\Database\DatabasePool;
|
||||
use phpOMS\Module\InstallerAbstract;
|
||||
use phpOMS\Module\ModuleInfo;
|
||||
|
|
@ -49,7 +50,7 @@ final class InstallerAbstractTest extends \PHPUnit\Framework\TestCase
|
|||
$this->expectException(\UnexpectedValueException::class);
|
||||
|
||||
$this->installer::install(
|
||||
new DatabasePool(),
|
||||
new class() extends ApplicationAbstract {},
|
||||
new ModuleInfo(__DIR__),
|
||||
new CoreSettings()
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user