From 08fad11a44ff4c5ceeb69e8089fd8601bc5e6687 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Jan 2010 12:21:29 +0000 Subject: [PATCH] More information in shared memory area --- htdocs/admin/system/dolibarr.php | 13 ++++++++++--- htdocs/langs/en_US/admin.lang | 1 + htdocs/langs/en_US/main.lang | 1 + htdocs/langs/fr_FR/admin.lang | 3 ++- htdocs/langs/fr_FR/main.lang | 1 + htdocs/lib/memory.lib.php | 16 ++++++++++++++-- 6 files changed, 29 insertions(+), 6 deletions(-) diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php index 02365d2a2be..39b0a3d55b4 100644 --- a/htdocs/admin/system/dolibarr.php +++ b/htdocs/admin/system/dolibarr.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2005-2010 Laurent Destailleur * Copyright (C) 2007 Rodolphe Quiedeville * * This program is free software; you can redistribute it and/or modify @@ -101,12 +101,19 @@ if (sizeof($shmoparray) > 0) { $var=true; print ''; - print ''."\n"; + print ''; + print ''; + print ''; + print ''; + print ''."\n"; foreach($shmoparray as $key => $val) { $var=!$var; - print "\n"; + print "'; + print '"; + print ''; + print "\n"; } print '
'.$langs->trans("LanguageFilesCachedIntoShmopSharedMemory").''.$langs->trans("NbOfEntries").'
'.$langs->trans("LanguageFilesCachedIntoShmopSharedMemory").''.$langs->trans("NbOfEntries").''.$langs->trans("Address").'
".$key.''.sizeof($val)."
".$key.''.sizeof($val)."'.dol_getshmopaddress($key).'
'; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 8cd28fef944..979aa567cd3 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -263,6 +263,7 @@ ModuleDisabled=Module disabled ModuleDisabledSoNoEvent=Module disabled so event never created ConfirmPurge=Are you sure you want to execute this purge ?
This will delete definitely all your data files with no way to restore them (ECM files, attached files...). MinLength=Minimum length +LanguageFilesCachedIntoShmopSharedMemory=Files .lang loaded in shared memory # Modules Module0Name=Users & groups diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 7d6877cdb57..d288a69cf72 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -47,6 +47,7 @@ ErrorFailedToSaveFile=Error, failed to save file. ErrorOnlyPngJpgSupported=Error, only .png and .jpg image format file are supported. ErrorImageFormatNotSupported=Your PHP does not support functions to convert images of this format. BackgroundColorByDefault=Default background color +NbOfEntries=Nb of entries GoToWikiHelpPage=Read online help (need Internet access) GoToHelpPage=Read help RecordSaved=Record saved diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 350bb2f196f..71ee035c978 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -263,6 +263,7 @@ ModuleDisabled=Module désactivé ModuleDisabledSoNoEvent=Module désactivé donc évênement jamais créé ConfirmPurge=Etes vous sur de vouloir réaliser cette purge ?
Ceci effacera définitivement toutes vos données fichier (espace GED, pièces jointes, etc...). MinLength=Longueur minimale +LanguageFilesCachedIntoShmopSharedMemory=Fichiers .lang en mémoire partagée # Modules = undefined Module0Name = Utilisateurs & groupes @@ -310,7 +311,7 @@ Module58Desc = Intégration de ClickToDial Module59Name = Bookmark4u Module59Desc = Ajoute fonction pour générer un compte Bookmark4u depuis un compte Dolibarr Module70Name = Interventions -Module70Desc = Gestion des interventions +Module70Desc = Gestion des interventions chez les tiers Module75Name = Notes de frais et déplacements Module75Desc = Gestion des notes de frais et déplacements Module80Name = Expéditions diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index e14eb7a8ae1..4b62f86d55f 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -47,6 +47,7 @@ ErrorFailedToSaveFile=Erreur, l'enregistrement du fichier a échoué. ErrorOnlyPngJpgSupported=Erreur, seuls les formats images .jpg et .png sont supportés. ErrorImageFormatNotSupported=Votre PHP ne supporte pas les fonctions de conversion de ce format d'image. BackgroundColorByDefault=Couleur de fond +NbOfEntries=Nb d'entrées GoToWikiHelpPage=Consulter l'aide (nécessite un accès internet) GoToHelpPage=Consulter l'aide RecordSaved=Enregistrement sauvegardé diff --git a/htdocs/lib/memory.lib.php b/htdocs/lib/memory.lib.php index c543f01afcf..f25bab1e2d6 100644 --- a/htdocs/lib/memory.lib.php +++ b/htdocs/lib/memory.lib.php @@ -34,6 +34,18 @@ $shmoffset=100; + +/** \brief Return shared memory address used to store dataset with key memoryid + * \param $memoryid Memory id of shared area + * \return int <0 if KO, Memoy address of shared memory for key + */ +function dol_getshmopaddress($memoryid) +{ + global $shmkeys,$shmoffset; + if (empty($shmkeys[$memoryid])) return 0; + return $shmkeys[$memoryid]+$shmoffset; +} + /** \brief Return list of contents of all memory area shared * \return int 0=Nothing is done, <0 if KO, >0 if OK */ @@ -59,7 +71,7 @@ function dol_getshmop($memoryid) global $shmkeys,$shmoffset; if (empty($shmkeys[$memoryid]) || ! function_exists("shmop_open")) return 0; - $shmkey=($shmkeys[$memoryid]+$shmoffset); + $shmkey=dol_getshmopaddress($memoryid);; //print 'dol_getshmop memoryid='.$memoryid." shmkey=".$shmkey."
\n"; $handle=@shmop_open($shmkey,'a',0,0); if ($handle) @@ -87,7 +99,7 @@ function dol_setshmop($memoryid,$data) //print 'dol_setshmop memoryid='.$memoryid."
\n"; if (empty($shmkeys[$memoryid]) || ! function_exists("shmop_write")) return 0; - $shmkey=$shmkeys[$memoryid]+$shmoffset; + $shmkey=dol_getshmopaddress($memoryid); $newdata=serialize($data); $size=strlen($newdata); //print 'dol_setshmop memoryid='.$memoryid." shmkey=".$shmkey." newdata=".$size."bytes
\n";