• Forum
  • Doc
  • Screenshots
  • Download
  • Donate
  • Contributors
  • Contact
  • Follow @phpfreechat
  • DEMO
  • Board index ‹ Version 1.x branch ‹ General Support (v1.x)
  • Change font size
  • FAQ
  • Register
  • Login

Chatroom Frozen

Moderators: OldWolf, re*s.t.a.r.s.*2

Post a reply
13 posts • Page 1 of 1

Postby gritty » Fri Mar 30, 2007 2:32 am

We just installed the latest update and were trying out our chatroom again. Things seemed to be going okay, but now all of a sudden no posts are appearing. We tried disconnecting, shutting down, trying a new window, all to no avail. And it's doing this to everyone in our chat (we've been emailing each other wondering if we were experiencing the same thing).

Do you know what's going on?
gritty
Member
 
Posts: 50
Joined: Wed May 03, 2006 7:39 pm
Top

Postby lrickyutah » Fri Mar 30, 2007 5:07 am

the same thing happened to me. I had to revert to beta 9. (which still doesn't quite work for me.)
lrickyutah
New member
 
Posts: 4
Joined: Thu Mar 15, 2007 6:30 am
Top

Postby phpfreechat » Fri Mar 30, 2007 8:12 am

I think the messages index file is just sometime reset to 0 so the new messages doesn't appears in the chat.
This is probably a bug and I think I can fix it with exclusive file locking... I'll keep you informed.
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top

Postby shacknasty » Fri Mar 30, 2007 8:45 am

We seem to be having this problem too, and the only way I can fix it is by deleting and recreating the data folder
shacknasty
Member
 
Posts: 16
Joined: Tue Oct 24, 2006 8:32 am
Top

Postby phpfreechat » Sun Apr 01, 2007 2:07 pm

Ok just commited a patch to fix this problem.
Please could you give me some feedback about it ?
Code: Select all
Modified: trunk/src/containers/file.class.php
===================================================================
--- trunk/src/containers/file.class.php 2007-04-01 11:01:46 UTC (rev 1012)
+++ trunk/src/containers/file.class.php 2007-04-01 13:06:42 UTC (rev 1013)
@@ -91,7 +91,7 @@
    }
    else
    {
-      file_put_contents($leaffilename, $leafvalue);
+      flock_put_contents($leaffilename, $leafvalue);
    }

    // store the value in the memory cache
@@ -157,7 +157,7 @@

    if (!file_exists($leaffilename)) return $ret;
    if ($withleafvalue)
-      $ret["value"][] = file_get_contents($leaffilename);
+      $ret["value"][] = flock_get_contents($leaffilename);
    else
      $ret["value"][] = NULL;
    $ret["timestamp"][] = filemtime($leaffilename);

Modified: trunk/src/pfctools.php
===================================================================
--- trunk/src/pfctools.php      2007-04-01 11:01:46 UTC (rev 1012)
+++ trunk/src/pfctools.php      2007-04-01 13:06:42 UTC (rev 1013)
@@ -403,4 +403,40 @@
  }
 }

+/**
+ * Almost the Same as file_get_contents except that it uses flock() to lock the file
+ */
+function flock_get_contents($filename, $mode = "rb")
+{
+  $data = '';
+  if (!file_exists($filename)) return $data;
+
+  $size = filesize($filename);
+  if ($size == 0) return $data;
+
+  $fp   = fopen( $filename, $mode );
+  if( $fp && flock( $fp, LOCK_SH ) )
+  {
+    $data = fread( $fp, $size );
+    flock($fp, LOCK_UN);
+  }
+  fclose( $fp );
+  return $data;
+}
+
+/**
+ * Almost the Same as file_put_contents except that it uses flock() to lock the file
+ */
+function flock_put_contents($filename, $data, $mode = "wb")
+{
+  $fp   = fopen( $filename, $mode );
+  if( $fp && flock( $fp, LOCK_EX ) )
+  {
+    fwrite( $fp, $data );
+    flock($fp, LOCK_UN);
+  }
+  fclose( $fp );
+}
+
+
 ?>
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top

Postby samp » Tue Apr 03, 2007 9:12 am

I didn´t undestand what we need to do in the trunk/src/pfctools.php file
samp
New member
 
Posts: 2
Joined: Tue Apr 03, 2007 9:02 am
Top

Postby pinup57 » Tue Apr 03, 2007 12:41 pm

in src/pftools.php replace the - lines by the + lines.....

Dirk
pinup57
Member
 
Posts: 89
Joined: Sat Feb 24, 2007 8:13 am
Top

Postby samp » Wed Apr 04, 2007 11:00 pm

pinup57 wrote:in src/pftools.php replace the - lines by the + lines.....

Dirk

but there is no - lines in the pftools.php...

so I just need to ad this lines?
samp
New member
 
Posts: 2
Joined: Tue Apr 03, 2007 9:02 am
Top

Postby pinup57 » Thu Apr 05, 2007 7:02 am

In src/pfctools.php look for the lines identified by a - sign in the code Stéphane posted, and replace them by the lines identified by the + sign (in the same code). The patch basically says: remove line - and add line +.

Dirk
pinup57
Member
 
Posts: 89
Joined: Sat Feb 24, 2007 8:13 am
Top

Postby mslm13 » Wed Apr 25, 2007 1:38 am

I'm getting an error after modifying the code. Can any one give me a clue


Parse error: syntax error, unexpected $end in /src/pfctools.php on line 439
mslm13
New member
 
Posts: 2
Joined: Wed Apr 25, 2007 1:36 am
Top

Postby phpfreechat » Wed Apr 25, 2007 8:44 am

mslm13 could you try with this modified function ?
Code: Select all
function flock_put_contents($filename, $data, $mode = "wb")
{
  $fp   = fopen( $filename, $mode );
  if( $fp )
  {
    if ( flock( $fp, LOCK_EX ) )
    {
      fwrite( $fp, $data );
      // flock($fp, LOCK_UN); // will be done by fclose
    }
    fclose( $fp );
  }
}
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top

Postby mslm13 » Mon Jun 04, 2007 12:03 am

It didn't work = I got this error

Parse error: syntax error, unexpected $end in /home/src/pfctools.php on line 442
mslm13
New member
 
Posts: 2
Joined: Wed Apr 25, 2007 1:36 am
Top

Postby srdev » Wed Aug 29, 2007 7:40 pm

This code works but the problem stay !

another solution please

he works perfectly on other server.

Is the server dont support anything ?
srdev
New member
 
Posts: 6
Joined: Mon Jun 11, 2007 10:19 pm
Top


Post a reply
13 posts • Page 1 of 1

Return to General Support (v1.x)

Who is online

Users browsing this forum: No registered users and 7 guests

  • Board index
  • The team • Delete all board cookies • All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
cron
Sign in
Wrong credentials
Sign up I forgot my password
.
jeu-gratuit.net | more partners
Fork me on GitHub