August 5, 2008

file permissions

Tags: ,
Filed under: ZenMagick — DerManoMann @ 12:42 am

One of the things that ZenMagick does not very well at the moment is handling file permissions of files it creates.

I just added this on my 1.0.0 tasklist, so hopefully it should get better soon.

Until then, there is a simple workaround – using the PHP Console that comes with ZenMagick (admin: ZenMagick -> Console.

The following shows the most useful commands for handling permissions.

getcwd();

Returns the current working directory. In the console context, this is going to be the full path to the admin folder: This is helpful to get your bearings.

chmod(..);

Another PHP function to change file permissions. For example, the following will grant full file permissions to everyone (user/group/other) to init.php:

chmod(getcwd().'/../zenmagick/init.php', 0777);

ZMTools::rmdir(..);

A very dangerous function that allows to recursively delete a folder tree incl. any containing files. To, say, delete an empty theme the following could be used:

ZMTools::rmdir(getcwd().’/../zenmagick/themes/MyTheme’);

Even though I used getcwd() in the examples to build the filename/directory name, it is worth using proper full names to minimize the chance of deleting anything accidentally.

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.