phpfreechat-svn Mailing List for phpFreeChat (Page 8)
Status: Beta
Brought to you by:
kerphi
You can subscribe to this list here.
2006 |
Jan
|
Feb
(2) |
Mar
|
Apr
(61) |
May
(56) |
Jun
(96) |
Jul
(23) |
Aug
(62) |
Sep
(76) |
Oct
(48) |
Nov
(28) |
Dec
(28) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(31) |
Feb
(40) |
Mar
(29) |
Apr
(11) |
May
(6) |
Jun
(18) |
Jul
(18) |
Aug
(108) |
Sep
(24) |
Oct
(6) |
Nov
(21) |
Dec
|
2008 |
Jan
|
Feb
(1) |
Mar
(16) |
Apr
|
May
(3) |
Jun
|
Jul
(7) |
Aug
(1) |
Sep
(3) |
Oct
|
Nov
(3) |
Dec
(2) |
2009 |
Jan
(2) |
Feb
|
Mar
(2) |
Apr
(3) |
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
(1) |
Oct
(1) |
Nov
|
Dec
(1) |
2010 |
Jan
(2) |
Feb
|
Mar
|
Apr
(6) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
2018 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <gpi...@us...> - 2007-08-09 01:07:13
|
Revision: 1104 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1104&view=rev Author: gpinzone Date: 2007-08-08 18:07:15 -0700 (Wed, 08 Aug 2007) Log Message: ----------- Got rid of buggy Safari detection method. Replaced other detection methods and variable names with the ones in prototype.js. Tested history function on Safari for Windows. Modified Paths: -------------- trunk/data/public/js/pfcclient.js Modified: trunk/data/public/js/pfcclient.js =================================================================== --- trunk/data/public/js/pfcclient.js 2007-08-08 22:15:04 UTC (rev 1103) +++ trunk/data/public/js/pfcclient.js 2007-08-09 01:07:15 UTC (rev 1104) @@ -1,9 +1,9 @@ -var is_ie = navigator.appName.match("Explorer"); -var is_khtml = navigator.appName.match("Konqueror") || navigator.appVersion.match("KHTML"); -var is_ff = navigator.appName.match("Netscape"); -var is_ie7 = navigator.userAgent.indexOf('MSIE 7') > 0; -var is_opera = window.opera; -var is_safari = document.childNodes && !document.all && !navigator.taintEnabled && !accentColorName; +var is_ie = window.attachEvent && !window.opera; +var is_khtml = navigator.appName.match("Konqueror") || navigator.appVersion.match("KHTML"); +var is_gecko = navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1; +var is_ie7 = navigator.userAgent.indexOf('MSIE 7') > 0; +var is_opera = window.opera; +var is_webkit = navigator.userAgent.indexOf('AppleWebKit/') > -1; /** * This class is the client part of phpFreeChat @@ -630,7 +630,7 @@ { return this.doSendMessage(); } - else if (code == 63232 && is_safari) // up arrow key + else if (code == 63232 && is_webkit) // up arrow key { // write the last command in the history if (this.cmdhistory.length>0) @@ -644,7 +644,7 @@ w.value = this.cmdhistory[this.cmdhistoryid]; } } - else if (code == 63233 && is_safari) // down arrow key + else if (code == 63233 && is_webkit) // down arrow key { // write the next command in the history if (this.cmdhistory.length>0) @@ -680,7 +680,7 @@ this.completeNick(); return false; /* do not leave the tab key default behavior */ } - else if (code == 38 && (is_ff || is_ie || is_khtml || is_opera)) // up arrow key + else if (code == 38 && (is_gecko || is_ie || is_khtml || is_opera)) // up arrow key { // write the last command in the history if (this.cmdhistory.length>0) @@ -694,7 +694,7 @@ w.value = this.cmdhistory[this.cmdhistoryid]; } } - else if (code == 40 && (is_ff || is_ie || is_khtml || is_opera)) // down arrow key + else if (code == 40 && (is_gecko || is_ie || is_khtml || is_opera)) // down arrow key { // write the next command in the history if (this.cmdhistory.length>0) @@ -908,7 +908,7 @@ while (elt) { // delete this element to save browser memory - if (is_ff) + if (is_gecko) elt.innerHTML = ''; else // this code don't work in FF, why ? don't know .. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gpi...@us...> - 2007-08-08 22:15:04
|
Revision: 1103 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1103&view=rev Author: gpinzone Date: 2007-08-08 15:15:04 -0700 (Wed, 08 Aug 2007) Log Message: ----------- Fixed Firefox bug introduced in last commit. Should not cause issues on Mac Firefox since "evt.which" takes precedence. Modified Paths: -------------- trunk/data/public/js/pfcclient.js Modified: trunk/data/public/js/pfcclient.js =================================================================== --- trunk/data/public/js/pfcclient.js 2007-08-08 22:01:19 UTC (rev 1102) +++ trunk/data/public/js/pfcclient.js 2007-08-08 22:15:04 UTC (rev 1103) @@ -630,7 +630,7 @@ { return this.doSendMessage(); } - else if (code == 38 && is_ff || code == 63232 && is_safari) // up arrow key + else if (code == 63232 && is_safari) // up arrow key { // write the last command in the history if (this.cmdhistory.length>0) @@ -644,7 +644,7 @@ w.value = this.cmdhistory[this.cmdhistoryid]; } } - else if (code == 40 && is_ff || code == 63233 && is_safari) // down arrow key + else if (code == 63233 && is_safari) // down arrow key { // write the next command in the history if (this.cmdhistory.length>0) @@ -680,7 +680,7 @@ this.completeNick(); return false; /* do not leave the tab key default behavior */ } - else if (code == 38 && (is_ie || is_khtml || is_opera)) // up arrow key + else if (code == 38 && (is_ff || is_ie || is_khtml || is_opera)) // up arrow key { // write the last command in the history if (this.cmdhistory.length>0) @@ -694,7 +694,7 @@ w.value = this.cmdhistory[this.cmdhistoryid]; } } - else if (code == 40 && (is_ie || is_khtml || is_opera)) // down arrow key + else if (code == 40 && (is_ff || is_ie || is_khtml || is_opera)) // down arrow key { // write the next command in the history if (this.cmdhistory.length>0) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gpi...@us...> - 2007-08-08 22:01:20
|
Revision: 1102 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1102&view=rev Author: gpinzone Date: 2007-08-08 15:01:19 -0700 (Wed, 08 Aug 2007) Log Message: ----------- Made more changes to handle Macintosh OS. Mac version of FF doesn't work well with "keydown" event. Safari returns unicode for arrow keys. Added Safari and Opera detection. History command will only work on recognized browsers. All changes regression tested on previously used browsers on Windows XP. Ref: http://unixpapa.com/js/key.html Modified Paths: -------------- trunk/data/public/js/pfcclient.js Modified: trunk/data/public/js/pfcclient.js =================================================================== --- trunk/data/public/js/pfcclient.js 2007-08-08 20:32:35 UTC (rev 1101) +++ trunk/data/public/js/pfcclient.js 2007-08-08 22:01:19 UTC (rev 1102) @@ -2,6 +2,9 @@ var is_khtml = navigator.appName.match("Konqueror") || navigator.appVersion.match("KHTML"); var is_ff = navigator.appName.match("Netscape"); var is_ie7 = navigator.userAgent.indexOf('MSIE 7') > 0; +var is_opera = window.opera; +var is_safari = document.childNodes && !document.all && !navigator.taintEnabled && !accentColorName; + /** * This class is the client part of phpFreeChat * (depends on prototype library) @@ -627,6 +630,34 @@ { return this.doSendMessage(); } + else if (code == 38 && is_ff || code == 63232 && is_safari) // up arrow key + { + // write the last command in the history + if (this.cmdhistory.length>0) + { + var w = this.el_words; + if (this.cmdhistoryissearching == false && w.value != "") + this.cmdhistory.push(w.value); + this.cmdhistoryissearching = true; + this.cmdhistoryid = this.cmdhistoryid-1; + if (this.cmdhistoryid<0) this.cmdhistoryid = this.cmdhistory.length-1; + w.value = this.cmdhistory[this.cmdhistoryid]; + } + } + else if (code == 40 && is_ff || code == 63233 && is_safari) // down arrow key + { + // write the next command in the history + if (this.cmdhistory.length>0) + { + var w = this.el_words; + if (this.cmdhistoryissearching == false && w.value != "") + this.cmdhistory.push(w.value); + this.cmdhistoryissearching = true; + this.cmdhistoryid = this.cmdhistoryid+1; + if (this.cmdhistoryid>=this.cmdhistory.length) this.cmdhistoryid = 0; + w.value = this.cmdhistory[this.cmdhistoryid]; + } + } else { /* allow other keys */ @@ -649,7 +680,7 @@ this.completeNick(); return false; /* do not leave the tab key default behavior */ } - else if (code == 38) // up arrow key + else if (code == 38 && (is_ie || is_khtml || is_opera)) // up arrow key { // write the last command in the history if (this.cmdhistory.length>0) @@ -663,7 +694,7 @@ w.value = this.cmdhistory[this.cmdhistoryid]; } } - else if (code == 40) // down arrow key + else if (code == 40 && (is_ie || is_khtml || is_opera)) // down arrow key { // write the next command in the history if (this.cmdhistory.length>0) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gpi...@us...> - 2007-08-08 20:32:36
|
Revision: 1101 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1101&view=rev Author: gpinzone Date: 2007-08-08 13:32:35 -0700 (Wed, 08 Aug 2007) Log Message: ----------- Command history fix for IE. Changed keys to Arrow Up/Down to emulate functionality in most IRC clients. Explorer doesn't fire the "keypress" event for Page Up/Down. Moved code to "keydown" area since "keypress" detection is too unreliable for some browsers. Tested on FF 2, IE 6, IE 7, and Opera. Ref: http://www.quirksmode.org/js/keys.html Modified Paths: -------------- trunk/data/public/js/pfcclient.js Modified: trunk/data/public/js/pfcclient.js =================================================================== --- trunk/data/public/js/pfcclient.js 2007-08-08 07:17:57 UTC (rev 1100) +++ trunk/data/public/js/pfcclient.js 2007-08-08 20:32:35 UTC (rev 1101) @@ -25,9 +25,9 @@ this.chanmeta = $H(); this.nickwhoisbox = $H(); - // this array contains all the sent command - // used the up and down key to navigate in the history - // (doesn't work on IE6) + // this array contains all the sent commands + // use the up and down arrow key to navigate through the history + // may not work in Safari 1.3 this.cmdhistory = Array(); this.cmdhistoryid = -1; this.cmdhistoryissearching = false; @@ -627,8 +627,30 @@ { return this.doSendMessage(); } - else if (code == 33 && false) // page up key + else { + /* allow other keys */ + return true; + } + }, + /** + * Handle the pressed keys + * see also callbackWords_OnKeypress + */ + callbackWords_OnKeydown: function(evt) + { + if (!this.isconnected) return false; + this.clearError(Array(this.el_words)); + var code = (evt.which) ? evt.which : evt.keyCode + if (code == 9) /* tab key */ + { + /* IE workaround : ignore TAB key here */ + /* do the nickname completion work like on IRC */ + this.completeNick(); + return false; /* do not leave the tab key default behavior */ + } + else if (code == 38) // up arrow key + { // write the last command in the history if (this.cmdhistory.length>0) { @@ -641,7 +663,7 @@ w.value = this.cmdhistory[this.cmdhistoryid]; } } - else if (code == 34 && false) // page down key + else if (code == 40) // down arrow key { // write the next command in the history if (this.cmdhistory.length>0) @@ -657,31 +679,9 @@ } else { - /* allow other keys */ return true; } }, - /** - * Handle the pressed keys - * see also callbackWords_OnKeypress - */ - callbackWords_OnKeydown: function(evt) - { - if (!this.isconnected) return false; - this.clearError(Array(this.el_words)); - var code = (evt.which) ? evt.which : evt.keyCode - if (code == 9) /* tab key */ - { - /* IE workaround : ignore TAB key here */ - /* do the nickname completion work like on IRC */ - this.completeNick(); - return false; /* do not leave the tab key default behavior */ - } - else - { - return true; - } - }, callbackWords_OnFocus: function(evt) { // if (this.el_handle && this.el_handle.value == '' && !this.minmax_status) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2007-08-08 07:28:27
|
Revision: 1100 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1100&view=rev Author: kerphi Date: 2007-08-08 00:17:57 -0700 (Wed, 08 Aug 2007) Log Message: ----------- Fix the new cmdtoplay queue Modified Paths: -------------- trunk/src/pfccommand.class.php trunk/src/pfccontainer.class.php Modified: trunk/src/pfccommand.class.php =================================================================== --- trunk/src/pfccommand.class.php 2007-08-08 07:08:23 UTC (rev 1099) +++ trunk/src/pfccommand.class.php 2007-08-08 07:17:57 UTC (rev 1100) @@ -223,16 +223,14 @@ // Get all queued commands to be played $cmdtoplay_ids = $ct->getCmdMeta($nickid); - // process each command and parse content foreach ( $cmdtoplay_ids as $cid ) { // take a command from the list $cmdtoplay = $ct->getCmdMeta($nickid, $cid); - $cmdtoplay = ($cmdtoplay == NULL) ? array() : unserialize($cmdtoplay); - + $cmdtoplay = ($cmdtoplay == NULL || count($cmdtoplay) == 0) ? array() : unserialize($cmdtoplay[0]); + // play the command - // print_r($cmdtoplay); $cmd =& pfcCommand::Factory($cmdtoplay['cmdstr']); $cmdp = $cmdtoplay['params']; if (!isset($cmdp['param'])) $cmdp['param'] = ''; Modified: trunk/src/pfccontainer.class.php =================================================================== --- trunk/src/pfccontainer.class.php 2007-08-08 07:08:23 UTC (rev 1099) +++ trunk/src/pfccontainer.class.php 2007-08-08 07:17:57 UTC (rev 1100) @@ -523,7 +523,7 @@ function getCmdMeta($nickid, $key = NULL) { $ret = $this->getMeta("nickid-to-cmdtoplay", $nickid, $key, true); - return isset($ret['value'][0]) ? $ret['value'][0] : NULL; + return $ret['value']; } function setCmdMeta($nickid, $key, $value) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2007-08-08 07:08:20
|
Revision: 1099 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1099&view=rev Author: kerphi Date: 2007-08-08 00:08:23 -0700 (Wed, 08 Aug 2007) Log Message: ----------- remove users commands in queue when user disconnected from all the channels Modified Paths: -------------- trunk/src/pfccontainer.class.php Modified: trunk/src/pfccontainer.class.php =================================================================== --- trunk/src/pfccontainer.class.php 2007-08-08 03:39:04 UTC (rev 1098) +++ trunk/src/pfccontainer.class.php 2007-08-08 07:08:23 UTC (rev 1099) @@ -195,12 +195,11 @@ $this->rmMeta('metadata-to-nickid', 'nick', $this->encode($this->getNickname($nickid))); // remove disconnected nickname metadata $this->rmMeta('nickid-to-metadata', $nickid); + // remove users commands in queue + $this->rmMeta("nickid-to-cmdtoplay", $nickid); + $this->rmMeta("nickid-to-cmdtoplayid", $nickid); } - // remove users commands in queue - $this->rmMeta("nickid-to-cmdtoplay", $nickid); - $this->rmMeta("nickid-to-cmdtoplayid", $nickid); - return $deleted_user; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gpi...@us...> - 2007-08-08 03:39:03
|
Revision: 1098 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1098&view=rev Author: gpinzone Date: 2007-08-07 20:39:04 -0700 (Tue, 07 Aug 2007) Log Message: ----------- Cleanup of user commands on exit. Modified Paths: -------------- trunk/src/pfccontainer.class.php Modified: trunk/src/pfccontainer.class.php =================================================================== --- trunk/src/pfccontainer.class.php 2007-08-08 02:11:56 UTC (rev 1097) +++ trunk/src/pfccontainer.class.php 2007-08-08 03:39:04 UTC (rev 1098) @@ -197,6 +197,10 @@ $this->rmMeta('nickid-to-metadata', $nickid); } + // remove users commands in queue + $this->rmMeta("nickid-to-cmdtoplay", $nickid); + $this->rmMeta("nickid-to-cmdtoplayid", $nickid); + return $deleted_user; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gpi...@us...> - 2007-08-08 02:11:54
|
Revision: 1097 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1097&view=rev Author: gpinzone Date: 2007-08-07 19:11:56 -0700 (Tue, 07 Aug 2007) Log Message: ----------- Rewrite of "command to play" stack. Uses similar algorithm as messages. Modified Paths: -------------- trunk/src/pfccommand.class.php trunk/src/pfccontainer.class.php Modified: trunk/src/pfccommand.class.php =================================================================== --- trunk/src/pfccommand.class.php 2007-08-07 07:47:36 UTC (rev 1096) +++ trunk/src/pfccommand.class.php 2007-08-08 02:11:56 UTC (rev 1097) @@ -173,49 +173,68 @@ } } + /** + * Add command to be played onto command stack + * @param $nickid is the user that entered the command + * @param $cmdstr is the command + * @param $cmdp is the command's parameters + * @return false if $nickid is blank, true for all other values of $nickid + */ function AppendCmdToPlay($nickid, $cmdstr, $cmdp) { $c =& pfcGlobalConfig::Instance(); $u =& pfcUserConfig::Instance(); $ct =& pfcContainer::Instance(); - if ($nickid != "") - { - $cmdtoplay = $ct->getUserMeta($nickid, 'cmdtoplay'); - $cmdtoplay = ($cmdtoplay == NULL) ? array() : unserialize($cmdtoplay); - $cmdtmp = array(); - $cmdtmp['cmdstr'] = $cmdstr; - $cmdtmp['params'] = $cmdp; - $cmdtoplay[] = $cmdtmp; - $ct->setUserMeta($nickid, 'cmdtoplay', serialize($cmdtoplay)); - return true; - } + + // check for empty nickid + if ($nickid == "") return false; + + // get new command id + $cmdtoplay_id = $ct->incMeta("nickid-to-cmdtoplayid", $nickid, 'cmdtoplayid'); + if (count($cmdtoplay_id["value"]) == 0) + $cmdtoplay_id = 0; else - return false; + $cmdtoplay_id = $cmdtoplay_id["value"][0]; + + // create command array + $cmdtoplay = array(); + $cmdtoplay['cmdstr'] = $cmdstr; + $cmdtoplay['params'] = $cmdp; + + // store command to play + $ct->setCmdMeta($nickid, $cmdtoplay_id, serialize($cmdtoplay)); + + return true; } - function RunPendingCmdToPlay($nickid,$context,&$xml_reponse) + + /** + * Run all commands to be played for a user + * @param $nickid is the user that entered the command + * @param $context + * @param $xml_reponse + */ + function RunPendingCmdToPlay($nickid, $context, &$xml_reponse) { $c =& pfcGlobalConfig::Instance(); $u =& pfcUserConfig::Instance(); $ct =& pfcContainer::Instance(); - $morecmd = true; - while($morecmd) + // Get all queued commands to be played + $cmdtoplay_ids = $ct->getCmdMeta($nickid); + + // process each command and parse content + foreach ( $cmdtoplay_ids as $cid ) { // take a command from the list - $cmdtoplay = $ct->getUserMeta($nickid, 'cmdtoplay'); + $cmdtoplay = $ct->getCmdMeta($nickid, $cid); $cmdtoplay = ($cmdtoplay == NULL) ? array() : unserialize($cmdtoplay); - if (count($cmdtoplay) == 0) { $morecmd = false; break; } - // take the last posted command - $cmdtmp = array_pop($cmdtoplay); - // store the new cmdtoplay list (-1 item) - $ct->setUserMeta($nickid, 'cmdtoplay', serialize($cmdtoplay)); // play the command - // print_r($cmdtmp); - $cmd =& pfcCommand::Factory($cmdtmp['cmdstr']); - $cmdp = $cmdtmp['params']; + // print_r($cmdtoplay); + $cmd =& pfcCommand::Factory($cmdtoplay['cmdstr']); + $cmdp = $cmdtoplay['params']; if (!isset($cmdp['param'])) $cmdp['param'] = ''; if (!isset($cmdp['sender'])) $cmdp['sender'] = $context['sender']; if (!isset($cmdp['recipient'])) $cmdp['recipient'] = $context['recipient']; @@ -226,6 +245,9 @@ $cmd->run($xml_reponse, $cmdp); else @$cmd->run($xml_reponse, $cmdp); + + // delete command when complete + $ct->rmMeta("nickid-to-cmdtoplay", $nickid, $cid); } } Modified: trunk/src/pfccontainer.class.php =================================================================== --- trunk/src/pfccontainer.class.php 2007-08-07 07:47:36 UTC (rev 1096) +++ trunk/src/pfccontainer.class.php 2007-08-08 02:11:56 UTC (rev 1097) @@ -517,6 +517,18 @@ return $ret; } + function getCmdMeta($nickid, $key = NULL) + { + $ret = $this->getMeta("nickid-to-cmdtoplay", $nickid, $key, true); + return isset($ret['value'][0]) ? $ret['value'][0] : NULL; + } + + function setCmdMeta($nickid, $key, $value) + { + $ret = $this->setMeta("nickid-to-cmdtoplay", $nickid, $key, $value); + return $ret; + } + function getAllChanMeta($chan) { $result = array(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2007-08-07 07:47:36
|
Revision: 1096 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1096&view=rev Author: kerphi Date: 2007-08-07 00:47:36 -0700 (Tue, 07 Aug 2007) Log Message: ----------- german translation for "%s was invited by %s" Modified Paths: -------------- trunk/i18n/de_DE-formal/main.php trunk/i18n/de_DE-informal/main.php Modified: trunk/i18n/de_DE-formal/main.php =================================================================== --- trunk/i18n/de_DE-formal/main.php 2007-08-07 07:46:37 UTC (rev 1095) +++ trunk/i18n/de_DE-formal/main.php 2007-08-07 07:47:36 UTC (rev 1096) @@ -405,6 +405,6 @@ $GLOBALS["i18n"]["You are trying to speak to a unknown (or not connected) user"] = ""; // line 89 in invite.class.php -$GLOBALS["i18n"]["%s was invited by %s"] = ""; +$GLOBALS["i18n"]["%s was invited by %s"] = "%s wurde von %s eingeladen"; ?> \ No newline at end of file Modified: trunk/i18n/de_DE-informal/main.php =================================================================== --- trunk/i18n/de_DE-informal/main.php 2007-08-07 07:46:37 UTC (rev 1095) +++ trunk/i18n/de_DE-informal/main.php 2007-08-07 07:47:36 UTC (rev 1096) @@ -406,6 +406,6 @@ $GLOBALS["i18n"]["You are trying to speak to a unknown (or not connected) user"] = ""; // line 89 in invite.class.php -$GLOBALS["i18n"]["%s was invited by %s"] = ""; +$GLOBALS["i18n"]["%s was invited by %s"] = "%s wurde von %s eingeladen"; ?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2007-08-07 07:46:41
|
Revision: 1095 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1095&view=rev Author: kerphi Date: 2007-08-07 00:46:37 -0700 (Tue, 07 Aug 2007) Log Message: ----------- Translation fix: http://www.phpfreechat.net/forum/viewtopic.php?id=1749 Modified Paths: -------------- trunk/i18n/ar_LB/main.php trunk/i18n/ba_BA/main.php trunk/i18n/bg_BG/main.php trunk/i18n/bn_BD/main.php trunk/i18n/da_DK/main.php trunk/i18n/de_DE-formal/main.php trunk/i18n/de_DE-informal/main.php trunk/i18n/el_GR/main.php trunk/i18n/en_US/main.php trunk/i18n/eo/main.php trunk/i18n/es_ES/main.php trunk/i18n/fr_FR/main.php trunk/i18n/hr_HR/main.php trunk/i18n/hu_HU/main.php trunk/i18n/hy_AM/main.php trunk/i18n/id_ID/main.php trunk/i18n/it_IT/main.php trunk/i18n/ja_JP/main.php trunk/i18n/ko_KR/main.php trunk/i18n/nb_NO/main.php trunk/i18n/nl_NL/main.php trunk/i18n/nn_NO/main.php trunk/i18n/pl_PL/main.php trunk/i18n/pt_BR/main.php trunk/i18n/pt_PT/main.php trunk/i18n/ru_RU/main.php trunk/i18n/sr_CS/main.php trunk/i18n/sv_SE/main.php trunk/i18n/tr_TR/main.php trunk/i18n/uk_RO/main.php trunk/i18n/uk_UA/main.php trunk/i18n/vi_VN/main.php trunk/i18n/zh_CN/main.php trunk/i18n/zh_TW/main.php trunk/src/commands/invite.class.php Modified: trunk/i18n/ar_LB/main.php =================================================================== --- trunk/i18n/ar_LB/main.php 2007-08-07 07:43:58 UTC (rev 1094) +++ trunk/i18n/ar_LB/main.php 2007-08-07 07:46:37 UTC (rev 1095) @@ -396,4 +396,10 @@ // line 42 in ban.class.php $GLOBALS["i18n"]["%s banished from %s by %s"] = ""; +// line 461 in phpfreechat.class.php +$GLOBALS["i18n"]["You are trying to speak to a unknown (or not connected) user"] = ""; + +// line 89 in invite.class.php +$GLOBALS["i18n"]["%s was invited by %s"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/ba_BA/main.php =================================================================== --- trunk/i18n/ba_BA/main.php 2007-08-07 07:43:58 UTC (rev 1094) +++ trunk/i18n/ba_BA/main.php 2007-08-07 07:46:37 UTC (rev 1095) @@ -399,4 +399,10 @@ // line 42 in ban.class.php $GLOBALS["i18n"]["%s banished from %s by %s"] = ""; +// line 461 in phpfreechat.class.php +$GLOBALS["i18n"]["You are trying to speak to a unknown (or not connected) user"] = ""; + +// line 89 in invite.class.php +$GLOBALS["i18n"]["%s was invited by %s"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/bg_BG/main.php =================================================================== --- trunk/i18n/bg_BG/main.php 2007-08-07 07:43:58 UTC (rev 1094) +++ trunk/i18n/bg_BG/main.php 2007-08-07 07:46:37 UTC (rev 1095) @@ -394,4 +394,10 @@ // line 42 in ban.class.php $GLOBALS["i18n"]["%s banished from %s by %s"] = ""; +// line 461 in phpfreechat.class.php +$GLOBALS["i18n"]["You are trying to speak to a unknown (or not connected) user"] = ""; + +// line 89 in invite.class.php +$GLOBALS["i18n"]["%s was invited by %s"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/bn_BD/main.php =================================================================== --- trunk/i18n/bn_BD/main.php 2007-08-07 07:43:58 UTC (rev 1094) +++ trunk/i18n/bn_BD/main.php 2007-08-07 07:46:37 UTC (rev 1095) @@ -400,4 +400,10 @@ // line 42 in ban.class.php $GLOBALS["i18n"]["%s banished from %s by %s"] = ""; +// line 461 in phpfreechat.class.php +$GLOBALS["i18n"]["You are trying to speak to a unknown (or not connected) user"] = ""; + +// line 89 in invite.class.php +$GLOBALS["i18n"]["%s was invited by %s"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/da_DK/main.php =================================================================== --- trunk/i18n/da_DK/main.php 2007-08-07 07:43:58 UTC (rev 1094) +++ trunk/i18n/da_DK/main.php 2007-08-07 07:46:37 UTC (rev 1095) @@ -396,4 +396,10 @@ // line 42 in ban.class.php $GLOBALS["i18n"]["%s banished from %s by %s"] = ""; +// line 461 in phpfreechat.class.php +$GLOBALS["i18n"]["You are trying to speak to a unknown (or not connected) user"] = ""; + +// line 89 in invite.class.php +$GLOBALS["i18n"]["%s was invited by %s"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/de_DE-formal/main.php =================================================================== --- trunk/i18n/de_DE-formal/main.php 2007-08-07 07:43:58 UTC (rev 1094) +++ trunk/i18n/de_DE-formal/main.php 2007-08-07 07:46:37 UTC (rev 1095) @@ -401,4 +401,10 @@ // line 42 in ban.class.php $GLOBALS["i18n"]["%s banished from %s by %s"] = ""; +// line 461 in phpfreechat.class.php +$GLOBALS["i18n"]["You are trying to speak to a unknown (or not connected) user"] = ""; + +// line 89 in invite.class.php +$GLOBALS["i18n"]["%s was invited by %s"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/de_DE-informal/main.php =================================================================== --- trunk/i18n/de_DE-informal/main.php 2007-08-07 07:43:58 UTC (rev 1094) +++ trunk/i18n/de_DE-informal/main.php 2007-08-07 07:46:37 UTC (rev 1095) @@ -402,4 +402,10 @@ // line 42 in ban.class.php $GLOBALS["i18n"]["%s banished from %s by %s"] = ""; +// line 461 in phpfreechat.class.php +$GLOBALS["i18n"]["You are trying to speak to a unknown (or not connected) user"] = ""; + +// line 89 in invite.class.php +$GLOBALS["i18n"]["%s was invited by %s"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/el_GR/main.php =================================================================== --- trunk/i18n/el_GR/main.php 2007-08-07 07:43:58 UTC (rev 1094) +++ trunk/i18n/el_GR/main.php 2007-08-07 07:46:37 UTC (rev 1095) @@ -395,4 +395,10 @@ // line 42 in ban.class.php $GLOBALS["i18n"]["%s banished from %s by %s"] = ""; +// line 461 in phpfreechat.class.php +$GLOBALS["i18n"]["You are trying to speak to a unknown (or not connected) user"] = ""; + +// line 89 in invite.class.php +$GLOBALS["i18n"]["%s was invited by %s"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/en_US/main.php =================================================================== --- trunk/i18n/en_US/main.php 2007-08-07 07:43:58 UTC (rev 1094) +++ trunk/i18n/en_US/main.php 2007-08-07 07:46:37 UTC (rev 1095) @@ -381,7 +381,6 @@ // line 479 in phpfreechat.class.php $GLOBALS["i18n"]["Cancel"] = "Cancel"; - // line 430 in pfcglobalconfig.class.php $GLOBALS["i18n"]["cannot create %s"] = "cannot create %s"; @@ -397,4 +396,10 @@ // line 42 in ban.class.php $GLOBALS["i18n"]["%s banished from %s by %s"] = "%s banished from %s by %s"; +// line 461 in phpfreechat.class.php +$GLOBALS["i18n"]["You are trying to speak to a unknown (or not connected) user"] = "You are trying to speak to a unknown (or not connected) user"; + +// line 89 in invite.class.php +$GLOBALS["i18n"]["%s was invited by %s"] = "%s was invited by %s"; + ?> \ No newline at end of file Modified: trunk/i18n/eo/main.php =================================================================== --- trunk/i18n/eo/main.php 2007-08-07 07:43:58 UTC (rev 1094) +++ trunk/i18n/eo/main.php 2007-08-07 07:46:37 UTC (rev 1095) @@ -399,4 +399,10 @@ // line 42 in ban.class.php $GLOBALS["i18n"]["%s banished from %s by %s"] = ""; +// line 461 in phpfreechat.class.php +$GLOBALS["i18n"]["You are trying to speak to a unknown (or not connected) user"] = ""; + +// line 89 in invite.class.php +$GLOBALS["i18n"]["%s was invited by %s"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/es_ES/main.php =================================================================== --- trunk/i18n/es_ES/main.php 2007-08-07 07:43:58 UTC (rev 1094) +++ trunk/i18n/es_ES/main.php 2007-08-07 07:46:37 UTC (rev 1095) @@ -397,4 +397,10 @@ // line 42 in ban.class.php $GLOBALS["i18n"]["%s banished from %s by %s"] = ""; +// line 461 in phpfreechat.class.php +$GLOBALS["i18n"]["You are trying to speak to a unknown (or not connected) user"] = ""; + +// line 89 in invite.class.php +$GLOBALS["i18n"]["%s was invited by %s"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/fr_FR/main.php =================================================================== --- trunk/i18n/fr_FR/main.php 2007-08-07 07:43:58 UTC (rev 1094) +++ trunk/i18n/fr_FR/main.php 2007-08-07 07:46:37 UTC (rev 1095) @@ -396,4 +396,10 @@ // line 42 in ban.class.php $GLOBALS["i18n"]["%s banished from %s by %s"] = "%s banni de %s par %s"; +// line 461 in phpfreechat.class.php +$GLOBALS["i18n"]["You are trying to speak to a unknown (or not connected) user"] = "Vous essayez de parler à un utilisateur inconnu (ou inconnu)"; + +// line 89 in invite.class.php +$GLOBALS["i18n"]["%s was invited by %s"] = "%s a été invité par %s"; + ?> \ No newline at end of file Modified: trunk/i18n/hr_HR/main.php =================================================================== --- trunk/i18n/hr_HR/main.php 2007-08-07 07:43:58 UTC (rev 1094) +++ trunk/i18n/hr_HR/main.php 2007-08-07 07:46:37 UTC (rev 1095) @@ -399,4 +399,10 @@ // line 42 in ban.class.php $GLOBALS["i18n"]["%s banished from %s by %s"] = ""; +// line 461 in phpfreechat.class.php +$GLOBALS["i18n"]["You are trying to speak to a unknown (or not connected) user"] = ""; + +// line 89 in invite.class.php +$GLOBALS["i18n"]["%s was invited by %s"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/hu_HU/main.php =================================================================== --- trunk/i18n/hu_HU/main.php 2007-08-07 07:43:58 UTC (rev 1094) +++ trunk/i18n/hu_HU/main.php 2007-08-07 07:46:37 UTC (rev 1095) @@ -399,4 +399,10 @@ // line 42 in ban.class.php $GLOBALS["i18n"]["%s banished from %s by %s"] = ""; +// line 461 in phpfreechat.class.php +$GLOBALS["i18n"]["You are trying to speak to a unknown (or not connected) user"] = ""; + +// line 89 in invite.class.php +$GLOBALS["i18n"]["%s was invited by %s"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/hy_AM/main.php =================================================================== --- trunk/i18n/hy_AM/main.php 2007-08-07 07:43:58 UTC (rev 1094) +++ trunk/i18n/hy_AM/main.php 2007-08-07 07:46:37 UTC (rev 1095) @@ -399,4 +399,10 @@ // line 42 in ban.class.php $GLOBALS["i18n"]["%s banished from %s by %s"] = ""; +// line 461 in phpfreechat.class.php +$GLOBALS["i18n"]["You are trying to speak to a unknown (or not connected) user"] = ""; + +// line 89 in invite.class.php +$GLOBALS["i18n"]["%s was invited by %s"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/id_ID/main.php =================================================================== --- trunk/i18n/id_ID/main.php 2007-08-07 07:43:58 UTC (rev 1094) +++ trunk/i18n/id_ID/main.php 2007-08-07 07:46:37 UTC (rev 1095) @@ -399,4 +399,10 @@ // line 42 in ban.class.php $GLOBALS["i18n"]["%s banished from %s by %s"] = ""; +// line 461 in phpfreechat.class.php +$GLOBALS["i18n"]["You are trying to speak to a unknown (or not connected) user"] = ""; + +// line 89 in invite.class.php +$GLOBALS["i18n"]["%s was invited by %s"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/it_IT/main.php =================================================================== --- trunk/i18n/it_IT/main.php 2007-08-07 07:43:58 UTC (rev 1094) +++ trunk/i18n/it_IT/main.php 2007-08-07 07:46:37 UTC (rev 1095) @@ -400,4 +400,10 @@ // line 42 in ban.class.php $GLOBALS["i18n"]["%s banished from %s by %s"] = ""; +// line 461 in phpfreechat.class.php +$GLOBALS["i18n"]["You are trying to speak to a unknown (or not connected) user"] = ""; + +// line 89 in invite.class.php +$GLOBALS["i18n"]["%s was invited by %s"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/ja_JP/main.php =================================================================== --- trunk/i18n/ja_JP/main.php 2007-08-07 07:43:58 UTC (rev 1094) +++ trunk/i18n/ja_JP/main.php 2007-08-07 07:46:37 UTC (rev 1095) @@ -397,4 +397,10 @@ // line 42 in ban.class.php $GLOBALS["i18n"]["%s banished from %s by %s"] = ""; +// line 461 in phpfreechat.class.php +$GLOBALS["i18n"]["You are trying to speak to a unknown (or not connected) user"] = ""; + +// line 89 in invite.class.php +$GLOBALS["i18n"]["%s was invited by %s"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/ko_KR/main.php =================================================================== --- trunk/i18n/ko_KR/main.php 2007-08-07 07:43:58 UTC (rev 1094) +++ trunk/i18n/ko_KR/main.php 2007-08-07 07:46:37 UTC (rev 1095) @@ -398,4 +398,10 @@ // line 42 in ban.class.php $GLOBALS["i18n"]["%s banished from %s by %s"] = ""; +// line 461 in phpfreechat.class.php +$GLOBALS["i18n"]["You are trying to speak to a unknown (or not connected) user"] = ""; + +// line 89 in invite.class.php +$GLOBALS["i18n"]["%s was invited by %s"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/nb_NO/main.php =================================================================== --- trunk/i18n/nb_NO/main.php 2007-08-07 07:43:58 UTC (rev 1094) +++ trunk/i18n/nb_NO/main.php 2007-08-07 07:46:37 UTC (rev 1095) @@ -396,4 +396,10 @@ // line 42 in ban.class.php $GLOBALS["i18n"]["%s banished from %s by %s"] = ""; +// line 461 in phpfreechat.class.php +$GLOBALS["i18n"]["You are trying to speak to a unknown (or not connected) user"] = ""; + +// line 89 in invite.class.php +$GLOBALS["i18n"]["%s was invited by %s"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/nl_NL/main.php =================================================================== --- trunk/i18n/nl_NL/main.php 2007-08-07 07:43:58 UTC (rev 1094) +++ trunk/i18n/nl_NL/main.php 2007-08-07 07:46:37 UTC (rev 1095) @@ -397,4 +397,10 @@ // line 42 in ban.class.php $GLOBALS["i18n"]["%s banished from %s by %s"] = ""; +// line 461 in phpfreechat.class.php +$GLOBALS["i18n"]["You are trying to speak to a unknown (or not connected) user"] = ""; + +// line 89 in invite.class.php +$GLOBALS["i18n"]["%s was invited by %s"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/nn_NO/main.php =================================================================== --- trunk/i18n/nn_NO/main.php 2007-08-07 07:43:58 UTC (rev 1094) +++ trunk/i18n/nn_NO/main.php 2007-08-07 07:46:37 UTC (rev 1095) @@ -397,4 +397,10 @@ // line 42 in ban.class.php $GLOBALS["i18n"]["%s banished from %s by %s"] = ""; +// line 461 in phpfreechat.class.php +$GLOBALS["i18n"]["You are trying to speak to a unknown (or not connected) user"] = ""; + +// line 89 in invite.class.php +$GLOBALS["i18n"]["%s was invited by %s"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/pl_PL/main.php =================================================================== --- trunk/i18n/pl_PL/main.php 2007-08-07 07:43:58 UTC (rev 1094) +++ trunk/i18n/pl_PL/main.php 2007-08-07 07:46:37 UTC (rev 1095) @@ -399,4 +399,10 @@ // line 42 in ban.class.php $GLOBALS["i18n"]["%s banished from %s by %s"] = ""; +// line 461 in phpfreechat.class.php +$GLOBALS["i18n"]["You are trying to speak to a unknown (or not connected) user"] = ""; + +// line 89 in invite.class.php +$GLOBALS["i18n"]["%s was invited by %s"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/pt_BR/main.php =================================================================== --- trunk/i18n/pt_BR/main.php 2007-08-07 07:43:58 UTC (rev 1094) +++ trunk/i18n/pt_BR/main.php 2007-08-07 07:46:37 UTC (rev 1095) @@ -401,4 +401,10 @@ // line 42 in ban.class.php $GLOBALS["i18n"]["%s banished from %s by %s"] = ""; +// line 461 in phpfreechat.class.php +$GLOBALS["i18n"]["You are trying to speak to a unknown (or not connected) user"] = ""; + +// line 89 in invite.class.php +$GLOBALS["i18n"]["%s was invited by %s"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/pt_PT/main.php =================================================================== --- trunk/i18n/pt_PT/main.php 2007-08-07 07:43:58 UTC (rev 1094) +++ trunk/i18n/pt_PT/main.php 2007-08-07 07:46:37 UTC (rev 1095) @@ -397,4 +397,10 @@ // line 42 in ban.class.php $GLOBALS["i18n"]["%s banished from %s by %s"] = ""; +// line 461 in phpfreechat.class.php +$GLOBALS["i18n"]["You are trying to speak to a unknown (or not connected) user"] = ""; + +// line 89 in invite.class.php +$GLOBALS["i18n"]["%s was invited by %s"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/ru_RU/main.php =================================================================== --- trunk/i18n/ru_RU/main.php 2007-08-07 07:43:58 UTC (rev 1094) +++ trunk/i18n/ru_RU/main.php 2007-08-07 07:46:37 UTC (rev 1095) @@ -402,4 +402,10 @@ // line 42 in ban.class.php $GLOBALS["i18n"]["%s banished from %s by %s"] = ""; +// line 461 in phpfreechat.class.php +$GLOBALS["i18n"]["You are trying to speak to a unknown (or not connected) user"] = ""; + +// line 89 in invite.class.php +$GLOBALS["i18n"]["%s was invited by %s"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/sr_CS/main.php =================================================================== --- trunk/i18n/sr_CS/main.php 2007-08-07 07:43:58 UTC (rev 1094) +++ trunk/i18n/sr_CS/main.php 2007-08-07 07:46:37 UTC (rev 1095) @@ -399,4 +399,10 @@ // line 42 in ban.class.php $GLOBALS["i18n"]["%s banished from %s by %s"] = ""; +// line 461 in phpfreechat.class.php +$GLOBALS["i18n"]["You are trying to speak to a unknown (or not connected) user"] = ""; + +// line 89 in invite.class.php +$GLOBALS["i18n"]["%s was invited by %s"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/sv_SE/main.php =================================================================== --- trunk/i18n/sv_SE/main.php 2007-08-07 07:43:58 UTC (rev 1094) +++ trunk/i18n/sv_SE/main.php 2007-08-07 07:46:37 UTC (rev 1095) @@ -405,4 +405,10 @@ // line 42 in ban.class.php $GLOBALS["i18n"]["%s banished from %s by %s"] = ""; +// line 461 in phpfreechat.class.php +$GLOBALS["i18n"]["You are trying to speak to a unknown (or not connected) user"] = ""; + +// line 89 in invite.class.php +$GLOBALS["i18n"]["%s was invited by %s"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/tr_TR/main.php =================================================================== --- trunk/i18n/tr_TR/main.php 2007-08-07 07:43:58 UTC (rev 1094) +++ trunk/i18n/tr_TR/main.php 2007-08-07 07:46:37 UTC (rev 1095) @@ -396,4 +396,10 @@ // line 42 in ban.class.php $GLOBALS["i18n"]["%s banished from %s by %s"] = ""; +// line 461 in phpfreechat.class.php +$GLOBALS["i18n"]["You are trying to speak to a unknown (or not connected) user"] = ""; + +// line 89 in invite.class.php +$GLOBALS["i18n"]["%s was invited by %s"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/uk_RO/main.php =================================================================== --- trunk/i18n/uk_RO/main.php 2007-08-07 07:43:58 UTC (rev 1094) +++ trunk/i18n/uk_RO/main.php 2007-08-07 07:46:37 UTC (rev 1095) @@ -396,4 +396,10 @@ // line 42 in ban.class.php $GLOBALS["i18n"]["%s banished from %s by %s"] = ""; +// line 461 in phpfreechat.class.php +$GLOBALS["i18n"]["You are trying to speak to a unknown (or not connected) user"] = ""; + +// line 89 in invite.class.php +$GLOBALS["i18n"]["%s was invited by %s"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/uk_UA/main.php =================================================================== --- trunk/i18n/uk_UA/main.php 2007-08-07 07:43:58 UTC (rev 1094) +++ trunk/i18n/uk_UA/main.php 2007-08-07 07:46:37 UTC (rev 1095) @@ -396,4 +396,10 @@ // line 42 in ban.class.php $GLOBALS["i18n"]["%s banished from %s by %s"] = ""; +// line 461 in phpfreechat.class.php +$GLOBALS["i18n"]["You are trying to speak to a unknown (or not connected) user"] = ""; + +// line 89 in invite.class.php +$GLOBALS["i18n"]["%s was invited by %s"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/vi_VN/main.php =================================================================== --- trunk/i18n/vi_VN/main.php 2007-08-07 07:43:58 UTC (rev 1094) +++ trunk/i18n/vi_VN/main.php 2007-08-07 07:46:37 UTC (rev 1095) @@ -397,4 +397,10 @@ // line 42 in ban.class.php $GLOBALS["i18n"]["%s banished from %s by %s"] = ""; +// line 461 in phpfreechat.class.php +$GLOBALS["i18n"]["You are trying to speak to a unknown (or not connected) user"] = ""; + +// line 89 in invite.class.php +$GLOBALS["i18n"]["%s was invited by %s"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/zh_CN/main.php =================================================================== --- trunk/i18n/zh_CN/main.php 2007-08-07 07:43:58 UTC (rev 1094) +++ trunk/i18n/zh_CN/main.php 2007-08-07 07:46:37 UTC (rev 1095) @@ -398,4 +398,10 @@ // line 42 in ban.class.php $GLOBALS["i18n"]["%s banished from %s by %s"] = ""; +// line 461 in phpfreechat.class.php +$GLOBALS["i18n"]["You are trying to speak to a unknown (or not connected) user"] = ""; + +// line 89 in invite.class.php +$GLOBALS["i18n"]["%s was invited by %s"] = ""; + ?> \ No newline at end of file Modified: trunk/i18n/zh_TW/main.php =================================================================== --- trunk/i18n/zh_TW/main.php 2007-08-07 07:43:58 UTC (rev 1094) +++ trunk/i18n/zh_TW/main.php 2007-08-07 07:46:37 UTC (rev 1095) @@ -396,4 +396,10 @@ // line 42 in ban.class.php $GLOBALS["i18n"]["%s banished from %s by %s"] = ""; +// line 461 in phpfreechat.class.php +$GLOBALS["i18n"]["You are trying to speak to a unknown (or not connected) user"] = ""; + +// line 89 in invite.class.php +$GLOBALS["i18n"]["%s was invited by %s"] = ""; + ?> \ No newline at end of file Modified: trunk/src/commands/invite.class.php =================================================================== --- trunk/src/commands/invite.class.php 2007-08-07 07:43:58 UTC (rev 1094) +++ trunk/src/commands/invite.class.php 2007-08-07 07:46:37 UTC (rev 1095) @@ -86,7 +86,7 @@ // notify the aimed channel that a user has been invited $cmdp = array(); - $cmdp["param"] = $nicktoinvite.' was invited by '.$sender; + $cmdp["param"] = _pfc("%s was invited by %s",$nicktoinvite,$sender); $cmdp["flag"] = 1; $cmdp["recipient"] = pfcCommand_join::GetRecipient($channeltarget); $cmdp["recipientid"] = pfcCommand_join::GetRecipientId($channeltarget); @@ -94,4 +94,4 @@ $cmd->run($xml_reponse, $cmdp); } } -?> \ No newline at end of file +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2007-08-07 07:43:56
|
Revision: 1094 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1094&view=rev Author: kerphi Date: 2007-08-07 00:43:58 -0700 (Tue, 07 Aug 2007) Log Message: ----------- typo Modified Paths: -------------- trunk/src/pfci18n.class.php Modified: trunk/src/pfci18n.class.php =================================================================== --- trunk/src/pfci18n.class.php 2007-08-06 23:58:20 UTC (rev 1093) +++ trunk/src/pfci18n.class.php 2007-08-07 07:43:58 UTC (rev 1094) @@ -103,7 +103,7 @@ */ function GetAcceptedLanguage($type="main") { - return /*<GetAcceptedLanguage>*/array('ar_LB','sv_SE','uk_RO','ja_JP','ba_BA','pt_PT','el_GR','tr_TR','nb_NO','zh_TW','ru_RU','hy_AM','fr_FR','es_ES','bg_BG','zh_CN','nl_NL','eo','bn_BD','uk_UA','de_DE-informal','pl_PL','pt_BR','it_IT','id_ID','hu_HU','en_US','sr_CS','de_DE-formal','ko_KR','da_DK','nn_NO','vi_VN','hr_HR');/*</GetAcceptedLanguage>*/ + return /*<GetAcceptedLanguage>*/array('pl_PL','pt_BR','da_DK','uk_UA','nb_NO','fr_FR','hr_HR','vi_VN','hy_AM','ru_RU','eo','en_US','es_ES','ko_KR','ba_BA','zh_TW','zh_CN','it_IT','el_GR','uk_RO','pt_PT','sr_CS','tr_TR','de_DE-informal','de_DE-formal','ja_JP','sv_SE','bn_BD','nl_NL','ar_LB','hu_HU','nn_NO','bg_BG','id_ID');/*</GetAcceptedLanguage>*/ } /** @@ -127,7 +127,7 @@ $data = preg_replace("/(\/\*<GetAcceptedLanguage>\*\/)(.*)(\/\*<\/GetAcceptedLanguage>\*\/)/", "$1".$i18n_accepted_lang_str."$3", $data); - file_put_contents(__FILE__, $data, FILE_EX); + file_put_contents(__FILE__, $data, LOCK_EX); // Now scan the source code in order to find "_pfc" patterns $files = array(); @@ -187,7 +187,7 @@ $content = "<?php" . $old_content . $new_content . "?>"; //echo $content; - file_put_contents($dst_filename, $content, FILE_EX); + file_put_contents($dst_filename, $content, LOCK_EX); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gpi...@us...> - 2007-08-06 23:58:21
|
Revision: 1093 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1093&view=rev Author: gpinzone Date: 2007-08-06 16:58:20 -0700 (Mon, 06 Aug 2007) Log Message: ----------- Changed popMeta to act more like a traditional pop command than a drop in replacement for existing algorithm. Cleaned up setMeta. Modified Paths: -------------- trunk/src/containers/file.class.php Modified: trunk/src/containers/file.class.php =================================================================== --- trunk/src/containers/file.class.php 2007-08-06 19:59:53 UTC (rev 1092) +++ trunk/src/containers/file.class.php 2007-08-06 23:58:20 UTC (rev 1093) @@ -248,35 +248,33 @@ { $ret["value"][] = chop(fread($fh, filesize($leaffilename))); $ret["timestamp"][] = filemtime($leaffilename); - $leafvalue = $ret; - array_pop($leafvalue); + $leafvalue = array_pop($ret); // check if array is now empty - if (count($leafvalue) == 0) + if (count($ret) == 0) { + fclose($fh); unlink($leaffilename); break; } rewind($fh); - fwrite($fh, $leafvalue); + fwrite($fh, $ret); fflush($fh); ftruncate($fh, ftell($fh)); flock($fh, LOCK_UN); + fclose($fh); break; } // If flock is working properly, this will never be reached $delay = rand(0, pow(2, ($i+1)) - 1) * 5000; // Exponential backoff usleep($delay); } - fclose($fh); + $ret = $leafvalue; } else { + // return empty array return $ret; } - - $ret["value"][] = $leafvalue; - $ret["timestamp"][] = filemtime($leaffilename); - return $ret; } @@ -295,11 +293,6 @@ // create or replace metadata file $leaffilename = $dir."/".$leaf; - // create return array - $ret = array(); - $ret["timestamp"] = array(); - $ret["value"] = array(); - // read and increment data from metadata file clearstatcache(); if ( $leafexists = file_exists($leaffilename) ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gpi...@us...> - 2007-08-06 19:59:51
|
Revision: 1092 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1092&view=rev Author: gpinzone Date: 2007-08-06 12:59:53 -0700 (Mon, 06 Aug 2007) Log Message: ----------- Added pushMeta and popMeta for future enhancement to AppendCmdToPlay and RunPendingCmdToPlay functions. Modified Paths: -------------- trunk/src/containers/file.class.php Modified: trunk/src/containers/file.class.php =================================================================== --- trunk/src/containers/file.class.php 2007-08-06 19:55:21 UTC (rev 1091) +++ trunk/src/containers/file.class.php 2007-08-06 19:59:53 UTC (rev 1092) @@ -217,6 +217,127 @@ return $ret; } + + function popMeta($group, $subgroup, $leaf) + { + $c =& pfcGlobalConfig::Instance(); + if ($c->debug) + file_put_contents("/tmp/debug", "\npopMeta(".$group.",".$subgroup.",".$leaf.")", FILE_APPEND | LOCK_EX); + + // create directories + $dir_base = $c->container_cfg_server_dir; + $dir = $dir_base.'/'.$group.'/'.$subgroup; + if (!is_dir($dir)) mkdir_r($dir); + + // create or replace metadata file + $leaffilename = $dir."/".$leaf; + + // create return array + $ret = array(); + $ret["timestamp"] = array(); + $ret["value"] = array(); + + // read and increment data from metadata file + clearstatcache(); + if (file_exists($leaffilename)) + { + $fh = fopen($leaffilename, 'r+'); + for($i = 0; $i < 10; $i++) // Try 10 times until an exclusive lock can be obtained + { + if (flock($fh, LOCK_EX)) + { + $ret["value"][] = chop(fread($fh, filesize($leaffilename))); + $ret["timestamp"][] = filemtime($leaffilename); + $leafvalue = $ret; + array_pop($leafvalue); + // check if array is now empty + if (count($leafvalue) == 0) + { + unlink($leaffilename); + break; + } + rewind($fh); + fwrite($fh, $leafvalue); + fflush($fh); + ftruncate($fh, ftell($fh)); + flock($fh, LOCK_UN); + break; + } + // If flock is working properly, this will never be reached + $delay = rand(0, pow(2, ($i+1)) - 1) * 5000; // Exponential backoff + usleep($delay); + } + fclose($fh); + } + else + { + return $ret; + } + + $ret["value"][] = $leafvalue; + $ret["timestamp"][] = filemtime($leaffilename); + + return $ret; + } + + + function pushMeta($group, $subgroup, $leaf, $leafvalue = NULL) + { + $c =& pfcGlobalConfig::Instance(); + if ($c->debug) + file_put_contents("/tmp/debug", "\npushMeta(".$group.",".$subgroup.",".$leaf.",".$leafvalue.")", FILE_APPEND | LOCK_EX); + + // create directories + $dir_base = $c->container_cfg_server_dir; + $dir = $dir_base.'/'.$group.'/'.$subgroup; + if (!is_dir($dir)) mkdir_r($dir); + + // create or replace metadata file + $leaffilename = $dir."/".$leaf; + + // create return array + $ret = array(); + $ret["timestamp"] = array(); + $ret["value"] = array(); + + // read and increment data from metadata file + clearstatcache(); + if ( $leafexists = file_exists($leaffilename) ) + { + $fh = fopen($leaffilename, 'r+'); + for($i = 0; $i < 10; $i++) // Try 10 times until an exclusive lock can be obtained + { + if (flock($fh, LOCK_EX)) + { + if ( $leafvalue == NULL ) $leafvalue = ''; + $leafvaltmp = chop(fread($fh, filesize($leaffilename))); + array_push($leafvaltmp, $leafvalue); + rewind($fh); + fwrite($fh, $leafvaltmp); + fflush($fh); + ftruncate($fh, ftell($fh)); + flock($fh, LOCK_UN); + break; + } + // If flock is working properly, this will never be reached + $delay = rand(0, pow(2, ($i+1)) - 1) * 5000; // Exponential backoff + usleep($delay); + } + fclose($fh); + } + else + { + file_put_contents($leaffilename, $leafvalue, LOCK_EX); + } + + if ($leafexists) + return 1; // value overwritten + else + return 0; // value created + } + + + function rmMeta($group, $subgroup = null, $leaf = null) { $c =& pfcGlobalConfig::Instance(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gpi...@us...> - 2007-08-06 19:55:20
|
Revision: 1091 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1091&view=rev Author: gpinzone Date: 2007-08-06 12:55:21 -0700 (Mon, 06 Aug 2007) Log Message: ----------- Simplified RunPendingCmdToPlay Modified Paths: -------------- trunk/src/pfccommand.class.php Modified: trunk/src/pfccommand.class.php =================================================================== --- trunk/src/pfccommand.class.php 2007-08-06 15:19:59 UTC (rev 1090) +++ trunk/src/pfccommand.class.php 2007-08-06 19:55:21 UTC (rev 1091) @@ -206,7 +206,7 @@ // take a command from the list $cmdtoplay = $ct->getUserMeta($nickid, 'cmdtoplay'); $cmdtoplay = ($cmdtoplay == NULL) ? array() : unserialize($cmdtoplay); - if (count($cmdtoplay) == 0) { $morecmd = false; continue; } + if (count($cmdtoplay) == 0) { $morecmd = false; break; } // take the last posted command $cmdtmp = array_pop($cmdtoplay); // store the new cmdtoplay list (-1 item) @@ -226,12 +226,6 @@ $cmd->run($xml_reponse, $cmdp); else @$cmd->run($xml_reponse, $cmdp); - - // check if there is other command to play - $cmdtoplay = $ct->getUserMeta($nickid, 'cmdtoplay'); - $cmdtoplay = ($cmdtoplay == NULL) ? array() : unserialize($cmdtoplay); - - $morecmd = (count($cmdtoplay) > 0); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2007-08-06 15:19:58
|
Revision: 1090 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1090&view=rev Author: kerphi Date: 2007-08-06 08:19:59 -0700 (Mon, 06 Aug 2007) Log Message: ----------- Optimize the mysql inMeta method by using the mysql LAST_INSERT_ID command ( see http://dev.mysql.com/doc/refman/5.0/en/innodb-locking-reads.html ) Modified Paths: -------------- trunk/src/containers/mysql.class.php Modified: trunk/src/containers/mysql.class.php =================================================================== --- trunk/src/containers/mysql.class.php 2007-08-06 15:18:53 UTC (rev 1089) +++ trunk/src/containers/mysql.class.php 2007-08-06 15:19:59 UTC (rev 1090) @@ -276,11 +276,10 @@ $time = time(); // search for the existing leafvalue - mysql_query('LOCK TABLES '.$c->container_cfg_mysql_table.' WRITE;', $db); - $sql_select = "SELECT leafvalue FROM ".$c->container_cfg_mysql_table." WHERE `server`='$server' AND `group`='$group' AND `subgroup`='$subgroup' AND `leaf`='$leaf' LIMIT 1"; - $res = mysql_query($sql_select, $db); + $sql_count = "SELECT COUNT(*) AS C FROM ".$c->container_cfg_mysql_table." WHERE `server`='$server' AND `group`='$group' AND `subgroup`='$subgroup' AND `leaf`='$leaf' LIMIT 1"; + $res = mysql_query($sql_count, $db); $row = mysql_fetch_array($res, MYSQL_ASSOC); - if( !isset($row['leafvalue']) ) + if( $row['C'] == 0 ) { if ($c->debug) file_put_contents("/tmp/debug.txt", "\nsetSQL(".$sql_insert.")", FILE_APPEND | LOCK_EX); @@ -292,11 +291,12 @@ { if ($c->debug) file_put_contents("/tmp/debug.txt", "\nsetSQL(".$sql_update.")", FILE_APPEND | LOCK_EX); - $leafvalue = $row['leafvalue'] + 1; - $sql_update="UPDATE ".$c->container_cfg_mysql_table." SET `leafvalue`='".$leafvalue."', `timestamp`='".$time."' WHERE `server`='$server' AND `group`='$group' AND `subgroup`='$subgroup' AND `leaf`='$leaf'"; + $sql_update="UPDATE ".$c->container_cfg_mysql_table." SET `leafvalue`= LAST_INSERT_ID( leafvalue + 1 ), `timestamp`='".$time."' WHERE `server`='$server' AND `group`='$group' AND `subgroup`='$subgroup' AND `leaf`='$leaf'"; mysql_query($sql_update, $db); + $res = mysql_query('SELECT LAST_INSERT_ID();', $db); + $row = mysql_fetch_array($res, MYSQL_ASSOC); + $leafvalue = $row['LAST_INSERT_ID()']; } - mysql_query('UNLOCK TABLES;', $db); $ret["value"][] = $leafvalue; $ret["timestamp"][] = $time; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2007-08-06 15:18:50
|
Revision: 1089 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1089&view=rev Author: kerphi Date: 2007-08-06 08:18:53 -0700 (Mon, 06 Aug 2007) Log Message: ----------- Oups the incMeta code was duplicated Modified Paths: -------------- trunk/src/pfccontainer.class.php Modified: trunk/src/pfccontainer.class.php =================================================================== --- trunk/src/pfccontainer.class.php 2007-08-06 14:52:30 UTC (rev 1088) +++ trunk/src/pfccontainer.class.php 2007-08-06 15:18:53 UTC (rev 1089) @@ -668,33 +668,6 @@ return $ret; } - - function incMeta($group, $subgroup, $leaf) - { - $ret = $this->_container->incMeta($group, $subgroup, $leaf); - - if ($this->_usememorycache) - { - // store the modifications in the cache - if (isset($this->_cache[$group]['value']) && - !in_array($subgroup, $this->_cache[$group]['value'])) - { - $this->_cache[$group]['value'][] = $subgroup; - $this->_cache[$group]['timestamp'][] = time(); - } - if (isset($this->_cache[$group]['childs'][$subgroup]['value']) && - !in_array($leaf, $this->_cache[$group]['childs'][$subgroup]['value'])) - { - $this->_cache[$group]['childs'][$subgroup]['value'][] = $leaf; - $this->_cache[$group]['childs'][$subgroup]['timestamp'][] = time(); - } - $this->_cache[$group]['childs'][$subgroup]['childs'][$leaf]['value'] = array($leafvalue); - $this->_cache[$group]['childs'][$subgroup]['childs'][$leaf]['timestamp'] = array(time()); - } - - return $ret; - } - /** * Increment a counter identified by the following path : group / subgroup / leaf * Notice: this step must be atomic in order to avoid multithread problem (don't forget to use locking features) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2007-08-06 14:52:28
|
Revision: 1088 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1088&view=rev Author: kerphi Date: 2007-08-06 07:52:30 -0700 (Mon, 06 Aug 2007) Log Message: ----------- Oups the mysql table should not be hardcoded. Modified Paths: -------------- trunk/src/containers/mysql.class.php Modified: trunk/src/containers/mysql.class.php =================================================================== --- trunk/src/containers/mysql.class.php 2007-08-06 14:44:57 UTC (rev 1087) +++ trunk/src/containers/mysql.class.php 2007-08-06 14:52:30 UTC (rev 1088) @@ -276,7 +276,7 @@ $time = time(); // search for the existing leafvalue - mysql_query('LOCK TABLES phpfreechat WRITE;', $db); + mysql_query('LOCK TABLES '.$c->container_cfg_mysql_table.' WRITE;', $db); $sql_select = "SELECT leafvalue FROM ".$c->container_cfg_mysql_table." WHERE `server`='$server' AND `group`='$group' AND `subgroup`='$subgroup' AND `leaf`='$leaf' LIMIT 1"; $res = mysql_query($sql_select, $db); $row = mysql_fetch_array($res, MYSQL_ASSOC); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2007-08-06 14:44:56
|
Revision: 1087 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1087&view=rev Author: kerphi Date: 2007-08-06 07:44:57 -0700 (Mon, 06 Aug 2007) Log Message: ----------- Now msgid are requested in an atomic process. It prevents corruption problems with multithreaded access. (thanks to Gerard Pinzone) Modified Paths: -------------- trunk/src/containers/file.class.php trunk/src/containers/mysql.class.php trunk/src/pfccontainer.class.php Modified: trunk/src/containers/file.class.php =================================================================== --- trunk/src/containers/file.class.php 2007-08-06 13:47:13 UTC (rev 1086) +++ trunk/src/containers/file.class.php 2007-08-06 14:44:57 UTC (rev 1087) @@ -171,7 +171,6 @@ // create directories $dir_base = $c->container_cfg_server_dir; $dir = $dir_base.'/'.$group.'/'.$subgroup; - if (!is_dir($dir)) mkdir_r($dir); // create or replace metadata file @@ -202,22 +201,21 @@ } // If flock is working properly, this will never be reached $delay = rand(0, pow(2, ($i+1)) - 1) * 5000; // Exponential backoff - echo "try=".$i." ".$delay."\n"; - usleep($delay); + usleep($delay); } fclose($fh); } else { $leafvalue="1"; - file_put_contents($leaffilename, $leafvalue, LOCK_EX); + file_put_contents($leaffilename, $leafvalue, LOCK_EX); } $ret["value"][] = $leafvalue; $ret["timestamp"][] = filemtime($leaffilename); return $ret; - } + } function rmMeta($group, $subgroup = null, $leaf = null) { @@ -283,4 +281,4 @@ } -?> \ No newline at end of file +?> Modified: trunk/src/containers/mysql.class.php =================================================================== --- trunk/src/containers/mysql.class.php 2007-08-06 13:47:13 UTC (rev 1086) +++ trunk/src/containers/mysql.class.php 2007-08-06 14:44:57 UTC (rev 1087) @@ -267,75 +267,41 @@ function incMeta($group, $subgroup, $leaf) { $c =& pfcGlobalConfig::Instance(); - + if ($c->debug) - file_put_contents("/tmp/debug.txt", "\ngetMeta(".$group.",".$subgroup.",".$leaf.")", FILE_APPEND | LOCK_EX); + file_put_contents("/tmp/debug.txt", "\nsetMeta(".$group.",".$subgroup.",".$leaf.",".$leafvalue.")", FILE_APPEND | LOCK_EX); - $ret = array(); - $ret["timestamp"] = array(); - $ret["value"] = array(); - $server = $c->serverid; $db = $this->_connect(); - - $sql_where .= " AND `leaf`='$leaf'"; - $value = "leafvalue"; - $sql_group_by = ""; - - $sql_select="SELECT `$value`, `timestamp` FROM ".$c->container_cfg_mysql_table." WHERE `server`='$server' $sql_where $sql_group_by ORDER BY timestamp FOR UPDATE"; + $time = time(); - if ($c->debug) - file_put_contents("/tmp/debug.txt", "\ngetSQL(".$sql_select.")", FILE_APPEND | LOCK_EX); - - if ($sql_select != "") - { - $thisresult = mysql_query($sql_select, $db); - if (mysql_num_rows($thisresult)) - { - while ($regel = mysql_fetch_array($thisresult)) - { - $ret["timestamp"][] = $regel["timestamp"]; - $ret["value"][] = $regel[$value]; - } - } - } - - $leafvalue = $ret["value"][]; - - if ($leafvalue == NULL) - $leafvalue = 0; - else - $leafvalue++; - - $timestamp = time(); - - $sql_count = "SELECT COUNT(*) AS C FROM ".$c->container_cfg_mysql_table." WHERE `server`='$server' AND `group`='$group' AND `subgroup`='$subgroup' AND `leaf`='$leaf' LIMIT 1"; - $sql_insert="REPLACE INTO ".$c->container_cfg_mysql_table." (`server`, `group`, `subgroup`, `leaf`, `leafvalue`, `timestamp`) VALUES('$server', '$group', '$subgroup', '$leaf', '".addslashes($leafvalue)."', '".$timestamp."')"; - $sql_update="UPDATE ".$c->container_cfg_mysql_table." SET `leafvalue`='".addslashes($leafvalue)."', `timestamp`='".$timestamp."' WHERE `server`='$server' AND `group`='$group' AND `subgroup`='$subgroup' AND `leaf`='$leaf'"; - - $res = mysql_query($sql_count, $db); + // search for the existing leafvalue + mysql_query('LOCK TABLES phpfreechat WRITE;', $db); + $sql_select = "SELECT leafvalue FROM ".$c->container_cfg_mysql_table." WHERE `server`='$server' AND `group`='$group' AND `subgroup`='$subgroup' AND `leaf`='$leaf' LIMIT 1"; + $res = mysql_query($sql_select, $db); $row = mysql_fetch_array($res, MYSQL_ASSOC); - if( $row['C'] == 0 ) + if( !isset($row['leafvalue']) ) { if ($c->debug) file_put_contents("/tmp/debug.txt", "\nsetSQL(".$sql_insert.")", FILE_APPEND | LOCK_EX); - + $leafvalue = 1; + $sql_insert="REPLACE INTO ".$c->container_cfg_mysql_table." (`server`, `group`, `subgroup`, `leaf`, `leafvalue`, `timestamp`) VALUES('$server', '$group', '$subgroup', '$leaf', '".$leafvalue."', '".$time."')"; mysql_query($sql_insert, $db); } else { - if ($sql_update != "") - { - if ($c->debug) - file_put_contents("/tmp/debug.txt", "\nsetSQL(".$sql_update.")", FILE_APPEND | LOCK_EX); - - mysql_query($sql_update, $db); - } + if ($c->debug) + file_put_contents("/tmp/debug.txt", "\nsetSQL(".$sql_update.")", FILE_APPEND | LOCK_EX); + $leafvalue = $row['leafvalue'] + 1; + $sql_update="UPDATE ".$c->container_cfg_mysql_table." SET `leafvalue`='".$leafvalue."', `timestamp`='".$time."' WHERE `server`='$server' AND `group`='$group' AND `subgroup`='$subgroup' AND `leaf`='$leaf'"; + mysql_query($sql_update, $db); } - $ret["value"][] = $leafvalue; - $ret["timestamp"][] = $timestamp; - - return $ret; + mysql_query('UNLOCK TABLES;', $db); + + $ret["value"][] = $leafvalue; + $ret["timestamp"][] = $time; + + return $ret; } @@ -378,4 +344,4 @@ } -?> \ No newline at end of file +?> Modified: trunk/src/pfccontainer.class.php =================================================================== --- trunk/src/pfccontainer.class.php 2007-08-06 13:47:13 UTC (rev 1086) +++ trunk/src/pfccontainer.class.php 2007-08-06 14:44:57 UTC (rev 1087) @@ -696,6 +696,40 @@ } /** + * Increment a counter identified by the following path : group / subgroup / leaf + * Notice: this step must be atomic in order to avoid multithread problem (don't forget to use locking features) + * @param $group is mandatory + * @param $subgroup is mandatory + * @param $leaf is mandatory, it's the counter name + * @return array which contains two subarray 'timestamp' and 'value' (value contains the incremented numeric value) + */ + function incMeta($group, $subgroup, $leaf) + { + $ret = $this->_container->incMeta($group, $subgroup, $leaf); + + if ($this->_usememorycache) + { + // store the modifications in the cache + if (isset($this->_cache[$group]['value']) && + !in_array($subgroup, $this->_cache[$group]['value'])) + { + $this->_cache[$group]['value'][] = $subgroup; + $this->_cache[$group]['timestamp'][] = time(); + } + if (isset($this->_cache[$group]['childs'][$subgroup]['value']) && + !in_array($leaf, $this->_cache[$group]['childs'][$subgroup]['value'])) + { + $this->_cache[$group]['childs'][$subgroup]['value'][] = $leaf; + $this->_cache[$group]['childs'][$subgroup]['timestamp'][] = time(); + } + $this->_cache[$group]['childs'][$subgroup]['childs'][$leaf]['value'] = $ret['value']; + $this->_cache[$group]['childs'][$subgroup]['childs'][$leaf]['timestamp'] = array(time()); + } + + return $ret; + } + + /** * Remove a meta data or a group of metadata * @param $group if null then it will remove all the possible groups (all the created metadata) * @param $subgroup if null then it will remove the $group's childs (all the subgroup contained by $group) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gpi...@us...> - 2007-08-06 13:47:12
|
Revision: 1086 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1086&view=rev Author: gpinzone Date: 2007-08-06 06:47:13 -0700 (Mon, 06 Aug 2007) Log Message: ----------- Introduction of incMeta function to resolve issue of data corruption. The mysql changes need to be tested. Modified Paths: -------------- trunk/src/containers/file.class.php trunk/src/containers/mysql.class.php trunk/src/pfccontainer.class.php Modified: trunk/src/containers/file.class.php =================================================================== --- trunk/src/containers/file.class.php 2007-08-06 13:12:26 UTC (rev 1085) +++ trunk/src/containers/file.class.php 2007-08-06 13:47:13 UTC (rev 1086) @@ -102,7 +102,6 @@ return 0; // value created } - function getMeta($group, $subgroup = null, $leaf = null, $withleafvalue = false) { $c =& pfcGlobalConfig::Instance(); @@ -161,6 +160,63 @@ $ret["timestamp"][] = filemtime($leaffilename); return $ret; + } + + function incMeta($group, $subgroup, $leaf) + { + $c =& pfcGlobalConfig::Instance(); + if ($c->debug) + file_put_contents("/tmp/debug", "\nincMeta(".$group.",".$subgroup.",".$leaf.")", FILE_APPEND | LOCK_EX); + + // create directories + $dir_base = $c->container_cfg_server_dir; + $dir = $dir_base.'/'.$group.'/'.$subgroup; + + if (!is_dir($dir)) mkdir_r($dir); + + // create or replace metadata file + $leaffilename = $dir."/".$leaf; + + // create return array + $ret = array(); + $ret["timestamp"] = array(); + $ret["value"] = array(); + + // read and increment data from metadata file + clearstatcache(); + if (file_exists($leaffilename)) + { + $fh = fopen($leaffilename, 'r+'); + for($i = 0; $i < 10; $i++) // Try 10 times until an exclusive lock can be obtained + { + if (flock($fh, LOCK_EX)) + { + $leafvalue = chop(fread($fh, filesize($leaffilename))); + $leafvalue++; + rewind($fh); + fwrite($fh, $leafvalue); + fflush($fh); + ftruncate($fh, ftell($fh)); + flock($fh, LOCK_UN); + break; + } + // If flock is working properly, this will never be reached + $delay = rand(0, pow(2, ($i+1)) - 1) * 5000; // Exponential backoff + echo "try=".$i." ".$delay."\n"; + usleep($delay); + } + fclose($fh); + } + else + { + $leafvalue="1"; + file_put_contents($leaffilename, $leafvalue, LOCK_EX); + } + + $ret["value"][] = $leafvalue; + $ret["timestamp"][] = filemtime($leaffilename); + + return $ret; } function rmMeta($group, $subgroup = null, $leaf = null) Modified: trunk/src/containers/mysql.class.php =================================================================== --- trunk/src/containers/mysql.class.php 2007-08-06 13:12:26 UTC (rev 1085) +++ trunk/src/containers/mysql.class.php 2007-08-06 13:47:13 UTC (rev 1086) @@ -263,6 +263,82 @@ return $ret; } + + function incMeta($group, $subgroup, $leaf) + { + $c =& pfcGlobalConfig::Instance(); + + if ($c->debug) + file_put_contents("/tmp/debug.txt", "\ngetMeta(".$group.",".$subgroup.",".$leaf.")", FILE_APPEND | LOCK_EX); + + $ret = array(); + $ret["timestamp"] = array(); + $ret["value"] = array(); + + $server = $c->serverid; + $db = $this->_connect(); + + $sql_where .= " AND `leaf`='$leaf'"; + $value = "leafvalue"; + $sql_group_by = ""; + + $sql_select="SELECT `$value`, `timestamp` FROM ".$c->container_cfg_mysql_table." WHERE `server`='$server' $sql_where $sql_group_by ORDER BY timestamp FOR UPDATE"; + + if ($c->debug) + file_put_contents("/tmp/debug.txt", "\ngetSQL(".$sql_select.")", FILE_APPEND | LOCK_EX); + + if ($sql_select != "") + { + $thisresult = mysql_query($sql_select, $db); + if (mysql_num_rows($thisresult)) + { + while ($regel = mysql_fetch_array($thisresult)) + { + $ret["timestamp"][] = $regel["timestamp"]; + $ret["value"][] = $regel[$value]; + } + } + } + + $leafvalue = $ret["value"][]; + + if ($leafvalue == NULL) + $leafvalue = 0; + else + $leafvalue++; + + $timestamp = time(); + + $sql_count = "SELECT COUNT(*) AS C FROM ".$c->container_cfg_mysql_table." WHERE `server`='$server' AND `group`='$group' AND `subgroup`='$subgroup' AND `leaf`='$leaf' LIMIT 1"; + $sql_insert="REPLACE INTO ".$c->container_cfg_mysql_table." (`server`, `group`, `subgroup`, `leaf`, `leafvalue`, `timestamp`) VALUES('$server', '$group', '$subgroup', '$leaf', '".addslashes($leafvalue)."', '".$timestamp."')"; + $sql_update="UPDATE ".$c->container_cfg_mysql_table." SET `leafvalue`='".addslashes($leafvalue)."', `timestamp`='".$timestamp."' WHERE `server`='$server' AND `group`='$group' AND `subgroup`='$subgroup' AND `leaf`='$leaf'"; + + $res = mysql_query($sql_count, $db); + $row = mysql_fetch_array($res, MYSQL_ASSOC); + if( $row['C'] == 0 ) + { + if ($c->debug) + file_put_contents("/tmp/debug.txt", "\nsetSQL(".$sql_insert.")", FILE_APPEND | LOCK_EX); + + mysql_query($sql_insert, $db); + } + else + { + if ($sql_update != "") + { + if ($c->debug) + file_put_contents("/tmp/debug.txt", "\nsetSQL(".$sql_update.")", FILE_APPEND | LOCK_EX); + + mysql_query($sql_update, $db); + } + } + $ret["value"][] = $leafvalue; + $ret["timestamp"][] = $timestamp; + + return $ret; + } + + function rmMeta($group, $subgroup = null, $leaf = null) { $c =& pfcGlobalConfig::Instance(); Modified: trunk/src/pfccontainer.class.php =================================================================== --- trunk/src/pfccontainer.class.php 2007-08-06 13:12:26 UTC (rev 1085) +++ trunk/src/pfccontainer.class.php 2007-08-06 13:47:13 UTC (rev 1086) @@ -476,10 +476,12 @@ { if ($chan == NULL) $chan = 'SERVER'; - $lastmsgid = $this->getLastId($chan); - $lastmsgid++; - $this->setMeta("channelid-to-msgid", $this->encode($chan), 'lastmsgid', $lastmsgid); + $lastmsgid = $this->incMeta("channelid-to-msgid", $this->encode($chan), 'lastmsgid'); + if (count($lastmsgid["value"]) == 0) + $lastmsgid = 0; + else + $lastmsgid = $lastmsgid["value"][0]; return $lastmsgid; } @@ -665,8 +667,34 @@ return $ret; } - + + function incMeta($group, $subgroup, $leaf) + { + $ret = $this->_container->incMeta($group, $subgroup, $leaf); + + if ($this->_usememorycache) + { + // store the modifications in the cache + if (isset($this->_cache[$group]['value']) && + !in_array($subgroup, $this->_cache[$group]['value'])) + { + $this->_cache[$group]['value'][] = $subgroup; + $this->_cache[$group]['timestamp'][] = time(); + } + if (isset($this->_cache[$group]['childs'][$subgroup]['value']) && + !in_array($leaf, $this->_cache[$group]['childs'][$subgroup]['value'])) + { + $this->_cache[$group]['childs'][$subgroup]['value'][] = $leaf; + $this->_cache[$group]['childs'][$subgroup]['timestamp'][] = time(); + } + $this->_cache[$group]['childs'][$subgroup]['childs'][$leaf]['value'] = array($leafvalue); + $this->_cache[$group]['childs'][$subgroup]['childs'][$leaf]['timestamp'] = array(time()); + } + + return $ret; + } + /** * Remove a meta data or a group of metadata * @param $group if null then it will remove all the possible groups (all the created metadata) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2007-08-06 13:12:25
|
Revision: 1085 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1085&view=rev Author: kerphi Date: 2007-08-06 06:12:26 -0700 (Mon, 06 Aug 2007) Log Message: ----------- Optimize the setMeta method in the mysql container Modified Paths: -------------- trunk/src/containers/mysql.class.php Modified: trunk/src/containers/mysql.class.php =================================================================== --- trunk/src/containers/mysql.class.php 2007-08-05 01:26:12 UTC (rev 1084) +++ trunk/src/containers/mysql.class.php 2007-08-06 13:12:26 UTC (rev 1085) @@ -165,12 +165,13 @@ if ($leafvalue == NULL){$leafvalue="";}; - $sql_select = "SELECT * FROM ".$c->container_cfg_mysql_table." WHERE `server`='$server' AND `group`='$group' AND `subgroup`='$subgroup' AND `leaf`='$leaf'"; + $sql_count = "SELECT COUNT(*) AS C FROM ".$c->container_cfg_mysql_table." WHERE `server`='$server' AND `group`='$group' AND `subgroup`='$subgroup' AND `leaf`='$leaf' LIMIT 1"; $sql_insert="REPLACE INTO ".$c->container_cfg_mysql_table." (`server`, `group`, `subgroup`, `leaf`, `leafvalue`, `timestamp`) VALUES('$server', '$group', '$subgroup', '$leaf', '".addslashes($leafvalue)."', '".time()."')"; $sql_update="UPDATE ".$c->container_cfg_mysql_table." SET `leafvalue`='".addslashes($leafvalue)."', `timestamp`='".time()."' WHERE `server`='$server' AND `group`='$group' AND `subgroup`='$subgroup' AND `leaf`='$leaf'"; - - $res = mysql_query($sql_select, $db); - if( !(mysql_num_rows($res)>0) ) + + $res = mysql_query($sql_count, $db); + $row = mysql_fetch_array($res, MYSQL_ASSOC); + if( $row['C'] == 0 ) { if ($c->debug) file_put_contents("/tmp/debug.txt", "\nsetSQL(".$sql_insert.")", FILE_APPEND | LOCK_EX); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gpi...@us...> - 2007-08-05 01:42:29
|
Revision: 1084 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1084&view=rev Author: gpinzone Date: 2007-08-04 18:26:12 -0700 (Sat, 04 Aug 2007) Log Message: ----------- Corrected exponential back-off algorithm. Modified Paths: -------------- branches/pfc-comet/misc/flock-tests/readwrite2.php Modified: branches/pfc-comet/misc/flock-tests/readwrite2.php =================================================================== --- branches/pfc-comet/misc/flock-tests/readwrite2.php 2007-08-04 17:33:26 UTC (rev 1083) +++ branches/pfc-comet/misc/flock-tests/readwrite2.php 2007-08-05 01:26:12 UTC (rev 1084) @@ -31,7 +31,7 @@ break; } // If flock is working properly, this will never be reached - $delay = (pow (2, ($i+1)) - 1) * rand(0,5000); // Exponential backoff + $delay = rand(0, pow(2, ($i+1)) - 1) * 5000; // Exponential backoff usleep($delay); } fclose($fh); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gpi...@us...> - 2007-08-04 17:33:24
|
Revision: 1083 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1083&view=rev Author: gpinzone Date: 2007-08-04 10:33:26 -0700 (Sat, 04 Aug 2007) Log Message: ----------- Implemented (2^n - 1) * delay exponential back-off for flock failure. Modified Paths: -------------- branches/pfc-comet/misc/flock-tests/readwrite2.php Modified: branches/pfc-comet/misc/flock-tests/readwrite2.php =================================================================== --- branches/pfc-comet/misc/flock-tests/readwrite2.php 2007-08-04 12:57:44 UTC (rev 1082) +++ branches/pfc-comet/misc/flock-tests/readwrite2.php 2007-08-04 17:33:26 UTC (rev 1083) @@ -31,7 +31,8 @@ break; } // If flock is working properly, this will never be reached - usleep(rand(1000,5000)); // TODO: implement exponential backoff + $delay = (pow (2, ($i+1)) - 1) * rand(0,5000); // Exponential backoff + usleep($delay); } fclose($fh); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gpi...@us...> - 2007-08-04 12:57:42
|
Revision: 1082 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1082&view=rev Author: gpinzone Date: 2007-08-04 05:57:44 -0700 (Sat, 04 Aug 2007) Log Message: ----------- Simplified initial write by using file_put_contents. TODO: exponential backoff on flock failure. Modified Paths: -------------- branches/pfc-comet/misc/flock-tests/readwrite2.php Modified: branches/pfc-comet/misc/flock-tests/readwrite2.php =================================================================== --- branches/pfc-comet/misc/flock-tests/readwrite2.php 2007-08-04 11:32:26 UTC (rev 1081) +++ branches/pfc-comet/misc/flock-tests/readwrite2.php 2007-08-04 12:57:44 UTC (rev 1082) @@ -30,18 +30,15 @@ flock($fh, LOCK_UN); break; } - usleep(rand(1000,5000)); // If flock is working properly, this will never be reached + // If flock is working properly, this will never be reached + usleep(rand(1000,5000)); // TODO: implement exponential backoff } fclose($fh); } else { - $fh = fopen($msgid_filename, 'w'); - flock($fh, LOCK_EX); $msgid="1"; - fwrite($fh, $msgid); - flock($fh, LOCK_UN); - fclose($fh); + file_put_contents($msgid_filename, $msgid, LOCK_EX); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2007-08-04 11:32:24
|
Revision: 1081 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1081&view=rev Author: kerphi Date: 2007-08-04 04:32:26 -0700 (Sat, 04 Aug 2007) Log Message: ----------- move the flock tests to a separated directory Added Paths: ----------- branches/pfc-comet/misc/flock-tests/ branches/pfc-comet/misc/flock-tests/readwrite.php branches/pfc-comet/misc/flock-tests/readwrite2.php Removed Paths: ------------- branches/pfc-comet/misc/comet-tests/iframe2/readwrite.php Deleted: branches/pfc-comet/misc/comet-tests/iframe2/readwrite.php =================================================================== --- branches/pfc-comet/misc/comet-tests/iframe2/readwrite.php 2007-08-03 16:12:56 UTC (rev 1080) +++ branches/pfc-comet/misc/comet-tests/iframe2/readwrite.php 2007-08-04 11:32:26 UTC (rev 1081) @@ -1,87 +0,0 @@ -<?php - -$method = 2; -$msgid_filename = '/tmp/readwrite'; - -$uid = md5(uniqid(rand(), true)); -$msgid = 0; -while(1) -{ - // improved method to request a msgid - if ($method == 1) - { - clearstatcache(); - if (file_exists($msgid_filename)) { - $fh = fopen($msgid_filename, 'r+'); - while(1) { - if (flock($fh, LOCK_EX)) { - $msgid = chop(fread($fh, filesize($msgid_filename))); - $msgid++; - rewind($fh); - fwrite($fh, $msgid); - fflush($fh); - ftruncate($fh, ftell($fh)); - flock($fh, LOCK_UN); - break; - } - } - } - else { - $fh = fopen($msgid_filename, 'w+'); - fwrite($fh, "1"); - $msgid="1"; - } - fclose($fh); - } - - - // method used in pfc to request a new msgid - if ($method == 2) - { - $msgid = file_get_contents_flock($msgid_filename); - $msgid++; - file_put_contents($msgid_filename, $msgid, LOCK_EX); - } - - echo "uid=".$uid." ".trim($msgid)."\n"; - usleep(rand(0,1000)); // a very small pause -} - - -/** - * file_get_contents_flock - * define an alternative file_get_contents when this function doesn't exists on the used php version (<4.3.0) - */ - -if (!defined('LOCK_SH')) { - define('LOCK_SH', 1); -} - -function file_get_contents_flock($filename, $incpath = false, $resource_context = null) -{ - if (false === $fh = fopen($filename, 'rb', $incpath)) { - user_error('file_get_contents() failed to open stream: No such file or directory ['.$filename.']', - E_USER_WARNING); - return false; - } - - // Attempt to get a shared (read) lock - if (!$flock = flock($fh, LOCK_SH)) { - return false; - } - - clearstatcache(); - if ($fsize = filesize($filename)) { - $data = fread($fh, $fsize); - } else { - $data = ''; - while (!feof($fh)) { - $data .= fread($fh, 8192); - } - } - - fclose($fh); - return $data; -} - -?> Added: branches/pfc-comet/misc/flock-tests/readwrite.php =================================================================== --- branches/pfc-comet/misc/flock-tests/readwrite.php (rev 0) +++ branches/pfc-comet/misc/flock-tests/readwrite.php 2007-08-04 11:32:26 UTC (rev 1081) @@ -0,0 +1,87 @@ +<?php + +$method = 2; +$msgid_filename = '/tmp/readwrite'; + +$uid = md5(uniqid(rand(), true)); +$msgid = 0; +while(1) +{ + // improved method to request a msgid + if ($method == 1) + { + clearstatcache(); + if (file_exists($msgid_filename)) { + $fh = fopen($msgid_filename, 'r+'); + while(1) { + if (flock($fh, LOCK_EX)) { + $msgid = chop(fread($fh, filesize($msgid_filename))); + $msgid++; + rewind($fh); + fwrite($fh, $msgid); + fflush($fh); + ftruncate($fh, ftell($fh)); + flock($fh, LOCK_UN); + break; + } + } + } + else { + $fh = fopen($msgid_filename, 'w+'); + fwrite($fh, "1"); + $msgid="1"; + } + fclose($fh); + } + + + // method used in pfc to request a new msgid + if ($method == 2) + { + $msgid = file_get_contents_flock($msgid_filename); + $msgid++; + file_put_contents($msgid_filename, $msgid, LOCK_EX); + } + + echo "uid=".$uid." ".trim($msgid)."\n"; + usleep(rand(0,1000)); // a very small pause +} + + +/** + * file_get_contents_flock + * define an alternative file_get_contents when this function doesn't exists on the used php version (<4.3.0) + */ + +if (!defined('LOCK_SH')) { + define('LOCK_SH', 1); +} + +function file_get_contents_flock($filename, $incpath = false, $resource_context = null) +{ + if (false === $fh = fopen($filename, 'rb', $incpath)) { + user_error('file_get_contents() failed to open stream: No such file or directory ['.$filename.']', + E_USER_WARNING); + return false; + } + + // Attempt to get a shared (read) lock + if (!$flock = flock($fh, LOCK_SH)) { + return false; + } + + clearstatcache(); + if ($fsize = filesize($filename)) { + $data = fread($fh, $fsize); + } else { + $data = ''; + while (!feof($fh)) { + $data .= fread($fh, 8192); + } + } + + fclose($fh); + return $data; +} + +?> Added: branches/pfc-comet/misc/flock-tests/readwrite2.php =================================================================== --- branches/pfc-comet/misc/flock-tests/readwrite2.php (rev 0) +++ branches/pfc-comet/misc/flock-tests/readwrite2.php 2007-08-04 11:32:26 UTC (rev 1081) @@ -0,0 +1,195 @@ +<?php + + +$method = 2; +$msgid_filename = '/tmp/readwrite'; + +$uid = md5(uniqid(rand(), true)); +$msgids = array(); +$msgid = 0; +$oldmsgid = 0; +for($c = 0; $c < 2000; $c++) +{ + // improved method to read and increment a msgid + if ($method == 1) + { + clearstatcache(); + if (file_exists($msgid_filename)) + { + $fh = fopen($msgid_filename, 'r+'); + for($i = 0; $i < 10; $i++) // Try 10 times until an exclusive lock can be obtained + { + if (flock($fh, LOCK_EX)) + { + $msgid = chop(fread($fh, filesize($msgid_filename))); + $msgid++; + rewind($fh); + fwrite($fh, $msgid); + fflush($fh); + ftruncate($fh, ftell($fh)); + flock($fh, LOCK_UN); + break; + } + usleep(rand(1000,5000)); // If flock is working properly, this will never be reached + } + fclose($fh); + } + else + { + $fh = fopen($msgid_filename, 'w'); + flock($fh, LOCK_EX); + $msgid="1"; + fwrite($fh, $msgid); + flock($fh, LOCK_UN); + fclose($fh); + } + } + + + // method used in pfc to request a new msgid + if ($method == 2) + { + $msgid = file_get_contents_flock($msgid_filename); + $msgid++; + file_put_contents($msgid_filename, $msgid, LOCK_EX); + } + + $pause = rand(0,1000); + usleep($pause); // a very small pause + $msgids[] = $msgid; + echo sprintf("uid=%s pause=%4s delta=%d msgid=%d\n",$uid,$pause,($msgid-$oldmsgid),trim($msgid)); + $oldmsgid = $msgid; +} +file_put_contents($msgid_filename."_".$uid, implode("\n",$msgids), LOCK_EX); + + +/** + * file_get_contents_flock + * define an alternative file_get_contents when this function doesn't exists on the used php version (<4.3.0) + */ + +if (!defined('LOCK_SH')) { + define('LOCK_SH', 1); +} + +function file_get_contents_flock($filename, $incpath = false, $resource_context = null) +{ + if (false === $fh = fopen($filename, 'rb', $incpath)) { + user_error('file_get_contents() failed to open stream: No such file or directory ['.$filename.']', + E_USER_WARNING); + return false; + } + + // Attempt to get a shared (read) lock + if (!$flock = flock($fh, LOCK_SH)) { + return false; + } + + clearstatcache(); + if ($fsize = filesize($filename)) { + $data = fread($fh, $fsize); + } else { + $data = ''; + while (!feof($fh)) { + $data .= fread($fh, 8192); + } + } + + fclose($fh); + return $data; +} + +/** + * Replace file_put_contents() + * + * @category PHP + * @package PHP_Compat + * @link http://php.net/function.file_put_contents + * @author Aidan Lister <ai...@ph...> + * @internal resource_context is not supported + * @since PHP 5 + * @require PHP 4.0.0 (user_error) + */ +if (!defined('FILE_USE_INCLUDE_PATH')) { + define('FILE_USE_INCLUDE_PATH', 1); +} + +if (!defined('LOCK_EX')) { + define('LOCK_EX', 2); +} + +if (!defined('FILE_APPEND')) { + define('FILE_APPEND', 8); +} +if (!function_exists('file_put_contents')) { + function file_put_contents($filename, $content, $flags = null, $resource_context = null) + { + // If $content is an array, convert it to a string + if (is_array($content)) { + $content = implode('', $content); + } + + // If we don't have a string, throw an error + if (!is_scalar($content)) { + user_error('file_put_contents() The 2nd parameter should be either a string or an array ['.$filename.']', + E_USER_WARNING); + return false; + } + + // Get the length of data to write + $length = strlen($content); + + // Check what mode we are using + $mode = ($flags & FILE_APPEND) ? + 'a' : + 'wb'; + + // Check if we're using the include path + $use_inc_path = ($flags & FILE_USE_INCLUDE_PATH) ? + true : + false; + + // Open the file for writing + if (($fh = @fopen($filename, $mode, $use_inc_path)) === false) { + user_error('file_put_contents() failed to open stream: Permission denied ['.$filename.']', + E_USER_WARNING); + return false; + } + + // Attempt to get an exclusive lock + $use_lock = ($flags & LOCK_EX) ? true : false ; + if ($use_lock === true) { + if (!flock($fh, LOCK_EX)) { + return false; + } + } + + // Write to the file + $bytes = 0; + if (($bytes = @fwrite($fh, $content)) === false) { + $errormsg = sprintf('file_put_contents() Failed to write %d bytes to %s ['.$filename.']', + $length, + $filename); + user_error($errormsg, E_USER_WARNING); + return false; + } + + // Close the handle + @fclose($fh); + + // Check all the data was written + if ($bytes != $length) { + $errormsg = sprintf('file_put_contents() Only %d of %d bytes written, possibly out of free disk space. ['.$filename.']', + $bytes, + $length); + user_error($errormsg, E_USER_WARNING); + return false; + } + + // Return length + return $bytes; + } +} + + +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2007-08-03 16:13:04
|
Revision: 1080 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1080&view=rev Author: kerphi Date: 2007-08-03 09:12:56 -0700 (Fri, 03 Aug 2007) Log Message: ----------- testcase script used to know the best method to to multithreaded write on a simple file Added Paths: ----------- branches/pfc-comet/misc/comet-tests/iframe2/readwrite.php Added: branches/pfc-comet/misc/comet-tests/iframe2/readwrite.php =================================================================== --- branches/pfc-comet/misc/comet-tests/iframe2/readwrite.php (rev 0) +++ branches/pfc-comet/misc/comet-tests/iframe2/readwrite.php 2007-08-03 16:12:56 UTC (rev 1080) @@ -0,0 +1,87 @@ +<?php + +$method = 2; +$msgid_filename = '/tmp/readwrite'; + +$uid = md5(uniqid(rand(), true)); +$msgid = 0; +while(1) +{ + // improved method to request a msgid + if ($method == 1) + { + clearstatcache(); + if (file_exists($msgid_filename)) { + $fh = fopen($msgid_filename, 'r+'); + while(1) { + if (flock($fh, LOCK_EX)) { + $msgid = chop(fread($fh, filesize($msgid_filename))); + $msgid++; + rewind($fh); + fwrite($fh, $msgid); + fflush($fh); + ftruncate($fh, ftell($fh)); + flock($fh, LOCK_UN); + break; + } + } + } + else { + $fh = fopen($msgid_filename, 'w+'); + fwrite($fh, "1"); + $msgid="1"; + } + fclose($fh); + } + + + // method used in pfc to request a new msgid + if ($method == 2) + { + $msgid = file_get_contents_flock($msgid_filename); + $msgid++; + file_put_contents($msgid_filename, $msgid, LOCK_EX); + } + + echo "uid=".$uid." ".trim($msgid)."\n"; + usleep(rand(0,1000)); // a very small pause +} + + +/** + * file_get_contents_flock + * define an alternative file_get_contents when this function doesn't exists on the used php version (<4.3.0) + */ + +if (!defined('LOCK_SH')) { + define('LOCK_SH', 1); +} + +function file_get_contents_flock($filename, $incpath = false, $resource_context = null) +{ + if (false === $fh = fopen($filename, 'rb', $incpath)) { + user_error('file_get_contents() failed to open stream: No such file or directory ['.$filename.']', + E_USER_WARNING); + return false; + } + + // Attempt to get a shared (read) lock + if (!$flock = flock($fh, LOCK_SH)) { + return false; + } + + clearstatcache(); + if ($fsize = filesize($filename)) { + $data = fread($fh, $fsize); + } else { + $data = ''; + while (!feof($fh)) { + $data .= fread($fh, 8192); + } + } + + fclose($fh); + return $data; +} + +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |