Skip to content

Commit ad748d5

Browse files
committed
Drop xml backup; check new versions from config
closes #7182
1 parent 7093bde commit ad748d5

File tree

12 files changed

+41
-809
lines changed

12 files changed

+41
-809
lines changed

front/backup.php

Lines changed: 0 additions & 700 deletions
This file was deleted.

front/config.form.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@
3333
include ('../inc/includes.php');
3434
Session::checkRight("config", READ);
3535

36+
if (isset($_GET['check_version'])) {
37+
Session::addMessageAfterRedirect(
38+
Toolbox::checkNewVersionAvailable()
39+
);
40+
Html::back();
41+
}
42+
3643
$config = new Config();
3744
$_POST['id'] = 1;
3845
if (!empty($_POST["update_auth"])) {

inc/config.class.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1779,6 +1779,9 @@ function showSystemInformations() {
17791779

17801780
echo "<table class='tab_cadre_fixe'>";
17811781
echo "<tr><th>". __('Information about system installation and configuration')."</th></tr>";
1782+
echo "<tr class='tab_bg_1'><td>";
1783+
echo "<a class='vsubmit' href='?check_version'>".__('Check if a new version is available')."</a>";
1784+
echo "</td></tr>";
17821785

17831786
$oldlang = $_SESSION['glpilanguage'];
17841787
// Keep this, for some function call which still use translation (ex showAllReplicateDelay)

inc/console/database/updatecommand.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ protected function execute(InputInterface $input, OutputInterface $output) {
170170
} else if ($force) {
171171
// Replay last update script even if there is no schema change.
172172
// It can be used in dev environment when update script has been updated/fixed.
173-
include_once(GLPI_ROOT . '/install/update_943_945.php');
174-
update943to945();
173+
include_once(GLPI_ROOT . '/install/update_945_946.php');
174+
update945to946();
175175

176176
$output->writeln('<info>' . __('Last migration replayed.') . '</info>');
177177
}

inc/crontask.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1654,7 +1654,7 @@ static function cronLogs($task) {
16541654
**/
16551655
static function cronCheckUpdate($task) {
16561656

1657-
$result = Toolbox::checkNewVersionAvailable(1);
1657+
$result = Toolbox::checkNewVersionAvailable();
16581658
$task->log($result);
16591659

16601660
return 1;

inc/html.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1414,7 +1414,7 @@ static function getMenuInfos() {
14141414

14151415
$menu['admin']['title'] = __('Administration');
14161416
$menu['admin']['types'] = ['User', 'Group', 'Entity', 'Rule',
1417-
'Profile', 'QueuedNotification', 'Backup', 'Glpi\\Event'];
1417+
'Profile', 'QueuedNotification', 'Glpi\\Event'];
14181418

14191419
$menu['config']['title'] = __('Setup');
14201420
$menu['config']['types'] = ['CommonDropdown', 'CommonDevice', 'Notification',

inc/profile.class.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,9 +1321,6 @@ function showFormAdmin($openform = true, $closeform = true) {
13211321
['itemtype' => 'QueuedNotification',
13221322
'label' => __('Notification queue'),
13231323
'field' => 'queuednotification'],
1324-
['itemtype' => 'Backup',
1325-
'label' => __('Maintenance'),
1326-
'field' => 'backup'],
13271324
['itemtype' => 'Log',
13281325
'label' => _n('Log', 'Logs', Session::getPluralNumber()),
13291326
'field' => 'logs']];

inc/toolbox.class.php

Lines changed: 5 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1407,25 +1407,11 @@ static function resizePicture($source_path, $dest_path, $new_width = 71, $new_he
14071407
/**
14081408
* Check if new version is available
14091409
*
1410-
* @param $auto boolean: check done autically ? (if not display result)
1411-
* (true by default)
1412-
* @param $messageafterredirect boolean: use message after redirect instead of display
1413-
* (false by default)
1414-
*
1415-
* @return string explaining the result
1410+
* @return string
14161411
**/
1417-
static function checkNewVersionAvailable($auto = true, $messageafterredirect = false) {
1412+
static function checkNewVersionAvailable() {
14181413
global $CFG_GLPI;
14191414

1420-
if (!$auto
1421-
&& !Session::haveRight('backup', Backup::CHECKUPDATE)) {
1422-
return false;
1423-
}
1424-
1425-
if (!$auto && !$messageafterredirect) {
1426-
echo "<br>";
1427-
}
1428-
14291415
//parse github releases (get last version number)
14301416
$error = "";
14311417
$json_gh_releases = self::getURLContent("https://api.github.com/repos/glpi-project/glpi/releases", $error);
@@ -1440,56 +1426,13 @@ static function checkNewVersionAvailable($auto = true, $messageafterredirect = f
14401426
$latest_version = array_pop($released_tags);
14411427

14421428
if (strlen(trim($latest_version)) == 0) {
1443-
if (!$auto) {
1444-
if ($messageafterredirect) {
1445-
Session::addMessageAfterRedirect($error, true, ERROR);
1446-
} else {
1447-
echo "<div class='center'>$error</div>";
1448-
}
1449-
} else {
1450-
return $error;
1451-
}
1452-
1429+
return $error;
14531430
} else {
14541431
if (version_compare($CFG_GLPI["version"], $latest_version, '<')) {
14551432
Config::setConfigurationValues('core', ['founded_new_version' => $latest_version]);
1456-
1457-
if (!$auto) {
1458-
if ($messageafterredirect) {
1459-
Session::addMessageAfterRedirect(sprintf(__('A new version is available: %s.'),
1460-
$latest_version));
1461-
Session::addMessageAfterRedirect(__('You will find it on the GLPI-PROJECT.org site.'));
1462-
} else {
1463-
echo "<div class='center'>".sprintf(__('A new version is available: %s.'),
1464-
$latest_version)."</div>";
1465-
echo "<div class='center'>".__('You will find it on the GLPI-PROJECT.org site.').
1466-
"</div>";
1467-
}
1468-
1469-
} else {
1470-
if ($messageafterredirect) {
1471-
Session::addMessageAfterRedirect(sprintf(__('A new version is available: %s.'),
1472-
$latest_version));
1473-
} else {
1474-
return sprintf(__('A new version is available: %s.'), $latest_version);
1475-
}
1476-
}
1477-
1433+
return sprintf(__('A new version is available: %s.'), $latest_version);
14781434
} else {
1479-
if (!$auto) {
1480-
if ($messageafterredirect) {
1481-
Session::addMessageAfterRedirect(__('You have the latest available version'));
1482-
} else {
1483-
echo "<div class='center'>".__('You have the latest available version')."</div>";
1484-
}
1485-
1486-
} else {
1487-
if ($messageafterredirect) {
1488-
Session::addMessageAfterRedirect(__('You have the latest available version'));
1489-
} else {
1490-
return __('You have the latest available version');
1491-
}
1492-
}
1435+
return __('You have the latest available version');
14931436
}
14941437
}
14951438
return 1;

inc/update.class.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,10 @@ public function doUpdates($current_version = null) {
458458
case "9.4.4":
459459
include_once "{$updir}update_943_945.php";
460460
update943to945();
461+
462+
case "9.4.5":
463+
include_once "{$updir}update_945_946.php";
464+
update945to946();
461465
break;
462466

463467
case GLPI_VERSION:

install/update_084_085.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,7 @@ function update084to085() {
893893
"`name` = 'check_update' AND `rights` = '1'") as $profrights) {
894894

895895
$query = "UPDATE `glpi_profilerights`
896-
SET `rights` = `rights` | " . Backup::CHECKUPDATE ."
896+
SET `rights` = `rights` | " . 1024 /*Backup::CHECKUPDATE*/ ."
897897
WHERE `profiles_id` = '".$profrights['profiles_id']."'
898898
AND `name` = 'backup'";
899899
$DB->queryOrDie($query, "0.85 update backup with check_update");

0 commit comments

Comments
 (0)