This package allows a PHP script to communicate with a Subversion repository using PHP function calls.
No hacks using the svn
command line interface.
I was unable to find documentation so I dug through the PECL code and tried my best, here you go.
Constants and Function List
This package defines the following constants and imports them into the namespace of the script.
- (String) SVN_AUTH_PARAM_DEFAULT_USERNAME - Use in svn_auth_set_parameter()
- (String) SVN_AUTH_PARAM_DEFAULT_PASSWORD - Use in svn_auth_set_parameter()
- (String) SVN_AUTH_PARAM_NON_INTERACTIVE
- (String) SVN_AUTH_PARAM_DONT_STORE_PASSWORDS
- (String) SVN_AUTH_PARAM_NO_AUTH_CACHE
- (String) SVN_AUTH_PARAM_SSL_SERVER_FAILURES
- (String) SVN_AUTH_PARAM_SSL_SERVER_CERT_INFO
- (String) SVN_AUTH_PARAM_CONFIG
- (String) SVN_AUTH_PARAM_SERVER_GROUP
- (String) SVN_AUTH_PARAM_CONFIG_DIR
- (String) PHP_SVN_AUTH_PARAM_IGNORE_SSL_VERIFY_ERRORS
- (String) SVN_FS_CONFIG_FS_TYPE
- (String) SVN_FS_TYPE_BDB
- (String) SVN_FS_TYPE_FSFS
- (String) SVN_PROP_REVISION_DATE
- (String) SVN_PROP_REVISION_ORIG_DATE
- (String) SVN_PROP_REVISION_AUTHOR
- (String) SVN_PROP_REVISION_LOG
- (integer) svn_wc_status_none
- (integer) svn_wc_status_unversioned
- (integer) svn_wc_status_normal
- (integer) svn_wc_status_added
- (integer) svn_wc_status_missing
- (integer) svn_wc_status_deleted
- (integer) svn_wc_status_replaced
- (integer) svn_wc_status_modified
- (integer) svn_wc_status_merged
- (integer) svn_wc_status_conflicted
- (integer) svn_wc_status_ignored
- (integer) svn_wc_status_obstructed
- (integer) svn_wc_status_external
- (integer) svn_wc_status_incomplete
This package defines the following functions and imports them into the namespace of the script.
- mixed = svn_checkout($repo_url,$target_path,$revision=0)
- mixed = svn_cat($repo_url,$revision=0)
- mixed = svn_ls($repo_url,$revision=0)
- mixed = svn_log, NULL)
- mixed = svn_auth_set_parameter(SVN_AUTH_PARAM_*,$value) - Use one of those constants from above and set $value to what is desired.
- mixed = svn_auth_get_parameter(SVN_AUTH_PARAM_*) - Use one of those constants from above.
- mixed = svn_client_version, NULL)
- mixed = svn_diff, NULL)
- mixed = svn_cleanup, NULL)
- mixed = svn_commit, NULL)
- mixed = svn_add, NULL)
- mixed = svn_status($path,$recurse=1,$get_all=0,$update=0,$no_ignore=0);
- mixed = svn_update, NULL)
- mixed = svn_import($string,$string,$boolean)
- mixed = svn_repos_create, NULL)
- mixed = svn_repos_recover, NULL)
- mixed = svn_repos_hotcopy, NULL)
- mixed = svn_repos_open, NULL)
- mixed = svn_repos_fs, NULL)
- mixed = svn_repos_fs_begin_txn_for_commit, NULL)
- mixed = svn_repos_fs_commit_txn, NULL)
- mixed = svn_fs_revision_root, NULL)
- mixed = svn_fs_check_path, NULL)
- mixed = svn_fs_revision_prop, NULL)
- mixed = svn_fs_dir_entries, NULL)
- mixed = svn_fs_node_created_rev, NULL)
- mixed = svn_fs_youngest_rev, NULL)
- mixed = svn_fs_file_contents, NULL)
- mixed = svn_fs_file_length, NULL)
- mixed = svn_fs_txn_root, NULL)
- mixed = svn_fs_make_file, NULL)
- mixed = svn_fs_make_dir, NULL)
- mixed = svn_fs_apply_text, NULL)
- mixed = svn_fs_copy, NULL)
- mixed = svn_fs_delete, NULL)
- mixed = svn_fs_begin_txn2, NULL)
- mixed = svn_fs_is_dir, NULL)
- mixed = svn_fs_is_file, NULL)
- mixed = svn_fs_node_prop, NULL)
- mixed = svn_fs_change_node_prop, NULL)
- mixed = svn_fs_contents_changed, NULL)
- mixed = svn_fs_props_changed, NULL)
- mixed = svn_fs_abort_txn, NULL)
Usage
Setup a connection before running any other calls.
dl('svn.so'); // Load SVN module (or set in php.ini) $url = 'http://svn.domain.com/svn/'; $rev = -1; // -1 == HEAD svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_USERNAME,'dude'); svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_PASSWORD,'d00d');
Get a list of files/directories at a given Subversion url, specify a revision to view a listing at that point in time.
$ls = svn_ls($url,$rev);
$ls is now and array of entry arrays, as below.
Array ( [0] => Array ( [created_rev] => 395 [last_author] => dbusby [size] => 0 [time] => Jan 18 07:43 [time_t] => 1137598980 [name] => branches [type] => dir ) [1] => Array ( [created_rev] => 400 [last_author] => dbusby [size] => 0 [time] => Jan 18 11:30 [time_t] => 1137612626 [name] => trunk [type] => dir ) )
View some logs entries.
See Also
- PECL :: Package :: svn :: 0.2 - The package home page.
- PECL Subversion archive - Subversion archive of the Subversion Package
ChangeLog
- 08 Aug 2006 - Created /djb