Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
35 changes: 9 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,24 @@ concurrency:

jobs:
tests:
name: PHP ${{ matrix.php }}${{ matrix.deps && format(' / {0}', matrix.deps) || '' }}${{ matrix.coverage && ' / Coverage' || '' }}
runs-on: ubuntu-22.04
name: PHP ${{ matrix.php }}${{ matrix.coverage && ' / Coverage' || '' }}
runs-on: ubuntu-latest
timeout-minutes: 15

strategy:
fail-fast: false
matrix:
include:
# Lowest supported dependencies test
- php: "7.2"
deps: "lowest"
# Standard tests across all supported versions
- php: "7.2"
- php: "7.3"
- php: "7.4"
- php: "8.0"
- php: "8.1"
- php: "8.2"
- php: "8.3"
- php: "8.4"
- php: "8.5"
# Coverage run
- php: "8.3"
- php: "8.4"
coverage: true

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: intl, mbstring, mysqli
Expand All @@ -53,23 +41,18 @@ jobs:
run: echo "dir=$(composer config cache-dir)" >> $GITHUB_OUTPUT

- name: Cache Composer
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ runner.os }}-${{ matrix.php }}-${{ matrix.deps || 'stable' }}-${{ hashFiles('**/composer.json.dist') }}
key: composer-${{ runner.os }}-${{ matrix.php }}-${{ hashFiles('**/composer.json.dist') }}
restore-keys: |
composer-${{ runner.os }}-${{ matrix.php }}-

- name: Prepare composer.json
run: cp composer.json.dist composer.json

- name: Install dependencies
run: |
if [ "${{ matrix.deps }}" = "lowest" ]; then
composer update --prefer-lowest --prefer-stable --no-interaction --prefer-dist --no-progress
else
composer update --prefer-stable --no-interaction --prefer-dist --no-progress
fi
run: composer update --prefer-stable --no-interaction --prefer-dist --no-progress

- name: Check platform requirements
run: composer check-platform-reqs
Expand All @@ -87,7 +70,7 @@ jobs:

- name: Upload coverage to Codecov
if: ${{ matrix.coverage }}
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5
uses: codecov/codecov-action@v5
with:
files: coverage.clover
token: ${{ secrets.CODECOV_TOKEN }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ concurrency:
jobs:
sonarcloud:
name: SonarCloud Analysis
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
timeout-minutes: 15
if: github.repository == 'XOOPS/XoopsCore26'
env:
Expand All @@ -26,7 +26,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2
with:
php-version: "8.3"
php-version: "8.4"
extensions: intl, mbstring, mysqli
tools: composer
coverage: xdebug
Expand Down
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
build:
environment:
php: 7.4
php: 8.4
dependencies:
before:
- cp composer.json.dist composer.json
Expand Down
11 changes: 9 additions & 2 deletions composer.json.dist
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,18 @@
"Xmf\\": "./xoops_lib/Xmf/"
}
},
"repositories": [
{
"type": "path",
"url": "../base-requires"
}
],
"require": {
"xoops/base-requires": "^0.4.1"
"php": "^8.4",
"xoops/base-requires": "dev-master"
},
Comment on lines +12 to 21
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The path repository ../base-requires is not available in typical CI/checkouts and will cause composer update to fail. Prefer a VCS/Packagist source (remove the path repo) and pin xoops/base-requires to a tagged/stable version (or a specific commit) instead of dev-master.

Copilot uses AI. Check for mistakes.
"require-dev": {
"phpunit/phpunit": "^8.5 || ^9.6",
"phpunit/phpunit": "^11.0",
"roave/security-advisories": "dev-master"
},
"config": {
Expand Down
6 changes: 4 additions & 2 deletions console/Commands/ActivateModuleCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ protected function configure()
);
}

protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$module = $input->getArgument('module');
$output->writeln(sprintf('Activating %s', $module));
Expand All @@ -32,7 +32,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$moduleObject = $moduleHandler->getByDirname($module);
if (false === $moduleObject) {
$output->writeln(sprintf('<error>%s is not an installed module!</error>', $module));
return;
return Command::FAILURE;
}
$moduleObject->setVar('isactive', true);
$moduleHandler->insert($moduleObject, true);
Expand All @@ -46,5 +46,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
}
$output->writeln(sprintf('<info>Set %s module active</info>', $module));
$xoops->cache()->delete('system');

return Command::SUCCESS;
}
}
10 changes: 6 additions & 4 deletions console/Commands/CiBootstrapCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ protected function createConfigFile($configFile, $baseDir)
*
* @param InputInterface $input input handler
* @param OutputInterface $output output handler
* @return void
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$XContainer = $this->getApplication()->XContainer;

Expand All @@ -126,7 +126,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
if (!file_exists($configFile)) {
if (false === $this->createConfigFile($configFile, $baseDir)) {
$output->writeln(sprintf('<error>Could not write file %s!</error>', $configFile));
return;
return Command::FAILURE;
}
$output->writeln(sprintf('<info>Created config file %s.</info>', $configFile));
} else {
Expand All @@ -136,7 +136,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
if (!file_exists($mainfile)) {
if (false === $this->createMainfile($configFile, $mainfile)) {
$output->writeln(sprintf('<error>Could not write %s!</error>', $mainfile));
return;
return Command::FAILURE;
}
$output->writeln(sprintf('<info>Wrote mainfile %s</info>', $mainfile));
} else {
Expand All @@ -148,5 +148,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
\XoopsBaseConfig::getInstance($configFile);
}
\Xoops\Core\Cache\CacheManager::createDefaultConfig();

return Command::SUCCESS;
}
}
8 changes: 5 additions & 3 deletions console/Commands/CiInstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ protected function configure()
*
* @param InputInterface $input input handler
* @param OutputInterface $output output handler
* @return void
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
// install the 'system' module
$xoops = \Xoops::getInstance();
$module = 'system';
$output->writeln(sprintf('Installing %s', $module));
if (false !== $xoops->getModuleByDirname($module)) {
$output->writeln(sprintf('<error>%s module is already installed!</error>', $module));
return;
return Command::FAILURE;
}
$xoops->setTpl(new XoopsTpl());
\XoopsLoad::load('module', 'system');
Expand Down Expand Up @@ -87,5 +87,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
)
);
$output->writeln(sprintf('<info>Inserted %d user.</info>', $result));

