本文整理汇总了PHP中Zip::extractZip方法的典型用法代码示例。如果您正苦于以下问题:PHP Zip::extractZip方法的具体用法?PHP Zip::extractZip怎么用?PHP Zip::extractZip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zip
的用法示例。
在下文中一共展示了Zip::extractZip方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: install
public function install($filename)
{
$src = ROOT . '/sys/tmp/' . $filename;
$dest = ROOT . '/sys/tmp/install_plugin/';
Zip::extractZip($src, $dest);
if (!file_exists($dest)) {
$this->errors = __('Some error occurred');
return false;
}
$tmp_plugin_path = glob($dest . '*', GLOB_ONLYDIR);
$tmp_plugin_path = $tmp_plugin_path[0];
$plugin_basename = substr(strrchr($tmp_plugin_path, '/'), 1);
$plugin_path = ROOT . '/sys/plugins/' . $plugin_basename;
copyr($dest, ROOT . '/sys/plugins/', 0755);
$this->files = getDirFiles($plugin_path);
if (file_exists($plugin_path . '/config.dat')) {
$config = json_decode(file_get_contents($plugin_path . '/config.dat'), true);
include_once $plugin_path . '/index.php';
$className = $config['className'];
$obj = new $className(null);
if (method_exists($obj, 'install')) {
$obj->install();
}
}
_unlink($src);
_unlink($dest);
return true;
}
示例2: foreach
if ($deleteList) {
foreach ($deleteList as &$curFile) {
$curFile = trim($curFile);
if ($curFile && substr($curFile, 0, 1) != "/") {
$fileName[] = $curFile;
}
}
}
$writingZip = new Zip(KB_CACHEDIR . '/update/backup/' . $codeversion . '.zip');
$writingZip->addFileArray($fileName);
if ($writingZip->createZip()) {
if ($writingZip->getErrors()) {
$page_error[] = $writingZip->getErrors();
}
}
$readingZip->extractZip(getcwd());
if ($deleteList) {
foreach ($deleteList as $curFile) {
if ($curFile && substr($curFile, 0, 1) != "/") {
if (file_exists($curFile) && !@unlink($curFile)) {
$page_error[] = "Could not unlink " . $curFile;
}
}
}
}
if ($readingZip->getErrors()) {
$page_error[] = $readingZip->getErrors();
} else {
Config::set('upd_CodeVersion', $piece['version']);
$qry = DBFactory::getDBQuery(true);
$qry->execute("INSERT INTO `kb3_config` (cfg_site, cfg_key, cfg_value) " . "SELECT cfg_site, 'upd_codeVersion', '{$piece['version']}' FROM `kb3_config` " . "GROUP BY cfg_site ON DUPLICATE KEY UPDATE cfg_value = '{$piece['version']}';");