N°8796 - Add PHP code style validation in iTop and extensions - format whole code base

This commit is contained in:
odain
2025-11-07 20:39:38 +01:00
parent 7681c157ec
commit b0a792afab
369 changed files with 22041 additions and 26866 deletions

View File

@@ -3,32 +3,32 @@
SetupWebPage::AddModule(
__FILE__, // Path to the current file, all other file names are relative to the directory containing this file
'combodo-email-synchro/3.8.2',
array(
[
// Identification
'label' => 'Tickets synchronization via e-mail',
'category' => 'business',
// Setup
'dependencies' => array(
'itop-profiles-itil/3.0.0',
),
'dependencies' => [
'itop-profiles-itil/3.0.0',
],
'mandatory' => false,
'visible' => true,
'installer' => 'EmailSynchroInstaller',
// Components
'datamodel' => array(
'datamodel' => [
'classes/autoload.php',
'model.combodo-email-synchro.php',
),
'dictionary' => array(),
'data.struct' => array(
),
'data.sample' => array(
),
],
'dictionary' => [],
'data.struct' => [
],
'data.sample' => [
],
// Documentation
'doc.manual_setup' => '', // No manual installation required
'doc.more_information' => '', // None
// Default settings
'settings' => array(
'settings' => [
'notify_errors_to' => '', // mandatory to track errors not handled by the email processing module
'notify_errors_from' => '', // mandatory as well (can be set at the same value as notify_errors_to)
'debug' => false, // Set to true to turn on debugging
@@ -36,44 +36,42 @@ SetupWebPage::AddModule(
'retention_period' => 1, // number of hour we keep the replica
'body_parts_order' => 'text/html,text/plain', // Order in which to read the parts of the incoming emails
'pop3_auth_option' => 'USER',
'imap_options' => array('imap'),
'imap_open_options' => array(),
'imap_options' => ['imap'],
'imap_open_options' => [],
'maximum_email_size' => '10M', // Maximum allowed size for incoming emails
'big_files_dir' => '',
'exclude_attachment_types' => array('application/exe'), // Example: 'application/exe', 'application/x-winexe', 'application/msdos-windows'
'exclude_attachment_types' => ['application/exe'], // Example: 'application/exe', 'application/x-winexe', 'application/msdos-windows'
// Lines to be removed just above the 'new part' in a reply-to message... add your own patterns below
'introductory-patterns' => array(
'introductory-patterns' => [
'/^le .+ a écrit :$/i', // Thunderbird French
'/^on .+ wrote:$/i', // Thunderbird English
'|^[0-9]{4}/[0-9]{1,2}/[0-9]{1,2} .+:$|', // Gmail style
),
],
// Some patterns which delimit the previous message in case of a Reply
// The "new" part of the message is the text before the pattern
// Add your own multi-line patterns (use \\R for a line break)
// These patterns depend on the mail client/server used... feel free to add your own discoveries to the list
'multiline-delimiter-patterns' => array(
'multiline-delimiter-patterns' => [
'/\\RFrom: .+\\RSent: .+\\R/m', // Outlook English
'/\\R_+\\R/m', // A whole line made only of underscore characters
'/\\RDe : .+\\R\\R?Envoyé : /m', // Outlook French, HTML and rich text
'/\\RDe : .+\\RDate d\'envoi : .+\\R/m', // Outlook French, plain text
'/\\R-----Message d\'origine-----\\R/m',
),
],
'use_message_id_as_uid' => false, // Do NOT change this unless you known what you are doing!!
'images_minimum_size' => '100x20', // Images smaller that these dimensions will be ignored (signatures...)
'images_maximum_size' => '', // Images bigger that these dimensions will be resized before uploading into iTop
'recommended_max_allowed_packet' => 10*1024*1024, // MySQL parameter for attachments
),
)
'recommended_max_allowed_packet' => 10 * 1024 * 1024, // MySQL parameter for attachments
],
]
);
if (!class_exists('EmailSynchroInstaller'))
{
if (!class_exists('EmailSynchroInstaller')) {
// Module installation handler
//
class EmailSynchroInstaller extends ModuleInstallerAPI
{
/**
* Handler called after the creation/update of the database schema
*
@@ -109,10 +107,9 @@ if (!class_exists('EmailSynchroInstaller'))
// Looping on inboxes to update
$oSet = new DBObjectSet($oSearch);
while ($oInbox = $oSet->Fetch())
{
$sUpdateQuery = "UPDATE $sTableName SET $sMailboxColName = " . CMDBSource::Quote($oInbox->Get('mailbox')) . " WHERE $sUidlColName LIKE " . CMDBSource::Quote($oInbox->Get('login') . '_%') . " AND $sMailboxColName IS NULL";
SetupLog::Info("Executing query: " . $sUpdateQuery);
while ($oInbox = $oSet->Fetch()) {
$sUpdateQuery = "UPDATE $sTableName SET $sMailboxColName = ".CMDBSource::Quote($oInbox->Get('mailbox'))." WHERE $sUidlColName LIKE ".CMDBSource::Quote($oInbox->Get('login').'_%')." AND $sMailboxColName IS NULL";
SetupLog::Info("Executing query: ".$sUpdateQuery);
$iRet = CMDBSource::Query($sUpdateQuery); // Throws an exception in case of error
SetupLog::Info("Updated $iRet rows.");
}