Skip to content

Commit

Permalink
Dotclear 2.24 compliance
Browse files Browse the repository at this point in the history
  • Loading branch information
franck-paul committed Nov 30, 2022
1 parent 03d1670 commit 60c111a
Show file tree
Hide file tree
Showing 4 changed files with 146 additions and 10 deletions.
119 changes: 119 additions & 0 deletions .github/workflows/dcstore.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: Update dcstore.xml file if necessary

on:
release:
types:
- released
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "dcstore"
dcstore:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Setup PHP
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'

# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

# Back to default branche
- name: Back to default branch of repository
shell: bash
run: |
echo "git fetch && git switch ${{github.event.repository.default_branch}}"
git fetch
git switch ${{github.event.repository.default_branch}}
# Run PHP code
- name: Run PHP code
id: getversion
shell: php {0}
run: |
<?php
$version = '';
$dcmin = '2.0';
if (file_exists('dcstore.xml')) {
$df = file_get_contents('./_define.php');
if (preg_match('/registerModule\((.*?),(.*?)[\'\"],(.*?)[\'\"],(.*?)[\'\"](.*?)[\'\"](.*?)(,.*)\)/s',$df,$matches)) {
if (isset($matches[5])) {
$version = $matches[5];
if (isset($matches[7])) {
$str = $matches[7];
if (preg_match('/\[(.*?)[\'\"]core[\'\"](.*?),(.*?)[\'\"](.*?)[\'\"](.*?)\]/s',$str,$submatches)) {
$dcmin = $submatches[4];
}
}
}
}
if ($version !== '') {
$ds = file_get_contents('dcstore.xml');
if ($ds) {
$ds = preg_replace('/<version>(.*?)<\/version>/s',"<version>$version</version>",$ds);
$ds = preg_replace('/download\/(.*?)\//s',"download/$version/",$ds);
$ds = preg_replace('/(.*)-(.*?).zip/s',"$1-$version.zip",$ds);
$ds = preg_replace('/<da:dcmin>(.*?)<\/da:dcmin>/s',"<da:dcmin>$dcmin</da:dcmin>",$ds);
if ($ds) {
file_put_contents('dcstore.xml',$ds);
}
}
}
}
echo "::set-output name=module_version::$version\n";
echo "::set-output name=module_dcmin::$dcmin\n";
# Cope with returned versions
- name: Log output of the script
shell: bash
run: echo "${{steps.getversion.outputs.module_version}} (Dotclear ${{steps.getversion.outputs.module_dcmin}}+)"

# Log default branch
- name: Log output the default branch
shell: bash
run: echo "The default branch is ${{github.event.repository.default_branch}}"

# Update dcstore.xml if necessary
- name: Update dcstore
id: update-dcstore
shell: bash
run: |
cat dcstore.xml
test=$(git diff --name-only -- dcstore.xml)
if [[ "$test" != "" ]]; then
echo "dcstore.xml modified, need to be commit"
echo "set credentials"
git config user.email "[email protected]"
git config user.name "franck-paul"
echo "git add dcstore.xml"
git add dcstore.xml
echo "git commit"
git commit -m "Update dcstore.xml - version ${{steps.getversion.outputs.module_version}} - Dotclear ${{steps.getversion.outputs.module_dcmin}}+"
echo "git push"
git push
else
echo "nothing to do"
fi
# Notification via Telegram
- name: Send Telegram Message Ok
uses: appleboy/telegram-action@master
env:
GITHUB_CONTEXT: ${{toJSON(github)}}
with:
to: ${{ secrets.TELEGRAM_ID }}
token: ${{ secrets.TELEGRAM_TOKEN }}
format: markdown
message: |
→ Update *dcstore.xml* file if necessary
Version: *${{steps.getversion.outputs.module_version}}* (Dotclear ${{steps.getversion.outputs.module_dcmin}}+)
Branch: *${{ github.ref }}*
Repository: *${{github.repository}}*
Owner: *${{github.repository_owner}}*
🍺
18 changes: 9 additions & 9 deletions _define.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
}

$this->registerModule(
'Café Crème', // Name
'Structure Aorakit-1B de Kozlika', // Description
'Franck Paul', // Author
'1.7', // Version
'Café Crème',
'Structure Aorakit-1B de Kozlika',
'Franck Paul',
'2.0',
[
'requires' => [['core', '2.19']], // Dependencies
'type' => 'theme', // Type
'requires' => [['core', '2.24']],
'type' => 'theme',

'details' => 'https://open-time.net/?q=cafe-creme', // Details URL
'support' => 'https://github.com/franck-paul/cafe-creme', // Support URL
'repository' => 'https://raw.githubusercontent.com/franck-paul/cafe-creme/main/dcstore.xml'
'details' => 'https://open-time.net/?q=cafe-creme',
'support' => 'https://github.com/franck-paul/cafe-creme',
'repository' => 'https://raw.githubusercontent.com/franck-paul/cafe-creme/main/dcstore.xml',
]
);
3 changes: 2 additions & 1 deletion _public.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
* @copyright Franck Paul ([email protected])
* @copyright GPL-2.0
*/

namespace themes\cafe_creme;

if (!defined('DC_RC_PATH')) {
return;
}

\l10n::set(dirname(__FILE__) . '/locales/' . $_lang . '/main');
\l10n::set(__DIR__ . '/locales/' . \dcCore::app()->lang . '/main');
16 changes: 16 additions & 0 deletions locales/fr/main.lang.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php
/**
* @package Dotclear
*
* @copyright Olivier Meunier & Association Dotclear
* @copyright GPL-2.0-only
*/
#
# DOT NOT MODIFY THIS FILE !
#

l10n::$locales['previous entry'] = 'billet plus ancien';
l10n::$locales['next entry'] = 'billet plus r&eacute;cent';
l10n::$locales['All tags'] = 'Tous les mots-cl&eacute;s';
l10n::$locales['Tags'] = 'Mots-cl&eacute;s';
l10n::$locales['Tag'] = 'Mot-cl&eacute;';

0 comments on commit 60c111a

Please sign in to comment.