Compare commits
No commits in common. "master" and "v0.1" have entirely different histories.
|
@ -1,10 +1,3 @@
|
||||||
HideStoreUpdates 0.2 - 2023.11.14
|
|
||||||
===========================================================
|
|
||||||
* Require Dotclear 2.28
|
|
||||||
* Require PHP 8.1+
|
|
||||||
* Clean old modules versions
|
|
||||||
* Add Fr translation
|
|
||||||
|
|
||||||
HideStoreUpdates 0.1 - 2023.11.13
|
HideStoreUpdates 0.1 - 2023.11.13
|
||||||
===========================================================
|
===========================================================
|
||||||
* Require Dotclear 2.28
|
* Require Dotclear 2.28
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# README
|
# README
|
||||||
|
|
||||||
[![Release](https://img.shields.io/badge/release-0.2-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/HideStoreUpdates/releases)
|
[![Release](https://img.shields.io/badge/release-0.1-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/HideStoreUpdates/releases)
|
||||||
![Date](https://img.shields.io/badge/date-2023.11.14-c44d58.svg)
|
![Date](https://img.shields.io/badge/date-2023.11.13-c44d58.svg)
|
||||||
[![Dotclear](https://img.shields.io/badge/dotclear-v2.28-137bbb.svg)](https://fr.dotclear.org/download)
|
[![Dotclear](https://img.shields.io/badge/dotclear-v2.28-137bbb.svg)](https://fr.dotclear.org/download)
|
||||||
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/HideStoreUpdates)
|
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/HideStoreUpdates)
|
||||||
[![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/JcDenis/HideStoreUpdates/src/branch/master/LICENSE)
|
[![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/JcDenis/HideStoreUpdates/src/branch/master/LICENSE)
|
||||||
|
|
|
@ -18,7 +18,7 @@ $this->registerModule(
|
||||||
'Hide store updates',
|
'Hide store updates',
|
||||||
'Hide some updates from store',
|
'Hide some updates from store',
|
||||||
'Jean-Christian Denis and Contributors',
|
'Jean-Christian Denis and Contributors',
|
||||||
'0.2',
|
'0.1',
|
||||||
[
|
[
|
||||||
'requires' => [['core', '2.28']],
|
'requires' => [['core', '2.28']],
|
||||||
'permissions' => 'My',
|
'permissions' => 'My',
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
<modules xmlns:da="http://dotaddict.org/da/">
|
<modules xmlns:da="http://dotaddict.org/da/">
|
||||||
<module id="HideStoreUpdates">
|
<module id="HideStoreUpdates">
|
||||||
<name>Hide store updates</name>
|
<name>Hide store updates</name>
|
||||||
<version>0.2</version>
|
<version>0.1</version>
|
||||||
<author>Jean-Christian Denis</author>
|
<author>Jean-Christian Denis</author>
|
||||||
<desc>Hide some updates from store</desc>
|
<desc>Hide some updates from store</desc>
|
||||||
<file>https://git.dotclear.watch/JcDenis/HideStoreUpdates/releases/download/v0.2/plugin-HideStoreUpdates.zip</file>
|
<file>https://git.dotclear.watch/JcDenis/HideStoreUpdates/releases/download/v0.1/plugin-HideStoreUpdates.zip</file>
|
||||||
<da:dcmin>2.28</da:dcmin>
|
<da:dcmin>2.28</da:dcmin>
|
||||||
<da:details>https://git.dotclear.watch/JcDenis/HideStoreUpdates/src/branch/master/README.md</da:details>
|
<da:details>https://git.dotclear.watch/JcDenis/HideStoreUpdates/src/branch/master/README.md</da:details>
|
||||||
<da:support>https://git.dotclear.watch/JcDenis/HideStoreUpdates/issues</da:support>
|
<da:support>https://git.dotclear.watch/JcDenis/HideStoreUpdates/issues</da:support>
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
<?php
|
|
||||||
// Language: Français
|
|
||||||
// Module: HideStoreUpdates - 0.1
|
|
||||||
// Date: 2023-11-14 21:04:22
|
|
||||||
// Author: , contact@jcdenis.fr
|
|
||||||
// Translated with Translater - 2023.11.04
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# DOT NOT MODIFY THIS FILE !
|
|
||||||
#
|
|
||||||
|
|
||||||
use Dotclear\Helper\L10n;
|
|
||||||
|
|
||||||
L10n::$locales['Module %s successfully hidden.'] = 'Module %s caché avec succès';
|
|
|
@ -1,22 +0,0 @@
|
||||||
# Language: Français
|
|
||||||
# Module: HideStoreUpdates - 0.1
|
|
||||||
# Date: 2023-11-14 21:04:22
|
|
||||||
# Author: , contact@jcdenis.fr
|
|
||||||
# Translated with translater 2023.11.04
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
msgstr ""
|
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
|
||||||
"Project-Id-Version: HideStoreUpdates 0.1\n"
|
|
||||||
"POT-Creation-Date: \n"
|
|
||||||
"PO-Revision-Date: 2023-11-14T21:04:22+00:00\n"
|
|
||||||
"Last-Translator: Jean-Christian Denis\n"
|
|
||||||
"Language-Team: \n"
|
|
||||||
"MIME-Version: 1.0\n"
|
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
|
||||||
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
|
||||||
|
|
||||||
#: src/BackendBehaviors.php:88
|
|
||||||
msgid "Module %s successfully hidden."
|
|
||||||
msgstr "Module %s caché avec succès"
|
|
||||||
|
|
|
@ -24,14 +24,6 @@ class BackendBehaviors
|
||||||
{
|
{
|
||||||
private static bool $cleared = false;
|
private static bool $cleared = false;
|
||||||
|
|
||||||
/**
|
|
||||||
* Add "Hide" button on modules list.
|
|
||||||
*
|
|
||||||
* @param ModulesList $list The modules list
|
|
||||||
* @param ModuleDefine $define The current module
|
|
||||||
*
|
|
||||||
* @return string The button or empty string
|
|
||||||
*/
|
|
||||||
public static function adminModulesListGetActionsV2(ModulesList $list, ModuleDefine $define): string
|
public static function adminModulesListGetActionsV2(ModulesList $list, ModuleDefine $define): string
|
||||||
{
|
{
|
||||||
return in_array($list->getList(), [
|
return in_array($list->getList(), [
|
||||||
|
@ -41,11 +33,7 @@ class BackendBehaviors
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hide selected module on modules list.
|
|
||||||
*
|
|
||||||
* @param ModulesList $list Th emodules list
|
|
||||||
* @param array<int, ModuleDefine> $defines The modules
|
* @param array<int, ModuleDefine> $defines The modules
|
||||||
* @param string $type The modules type (plugins or themes)
|
|
||||||
*/
|
*/
|
||||||
public static function adminModulesListDoActions(ModulesList $list, array $defines, string $type): void
|
public static function adminModulesListDoActions(ModulesList $list, array $defines, string $type): void
|
||||||
{
|
{
|
||||||
|
@ -56,61 +44,33 @@ class BackendBehaviors
|
||||||
}
|
}
|
||||||
|
|
||||||
$type = str_starts_with($type, 'theme') ? 'themes' : 'plugins';
|
$type = str_starts_with($type, 'theme') ? 'themes' : 'plugins';
|
||||||
$update = key($_POST[My::id()]);
|
$to_add = key($_POST[My::id()]);
|
||||||
$tmp = explode(' ', $update);
|
|
||||||
$module = $tmp[0];
|
|
||||||
|
|
||||||
$logs = self::getLogs($type);
|
$logs = self::getLogs($type);
|
||||||
if (!$logs->isEmpty()) {
|
if (!$logs->isEmpty()) {
|
||||||
$ids = [];
|
|
||||||
while ($logs->fetch()) {
|
while ($logs->fetch()) {
|
||||||
if ($update == $logs->f('log_msg')) {
|
if ($to_add == $logs->f('log_msg')) {
|
||||||
// Same module version allready hidden
|
// Allready hidden!
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (str_starts_with($logs->f('log_msg'), $module)) {
|
|
||||||
// Same module but older version
|
|
||||||
$ids[] = $logs->f('log_id');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!empty($ids)) {
|
if (!empty($to_add)) {
|
||||||
// Delete older versions
|
|
||||||
App::log()->deLogs($ids);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!empty($update)) {
|
|
||||||
// Add module version
|
|
||||||
$cur = App::log()->openLogCursor();
|
$cur = App::log()->openLogCursor();
|
||||||
$cur->setField('log_table', My::id() . '_' . $type);
|
$cur->setField('log_table', My::id() . '_' . $type);
|
||||||
$cur->setField('log_msg', $update);
|
$cur->setField('log_msg', $to_add);
|
||||||
App::log()->addLog($cur);
|
App::log()->addLog($cur);
|
||||||
|
|
||||||
Notices::AddSuccessNotice(sprintf(__('Module %s successfully hidden.'), $update));
|
Notices::AddSuccessNotice(__('Module successfully hidden.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hide modules from store update list.
|
|
||||||
*
|
|
||||||
* @param string $type The modules type (plugins or themes)
|
|
||||||
* @param ArrayObject<int, ModuleDefine> $defines The modules
|
* @param ArrayObject<int, ModuleDefine> $defines The modules
|
||||||
*/
|
*/
|
||||||
public static function afterCheckStoreUpdate(string $type, ArrayObject $defines): void
|
public static function afterCheckStoreUpdate(string $type, ArrayObject $defines): void
|
||||||
{
|
{
|
||||||
if (!self::$cleared && !empty($_GET['nocache'])) {
|
self::clearLogs($type);
|
||||||
// Clear (once) modules versions on manual check
|
|
||||||
$logs = self::getLogs($type);
|
|
||||||
if (!$logs->isEmpty()) {
|
|
||||||
$ids = [];
|
|
||||||
while ($logs->fetch()) {
|
|
||||||
$ids[] = (int) $logs->f('log_id');
|
|
||||||
}
|
|
||||||
App::log()->delLogs($ids);
|
|
||||||
self::$cleared = true;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$logs = self::getLogs($type);
|
$logs = self::getLogs($type);
|
||||||
if ($logs->isEmpty()) {
|
if ($logs->isEmpty()) {
|
||||||
|
@ -129,6 +89,21 @@ class BackendBehaviors
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static function clearLogs(string $type): void
|
||||||
|
{
|
||||||
|
if (!self::$cleared && !empty($_GET['nocache'])) {
|
||||||
|
$logs = self::getLogs($type);
|
||||||
|
if (!$logs->isEmpty()) {
|
||||||
|
$ids = [];
|
||||||
|
while ($logs->fetch()) {
|
||||||
|
$ids[] = (int) $logs->f('log_id');
|
||||||
|
}
|
||||||
|
App::log()->delLogs($ids);
|
||||||
|
}
|
||||||
|
self::$cleared = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static function getLogs(string $type): MetaRecord
|
private static function getLogs(string $type): MetaRecord
|
||||||
{
|
{
|
||||||
return App::log()->getLogs([
|
return App::log()->getLogs([
|
||||||
|
|
Loading…
Reference in New Issue