In function createCSS() in OSMPlayer.php there are calls to is_dir(), mkdir() and chmod(). My server does not give apache access to chmod, and I get a nasty error about it, yet the css files are created just fine.

I think you ought to look in to the Drupal function file_check_directory() which has a whole bunch of wrappers to ensure the directory is created smoothly. See http://api.drupal.org/api/function/file_check_directory/6

Comments

travist’s picture

I will probably just need to re-create that function as a class method within the OSMPlayer since that class was built to be used as a stand alone without Drupal. I will see what I can do on this.

Thanks,

Travis.

travist’s picture

Looking further into this, it seems all drupal really does different from what my library does is just suppress those alarms by placing a "@" symbol in front of the chmod calls. This would basically make the call, but suppress any errors. I will add this to the library which should resolve this issue.

Thanks,

Travis.

backwardgraphics’s picture

I'm not quite sure how to write a patch but I simply replaced this code at line 431 of /mediafront/players/osmplayer/player/OSMPlayer.php

      // Now make sure the directory has the right permissions.
      chmod( $dir, 0775 );

With this code

      // Now make sure the directory has the right permissions.
			$directory == $dir;
			file_check_directory(&$directory, $mode = 0, $form_item = NULL);

Everything Appears to be working properly. Hope this works for others

travist’s picture

jtsowards,

Thanks for your efforts. But I probably won't be able to put this in. The OSMPlayer.php was built to be used as a stand-alone ( without Drupal ). This would break the stand-alone installations since this has a dependency on Drupal.

I will commit a version tonight that puts the "@" in front of the "chmod" calls and hopefully that fixes this issue.

Thanks,

Travis.

travist’s picture

Status: Active » Fixed

This should be fixed in BETA3. Please let me know otherwise.

hatsch’s picture

Status: Fixed » Active

i am reopening this because since beta3 i am experiencing problems with the paths generated by mediafront. switching back to beta2 solved the issue!

here's the bug i encounter:

all paths generated by mediafront look like this
[BASE_URL][ABSOLUTE PATH] http://example.com/var/www/example.com/sites/example.com/modules/......
all images loaded from css and the osm player swf don't get loaded because of this
html5 playback is working, but there are also no icons showing.

when i use osmplayer-beta2 together with mediafront-beta3 everything works again.

maybe it is relevant that i use symbolic links for my sites directory.

i hope that these bug are somehow related.

mstrelan’s picture

#4 - I thought it might be something like this, but I guess now there is no warning if it fails. I would suggest code as below.
#5 - No more nasty errors!
#6 - This should be a new issue I think

<?php
      // Now make sure the directory has the right permissions.
      if (!is_writable()) {
        if (!@chmod( $dir, 0775 )) {
          watchdog('mediafront', 'Unable to create CSS file');
        }
      }
?>

But then again that is Drupal specific, so I guess maybe you could return TRUE if it was created and FALSE if it wasn't, then do the watchdog() call from your module

travist’s picture

mstrelan,

Thanks for your previous post. But looking at that code might defeat the purpose of chmod altogehter. is_writable checks if the folder is writable, and if not, then skips over that. The point of the chmod is to make sure the folder is writable. I am thinking I can use your code above, but without the is_writable. Because the chmod has the @ in front of it, it will fail silently to which I can then return false and add it to the watchdog in that case.

Let me know if this works for you.

Thanks,

Travis.

mstrelan’s picture

Status: Active » Reviewed & tested by the community

No problems

enjoylife’s picture

Status: Reviewed & tested by the community » Closed (fixed)