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


PHP util::remove方法代码示例

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


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

示例1: unzip

 protected function unzip($zip, $path)
 {
     // build the temporary folder path
     $tmp = $this->tmp(preg_replace('!.zip$!', '', $zip));
     // extract the zip file
     util::unzip($zip, $tmp);
     // get the list of directories within our tmp folder
     $dirs = glob($tmp . '/*');
     // get the source directory from the tmp folder
     if (isset($dirs[0]) && is_dir($dirs[0])) {
         $source = $dirs[0];
     } else {
         throw new RuntimeException('The source directory could not be found');
     }
     // create the folder if it does not exist yet
     if (!is_dir($path)) {
         mkdir($path);
     }
     // extract the content of the directory to the final path
     foreach ((array) array_diff(scandir($source), ['.', '..']) as $name) {
         if (!rename($source . '/' . $name, $path . '/' . $name)) {
             throw new RuntimeException($name . ' could not be copied');
         }
     }
     // remove the zip file
     util::remove($zip);
     // remove the temporary folder
     util::remove($tmp);
 }
开发者ID:getkirby,项目名称:cli,代码行数:29,代码来源:Command.php

示例2: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if ($this->isInstalled() === false) {
         throw new RuntimeException('There seems to be no valid Kirby installation in this folder!');
     }
     $output->writeln('<info>Updating Kirby...</info>');
     $output->writeln('');
     // check if the panel is installed at all
     $hasPanel = is_dir($this->dir() . '/panel');
     // start updating the core
     $output->writeln('Updating the core...');
     // remove the old folder
     util::remove($this->dir() . '/kirby');
     // update the core
     $this->install(['repo' => 'getkirby/kirby', 'branch' => $input->getOption('dev') ? 'develop' : 'master', 'path' => $this->dir() . '/kirby', 'output' => $output]);
     // still has the old toolkit submodule
     if (is_dir($this->dir() . '/kirby/toolkit')) {
         // start updating the toolkit
         $output->writeln('Updating the toolkit...');
         // remove the toolkit folder first
         util::remove($this->dir() . '/kirby/toolkit');
         // update the toolkit
         $this->install(['repo' => 'getkirby/toolkit', 'branch' => $input->getOption('dev') ? 'develop' : 'master', 'path' => $this->dir() . '/kirby/toolkit', 'output' => $output]);
     }
     if ($hasPanel) {
         // start updating the panel
         $output->writeln('Updating the panel...');
         // remove the old panel folder first
         util::remove($this->dir() . '/panel');
         // update the panel
         $this->install(['repo' => 'getkirby/panel', 'branch' => $input->getOption('dev') ? 'develop' : 'master', 'path' => $this->dir() . '/panel', 'output' => $output]);
     }
     $output->writeln('<comment>Kirby has been updated to: ' . $this->version() . '!</comment>');
     $output->writeln('');
 }
开发者ID:getkirby,项目名称:cli,代码行数:35,代码来源:Update.php

示例3: dev

 protected function dev($input, $output, $kit)
 {
     $path = $input->getArgument('path');
     $this->install(['repo' => 'getkirby/' . $kit, 'branch' => 'master', 'path' => $path, 'output' => $output]);
     util::remove(realpath($path) . '/panel');
     util::remove(realpath($path) . '/kirby');
     $output->writeln('Installing the core developer preview...');
     $this->install(['repo' => 'getkirby/kirby', 'branch' => 'develop', 'path' => $path . '/kirby', 'output' => $output]);
     $output->writeln('Installing the panel developer preview...');
     $this->install(['repo' => 'getkirby/panel', 'branch' => 'develop', 'path' => $path . '/panel', 'output' => $output]);
     $output->writeln('<comment>The developer preview has been installed!</comment>');
     $output->writeln('');
 }
开发者ID:getkirby,项目名称:cli,代码行数:13,代码来源:Install.php


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