2011-08-16 11:38:58 +00:00
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
2009-07-11 09:19:14 +00:00
|
|
|
<!-- $Revision$ -->
|
2004-08-14 23:39:49 +00:00
|
|
|
<!-- Generated by xml_proto.php v2.0. Found in /scripts directory of phpdoc. -->
|
2007-06-20 22:25:43 +00:00
|
|
|
<refentry xml:id="function.xattr-set" xmlns="http://docbook.org/ns/docbook">
|
2005-01-02 16:49:45 +00:00
|
|
|
<refnamediv>
|
|
|
|
<refname>xattr_set</refname>
|
|
|
|
<refpurpose>
|
|
|
|
Set an extended attribute
|
|
|
|
</refpurpose>
|
|
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
|
|
&reftitle.description;
|
|
|
|
<methodsynopsis>
|
|
|
|
<type>bool</type><methodname>xattr_set</methodname>
|
|
|
|
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
|
|
|
|
<methodparam><type>string</type><parameter>name</parameter></methodparam>
|
|
|
|
<methodparam><type>string</type><parameter>value</parameter></methodparam>
|
2009-01-19 15:05:01 +00:00
|
|
|
<methodparam choice="opt"><type>int</type><parameter>flags</parameter><initializer>0</initializer></methodparam>
|
2005-01-02 16:49:45 +00:00
|
|
|
</methodsynopsis>
|
|
|
|
<para>
|
|
|
|
This function sets the value of an extended attribute of a file.
|
|
|
|
</para>
|
|
|
|
&xattr.namespace;
|
|
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
|
|
&reftitle.parameters;
|
|
|
|
<para>
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>filename</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The file in which we set the attribute.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>name</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2005-02-14 04:13:17 +00:00
|
|
|
The name of the extended attribute. This attribute will be created if
|
2005-01-02 16:49:45 +00:00
|
|
|
it doesn't exist or replaced otherwise. You can change this behaviour
|
|
|
|
by using the <parameter>flags</parameter> parameter.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>value</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The value of the attribute.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>flags</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
<table>
|
|
|
|
<title>Supported xattr flags</title>
|
|
|
|
<tgroup cols="2">
|
|
|
|
<tbody>
|
|
|
|
<row>
|
|
|
|
<entry><constant>XATTR_CREATE</constant></entry>
|
|
|
|
<entry>Function will fail if extended attribute already exists.</entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
|
|
|
<entry><constant>XATTR_REPLACE</constant></entry>
|
|
|
|
<entry>Function will fail if extended attribute doesn't exist.</entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
|
|
|
<entry><constant>XATTR_DONTFOLLOW</constant></entry>
|
|
|
|
<entry>Do not follow the symbolic link but operate on symbolic link itself.</entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
|
|
|
<entry><constant>XATTR_ROOT</constant></entry>
|
|
|
|
<entry>Set attribute in root (trusted) namespace. Requires root privileges.</entry>
|
|
|
|
</row>
|
|
|
|
</tbody>
|
|
|
|
</tgroup>
|
|
|
|
</table>
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
|
|
&reftitle.returnvalues;
|
|
|
|
<para>
|
|
|
|
&return.success;
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
|
|
&reftitle.examples;
|
|
|
|
<para>
|
|
|
|
<example>
|
2009-05-04 21:23:55 +00:00
|
|
|
<title>Sets extended attributes on <filename>.wav</filename> file</title>
|
2005-01-02 16:49:45 +00:00
|
|
|
<programlisting role="php">
|
2004-08-18 21:11:52 +00:00
|
|
|
<![CDATA[
|
|
|
|
<?php
|
2004-08-19 10:11:41 +00:00
|
|
|
$file = 'my_favourite_song.wav';
|
2004-08-18 21:11:52 +00:00
|
|
|
xattr_set($file, 'Artist', 'Someone');
|
|
|
|
xattr_set($file, 'My ranking', 'Good');
|
|
|
|
xattr_set($file, 'Listen count', '34');
|
|
|
|
|
|
|
|
/* ... other code ... */
|
|
|
|
|
|
|
|
printf("You've played this song %d times", xattr_get($file, 'Listen count'));
|
|
|
|
?>
|
|
|
|
]]>
|
2005-01-02 16:49:45 +00:00
|
|
|
</programlisting>
|
|
|
|
</example>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
|
|
&reftitle.seealso;
|
|
|
|
<para>
|
|
|
|
<simplelist>
|
|
|
|
<member><function>xattr_get</function></member>
|
|
|
|
<member><function>xattr_remove</function></member>
|
|
|
|
</simplelist>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
</refentry>
|
2004-08-14 23:39:49 +00:00
|
|
|
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
|
|
Local variables:
|
|
|
|
mode: sgml
|
|
|
|
sgml-omittag:t
|
|
|
|
sgml-shorttag:t
|
|
|
|
sgml-minimize-attributes:nil
|
|
|
|
sgml-always-quote-attributes:t
|
|
|
|
sgml-indent-step:1
|
|
|
|
sgml-indent-data:t
|
|
|
|
indent-tabs-mode:nil
|
|
|
|
sgml-parent-document:nil
|
2009-09-25 07:04:39 +00:00
|
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
2004-08-14 23:39:49 +00:00
|
|
|
sgml-exposed-tags:nil
|
|
|
|
sgml-local-catalogs:nil
|
|
|
|
sgml-local-ecat-files:nil
|
|
|
|
End:
|
|
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
|
|
vim: et tw=78 syn=sgml
|
|
|
|
vi: ts=1 sw=1
|
2007-06-20 22:25:43 +00:00
|
|
|
-->
|