Skip to content

Commit

Permalink
fix: ILIAS 8 compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
iFadi committed Mar 21, 2024
1 parent 9e52551 commit 40222ba
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 17 deletions.
27 changes: 27 additions & 0 deletions .github/scripts/update_readme_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

# Get the latest version (assuming it's stored in a file or as a Git tag)
latest_version=$(git describe --tags `git rev-list --tags --max-count=1`)

# Check if latest_version is not empty
if [ -z "$latest_version" ]; then
echo "Error: Could not determine latest version."
exit 1
fi

# Update the README.md file
sed -i "/^## Version/{N;s/.*/## Version\n$latest_version/}" README.md


# Check if README was updated
if ! git diff --exit-code --quiet README.md; then
# Configure Git (Replace with your details)
git config --global user.email "fadi@asbih.com"
git config --global user.name "Fadi Asbih"

# Add and commit changes
git add README.md
git commit -m "chore: update version in README to $latest_version"
else
echo "No changes to README.md"
fi
33 changes: 33 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
on:
push:
branches:
- main

permissions:
contents: write
pull-requests: write

name: release-please

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v4
with:
token: ${{ secrets.MY_RELEASE_PLEASE_TOKEN }}
release-type: simple

- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0 # Fetches all history for all branches and tags

- name: Update README Version
run: bash .github/scripts/update_readme_version.sh

- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: main
Empty file added CHANGELOG.md
Empty file.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ After activating the plugin, a new cronjob "Customizable - Check user accounts"
* {EXPIRES}

## Tested on the following ILIAS Versions:
* v7.19
* v7.21
* v8.0
* v8.99

## Maintainer
[ZQS/elsa - Leibniz Universität Hannover](https://www.zqs.uni-hannover.de/de/zqs/team-kontakt/elsa/), [elearning@uni-hannover.de](mailto:elearning@uni-hannover.de)
Expand Down
24 changes: 12 additions & 12 deletions classes/class.ilCustomUserCronCheckAccounts.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,48 +16,48 @@ public function __construct(ilSetting $settings)
$this->settings = $settings;
}

public function getId()
public function getId(): string
{
return self::PLUGIN_ID;
}

public function getTitle()
public function getTitle(): string
{
return ilCustomUserCronCheckAccountsPlugin::getInstance()->txt(self::CRON_NAME);
}

public function getDescription()
public function getDescription(): string
{
return ilCustomUserCronCheckAccountsPlugin::getInstance()->txt("cron_description");
}

public function run()
public function run(): ilCronJobResult
{
$customUserCronCheckAccounts = new CustomUserCronCheckAccounts($this->settings);
return $customUserCronCheckAccounts->run();
}

public function hasAutoActivation()
public function hasAutoActivation(): bool
{
return false;
}

public function hasFlexibleSchedule()
public function hasFlexibleSchedule(): bool
{
return false;
}

public function getDefaultScheduleType()
public function getDefaultScheduleType(): int
{
return self::SCHEDULE_TYPE_DAILY;
}

public function getDefaultScheduleValue()
public function getDefaultScheduleValue(): int
{
return 1;
}

public function hasCustomSettings()
public function hasCustomSettings(): bool
{
return true;
}
Expand All @@ -68,7 +68,7 @@ public function hasCustomSettings()
* @param ilPropertyFormGUI $a_form
* @throws ilDateTimeException
*/
public function addCustomSettingsToForm(ilPropertyFormGUI $a_form)
public function addCustomSettingsToForm(ilPropertyFormGUI $a_form): void
{
// Language selection
$language_section = new ilFormSectionHeaderGUI();
Expand Down Expand Up @@ -121,7 +121,7 @@ public function addCustomSettingsToForm(ilPropertyFormGUI $a_form)



public function saveCustomSettings(ilPropertyFormGUI $a_form)
public function saveCustomSettings(ilPropertyFormGUI $a_form): bool
{
$this->settings->set('mail_subject_de', $a_form->getInput('mail_subject_de'));
$this->settings->set('mail_body_de', $a_form->getInput('mail_body_de'));
Expand All @@ -134,7 +134,7 @@ public function saveCustomSettings(ilPropertyFormGUI $a_form)

class CustomUserCronCheckAccounts extends ilUserCronCheckAccounts
{
public function run()
public function run(): ilCronJobResult
{
global $DIC;

Expand Down
5 changes: 2 additions & 3 deletions classes/class.ilCustomUserCronCheckAccountsPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function getCronJobInstance($a_job_id): ilCustomUserCronCheckAccounts
return new ilCustomUserCronCheckAccounts($settings);
}

protected function beforeUninstall()
protected function beforeUninstall(): bool
{
global $DIC;

Expand Down Expand Up @@ -88,7 +88,7 @@ protected function beforeUninstall()
return true;
}

protected function afterActivation()
protected function afterActivation(): void
{
global $DIC;

Expand All @@ -108,7 +108,6 @@ protected function afterActivation()
$this->logger->debug('Installing: loading plugin settings: mail_subject_de, mail_body_de, mail_subject_en, mail_body_de');


return true;
}

//public function activate()
Expand Down

0 comments on commit 40222ba

Please sign in to comment.