diff --git a/.github/workflows/close_stale_issue.yml b/.github/workflows/close_stale_issue.yml index 924a2bc..b0f952b 100644 --- a/.github/workflows/close_stale_issue.yml +++ b/.github/workflows/close_stale_issue.yml @@ -10,7 +10,7 @@ jobs: issues: write # for actions/stale to close stale issues runs-on: ubuntu-latest steps: - - uses: actions/stale@v10 + - uses: actions/stale@v11 with: stale-issue-message: >- There has been no activity on this issue for some time and therefore it is considered stale diff --git a/inc/tagitem.class.php b/inc/tagitem.class.php index 743d5ff..f06709c 100644 --- a/inc/tagitem.class.php +++ b/inc/tagitem.class.php @@ -475,14 +475,7 @@ public static function updateItem(CommonDBTM $item, bool $delete_existing_tags = if ( $item->getID() && !isset($item->input["_plugin_tag_tag_process_form"]) - && !( - // Always trigger on newly created tickets, as they may come from - // the mail collector which wont set the _plugin_tag_tag_process_form - // flag - $item::getType() == Ticket::getType() - // Allow a few seconds difference if glpi_currenttime changed - && abs(strtotime((string) $item->fields['date_creation']) - strtotime((string) $_SESSION['glpi_currenttime'])) < 5 - ) + && ($item::getType() != Ticket::getType() || abs(strtotime((string) $item->fields['date_creation']) - strtotime((string) $_SESSION['glpi_currenttime'])) >= 5) ) { return true; } diff --git a/rector.php b/rector.php index b738e1d..54d3dc1 100644 --- a/rector.php +++ b/rector.php @@ -28,31 +28,28 @@ * ------------------------------------------------------------------------- */ +use Rector\Configuration\RectorConfigBuilder; + require_once __DIR__ . '/../../src/Plugin.php'; -use Rector\Caching\ValueObject\Storage\FileCacheStorage; -use Rector\Config\RectorConfig; -use Rector\ValueObject\PhpVersion; +$baseline_file = __DIR__ . '/../../PluginsRector.php'; +if (!file_exists($baseline_file)) { + throw new RuntimeException( + sprintf( + 'Unable to find "%s". Running rector on a plugin requires a GLPI development checkout that ships PluginsRector.php.', + $baseline_file, + ), + ); +} + +$baseline = require $baseline_file; + +/** @var RectorConfigBuilder $config */ +$config = $baseline([ + __DIR__ . '/ajax', + __DIR__ . '/inc', + __DIR__ . '/stubs', + __DIR__ . '/tests', +]); -return RectorConfig::configure() - ->withPaths([ - __DIR__ . '/ajax', - __DIR__ . '/inc', - __DIR__ . '/stubs', - __DIR__ . '/tests', - ]) - ->withPhpVersion(PhpVersion::PHP_82) - ->withCache( - cacheDirectory: __DIR__ . '/var/rector', - cacheClass: FileCacheStorage::class, - ) - ->withRootFiles() - ->withParallel(timeoutSeconds: 300) - ->withImportNames(removeUnusedImports: true) - ->withPreparedSets( - deadCode: true, - codeQuality: true, - codingStyle: true, - ) - ->withPhpSets(php82: true) // apply PHP sets up to PHP 8.2 -; +return $config;