Commit 856be249 authored by Cédric Anne's avatar Cédric Anne Committed by Johan Cwiklinski
Browse files

Drop deprecated methods

parent b58a24d2
......@@ -20,6 +20,73 @@ The present file will list all changes made to the project; according to the
#### Removed
- `Update::declareOldItems()`
- Usage of `$order` parameter in `getAllDataFromTable()` (`DbUtils::getAllDataFromTable()`)
- `$LOADED_PLUGINS` global variable
- `Computer_SoftwareLicense` class
- `Computer_SoftwareVersion` class
- `getAllDatasFromTable()`
- `getRealQueryForTreeItem()`
- `DBMysql::affected_rows()`
- `DBMysql::data_seek()`
- `DBMysql::fetch_array()`
- `DBMysql::fetch_assoc()`
- `DBMysql::fetch_object()`
- `DBMysql::fetch_row()`
- `DBMysql::field_name()`
- `DBMysql::free_result()`
- `DBMysql::insert_id()`
- `DBMysql::isMySQLStrictMode()`
- `DBMysql::list_fields()`
- `DBMysql::num_fields()`
- `DbUtils::getRealQueryForTreeItem()`
- `Calendar_Holiday::cloneCalendar()`
- `CalendarSegment::cloneCalendar()`
- `Change::getCommonLeftJoin()`
- `Change::getCommonSelect()`
- `CommonDBTM::getRawName()`
- `Computer_Item::cloneComputer()`
- `Computer_Item::cloneItem()`
- `ComputerAntivirus::cloneComputer()`
- `Config::checkWriteAccessToDirs()`
- `Config::displayCheckExtensions()`
- `Contract::cloneItem()`
- `ContractCost::cloneContract()`
- `Contract_Item::cloneItem()`
- `Document_Item::cloneItem()`
- `Html::jsDisable()`
- `Html::jsEnable()`
- `Infocom::cloneItem()`
- `Itil_Project::cloneItilProject()`
- `Item_Devices::cloneItem()`
- `Item_Disk::cloneItem()`
- `Item_OperatingSystem::cloneItem()`
- `Item_SoftwareLicense::cloneComputer()`
- `Item_SoftwareLicense::cloneItem()`
- `Item_SoftwareVersion::cloneComputer()`
- `Item_SoftwareVersion::cloneItem()`
- `Item_SoftwareVersion::showForComputer()`
- `Item_SoftwareVersion::updateDatasForComputer()`
- `KnowbaseItem_Item::cloneItem()`
- `NetworkPort::cloneItem()`
- `Notepad::cloneItem()`
- `Plugin::setLoaded()`
- `Plugin::setUnloaded()`
- `Plugin::setUnloadedByName()`
- `Problem::getCommonLeftJoin()`
- `Problem::getCommonSelect()`
- `ProjectCost::cloneProject()`
- `ProjectTeam::cloneProjectTask()`
- `ProjectTask::cloneProjectTeam()`
- `Ticket::getCommonLeftJoin()`
- `Ticket::getCommonSelect()`
- `Ticket::getTicketTemplateToUse()`
- `TicketTemplate::getFromDBWithDatas()`
- `Toolbox::canUseImapPop()`
- `Toolbox::checkSELinux()`
- `Toolbox::userErrorHandlerDebug()`
- `Toolbox::userErrorHandlerNormal()`
- `Transfer::transferComputerSoftwares()`
## [9.5.1] unreleased
## [9.5.0] 2020-07-07
......@@ -142,7 +209,7 @@ The present file will list all changes made to the project; according to the
- `ProjectTeam::cloneProjectTask()`
- `ProjectTask::cloneProjectTeam()`
- Usage of `GLPIKEY` constant
- `Toolbox::encrypt()` and `Toolbox::decrypt()` because they use the old encryption aglogithm
- `Toolbox::encrypt()` and `Toolbox::decrypt()` because they use the old encryption algorithm
#### Removed
......
......@@ -276,14 +276,6 @@ function glpi_autoload($classname) {
$dir = GLPI_ROOT . "/inc/";
// Deprecation warn for Computer_Software* classes
if ($classname === 'Computer_SoftwareLicense') {
Toolbox::deprecated('Computer_SoftwareLicense has been replaced by Item_SoftwareLicense.');
}
if ($classname === 'Computer_SoftwareVersion') {
Toolbox::deprecated('Computer_SoftwareVersion has been replaced by Item_SoftwareVersion.');
}
if ($plug = isPluginItemType($classname)) {
$plugname = strtolower($plug['plugin']);
......
......@@ -181,37 +181,6 @@ class Calendar_Holiday extends CommonDBRelation {
echo "</div>";
}
/**
* Duplicate all holidays from a calendar to its clone
*
* @deprecated 9.5
*
* @param integer $oldid The ID of the calendar to copy from.
* @param integer $newid The ID of the calendar to copy to.
**/
static function cloneCalendar($oldid, $newid) {
global $DB;
Toolbox::deprecated('Use clone');
$result = $DB->request(
[
'FROM' => self::getTable(),
'WHERE' => [
'calendars_id' => $oldid,
]
]
);
foreach ($result as $data) {
$ch = new self();
unset($data['id']);
$data['calendars_id'] = $newid;
$data['_no_history'] = true;
$ch->add($data);
}
}
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) {
......
......@@ -75,38 +75,6 @@ class CalendarSegment extends CommonDBChild {
return parent::prepareInputForAdd($input);
}
/**
* Duplicate all segments from a calendar to his clone
*
* @deprecated 9.5
*
* @param $oldid
* @param $newid
**/
static function cloneCalendar($oldid, $newid) {
global $DB;
Toolbox::deprecated('Use clone');
$result = $DB->request(
[
'FROM' => self::getTable(),
'WHERE' => [
'calendars_id' => $oldid,
]
]
);
foreach ($result as $data) {
$c = new self();
unset($data['id']);
$data['calendars_id'] = $newid;
$data['_no_history'] = true;
$c->add($data);
}
}
function post_addItem() {
// Update calendar cache
......
......@@ -1290,44 +1290,6 @@ class Change extends CommonITILObject {
return $values;
}
/**
* @deprecated 9.5.0
*/
static function getCommonSelect() {
Toolbox::deprecated('Use getCommonCriteria with db iterator');
$SELECT = "";
if (count($_SESSION["glpiactiveentities"])>1) {
$SELECT .= ", `glpi_entities`.`completename` AS entityname,
`glpi_changes`.`entities_id` AS entityID ";
}
return " DISTINCT `glpi_changes`.*,
`glpi_itilcategories`.`completename` AS catname
$SELECT";
}
/**
* @deprecated 9.5.0
*/
static function getCommonLeftJoin() {
Toolbox::deprecated('Use getCommonCriteria with db iterator');
$FROM = "";
if (count($_SESSION["glpiactiveentities"])>1) {
$FROM .= " LEFT JOIN `glpi_entities`
ON (`glpi_entities`.`id` = `glpi_changes`.`entities_id`) ";
}
return " LEFT JOIN `glpi_changes_groups`
ON (`glpi_changes`.`id` = `glpi_changes_groups`.`changes_id`)
LEFT JOIN `glpi_changes_users`
ON (`glpi_changes`.`id` = `glpi_changes_users`.`changes_id`)
LEFT JOIN `glpi_changes_suppliers`
ON (`glpi_changes`.`id` = `glpi_changes_suppliers`.`changes_id`)
LEFT JOIN `glpi_itilcategories`
ON (`glpi_changes`.`itilcategories_id` = `glpi_itilcategories`.`id`)
$FROM";
}
/**
* Display changes for an item
*
......
......@@ -3444,23 +3444,6 @@ class CommonDBTM extends CommonGLPI {
}
/**
* Get raw name of the object
* Maybe overloaded
*
* @deprecated 9.5
* @see CommonDBTM::getNameField
* @since 0.85
*
* @return string
**/
function getRawName() {
\Toolbox::deprecated('Use CommonDBTM::getFriendlyName()');
return $this->getFriendlyName();
}
/** Get raw completename of the object
* Maybe overloaded
*
......
......@@ -743,64 +743,6 @@ class Computer_Item extends CommonDBRelation{
}
/**
* Duplicate connected items to computer from an item template to its clone
*
* @deprecated 9.5
* @since 0.84
*
* @param integer $oldid ID of the item to clone
* @param integer $newid ID of the item cloned
**/
static function cloneComputer($oldid, $newid) {
global $DB;
Toolbox::deprecated('Use clone');
$iterator = $DB->request([
'FROM' => self::getTable(),
'WHERE' => ['computers_id' => $oldid]
]);
while ($data = $iterator->next()) {
$conn = new Computer_Item();
$conn->add(['computers_id' => $newid,
'itemtype' => $data["itemtype"],
'items_id' => $data["items_id"]]);
}
}
/**
* Duplicate connected items to item from an item template to its clone
*
* @deprecated 9.5
* @since 0.83.3
*
* @param string $itemtype type of the item to clone
* @param integer $oldid ID of the item to clone
* @param integer $newid ID of the item cloned
**/
static function cloneItem($itemtype, $oldid, $newid) {
global $DB;
Toolbox::deprecated('Use clone');
$iterator = $DB->request([
'FROM' => self::getTable(),
'WHERE' => [
'itemtype' => $itemtype,
'items_id' => $oldid
]
]);
while ($data = $iterator->next()) {
$conn = new self();
$conn->add(['computers_id' => $data["computers_id"],
'itemtype' => $data["itemtype"],
'items_id' => $newid]);
}
}
/**
* @since 9.1.7
*
......
<?php
/**
* ---------------------------------------------------------------------
* GLPI - Gestionnaire Libre de Parc Informatique
* Copyright (C) 2015-2020 Teclib' and contributors.
*
* http://glpi-project.org
*
* based on GLPI - Gestionnaire Libre de Parc Informatique
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
*
* ---------------------------------------------------------------------
*
* LICENSE
*
* This file is part of GLPI.
*
* GLPI 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 2 of the License, or
* (at your option) any later version.
*
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
* ---------------------------------------------------------------------
*/
if (!defined('GLPI_ROOT')) {
die("Sorry. You can't access this file directly");
}
/**
* Manage link beetween computer and software licenses.
* @deprecated 9.5.0 Use Item_SoftwareLicense
*/
class Computer_SoftwareLicense extends Item_SoftwareLicense {
static function getTable($classname = null) {
return Item_SoftwareLicense::getTable();
}
public function prepareInputForAdd($input) {
//Copy input to match new format
$input['itemtype'] = 'Computer';
if (isset($input['computers_id'])) {
$input['items_id'] = $input['computers_id'];
}
parent::prepareInputForAdd($input);
}
public function prepareInputForUpdate($input) {
//Copy input to match new format
$input['itemtype'] = 'Computer';
if (isset($input['computers_id'])) {
$input['items_id'] = $input['computers_id'];
}
parent::prepareInputForUpdate($input);
}
public function post_getFromDB() {
//Copy fields to match new format
$this->fields['itemtype'] = 'Computer';
$this->fields['computers_id'] = $this->fields['items_id'];
parent::post_getFromDB();
}
}
<?php
/**
* ---------------------------------------------------------------------
* GLPI - Gestionnaire Libre de Parc Informatique
* Copyright (C) 2015-2020 Teclib' and contributors.
*
* http://glpi-project.org
*
* based on GLPI - Gestionnaire Libre de Parc Informatique
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
*
* ---------------------------------------------------------------------
*
* LICENSE
*
* This file is part of GLPI.
*
* GLPI 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 2 of the License, or
* (at your option) any later version.
*
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
* ---------------------------------------------------------------------
*/
if (!defined('GLPI_ROOT')) {
die("Sorry. You can't access this file directly");
}
/**
* @deprecated 9.5.0 Use Item_SoftwareVersion
*/
class Computer_SoftwareVersion extends Item_SoftwareVersion {
static function getTable($classname = null) {
return Item_SoftwareVersion::getTable();
}
public function prepareInputForAdd($input) {
//Copy input to match new format
$input['itemtype'] = 'Computer';
if (isset($input['computers_id'])) {
$input['items_id'] = $input['computers_id'];
}
parent::prepareInputForAdd($input);
}
public function prepareInputForUpdate($input) {
//Copy input to match new format
$input['itemtype'] = 'Computer';
if (isset($input['computers_id'])) {
$input['items_id'] = $input['computers_id'];
}
parent::prepareInputForUpdate($input);
}
public function post_getFromDB() {
//Copy fields to match new format
$this->fields['itemtype'] = 'Computer';
$this->fields['computers_id'] = $this->fields['items_id'];
parent::post_getFromDB();
}
}
......@@ -84,34 +84,6 @@ class ComputerAntivirus extends CommonDBChild {
return $ong;
}
/**
* Duplicate all antirivuses from a computer template to his clone
*
* @deprecated 9.5
*
* @param $oldid
* @param $newid
**/
static function cloneComputer($oldid, $newid) {
global $DB;
Toolbox::deprecated('Use clone');
$result = $DB->request(
[
'FROM' => ComputerAntivirus::getTable(),
'WHERE' => ['computers_id' => $oldid],
]
);
foreach ($result as $data) {
$antirivus = new self();
unset($data['id']);
$data['computers_id'] = $newid;
$data = Toolbox::addslashes_deep($data);
$antirivus->add($data);
}
}
function rawSearchOptions() {
$tab = [];
......
......@@ -2401,61 +2401,6 @@ class Config extends CommonDBTM {
return $error;
}
/**
* Display extensions checks report
*
* @since 9.2
*
* @param boolean $fordebug display for debug (no html required) (false by default)
*
* @return integer 2: missing extension, 1: missing optionnal extension, 0: OK,
*
* @deprecated 9.5.0
**/
static function displayCheckExtensions($fordebug = false) {
Toolbox::deprecated();
global $CFG_GLPI;
$report = self::checkExtensions();
foreach ($report['good'] as $ext => $msg) {
if (!$fordebug) {
echo "<tr class=\"tab_bg_1\"><td class=\"left b\">" . sprintf(__('%s extension test'), $ext) . "</td>";
echo "<td><img src=\"{$CFG_GLPI['root_doc']}/pics/ok_min.png\"
alt=\"$msg\"
title=\"$msg\"></td>";
echo "</tr>";
} else {
echo "<img src=\"{$CFG_GLPI['root_doc']}/pics/ok_min.png\"
alt=\"\">$msg\n";
}
}
foreach ($report['may'] as $ext => $msg) {
if (!$fordebug) {
echo "<tr class=\"tab_bg_1\"><td class=\"left b\">" . sprintf(__('%s extension test'), $ext) . "</td>";
echo "<td><img src=\"{$CFG_GLPI['root_doc']}/pics/warning_min.png\"> " . $msg . "</td>";
echo "</tr>";
} else {
echo "<img src=\"{$CFG_GLPI['root_doc']}/pics/warning_min.png\">" . $msg . "\n";
}
}
foreach ($report['missing'] as $ext => $msg) {
if (!$fordebug) {
echo "<tr class=\"tab_bg_1\"><td class=\"left b\">" . sprintf(__('%s extension test'), $ext) . "</td>";
echo "<td class=\"red\"><img src=\"{$CFG_GLPI['root_doc']}/pics/ko_min.png\"> " . $msg . "</td>";
echo "</tr>";
} else {
echo "<img src=\"{$CFG_GLPI['root_doc']}/pics/ko_min.png\">" . $msg . "\n";
}
}
return $report['error'];
}
/**
* Check for needed extensions
......@@ -2623,213 +2568,6 @@ class Config extends CommonDBTM {
}
/**
* Get data directories for checks
*
* @return array
*
* @deprecated 9.5.0
*/
private static function getDataDirectories() {
Toolbox::deprecated();
$dir_to_check = [
GLPI_CONFIG_DIR => __('Checking write permissions for setting files'),
GLPI_DOC_DIR => __('Checking write permissions for document files'),
GLPI_DUMP_DIR => __('Checking write permissions for dump files'),
GLPI_SESSION_DIR => __('Checking write permissions for session files'),
GLPI_CRON_DIR => __('Checking write permissions for automatic actions files'),
GLPI_GRAPH_DIR => __('Checking write permissions for graphic files'),
GLPI_LOCK_DIR => __('Checking write permissions for lock files'),
GLPI_PLUGIN_DOC_DIR => __('Checking write permissions for plugins document files'),
GLPI_TMP_DIR => __('Checking write permissions for temporary files'),
GLPI_CACHE_DIR => __('Checking write permissions for cache files'),
GLPI_RSS_DIR => __('Checking write permissions for rss files'),
GLPI_UPLOAD_DIR => __('Checking write permissions for upload files'),
GLPI_PICTURE_DIR => __('Checking write permissions for pictures files')
];
return $dir_to_check;
}
/**
* Check Write Access to needed directories
*
* @param boolean $fordebug display for debug (no html, no gettext required) (false by default)
*
* @return integer 2 : creation error 1 : delete error 0: OK
*
* @deprecated 9.5.0
**/
static function checkWriteAccessToDirs($fordebug = false) {
Toolbox::deprecated();
global $CFG_GLPI;
// Only write test for GLPI_LOG as SElinux prevent removing log file.
if (!$fordebug) {
echo "<tr class='tab_bg_1'><td class='b left'>".
__('Checking write permissions for log files')."</td>";
}
$can_write_logs = false;
try {
global $PHPLOGGER;
$PHPLOGGER->addRecord(Monolog\Logger::WARNING, "Test logger");
$can_write_logs = true;
} catch (\UnexpectedValueException $e) {
$catched = true;
//empty catch
}
if ($can_write_logs) {
if ($fordebug) {
echo "<img src='".$CFG_GLPI['root_doc']."/pics/ok_min.png' alt=\"".__s('OK')."\">".