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


PHP tar::loadfromstring方法代码示例

本文整理汇总了PHP中tar::loadfromstring方法的典型用法代码示例。如果您正苦于以下问题:PHP tar::loadfromstring方法的具体用法?PHP tar::loadfromstring怎么用?PHP tar::loadfromstring使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tar的用法示例。


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

示例1: processform

 public function processform()
 {
     $plugin = tsourcefiles::i();
     if (isset($_POST['download'])) {
         set_time_limit(300);
         $version = litepublisher::$options->version;
         if (!(($s = http::get("http://litepublisher.googlecode.com/files/litepublisher.{$version}.tar.gz")) || ($s = http::get("http://litepublisher.com/download/litepublisher.{$version}.tar.gz")))) {
             return 'Error download';
         }
         tbackuper::include_tar();
         $tar = new tar();
         $tar->loadfromstring($s);
         if (!is_array($tar->files)) {
             unset($tar);
             return 'Invalid file archive';
         }
         tfiler::delete($plugin->root, true, false);
         foreach ($tar->files as $item) {
             $filename = $plugin->root . $item['name'];
             $dir = dirname($filename);
             if (!is_dir($dir)) {
                 $this->mkdir($dir);
             }
             file_put_contents($filename, $item['file']);
             @chmod($filename, 0666);
         }
         unset($tar);
         $plugin->reread();
     } elseif (isset($_POST['reread'])) {
         $plugin->reread();
     } else {
         $plugin->root = $_POST['root'];
         $plugin->save();
     }
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:35,代码来源:admin.sourcefiles.class.php

示例2: unpack

 public function unpack($content, $archtype)
 {
     $result = array();
     if ($archtype == 'zip') {
         $archtype = 'unzip';
     }
     $this->archtype = $archtype;
     //$this->createarchive();
     switch ($archtype) {
         case 'tar':
             self::include_tar();
             $tar = new tar();
             $tar->loadfromstring($content);
             if (!is_array($tar->files)) {
                 unset($tar);
                 return $this->errorarch();
             }
             foreach ($tar->files as $item) {
                 $result[$item['name']] = $item['file'];
             }
             unset($tar);
             break;
         case 'unzip':
         case 'zip':
             self::include_unzip();
             $unzip = new StrSimpleUnzip();
             $unzip->ReadData($content);
             foreach ($unzip->Entries as $item) {
                 $result[$item->Path . '/' . $item->Name] = $item->Data;
             }
             unset($unzip);
             break;
         default:
             $this->unknown_archive();
     }
     return $result;
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:37,代码来源:backuper.class.php

示例3: install

 public static function install()
 {
     $dir = dirname(__FILE__) . DIRECTORY_SEPARATOR;
     //test write
     if (!file_put_contents($dir . 'test.php', ' ')) {
         die('Error write to test.php');
     }
     chmod($dir . 'test.php', 0666);
     unlink($dir . 'test.php');
     if ($version = self::getlatest()) {
         if (($s = http::get("http://litepublisher.googlecode.com/files/litepublisher.{$version}.tar.gz")) || ($s = http::get("http://litepublisher.com/download/litepublisher.{$version}.tar.gz"))) {
             $tar = new tar();
             $tar->loadfromstring($s);
             foreach ($tar->files as $file) {
                 $filename = $dir . str_replace('/', DIRECTORY_SEPARATOR, $file['name']);
                 if (!self::forcedir(dirname($filename))) {
                     die("error create folder " . dirname($filename));
                 }
                 if (false === @file_put_contents($filename, $file['file'])) {
                     die(sprintf('Error write file %s', $filename));
                 }
                 @chmod($filename, 0666);
             }
             return true;
         }
     }
     die('Error download last release');
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:28,代码来源:reinstall.php


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