Repository navigation
update 12.0/bugfixes branch #378
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| <?php | ||
|
|
||
| /** | ||
| * ------------------------------------------------------------------------- | ||
| * Carbon plugin for GLPI | ||
| * | ||
| * @copyright Copyright (C) 2024-2025 Teclib' and contributors. | ||
| * @license https://www.gnu.org/licenses/gpl-3.0.txt GPLv3+ | ||
| * @link https://github.com/pluginsGLPI/carbon | ||
| * | ||
| * ------------------------------------------------------------------------- | ||
| * | ||
| * LICENSE | ||
| * | ||
| * This file is part of Carbon plugin for GLPI. | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License as published by | ||
| * the Free Software Foundation, either version 3 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
| * | ||
| * ------------------------------------------------------------------------- | ||
| */ | ||
|
|
||
| use Safe\Exceptions\FilesystemException; | ||
|
|
||
| use function Safe\preg_match; | ||
| use function Safe\scandir; | ||
|
|
||
| function update140to141(Migration $migration) | ||
| { | ||
| /** @var DBmysql $DB */ | ||
| global $DB; | ||
|
|
||
| $updateresult = true; | ||
| $from_version = '1.4.0'; | ||
| $to_version = '1.4.1'; | ||
| $update_dir = __DIR__ . "/update_{$from_version}_to_{$to_version}/"; | ||
|
|
||
| //TRANS: %s is the number of new version | ||
| $migration->addInfoMessage(sprintf(__('Update to %s'), $to_version)); | ||
| $migration->setVersion($to_version); | ||
|
|
||
| // New tables from enpty.sql file after the migration | ||
| // If a script requires a new table, it may create it by itself | ||
|
|
||
| $update_scripts = scandir($update_dir); | ||
| natcasesort($update_scripts); | ||
| foreach ($update_scripts as $update_script) { | ||
| if (preg_match('/\.php$/', $update_script) !== 1) { | ||
| continue; | ||
| } | ||
| require $update_dir . $update_script; | ||
| } | ||
|
|
||
| $dbFile = plugin_carbon_getSchemaPath($to_version); | ||
| if ($dbFile === null) { | ||
| $migration->addWarningMessage("Error creating tables : " . $DB->error()); | ||
| $updateresult = false; | ||
| } | ||
| try { | ||
| $DB->runFile($dbFile); | ||
| } catch (RuntimeException|FilesystemException $e) { | ||
| $migration->addWarningMessage("Error creating tables : " . $e->getMessage()); | ||
| $updateresult = false; | ||
| } | ||
|
|
||
|
|
||
| // ************ Keep it at the end ************** | ||
| $migration->executeMigration(); | ||
|
|
||
| return $updateresult; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| <?php | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file has actually NOT been renamed. This is a false positive from renaming detection feature. |
||
|
|
||
| /** | ||
| * ------------------------------------------------------------------------- | ||
| * Carbon plugin for GLPI | ||
|
|
@@ -28,5 +30,28 @@ | |
| * ------------------------------------------------------------------------- | ||
| */ | ||
|
|
||
| import ApexCharts from "apexcharts"; | ||
| window.ApexCharts = ApexCharts; | ||
| use Glpi\Dashboard\Item as DashboardItem; | ||
|
|
||
| use function Safe\json_decode; | ||
| use function Safe\json_encode; | ||
|
|
||
| /** @var DBmysql $DB */ | ||
| /** @var Migration $migration */ | ||
|
|
||
| $dashboard_item = new DashboardItem(); | ||
| $rows = $dashboard_item->find([ | ||
| 'card_id' => 'plugin_carbon_assets_completeness_ratio', | ||
| ]); | ||
|
|
||
| foreach ($rows as $row) { | ||
| $card_options = json_decode($row['card_options'], true); | ||
| if (!is_array($card_options) || ($card_options['widgettype'] ?? null) !== 'apex_radar') { | ||
| continue; | ||
| } | ||
|
|
||
| $card_options['widgettype'] = 'radar'; | ||
| $dashboard_item->update([ | ||
| 'id' => $row['id'], | ||
| 'card_options' => json_encode($card_options), | ||
| ]); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file has actually NOT been renamed. This is a false positive from renaming detection feature.