当前位置: 首页>>代码示例>>PHP>>正文


PHP PEAR_Task_Common类代码示例

本文整理汇总了PHP中PEAR_Task_Common的典型用法代码示例。如果您正苦于以下问题:PHP PEAR_Task_Common类的具体用法?PHP PEAR_Task_Common怎么用?PHP PEAR_Task_Common使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PEAR_Task_Common类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: runPostinstallTasks

 /**
  * @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']);
 }
开发者ID:OTiZ,项目名称:osx,代码行数:14,代码来源:Common.php

示例2: install


//.........这里部分代码省略.........
             $this->popExpect();
         } else {
             $this->expectError(PEAR_INSTALLER_FAILED);
             $res = $this->_installFile2($pkg, $file, $atts, $tmp_path, $options);
             $this->popExpect();
         }
         if (PEAR::isError($res)) {
             if (empty($options['ignore-errors'])) {
                 $this->rollbackFileTransaction();
                 if ($res->getMessage() == "file does not exist") {
                     $this->raiseError("file {$file} in package.xml does not exist");
                 }
                 return $this->raiseError($res);
             } else {
                 if (!isset($options['soft'])) {
                     $this->log(0, "Warning: " . $res->getMessage());
                 }
             }
         }
         if ($res == PEAR_INSTALLER_OK) {
             // Register files that were installed
             $pkg->installedFile($file, $atts);
         }
     }
     // }}}
     // {{{ compile and install source files
     if ($this->source_files > 0 && empty($options['nobuild'])) {
         if (PEAR::isError($err = $this->_compileSourceFiles($savechannel, $pkg))) {
             return $err;
         }
     }
     // }}}
     if (isset($backedup)) {
         $this->_removeBackups($backedup);
     }
     if (!$this->commitFileTransaction()) {
         $this->rollbackFileTransaction();
         $this->configSet('default_channel', $savechannel);
         return $this->raiseError("commit failed", PEAR_INSTALLER_FAILED);
     }
     // }}}
     $ret = false;
     $installphase = 'install';
     $oldversion = false;
     // {{{ Register that the package is installed -----------------------
     if (empty($options['upgrade'])) {
         // if 'force' is used, replace the info in registry
         $usechannel = $channel;
         if ($channel == 'pecl.php.net') {
             $test = $installregistry->packageExists($pkgname, $channel);
             if (!$test) {
                 $test = $installregistry->packageExists($pkgname, 'pear.php.net');
                 $usechannel = 'pear.php.net';
             }
         } else {
             $test = $installregistry->packageExists($pkgname, $channel);
         }
         if (!empty($options['force']) && $test) {
             $oldversion = $installregistry->packageInfo($pkgname, 'version', $usechannel);
             $installregistry->deletePackage($pkgname, $usechannel);
         }
         $ret = $installregistry->addPackage2($pkg);
     } else {
         $usechannel = $channel;
         if ($channel == 'pecl.php.net') {
             $test = $installregistry->packageExists($pkgname, $channel);
             if (!$test) {
                 $test = $installregistry->packageExists($pkgname, 'pear.php.net');
                 $usechannel = 'pear.php.net';
             }
         } else {
             $test = $installregistry->packageExists($pkgname, $channel);
         }
         // new: upgrade installs a package if it isn't installed
         if (!$test) {
             $ret = $installregistry->addPackage2($pkg);
         } else {
             if ($usechannel != $channel) {
                 $installregistry->deletePackage($pkgname, $usechannel);
                 $ret = $installregistry->addPackage2($pkg);
             } else {
                 $ret = $installregistry->updatePackage2($pkg);
             }
             $installphase = 'upgrade';
         }
     }
     if (!$ret) {
         $this->configSet('default_channel', $savechannel);
         return $this->raiseError("Adding package {$channel}/{$pkgname} to registry failed");
     }
     // }}}
     $this->configSet('default_channel', $savechannel);
     if (class_exists('PEAR_Task_Common')) {
         // this is auto-included if any tasks exist
         if (PEAR_Task_Common::hasPostinstallTasks()) {
             PEAR_Task_Common::runPostinstallTasks($installphase);
         }
     }
     return $pkg->toArray(true);
 }
开发者ID:zseand,项目名称:kloxo,代码行数:101,代码来源:Installer.php


注:本文中的PEAR_Task_Common类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。