Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to update this plugin #6

Closed
Windayz opened this issue Apr 16, 2024 · 5 comments
Closed

How to update this plugin #6

Windayz opened this issue Apr 16, 2024 · 5 comments

Comments

@Windayz
Copy link

Windayz commented Apr 16, 2024

Hello,

I've downloaded the new release, deleted the old plugin folder and added the new one, but GLPI doesn't suggest that I update.
What should I do?

Thanks

@Windayz
Copy link
Author

Windayz commented Apr 16, 2024

You forgot to modify setup.php with the correct version number:

<?php

define('PLUGIN_TRADEMARK_VERSION', '1.4.0');

// Minimal GLPI version, inclusive
define("PLUGIN_TRADEMARK_MIN_GLPI_VERSION", "10.0.0");

// Maximum GLPI version, exclusive
define("PLUGIN_TRADEMARK_MAX_GLPI_VERSION", "10.1.0");


$folder = basename(dirname(__FILE__));

if ($folder !== "trademark") {
   $msg = sprintf("Please, rename the plugin folder \"%s\" to \"trademark\"", $folder);
   Session::addMessageAfterRedirect($msg, true, ERROR);
}

// Init the hooks of the plugins -Needed
function plugin_init_trademark() {
   global $PLUGIN_HOOKS, $CFG_GLPI;
   $PLUGIN_HOOKS['csrf_compliant']['trademark'] = true;

   Plugin::registerClass('PluginTrademarkConfig', ['addtabon' => 'Config']);
   $PLUGIN_HOOKS['config_page']['trademark'] = 'front/config.form.php';

   $plugin = new Plugin();

   if ($plugin->isInstalled('trademark') && $plugin->isActivated('trademark')) {

      $autoload = __DIR__ . '/vendor/autoload.php';
      if (file_exists($autoload)) {
         include_once $autoload;
      };

      Plugin::registerClass('PluginTrademarkConfig', [
         'addtabon' => ['Config']
      ]);

      $PLUGIN_HOOKS['display_login']['trademark'] = "plugin_trademark_display_login";

      // Tip Trick to add version in css output
      $PLUGIN_HOOKS["add_css"]['trademark'] = new PluginTrademarkFileVersion('front/internal.css.php');
      $PLUGIN_HOOKS["add_javascript"]['trademark'] = new PluginTrademarkFileVersion('front/internal.js.php');

      $CFG_GLPI['javascript']['config']['config'][] = 'codemirror';
      $CFG_GLPI['javascript']['config']['config'][] = 'tinymce';
   }
}

// Get the name and the version of the plugin - Needed
function plugin_version_trademark() {
   return [
      'name'           => t_trademark('Trademark'),
      'version'        => PLUGIN_TRADEMARK_VERSION,
      'author'         => '<a href="https://librecode.coop/">LibreCode</a>, <a href="https://github.com/edgardmessias">Edgard</a>',
      'homepage'       => 'https://github.com/librecodecoop/trademark',
      'license'        => 'GPL v2+',
      'minGlpiVersion' => PLUGIN_TRADEMARK_MIN_GLPI_VERSION,
      'requirements'   => [
         'glpi' => [
            'min' => PLUGIN_TRADEMARK_MIN_GLPI_VERSION,
            'max' => PLUGIN_TRADEMARK_MAX_GLPI_VERSION,
         ]
      ]
   ];
}

// Optional : check prerequisites before install : may print errors or add to message after redirect
function plugin_trademark_check_prerequisites() {
   if (version_compare(GLPI_VERSION, PLUGIN_TRADEMARK_MIN_GLPI_VERSION, 'lt')) {
      echo "This plugin requires GLPI >= " . PLUGIN_TRADEMARK_MIN_GLPI_VERSION;
      return false;
   } else {
      return true;
   }
}

function plugin_trademark_check_config() {
   return true;
}

function t_trademark($str) {
   return __($str, 'trademark');
}

@vitormattos vitormattos mentioned this issue Apr 16, 2024
@vitormattos
Copy link
Member

vitormattos commented Apr 16, 2024

Thanks by your report!

@vitormattos
Copy link
Member

@Windayz could you check if the new release is ok?

@Windayz
Copy link
Author

Windayz commented Apr 16, 2024

Yes, everything is ok, thank you :)

@vitormattos
Copy link
Member

If you liked this app and others solutions of LibreCode, like LibreSign, fell free to help us to maintain this and other open source softwares making a pontual or recurrent funding here:
https://github.com/sponsors/LibreSign
We centralized all sponsors at LibreSign project because is our main product now and we wish to have the enouth to be possible dedicate more time to open source projects and help other software engineers.
You also can help us making more tests, sending issues, giving stars at this repository and at LibreSign repository, announcing the LibreSign app and by a lot of other ways.
Very happy by your contribution!
Thanks a lot again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants