DS.'foo'))
{
// handle failed folder delete
}
The last of these management-type methods is the create() method. This method
creates a new folder in the file system. This example creates the folder baz in the
frontend root of the current component:
if (!JFolder::create(JPATH_COMPONENT.DS.'baz'))
{
// handle failed folder creation
}
Chapter 12
[ 349 ]
There is a second parameter that we can optionally provide when using the
create() method. This parameter determines the access rights of the newly
created folder; by default this is 0777. This example creates a folder with the access
rights 0775:
if (!JFolder::create(JPATH_COMPONENT.DS.'baz', 0775))
{
// handle failed folder creation
}
Notice that the second parameter is prefixed with a 0; this ensures that the value is
treated as an octal integer. If we don't do this, we run the risk of the access rights
mode being misinterpreted. For a full description of file access rights mode in
PHP please consult the official PHP documentation: http://php.
Pages:
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485