*
* PHP versions 4 and 5
*
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Common.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.0a1
+ * @category pear
+ * @package PEAR
+ * @author Greg Beaver <cellog@php.net>
+ * @copyright 1997-2009 The Authors
+ * @license http://opensource.org/licenses/bsd-license.php New BSD License
+ * @link http://pear.php.net/package/PEAR
+ * @since File available since Release 1.4.0a1
*/
/**#@+
* Error codes for task validation routines
* This will first replace any instance of @data-dir@ in the test.php file
* with the path to the current data directory. Then, it will include the
* test.php file and run the script it contains to configure the package post-installation.
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a1
+ *
+ * @category pear
+ * @package PEAR
+ * @author Greg Beaver <cellog@php.net>
+ * @copyright 1997-2009 The Authors
+ * @license http://opensource.org/licenses/bsd-license.php New BSD License
+ * @version Release: 1.10.1
+ * @link http://pear.php.net/package/PEAR
+ * @since Class available since Release 1.4.0a1
* @abstract
*/
class PEAR_Task_Common
* changes directly to disk
*
* Child task classes must override this property.
+ *
* @access protected
*/
- var $type = 'simple';
+ protected $type = 'simple';
/**
* Determines which install phase this task is executed under
*/
- var $phase = PEAR_TASK_INSTALL;
+ public $phase = PEAR_TASK_INSTALL;
/**
* @access protected
*/
- var $config;
+ protected $config;
/**
* @access protected
*/
- var $registry;
+ protected $registry;
/**
* @access protected
*/
- var $logger;
+ public $logger;
/**
* @access protected
*/
- var $installphase;
+ protected $installphase;
/**
* @param PEAR_Config
* @param PEAR_Common
*/
- function PEAR_Task_Common(&$config, &$logger, $phase)
+ function __construct(&$config, &$logger, $phase)
{
$this->config = &$config;
$this->registry = &$config->getRegistry();
/**
* Validate the basic contents of a task tag.
+ *
* @param PEAR_PackageFile_v2
* @param array
* @param PEAR_Config
* @param array the entire parsed <file> tag
+ *
* @return true|array On error, return an array in format:
- * array(PEAR_TASK_ERROR_???[, param1][, param2][, ...])
+ * array(PEAR_TASK_ERROR_???[, param1][, param2][, ...])
+ *
+ * For PEAR_TASK_ERROR_MISSING_ATTRIB, pass the attribute name in
+ * For PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE, pass the attribute name and
+ * an array of legal values in
*
- * For PEAR_TASK_ERROR_MISSING_ATTRIB, pass the attribute name in
- * For PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE, pass the attribute name and an array
- * of legal values in
- * @static
* @abstract
*/
- function validateXml($pkg, $xml, $config, $fileXml)
+ public static function validateXml($pkg, $xml, $config, $fileXml)
{
}
/**
* Initialize a task instance with the parameters
- * @param array raw, parsed xml
- * @param array attributes from the <file> tag containing this task
- * @param string|null last installed version of this package
+ *
+ * @param array raw, parsed xml
+ * @param array attributes from the <file> tag containing this task
+ * @param string|null last installed version of this package
* @abstract
*/
- function init($xml, $fileAttributes, $lastVersion)
+ public function init($xml, $fileAttributes, $lastVersion)
{
}
/**
- * Begin a task processing session. All multiple tasks will be processed after each file
- * has been successfully installed, all simple tasks should perform their task here and
- * return any errors using the custom throwError() method to allow forward compatibility
+ * Begin a task processing session. All multiple tasks will be processed
+ * after each file has been successfully installed, all simple tasks should
+ * perform their task here and return any errors using the custom
+ * throwError() method to allow forward compatibility
*
* This method MUST NOT write out any changes to disk
- * @param PEAR_PackageFile_v2
- * @param string file contents
- * @param string the eventual final file location (informational only)
- * @return string|false|PEAR_Error false to skip this file, PEAR_Error to fail
- * (use $this->throwError), otherwise return the new contents
+ *
+ * @param PEAR_PackageFile_v2
+ * @param string file contents
+ * @param string the eventual final file location (informational only)
+ * @return string|false|PEAR_Error false to skip this file, PEAR_Error to fail
+ * (use $this->throwError), otherwise return the new contents
* @abstract
*/
- function startSession($pkg, $contents, $dest)
+ public function startSession($pkg, $contents, $dest)
{
}
/**
- * This method is used to process each of the tasks for a particular multiple class
- * type. Simple tasks need not implement this method.
- * @param array an array of tasks
- * @access protected
- * @static
- * @abstract
+ * This method is used to process each of the tasks for a particular
+ * multiple class type. Simple tasks need not implement this method.
+ *
+ * @param array an array of tasks
+ * @access protected
*/
- function run($tasks)
+ public static function run($tasks)
{
}
/**
- * @static
* @final
*/
- function hasPostinstallTasks()
+ public static function hasPostinstallTasks()
{
return isset($GLOBALS['_PEAR_TASK_POSTINSTANCES']);
}
- /**
- * @static
- * @final
- */
- function runPostinstallTasks()
- {
- foreach ($GLOBALS['_PEAR_TASK_POSTINSTANCES'] as $class => $tasks) {
- $err = call_user_func(array($class, 'run'),
- $GLOBALS['_PEAR_TASK_POSTINSTANCES'][$class]);
- if ($err) {
- return PEAR_Task_Common::throwError($err);
- }
- }
- unset($GLOBALS['_PEAR_TASK_POSTINSTANCES']);
+ /**
+ * @final
+ */
+ public static function runPostinstallTasks()
+ {
+ foreach ($GLOBALS['_PEAR_TASK_POSTINSTANCES'] as $class => $tasks) {
+ $err = call_user_func(
+ array($class, 'run'),
+ $GLOBALS['_PEAR_TASK_POSTINSTANCES'][$class]
+ );
+ if ($err) {
+ return PEAR_Task_Common::throwError($err);
+ }
+ }
+ unset($GLOBALS['_PEAR_TASK_POSTINSTANCES']);
}
/**
* Determines whether a role is a script
* @return bool
*/
- function isScript()
+ public function isScript()
{
- return $this->type == 'script';
+ return $this->type == 'script';
}
- function throwError($msg, $code = -1)
+ public function throwError($msg, $code = -1)
{
include_once 'PEAR.php';
+
return PEAR::raiseError($msg, $code);
}
}
-?>
\ No newline at end of file