mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Remove example unnecessary due to limit parameter
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@262017 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
4e6cd4302b
commit
5831afa921
1 changed files with 1 additions and 42 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<refentry xml:id="function.svn-log" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>svn_log</refname>
|
||||
|
@ -235,47 +235,6 @@ Array
|
|||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>Simulating <userinput>--limit</userinput> with <userinput>svn</userinput> and <function>svn_log</function></title>
|
||||
<para>
|
||||
This sample function simulates the <userinput>--limit</userinput> switch
|
||||
by using the SVN executable to return a list of revisions, which
|
||||
are then losslessly accessed using <function>svn_log</function>.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
This function will perform a total of <parameter>limit</parameter> + 1
|
||||
requests: the first request to pull the required revisions, and
|
||||
each one after to retrieve the log item for that request.
|
||||
</para>
|
||||
</note>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
/**
|
||||
* Retrieves the last $limit log entries.
|
||||
* @param $repos_url Repository URL of item to get logs for
|
||||
* @param $limit Integer limit of items
|
||||
*/
|
||||
function svn_log_limit($repos_url, $limit) {
|
||||
$limit = (int) $limit;
|
||||
if ($limit <= 0) return array();
|
||||
// -q flag used to prevent server from sending log messages
|
||||
$output = shell_exec("svn log -q --limit $limit $repos_url");
|
||||
preg_match_all('/^r(\d+) /m', $output, $matches);
|
||||
$ret = array();
|
||||
foreach ($matches[1] as $rev) {
|
||||
$log = svn_log($repos_url, (int) $rev);
|
||||
$ret[] = $log[0]; // log is only one item long
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
|
|
Loading…
Reference in a new issue