GetSimple Support Forum
Weird problems with GS3.2.0 and News Manager plugin - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: General Questions and Problems (http://get-simple.info/forums/forumdisplay.php?fid=16)
+--- Thread: Weird problems with GS3.2.0 and News Manager plugin (/showthread.php?tid=4430)



Weird problems with GS3.2.0 and News Manager plugin - D.O. - 2013-03-08

My site was working very fine (GS3.2.0 + NM updated version), but weirdly, when I delete a post, it shows this message:

Warning: rename(D:\Inetpub\webs\my_site/data/posts/prova.xml,D:\Inetpub\webs\my_site/backups/posts/prova.xml) [function.rename]: File exists in D:\Inetpub\webs\my_site\plugins\news_manager\inc\functions.php on line 147

Any help please???


RE: Weird problems with GS3.2.0 and News Manager plugin - Carlos - 2013-03-08

Oh, I thought we had this rename/Windows issue fixed...

1. Even with that error, has the post been deleted?
2. Do you have debug mode enabled?
3. PHP version?
4. Did this work ok with GS 3.1.2 + NM 2.3.2? (can you check with a test install?)


RE: Weird problems with GS3.2.0 and News Manager plugin - Carlos - 2013-03-08

I can prepare a quick patch for you that may fix this, but I'd like to know if this issue also happens with GS 3.1.2 in the same Windows server you're using for GS 3.2.0, if possible.


RE: Weird problems with GS3.2.0 and News Manager plugin - shawn_a - 2013-03-08

This a nm or gs bug Carlos?


RE: Weird problems with GS3.2.0 and News Manager plugin - Carlos - 2013-03-08

It seems it's an issue that only happens in some Windows systems, with PHP's rename when used to move a file AND the destination exists.

GS only uses rename in ZipArchive.php, I don't know if there could be some issue there.

I thought this was fixed by https://github.com/cnb/News_Manager-getsimplecms/commit/b23bce357581d23986614a68ee20ed394ec41ded

I cannot reproduce this issue, so I'll wait for D.O.'s response.
If it happens with GS 3.2.0 but not with 3.1.2, another test I wanted him to do is enabling GSSUPPRESSERRORS in gsconfig.


RE: Weird problems with GS3.2.0 and News Manager plugin - D.O. - 2013-03-09

Thanks for your help, mates
@Carlos:

1. Yes, even with that error the post has been deleted
2. No, debug mode wasn't enabled
3. PHP version is 5.2.14
4. it was okay with the old GS version


RE: Weird problems with GS3.2.0 and News Manager plugin - Carlos - 2013-03-09

Ok!

Now please try this - uncomment (or add) this in your GS 3.2.0 site's gsconfig, like this:

Code:
# Forces suppression of php errors when GSDEBUG is false, despite php ini settings
define('SUPPRESSERRORS',true);

then try again deleting some post.

(Next test will be a patch for NM)


RE: Weird problems with GS3.2.0 and News Manager plugin - shawn_a - 2013-03-09

Is this an ajax action Carlos.


RE: Weird problems with GS3.2.0 and News Manager plugin - Carlos - 2013-03-09

No, no.
To have the undo functionality, News Manager moves deleted posts to its backups folders using PHP's rename function, that seems to throw errors in some Windows/PHP environments (not mine).


RE: Weird problems with GS3.2.0 and News Manager plugin - D.O. - 2013-03-09

Hi carlos,
no way.. it shows again that message.


RE: Weird problems with GS3.2.0 and News Manager plugin - shawn_a - 2013-03-09

Well it's a warning, so php errors must be enabled, it's not fatal errors.


RE: Weird problems with GS3.2.0 and News Manager plugin - D.O. - 2013-03-09

it's not a fatal error but it disturbs who has to add news on my site...


RE: Weird problems with GS3.2.0 and News Manager plugin - shawn_a - 2013-03-09

No but why is error reporting on in the first place.


RE: Weird problems with GS3.2.0 and News Manager plugin - Carlos - 2013-03-09

@shawn_a

I don't understand is why D.O. didn't have this error in GS 3.1.2 but does in 3.2.0 with GSSUPPRESSERRORS enabled (wasn't this setting supposed to make it work like pre-3.2?)

This is the function where the error happens:
Code:
function nm_rename_file($oldfile,$newfile) {
  if (!rename($oldfile,$newfile)) {
   if (copy ($oldfile,$newfile)) {
       unlink($oldfile);
       return TRUE;
    }
    return FALSE;
  }
  return TRUE;
}

It's in the first if. I added that function precissely because some Windows systems couldn't move the file using rename if the destination existed.

I can think of two ways to fix D.O.'s problem,

replacing the if line by:
Code:
if (!@rename($oldfile,$newfile)) {

or by:
Code:
if ((strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') or !rename($oldfile,$newfile)) {

What do you suggest?
I prefer not to use the @ operator (in fact, I'd like to remove many of those that are in the plugin), but the second one looks a bit ugly to me. :-)

Or do you think I should leave it like it is, and it's D.O. (or any other Windows user having this issue) who should fix the server configuration?


RE: Weird problems with GS3.2.0 and News Manager plugin - shawn_a - 2013-03-09

No clue, sounds like it works, but throws an error. So turn error reporting off, I mean is it a production site? Why are errors even on.

Suppress errors should fix it, but maybe his ini is not overridable, there is no way of knowing, or maybe he did it wrong.


RE: Weird problems with GS3.2.0 and News Manager plugin - Carlos - 2013-03-09

@shawn_a Thanks.

@D.O. So you can:

- as shawn_a suggests, check your server configuration and turn error reporting off if possible.
or:
- try one of the patches I suggested above, e.g.
edit news_manager/inc/functions.php, find function nm_rename_file(...) and change the first if to:
Code:
if (!@rename($oldfile,$newfile)) {



RE: Weird problems with GS3.2.0 and News Manager plugin - D.O. - 2013-03-11

THANKS Carlos, it's perfect!!!!
The patch "if (!@rename($oldfile,$newfile)) {" worked great!

But - at the same time - another old problem came out...

I typed a post with this letters "L'è" and when I tried to delete it GS allerted me with this message: "Error: incorrect path". After it, it was impossible to delete the post.

Into the folder named "posts" the file was written in this way: "l%E3%A8.xml". Then I tried to use your alternative "basic.php" for Latin language, but it didn't work. I hope it can be useful to fix these bugs.

Thanks again!


RE: Weird problems with GS3.2.0 and News Manager plugin - Carlos - 2013-03-11

Thanks for reporting.

The issue (that should happen not only with NM posts but also with GS normal pages) will be fixed in GS 3.2.1. (You could test the beta, BTW)

At the meantime, for GS 3.2.0 you could use the RomanTranslit plugin.


RE: Weird problems with GS3.2.0 and News Manager plugin - D.O. - 2013-03-11

Yes true it does NOT depend on NM Updated. I hope they will fix this bug in the next version of GS.
By the way, I tried this "RomanTranslit" plugin and it works with a title like "L'è"...
Thanks again for your help =D