JBZoo\Utils\FS::executable PHP Method

executable() public static method

Set the executable bit on a file to the minimum value that allows the user running PHP to read to it.
public static executable ( string $filename, boolean $executable = true ) : boolean
$filename string The filename to set the executable bit on
$executable boolean Whether to make the file executable or not
return boolean
    public static function executable($filename, $executable = true)
    {
        return self::_setPerms($filename, $executable, 1);
    }

Usage Example

コード例 #1
0
ファイル: FileSystemTest.php プロジェクト: jbzoo/utils
 public function testExecutable()
 {
     if (Sys::isWin()) {
         //skip('This functionality is not working on Windows.');
         return false;
     }
     if (Sys::isRoot()) {
         skip('These tests don\'t work when run as root');
     }
     isFalse(FS::executable('/no/such/file'));
     $dirname = dirname(__FILE__);
     $file = $dirname . '/test9';
     touch($file);
     isFalse(is_executable($file));
     FS::executable($file, true);
     clearstatcache();
     isTrue(is_executable($file));
     FS::executable($file, false);
     clearstatcache();
     isFalse(is_executable($file));
     unlink($file);
 }