cvs: php-src /pear/PEAR Installer.php
| From: | Greg Beaver | Date: | Tue, 16 Sep 2003 23:42:17 +0000 |
| Subject: | cvs: php-src /pear/PEAR Installer.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-12786@lists.php.net to get a copy of this message | ||
cellog Tue Sep 16 19:42:17 2003 EDT
Modified files:
/php-src/pear/PEAR Installer.php
Log:
Document addFileOperation()
Add basic test for invalid input, since it is a public method
Index: php-src/pear/PEAR/Installer.php
diff -u php-src/pear/PEAR/Installer.php:1.121 php-src/pear/PEAR/Installer.php:1.122
--- php-src/pear/PEAR/Installer.php:1.121 Mon Sep 15 23:27:55 2003
+++ php-src/pear/PEAR/Installer.php Tue Sep 16 19:42:16 2003
@@ -18,7 +18,7 @@
// | Martin Jansen <mj@php.net> |
// +----------------------------------------------------------------------+
//
-// $Id: Installer.php,v 1.121 2003/09/16 03:27:55 cellog Exp $
+// $Id: Installer.php,v 1.122 2003/09/16 23:42:16 cellog Exp $
require_once 'PEAR/Common.php';
require_once 'PEAR/Registry.php';
@@ -335,8 +335,34 @@
// }}}
// {{{ addFileOperation()
+ /**
+ * Add a file operation to the current file transaction.
+ *
+ * @see startFileTransaction()
+ * @var string $type This can be one of:
+ * - rename: rename a file ($data has 2 values)
+ * - chmod: change permissions on a file ($data has 1 value)
+ * - delete: delete a file ($data has 1 value)
+ * - rmdir: delete a directory if empty ($data has 1 value)
+ * - installed_as: mark a file as installed ($data has 4 values).
+ * @var array $data For all file operations, this array must contain the
+ * full path to the file or directory that is being operated on. For
+ * the rename command, the first parameter must be the file to rename,
+ * the second its new name.
+ *
+ * The installed_as operation contains 4 elements in this order:
+ * 1. Filename as listed in the filelist element from package.xml
+ * 2. Full path to the installed file
+ * 3. Full path from the php_dir configuration variable used in this
+ * installation
+ * 4. Relative path from the php_dir that this file is installed in
+ */
function addFileOperation($type, $data)
{
+ if (!is_array($data)) {
+ return $this->raiseError('Internal Error: $data in addFileOperation'
+ . ' must be an array, was ' . gettype($data));
+ }
if ($type == 'chmod') {
$octmode = decoct($data[0]);
$this->log(3, "adding to transaction: $type $octmode $data[1]");