本文整理汇总了PHP中Plugin::getFromDBbyDir方法的典型用法代码示例。如果您正苦于以下问题:PHP Plugin::getFromDBbyDir方法的具体用法?PHP Plugin::getFromDBbyDir怎么用?PHP Plugin::getFromDBbyDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plugin
的用法示例。
在下文中一共展示了Plugin::getFromDBbyDir方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: plugin_fields_install
function plugin_fields_install()
{
global $CFG_GLPI;
set_time_limit(900);
ini_set('memory_limit', '2048M');
$plugin_fields = new Plugin();
$plugin_fields->getFromDBbyDir('fields');
$version = $plugin_fields->fields['version'];
$classesToInstall = array('PluginFieldsDropdown', 'PluginFieldsField', 'PluginFieldsContainer', 'PluginFieldsContainer_Field', 'PluginFieldsValue', 'PluginFieldsProfile', 'PluginFieldsMigration');
$migration = new Migration($version);
echo "<center>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th>" . __("MySQL tables installation", "fields") . "<th></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td align='center'>";
foreach ($classesToInstall as $class) {
if ($plug = isPluginItemType($class)) {
$dir = GLPI_ROOT . "/plugins/fields/inc/";
$item = strtolower($plug['class']);
if (file_exists("{$dir}{$item}.class.php")) {
include_once "{$dir}{$item}.class.php";
if (!call_user_func(array($class, 'install'), $migration, $version)) {
return false;
}
}
}
}
echo "</td>";
echo "</tr>";
echo "</table></center>";
return true;
}
示例2: getItemtypes
/**
* Return all injectable types
*
* @param $only_primary return only primary types (false by default)
*
* @return an array which contains array(itemtype => itemtype name)
**/
static function getItemtypes($only_primary = false)
{
global $INJECTABLE_TYPES;
getTypesToInject();
$plugin = new Plugin();
$values = array();
foreach ($INJECTABLE_TYPES as $type => $from) {
$injectionclass = new $type();
if (class_exists($type) && (!$only_primary || $only_primary && $injectionclass->isPrimaryType())) {
$instance = new $type();
//If user has no right to create an object of this type, do not display type in the list
if (!$instance->canCreate()) {
continue;
}
$typename = get_parent_class($type);
$name = '';
if ($from != 'datainjection') {
$plugin->getFromDBbyDir($from);
$name = $plugin->getName() . ': ';
}
$name .= call_user_func(array($type, 'getTypeName'));
$values[$typename] = $name;
}
}
asort($values);
return $values;
}
示例3: methodTest
static function methodTest($params, $protocol)
{
global $PLUGIN_HOOKS;
if (isset($params['help'])) {
return array('help' => 'bool,optional');
}
$resp = array('glpi' => GLPI_VERSION);
$plugin = new Plugin();
foreach ($PLUGIN_HOOKS['webservices'] as $name => $fct) {
if ($plugin->getFromDBbyDir($name)) {
$resp[$name] = $plugin->fields['version'];
}
}
return $resp;
}
示例4: PluginSccmSccmxml
function PluginSccmSccmxml($data)
{
$plug = new Plugin();
$plug->getFromDBbyDir("sccm");
$this->data = $data;
$this->device_id = $data['CSD-MachineID'];
$this->agentbuildnumber = "SCCM-v" . $plug->fields['version'];
$SXML = <<<XML
<?xml version='1.0' encoding='UTF-8'?>
<REQUEST>
<CONTENT>
<VERSIONCLIENT>{$this->agentbuildnumber}</VERSIONCLIENT>
</CONTENT>
<DEVICEID>{$this->device_id}</DEVICEID>
<TOKEN>SOC_{$this->device_id}</TOKEN>
<QUERY>INVENTORY</QUERY>
<PROLOG></PROLOG>
</REQUEST>
XML;
$this->sxml = new SimpleXMLElement($SXML);
}
示例5:
$migration->displayWarning("***** Install process of plugin TIMELINETICKET *****");
} else {
$migration->displayWarning("***** Update process of plugin TIMELINETICKET *****");
}
$migration->displayWarning("Current Timelineticket version: {$current_version}");
$migration->displayWarning("Version to update: " . PLUGIN_TIMELINETICKET_VERSION);
// To prevent problem of execution time
ini_set("max_execution_time", "0");
ini_set("memory_limit", "-1");
$mess = '';
if ($current_version != PLUGIN_TIMELINETICKET_VERSION and $current_version != '0') {
$mess = "Update done.";
} else {
if ($current_version == PLUGIN_TIMELINETICKET_VERSION) {
$mess = "No migration needed.";
} else {
$mess = "installation done.";
}
}
$plugin->getFromDBbyDir("timelineticket");
$plugin->install($plugin->fields['id']);
plugin_timelineticket_install();
$migration->displayWarning($mess);
$plugin->load("timelineticket");
$plugin->activate($plugin->fields['id']);
$plugin->load("timelineticket");
if (in_array('--optimize', $_SERVER['argv'])) {
$migration->displayTitle("Optimizing tables");
DBmysql::optimize_tables($migration);
$migration->displayWarning("Optimize done.");
}
示例6: saveDatas
function saveDatas($params)
{
global $DB;
$tasks_id = $params['tasks_id'];
$tasks = json_decode($params['tasks']);
//remove old jobs from task
$query = "DELETE FROM " . $this->getTable() . "\n WHERE plugin_fusioninventory_deploytasks_id = '" . $tasks_id . "'";
$res = $DB->query($query);
//get plugin id
$plug = new Plugin();
$plug->getFromDBbyDir('fusinvdeploy');
$plugins_id = $plug->getField('id');
//insert new rows
$sql_tasks = array();
$i = 0;
foreach ($tasks as $task) {
$task = get_object_vars($task);
//encode action and definition
//$action = exportArrayToDB(array(array(
// $task['action_type'] => $task['action_selection'])));
$action = exportArrayToDB($task['action']);
$definition = exportArrayToDB(array(array('PluginFusioninventoryDeployPackage' => $task['package_id'])));
$sql_tasks[] = "INSERT INTO " . $this->getTable() . "\n (\n plugin_fusioninventory_deploytasks_id, name, date_creation, entities_id,\n plugins_id, method, definition, action,\n retry_nb, retry_time, periodicity_type, periodicity_count\n ) VALUES (\n '{$tasks_id}', 'job_" . $tasks_id . "_{$i}', NOW(), '0',\n '{$plugins_id}', '" . $task['method'] . "', '{$definition}', '{$action}',\n '" . $task['retry_nb'] . "', '" . $task['retry_time'] . "', 'minutes', '0'\n )";
$i++;
}
foreach ($sql_tasks as $query) {
$res = $DB->query($query);
}
}
示例7: plugin_init_fusioninventory
function plugin_init_fusioninventory()
{
global $PLUGIN_HOOKS, $CFG_GLPI;
$PLUGIN_HOOKS['csrf_compliant']['fusioninventory'] = TRUE;
$Plugin = new Plugin();
$moduleId = 0;
if (isset($_SESSION['glpi_use_mode'])) {
$debug_mode = $_SESSION['glpi_use_mode'] == Session::DEBUG_MODE;
} else {
$debug_mode = false;
}
if ($Plugin->isActivated('fusioninventory')) {
// check if plugin is active
// Register classes into GLPI plugin factory
Plugin::registerClass('PluginFusioninventoryAgent', array('addtabon' => array('Computer', 'Printer', 'NetworkEquipment', 'PluginFusioninventoryCredentialIp')));
Plugin::registerClass('PluginFusioninventoryAgentmodule');
Plugin::registerClass('PluginFusioninventoryConfig');
Plugin::registerClass('PluginFusioninventoryTask', array('addtabon' => array('Computer', 'Printer', 'NetworkEquipment', 'PluginFusioninventoryCredentialIp')));
Plugin::registerClass('PluginFusioninventoryTaskjob', array('addtabon' => array('PluginFusioninventoryTask')));
Plugin::registerClass('PluginFusioninventoryTaskjobstate', array('addtabon' => array('PluginFusioninventoryTask')));
Plugin::registerClass('PluginFusioninventoryUnmanaged');
Plugin::registerClass('PluginFusioninventoryModule');
Plugin::registerClass('PluginFusioninventoryProfile', array('addtabon' => array('Profile')));
Plugin::registerClass('PluginFusioninventoryEntity', array('addtabon' => array('Entity')));
Plugin::registerClass('PluginFusioninventorySetup');
Plugin::registerClass('PluginFusioninventoryIPRange');
Plugin::registerClass('PluginFusioninventoryIPRange_ConfigSecurity', array('addtabon' => 'PluginFusioninventoryIPRange'));
Plugin::registerClass('PluginFusioninventoryCredential');
Plugin::registerClass('PluginFusioninventoryTimeslot');
Plugin::registerClass('PluginFusioninventoryLock', array('addtabon' => array('Computer', 'Printer', 'NetworkEquipment')));
Plugin::registerClass('PluginFusioninventoryInventoryComputerAntivirus', array('addtabon' => array('Computer')));
Plugin::registerClass('PluginFusioninventoryInventoryComputerComputer', array('addtabon' => array('Computer')));
Plugin::registerClass('PluginFusioninventoryInventoryComputerInventory');
Plugin::registerClass('PluginFusioninventoryInventoryComputerStorage', array('addtabon' => array('Computer')));
Plugin::registerClass('PluginFusioninventoryCollect');
Plugin::registerClass('PluginFusioninventoryCollect_Registry', array('addtabon' => array('PluginFusioninventoryCollect')));
Plugin::registerClass('PluginFusioninventoryCollect_Registry_Content', array('addtabon' => array('PluginFusioninventoryCollect', 'Computer')));
Plugin::registerClass('PluginFusioninventoryCollect_Wmi', array('addtabon' => array('PluginFusioninventoryCollect')));
Plugin::registerClass('PluginFusioninventoryCollect_Wmi_Content', array('addtabon' => array('PluginFusioninventoryCollect', 'Computer')));
Plugin::registerClass('PluginFusioninventoryCollect_File', array('addtabon' => array('PluginFusioninventoryCollect')));
Plugin::registerClass('PluginFusioninventoryCollect_File_Content', array('addtabon' => array('PluginFusioninventoryCollect', 'Computer')));
Plugin::registerClass('PluginFusioninventoryComputerLicenseInfo', array('addtabon' => array('Computer')));
//Classes for rulesengine
Plugin::registerClass('PluginFusioninventoryInventoryRuleLocation');
Plugin::registerClass('PluginFusioninventoryInventoryRuleLocationCollection', array('rulecollections_types' => TRUE));
Plugin::registerClass('PluginFusioninventoryInventoryRuleEntity');
Plugin::registerClass('PluginFusioninventoryInventoryRuleEntityCollection', array('rulecollections_types' => TRUE));
Plugin::registerClass('PluginFusioninventoryRulematchedlog', array('addtabon' => array('Computer', 'PluginFusioninventoryAgent', 'PluginFusioninventoryUnmanaged', 'Printer', 'NetworkEquipment')));
//Classes for rulesengine
Plugin::registerClass('PluginFusioninventoryInventoryRuleImport');
Plugin::registerClass('PluginFusioninventoryInventoryRuleImportCollection', array('rulecollections_types' => TRUE));
Plugin::registerClass('PluginFusioninventoryConstructDevice');
//Computer arch dictionnary
Plugin::registerClass('PluginFusioninventoryRuleDictionnaryComputerArch');
Plugin::registerClass('PluginFusioninventoryRuleDictionnaryComputerArchCollection', array('rulecollections_types' => TRUE));
array_push($CFG_GLPI["dictionnary_types"], 'PluginFusioninventoryRuleDictionnaryComputerArchCollection');
// Networkinventory and networkdiscovery
Plugin::registerClass('PluginFusioninventorySnmpmodel');
Plugin::registerClass('PluginFusioninventoryNetworkEquipment', array('addtabon' => array('NetworkEquipment')));
Plugin::registerClass('PluginFusioninventoryPrinter', array('addtabon' => array('Printer')));
Plugin::registerClass('PluginFusioninventoryPrinterCartridge');
Plugin::registerClass('PluginFusioninventoryConfigSecurity');
Plugin::registerClass('PluginFusioninventoryNetworkPortLog', array('addtabon' => array('NetworkPort')));
Plugin::registerClass('PluginFusinvsnmpAgentconfig');
Plugin::registerClass('PluginFusioninventoryNetworkPort', array('classname' => 'glpi_networkports'));
Plugin::registerClass('PluginFusioninventoryStateDiscovery');
Plugin::registerClass('PluginFusioninventoryPrinterLogReport');
Plugin::registerClass('PluginFusioninventorySnmpmodelConstructdevice_User', array('addtabon' => array('User')));
Plugin::registerClass('PluginFusioninventoryDeployGroup');
Plugin::registerClass('PluginFusioninventoryDeployGroup_Staticdata', array('addtabon' => array('PluginFusioninventoryDeployGroup')));
Plugin::registerClass('PluginFusioninventoryDeployGroup_Dynamicdata', array('addtabon' => array('PluginFusioninventoryDeployGroup')));
$CFG_GLPI['glpitablesitemtype']["PluginFusioninventoryPrinterLogReport"] = "glpi_plugin_fusioninventory_printers";
$CFG_GLPI['glpitablesitemtype']["PluginFusioninventoryComputer"] = "glpi_computers";
// ##### 3. get informations of the plugin #####
$Plugin->getFromDBbyDir('fusioninventory');
$moduleId = $Plugin->fields['id'];
// Load config
PluginFusioninventoryConfig::loadCache();
// ##### 5. Set in session XMLtags of methods #####
$_SESSION['glpi_plugin_fusioninventory']['xmltags']['WAKEONLAN'] = '';
$_SESSION['glpi_plugin_fusioninventory']['xmltags']['INVENTORY'] = 'PluginFusioninventoryInventoryComputerInventory';
$_SESSION['glpi_plugin_fusioninventory']['xmltags']['NETWORKDISCOVERY'] = 'PluginFusioninventoryCommunicationNetworkDiscovery';
$_SESSION['glpi_plugin_fusioninventory']['xmltags']['NETWORKINVENTORY'] = 'PluginFusioninventoryCommunicationNetworkInventory';
$PLUGIN_HOOKS['import_item']['fusioninventory'] = array('Computer' => array('Plugin'));
$CFG_GLPI["specif_entities_tables"][] = 'glpi_plugin_fusioninventory_ipranges';
$CFG_GLPI["networkport_types"][] = 'PluginFusioninventoryUnmanaged';
/**
* Load the relevant javascript/css files only on pages that need them.
*/
$PLUGIN_HOOKS['add_javascript']['fusioninventory'] = array();
$PLUGIN_HOOKS['add_css']['fusioninventory'] = array();
if (strpos($_SERVER['SCRIPT_FILENAME'], "plugins/fusioninventory") != false) {
$PLUGIN_HOOKS['add_css']['fusioninventory'][] = "css/views.css";
$PLUGIN_HOOKS['add_css']['fusioninventory'][] = "css/deploy.css";
array_push($PLUGIN_HOOKS['add_javascript']['fusioninventory'], "lib/d3-3.4.3/d3" . ($debug_mode ? "" : ".min") . ".js", "lib/nvd3/nv.d3" . ($debug_mode ? "" : ".min") . ".js", "lib/expanding/expanding" . ($debug_mode ? "" : ".min") . ".js");
}
if (script_endswith("timeslot.form.php")) {
$PLUGIN_HOOKS['add_javascript']['fusioninventory'][] = "lib/timeslot" . ($debug_mode ? "" : ".min") . ".js";
}
if (script_endswith("deploypackage.form.php")) {
//.........这里部分代码省略.........
示例8:
$migration->displayWarning("Current Monitoring version: {$current_version}");
$migration->displayWarning("Version to update: " . PLUGIN_MONITORING_VERSION);
// To prevent problem of execution time
ini_set("max_execution_time", "0");
ini_set("memory_limit", "-1");
$mess = '';
if ($current_version != PLUGIN_MONITORING_VERSION and $current_version != '0') {
$mess = "Update needed.";
} else {
if ($current_version == PLUGIN_MONITORING_VERSION) {
$mess = "No migration needed.";
} else {
$mess = "installation done.";
}
}
$migration->displayWarning($mess);
$plugin->getFromDBbyDir("monitoring");
print "Installing Plugin...\n";
$plugin->install($plugin->fields['id']);
print "Install Done\n";
print "Activating Plugin...\n";
$plugin->activate($plugin->fields['id']);
print "Activation Done\n";
print "Loading Plugin...\n";
$plugin->load("monitoring");
print "Load Done...\n";
if (in_array('--optimize', $_SERVER['argv'])) {
$migration->displayTitle(__('Optimizing tables'));
DBmysql::optimize_tables($migration);
$migration->displayWarning("Optimize done.");
}
示例9: define
}
$migration->displayWarning($mess);
if ($args['--no-models-update']) {
define('NO_MODELS_UPDATE', TRUE);
}
if ($args['--force-upgrade']) {
define('FORCE_UPGRADE', TRUE);
}
if (!is_null($args['--as-user'])) {
$user = new User();
$user->getFromDBbyName($args['--as-user']);
$auth = new Auth();
$auth->auth_succeded = true;
$auth->user = $user;
Session::init($auth);
}
$plugin->getFromDBbyDir("fusioninventory");
print "Installing Plugin...\n";
$plugin->install($plugin->fields['id']);
print "Install Done\n";
print "Activating Plugin...\n";
$plugin->activate($plugin->fields['id']);
print "Activation Done\n";
print "Loading Plugin...\n";
$plugin->load("fusioninventory");
print "Load Done...\n";
if ($args['--optimize']) {
$migration->displayTitle(__('Optimizing tables'));
DBmysql::optimize_tables($migration);
$migration->displayWarning("Optimize done.");
}
示例10: setUp
protected function setUp()
{
global $CFG_GLPI, $DB;
$DB = new DB();
// Force profile in session to SuperAdmin
$_SESSION['glpiprofiles'] = array('4' => array('entities' => 0));
$_SESSION['glpi_plugin_fusioninventory_profile']['unmanaged'] = 'w';
$_SESSION['glpiactiveentities'] = array(0, 1);
$_SESSION['glpi_use_mode'] = Session::NORMAL_MODE;
require GLPI_ROOT . "/inc/includes.php";
$plugin = new Plugin();
$DB->connect();
$plugin->getFromDBbyDir("fusioninventory");
$plugin->activate($plugin->fields['id']);
file_put_contents(GLPI_ROOT . "/files/_log/sql-errors.log", '');
file_put_contents(GLPI_ROOT . "/files/_log/php-errors.log", '');
$dir = GLPI_ROOT . "/files/_files/_plugins/fusioninventory";
if (file_exists($dir)) {
$objects = scandir($dir);
foreach ($objects as $object) {
if ($object != "." && $object != "..") {
if (filetype($dir . "/" . $object) == "dir") {
} else {
unlink($dir . "/" . $object);
}
}
}
}
include_once GLPI_ROOT . "/inc/timer.class.php";
// Security of PHP_SELF
$_SERVER['PHP_SELF'] = Html::cleanParametersURL($_SERVER['PHP_SELF']);
// function glpiautoload($classname) {
// global $DEBUG_AUTOLOAD, $CFG_GLPI;
// static $notfound = array();
//
// // empty classname or non concerted plugin
// if (empty($classname) || is_numeric($classname)) {
// return FALSE;
// }
//
// $dir=GLPI_ROOT . "/inc/";
// //$classname="PluginExampleProfile";
// if ($plug=isPluginItemType($classname)) {
// $plugname=strtolower($plug['plugin']);
// $dir=GLPI_ROOT . "/plugins/$plugname/inc/";
// $item=strtolower($plug['class']);
// // Is the plugin activate ?
// // Command line usage of GLPI : need to do a real check plugin activation
// if (isCommandLine()) {
// $plugin = new Plugin();
// if (count($plugin->find("directory='$plugname' AND state=".Plugin::ACTIVATED)) == 0) {
// // Plugin does not exists or not activated
// return FALSE;
// }
// } else {
// // Standard use of GLPI
// if (!in_array($plugname, $_SESSION['glpi_plugins'])) {
// // Plugin not activated
// return FALSE;
// }
// }
// } else {
// // Is ezComponent class ?
// $matches = array();
// if (preg_match('/^ezc([A-Z][a-z]+)/', $classname, $matches)) {
// include_once(GLPI_EZC_BASE);
// ezcBase::autoload($classname);
// return TRUE;
// } else {
// $item=strtolower($classname);
// }
// }
//
// // No errors for missing classes due to implementation
// if (!isset($CFG_GLPI['missingclasses'])
// OR !in_array($item, $CFG_GLPI['missingclasses'])){
// if (file_exists("$dir$item.class.php")) {
// include_once ("$dir$item.class.php");
// if ($_SESSION['glpi_use_mode']==Session::DEBUG_MODE) {
// $DEBUG_AUTOLOAD[]=$classname;
// }
//
// } else if (!isset($notfound["$classname"])) {
// // trigger an error to get a backtrace, but only once (use prefix 'x' to handle empty case)
// //Toolbox::logInFile('debug', "file $dir$item.class.php not founded trying to load class $classname\n");
// trigger_error("GLPI autoload : file $dir$item.class.php not founded trying to load class '$classname'");
// $notfound["$classname"] = TRUE;
// }
// }
// }
//
// spl_autoload_register('glpiautoload');
// restore_error_handler();
// error_reporting(E_ALL | E_STRICT);
// ini_set('display_errors', 'On');
ini_set("memory_limit", "-1");
ini_set("max_execution_time", "0");
}
示例11: manageTicket
private function manageTicket($closed = true)
{
global $DB, $CFG_GLPI;
$DB->connect();
$_SESSION['glpiactive_entity'] = 0;
$CFG_GLPI['root_doc'] = "http://127.0.0.1/fusion0.83/";
$plugin = new Plugin();
$plugin->getFromDBbyDir("timelineticket");
$plugin->activate($plugin->fields['id']);
Plugin::load("timelineticket");
Session::loadLanguage("en_GB");
$ticket = new Ticket();
$group = new Group();
$group_ticket = new Group_Ticket();
$GLPIlog = new GLPIlogs();
$ticket_User = new Ticket_User();
$_SESSION['plugin_timelineticket_date'] = array();
$group->add(array('name' => 'grtech1'));
$group->add(array('name' => 'grtech2'));
// * 01/
$_SESSION["glpi_currenttime"] = date("Y-m-d H:i:s");
$a_storedate = array('1' => $_SESSION["glpi_currenttime"]);
$input = array();
$input['name'] = 'Pb with the ticket';
$input['content'] = 'I have a problem with the ticket';
$tickets_id = $ticket->add($input);
$GLPIlog->testSQLlogs('01/');
$GLPIlog->testPHPlogs('01/');
// * 02/
sleep(2);
// * 03/
$_SESSION["glpi_currenttime"] = date("Y-m-d H:i:s");
$a_storedate[3] = $_SESSION["glpi_currenttime"];
$input = array();
$input['id'] = $tickets_id;
$input['_itil_assign']['_type'] = 'group';
$input['_itil_assign']['groups_id'] = 1;
$ticket->update($input);
$input['_itil_assign']['_type'] = 'user';
$input['_itil_assign']['users_id'] = 2;
$ticket->update($input);
$GLPIlog->testSQLlogs('03/');
$GLPIlog->testPHPlogs('03/');
$a_db = getAllDatasFromTable('glpi_groups_tickets');
$a_ref = array();
$a_ref[1] = array('id' => '1', 'tickets_id' => '1', 'groups_id' => '1', 'type' => '2');
$this->assertEquals($a_ref, $a_db, 'May have ticket assigned to group1');
$a_db = getAllDatasFromTable('glpi_tickets_users');
$a_ref = array();
$a_ref[1] = array('id' => '1', 'tickets_id' => '1', 'users_id' => '2', 'type' => '1', 'use_notification' => '1', 'alternative_email' => '');
$a_ref[2] = array('id' => '2', 'tickets_id' => '1', 'users_id' => '2', 'type' => '2', 'use_notification' => '1', 'alternative_email' => '');
$this->assertEquals($a_ref, $a_db, 'May have ticket assigned to user 2 (glpi)');
// * 04/
sleep(2);
// * 05/
$_SESSION["glpi_currenttime"] = date("Y-m-d H:i:s");
$a_storedate[5] = $_SESSION["glpi_currenttime"];
$input = array();
$input['id'] = $tickets_id;
$input['status'] = Ticket::WAITING;
$ticket->update($input);
$GLPIlog->testSQLlogs('05/');
$GLPIlog->testPHPlogs('05/');
$ticket->getFromDB(1);
$this->assertEquals('waiting', $ticket->fields['status'], 'May have status waiting');
// * 06/
sleep(1);
// * 07/
$_SESSION["glpi_currenttime"] = date("Y-m-d H:i:s");
$a_storedate[7] = $_SESSION["glpi_currenttime"];
$input = array();
$input['id'] = 2;
$input['itickets_id'] = $tickets_id;
$ticket_User->check($input['id'], 'w');
$ticket_User->delete($input);
$input = array();
$input['id'] = 1;
$input['itickets_id'] = $tickets_id;
$group_ticket->check($input['id'], 'w');
$group_ticket->delete($input);
$GLPIlog->testSQLlogs('07/');
$GLPIlog->testPHPlogs('07/');
$a_db = getAllDatasFromTable('glpi_groups_tickets');
$this->assertEquals(array(), $a_db, 'May have no group assigned');
// * 08/
sleep(1);
// * 09/
$_SESSION["glpi_currenttime"] = date("Y-m-d H:i:s");
$a_storedate[9] = $_SESSION["glpi_currenttime"];
$input = array();
$input['id'] = $tickets_id;
$input['_itil_assign']['_type'] = 'group';
$input['_itil_assign']['groups_id'] = 2;
$ticket->update($input);
$GLPIlog->testSQLlogs('09/');
$GLPIlog->testPHPlogs('09/');
$a_db = getAllDatasFromTable('glpi_groups_tickets');
$a_ref = array();
$a_ref[2] = array('id' => '2', 'tickets_id' => '1', 'groups_id' => '2', 'type' => '2');
$this->assertEquals($a_ref, $a_db, 'May have ticket assigned to group2');
//.........这里部分代码省略.........