return Command::SUCCESS;
}
}
6 changes: 4 additions & 2 deletions console/Commands/DeactivateModuleCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ protected function configure()
);
}

protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$module = $input->getArgument('module');
$output->writeln(sprintf('Deactivating %s', $module));
Expand All @@ -32,7 +32,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$moduleObject = $moduleHandler->getByDirname($module);
if (false === $moduleObject) {
$output->writeln(sprintf('<error>%s is not an installed module!</error>', $module));
return;
return Command::FAILURE;
}
$moduleObject->setVar('isactive', false);
$moduleHandler->insert($moduleObject, true);
Expand All @@ -46,5 +46,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
}
$output->writeln(sprintf('<info>Set %s module inactive</info>', $module));
$xoops->cache()->delete('system');

return Command::SUCCESS;
}
}
10 changes: 6 additions & 4 deletions console/Commands/InstallModuleCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,20 @@ protected function configure()
*
* @param InputInterface $input input handler
* @param OutputInterface $output output handler
* @return void
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$xoops = \Xoops::getInstance();
$module = $input->getArgument('module');
if (false === \XoopsLoad::fileExists($xoops->path("modules/$module/xoops_version.php"))) {
$output->writeln(sprintf('<error>No module named %s found!</error>', $module));
return;
return Command::FAILURE;
}
$output->writeln(sprintf('Installing %s', $module));
if (false !== $xoops->getModuleByDirname($module)) {
$output->writeln(sprintf('<error>%s module is already installed!</error>', $module));
return;
return Command::FAILURE;
}
$xoops->setTpl(new XoopsTpl());
\XoopsLoad::load('module', 'system');
Expand All @@ -68,5 +68,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$output->writeln(sprintf('<info>Install of %s completed.</info>', $module));
}
$xoops->cache()->delete('system');

return Command::SUCCESS;
}
}
4 changes: 3 additions & 1 deletion console/Commands/RenameSystemTablesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ protected function configure()
);
}

protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{

$tableNames = [
Expand Down Expand Up @@ -72,5 +72,7 @@ protected function execute(InputInterface $input, OutputInterface $output)

//var_dump($migrate->dumpQueue());
$migrate->executeQueue(true);

return Command::SUCCESS;
}
}
10 changes: 6 additions & 4 deletions console/Commands/SetConfigCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ protected function configure()
*
* @param InputInterface $input input handler
* @param OutputInterface $output output handler
* @return void
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$xoops = \Xoops::getInstance();

Expand All @@ -47,7 +47,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$sysmodule = $xoops->getModuleByDirname('system');
if (empty($sysmodule)) {
$output->writeln('<error>Module system is not installed!</error>');
return;
return Command::FAILURE;
}
$mid = $sysmodule->mid();
$criteria = new CriteriaCompo;
Expand All @@ -57,13 +57,15 @@ protected function execute(InputInterface $input, OutputInterface $output)
$configItem = reset($objArray);
if (empty($configItem)) {
$output->writeln(sprintf('<error>Config item %s not found!</error>', $name));
return;
return Command::FAILURE;
}
$configItem->setConfValueForInput($value);
$result = $configHandler->insertConfig($configItem);
if ($result === false) {
$output->writeln(sprintf('<error>Could not set %s!</error>', $name));
}
$output->writeln(sprintf('Set %s', $name));

return Command::SUCCESS;
}
}
4 changes: 3 additions & 1 deletion console/Commands/TestCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ protected function configure() {
);
}

protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
if ($input->getOption('flag')) {
$output->writeln('<info>flagged</info>');
}
$output->writeln(sprintf('Hello, %s!', $input->getArgument('name')));

return Command::SUCCESS;
}
}
6 changes: 4 additions & 2 deletions console/Commands/UninstallModuleCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ protected function configure()
);
}

protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$module = $input->getArgument('module');
$output->writeln(sprintf('Uninstalling %s', $module));
$xoops = \Xoops::getInstance();
if (false === $xoops->getModuleByDirname($module)) {
$output->writeln(sprintf('<error>%s is not an installed module!</error>', $module));
return;
return Command::FAILURE;
}
$xoops->setTpl(new XoopsTpl());
\XoopsLoad::load('module', 'system');
Expand All @@ -53,5 +53,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$output->writeln(sprintf('<info>Uninstall of %s completed.</info>', $module));
}
$xoops->cache()->delete('system');

return Command::SUCCESS;
}
}
6 changes: 4 additions & 2 deletions console/Commands/UpdateModuleCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ protected function configure()
);
}

protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$module = $input->getArgument('module');
$output->writeln(sprintf('Updating %s', $module));
$xoops = \Xoops::getInstance();
if (false === $xoops->getModuleByDirname($module)) {
$output->writeln(sprintf('<error>%s is not an installed module!</error>', $module));
return;
return Command::FAILURE;
}
$xoops->setTpl(new XoopsTpl());
\XoopsLoad::load('module', 'system');
Expand All @@ -56,5 +56,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$output->writeln(sprintf('<info>Update of %s completed.</info>', $module));
}
$xoops->cache()->delete('system');

return Command::SUCCESS;
}
}
Loading
Loading