Re: ext/mysql updates (~deprecated)
| From: | Hannes Magnusson | Date: | Tue, 05 Jun 2012 13:25:20 +0000 |
| Subject: | Re: ext/mysql updates (~deprecated) | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969383847@lists.php.net to get a copy of this message | ||
On Mon, Jun 4, 2012 at 6:03 PM, Philip Olson <philip@roshambo.org> wrote:
>
> On Jun 2, 2012, at 10:02 AM, Hannes Magnusson wrote:
>
>> On Sat, Jun 2, 2012 at 5:36 PM, Peter Cowburn <petercowburn@gmail.com> wrote:
>>> On 2 June 2012 12:53, Hannes Magnusson <hannes.magnusson@gmail.com> wrote:
>>>>
>>>> Yep. +1 from me.
>>>>
>>>
>>> Excellent. I've committed your patches for PhD, the
>>> mysql_affected_rows() docs change, and mine for phpweb. I've also
>>> opened a ticket to track these changes (and conveniently forgot to
>>> reference it in the commits!) at
>>> https://bugs.php.net/62213
>>>
>>> I guess, if the above hasn't caused everything to explode, the next
>>> step is to roll out the docs changes for the rest of the ext/mysql
>>> functions (Philip?). Also, do we want to get this into a PhD release;
>>> I believe this was mentioned earlier?
>>
>> Kudos!
>>
>> We'll see if things explode on docs.php.net in few hours.
>> If it works out allright we must rollout a new PhD release and deploy
>> it before Friday, otherwise we'll get weird issues when the mirrors
>> pick up the new version :)
>
> Looks good. I also like that it's shown before the description.
>
> In the future we can think about soft vs hard deprecation but for now
> this works great.
>
> Also, I'll be updating all of ext/mysql before Friday.
A lot of these alternatives include passing specific arguments to
functions, which currently looks awkward and silly.
Attached is a patch that introduces phd:argN attribute to
<function/methodname> and will cause <methodname phd:arg1="PDO::bar"
phd:arg2="PDO::baz>PDOStatement::foo</methodname> to be rendered as:
<span..><a hre...>PDOStatement::foo(PDO::bar, PDO::baz)</a></span>
That is, it will make the phd:argN look like proper arguments to the function.
Should we include include this in the coming PhD release before Friday?
-Hannes
Index: en/reference/mysql/functions/mysql-fetch-row.xml =================================================================== --- en/reference/mysql/functions/mysql-fetch-row.xml (revision 325983) +++ en/reference/mysql/functions/mysql-fetch-row.xml (working copy) @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!-- $Revision$ --> -<refentry xml:id="function.mysql-fetch-row" xmlns="http://docbook.org/ns/docbook"> +<refentry xml:id="function.mysql-fetch-row" xmlns="http://docbook.org/ns/docbook" xmlns:phd="http://www.php.net/ns/phd"> <refnamediv> <refname>mysql_fetch_row</refname> <refpurpose>Get a result row as an enumerated array</refpurpose> @@ -11,7 +11,7 @@ &mysql.alternative.note; <simplelist role="alternatives"> <member><function>mysqli_fetch_row</function></member> - <member><methodname>PDOStatement::fetch</methodname> (<constant>PDO::FETCH_NUM</constant>)</member> + <member><methodname phd:arg1="PDO::FETCH_NUM" phd:arg3="$stuff" phd:arg2="$foobar">PDOStatement::fetch</methodname></member> </simplelist> </sidebar> </refsynopsisdiv> @@ -40,7 +40,7 @@ <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> - Returns an numerical array of strings that corresponds to the fetched row, or + Returns an numerical array of strings that corresponds to the fetched row, or &false; if there are no more rows. </para> <para> Index: doc-base/docbook/docbook-xml/docbook.dtd =================================================================== --- doc-base/docbook/docbook-xml/docbook.dtd (revision 325983) +++ doc-base/docbook/docbook-xml/docbook.dtd (working copy) @@ -1052,6 +1052,11 @@ <!ATTLIST methodname xmlns CDATA #FIXED "http://docbook.org/ns/docbook" role CDATA #IMPLIED + phd:arg1 CDATA #IMPLIED + phd:arg2 CDATA #IMPLIED + phd:arg3 CDATA #IMPLIED + phd:arg4 CDATA #IMPLIED + phd:arg4 CDATA #IMPLIED %db.common.attributes; %db.common.linking.attributes; @@ -1902,6 +1907,11 @@ <!ATTLIST function xmlns CDATA #FIXED "http://docbook.org/ns/docbook" role CDATA #IMPLIED + phd:arg1 CDATA #IMPLIED + phd:arg2 CDATA #IMPLIED + phd:arg3 CDATA #IMPLIED + phd:arg4 CDATA #IMPLIED + phd:arg4 CDATA #IMPLIED %db.common.attributes; %db.common.linking.attributes; diff --git a/phpdotnet/phd/Package/PHP/XHTML.php b/phpdotnet/phd/Package/PHP/XHTML.php index ddd3246..e5a4f95 100644 --- a/phpdotnet/phd/Package/PHP/XHTML.php +++ b/phpdotnet/phd/Package/PHP/XHTML.php @@ -11,6 +11,8 @@ abstract class Package_PHP_XHTML extends Package_Generic_XHTML { 'classname' => 'format_suppressed_tags', 'chapter' => 'format_container_chunk', 'colophon' => 'format_chunk', + 'function' => 'format_function', + 'methodname' => 'format_function', 'legalnotice' => 'format_chunk', 'part' => 'format_container_chunk', 'partintro' => 'format_partintro', @@ -126,6 +128,7 @@ abstract class Package_PHP_XHTML extends Package_Generic_XHTML { protected $dchunk = array( "phpdoc:classref" => null, + "args" => array(), "fieldsynopsis" => array( "modifier" => "public", ), @@ -454,6 +457,19 @@ abstract class Package_PHP_XHTML extends Package_Generic_XHTML { return $this->format_function_text($value, $tag, $display_value); } + public function format_function($open, $tag, $attrs, $props) { + if ($open) { + if (isset($attrs[Reader::XMLNS_PHD])) { + ksort($attrs[Reader::XMLNS_PHD]); + $this->cchunk["args"] = $attrs[Reader::XMLNS_PHD]; + } + // Leading space intional for methodname as phpdoc doesn't have a + // space between <type> and the <methodname> in methodsynopsis + return ' <span class="' . $tag . '">'; + } + return "</span>"; + } + public function format_function_text($value, $tag, $display_value = null) { static $non_functions = array( "echo" => true, "print" => true, @@ -465,7 +481,9 @@ abstract class Package_PHP_XHTML extends Package_Generic_XHTML { if ($display_value === null) { $display_value = $value; if (!isset($non_functions[$value])) { - $display_value .= "()"; + $args = implode(", ", $this->cchunk["args"]); + $this->cchunk["args"] = $this->dchunk["args"]; + $display_value .= "($args)"; } }
Index: en/reference/mysql/functions/mysql-fetch-row.xml =================================================================== --- en/reference/mysql/functions/mysql-fetch-row.xml (revision 325983) +++ en/reference/mysql/functions/mysql-fetch-row.xml (working copy) @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!-- $Revision$ --> -<refentry xml:id="function.mysql-fetch-row" xmlns="http://docbook.org/ns/docbook"> +<refentry xml:id="function.mysql-fetch-row" xmlns="http://docbook.org/ns/docbook" xmlns:phd="http://www.php.net/ns/phd"> <refnamediv> <refname>mysql_fetch_row</refname> <refpurpose>Get a result row as an enumerated array</refpurpose> @@ -11,7 +11,7 @@ &mysql.alternative.note; <simplelist role="alternatives"> <member><function>mysqli_fetch_row</function></member> - <member><methodname>PDOStatement::fetch</methodname> (<constant>PDO::FETCH_NUM</constant>)</member> + <member><methodname phd:arg1="PDO::FETCH_NUM" phd:arg3="$stuff" phd:arg2="$foobar">PDOStatement::fetch</methodname></member> </simplelist> </sidebar> </refsynopsisdiv> @@ -40,7 +40,7 @@ <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> - Returns an numerical array of strings that corresponds to the fetched row, or + Returns an numerical array of strings that corresponds to the fetched row, or &false; if there are no more rows. </para> <para> Index: doc-base/docbook/docbook-xml/docbook.dtd =================================================================== --- doc-base/docbook/docbook-xml/docbook.dtd (revision 325983) +++ doc-base/docbook/docbook-xml/docbook.dtd (working copy) @@ -1052,6 +1052,11 @@ <!ATTLIST methodname xmlns CDATA #FIXED "http://docbook.org/ns/docbook" role CDATA #IMPLIED + phd:arg1 CDATA #IMPLIED + phd:arg2 CDATA #IMPLIED + phd:arg3 CDATA #IMPLIED + phd:arg4 CDATA #IMPLIED + phd:arg4 CDATA #IMPLIED %db.common.attributes; %db.common.linking.attributes; @@ -1902,6 +1907,11 @@ <!ATTLIST function xmlns CDATA #FIXED "http://docbook.org/ns/docbook" role CDATA #IMPLIED + phd:arg1 CDATA #IMPLIED + phd:arg2 CDATA #IMPLIED + phd:arg3 CDATA #IMPLIED + phd:arg4 CDATA #IMPLIED + phd:arg4 CDATA #IMPLIED %db.common.attributes; %db.common.linking.attributes; diff --git a/phpdotnet/phd/Package/PHP/XHTML.php b/phpdotnet/phd/Package/PHP/XHTML.php index ddd3246..e5a4f95 100644 --- a/phpdotnet/phd/Package/PHP/XHTML.php +++ b/phpdotnet/phd/Package/PHP/XHTML.php @@ -11,6 +11,8 @@ abstract class Package_PHP_XHTML extends Package_Generic_XHTML { 'classname' => 'format_suppressed_tags', 'chapter' => 'format_container_chunk', 'colophon' => 'format_chunk', + 'function' => 'format_function', + 'methodname' => 'format_function', 'legalnotice' => 'format_chunk', 'part' => 'format_container_chunk', 'partintro' => 'format_partintro', @@ -126,6 +128,7 @@ abstract class Package_PHP_XHTML extends Package_Generic_XHTML { protected $dchunk = array( "phpdoc:classref" => null, + "args" => array(), "fieldsynopsis" => array( "modifier" => "public", ), @@ -454,6 +457,19 @@ abstract class Package_PHP_XHTML extends Package_Generic_XHTML { return $this->format_function_text($value, $tag, $display_value); } + public function format_function($open, $tag, $attrs, $props) { + if ($open) { + if (isset($attrs[Reader::XMLNS_PHD])) { + ksort($attrs[Reader::XMLNS_PHD]); + $this->cchunk["args"] = $attrs[Reader::XMLNS_PHD]; + } + // Leading space intional for methodname as phpdoc doesn't have a + // space between <type> and the <methodname> in methodsynopsis + return ' <span class="' . $tag . '">'; + } + return "</span>"; + } + public function format_function_text($value, $tag, $display_value = null) { static $non_functions = array( "echo" => true, "print" => true, @@ -465,7 +481,9 @@ abstract class Package_PHP_XHTML extends Package_Generic_XHTML { if ($display_value === null) { $display_value = $value; if (!isset($non_functions[$value])) { - $display_value .= "()"; + $args = implode(", ", $this->cchunk["args"]); + $this->cchunk["args"] = $this->dchunk["args"]; + $display_value .= "($args)"; } }