本文整理汇总了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);
}
示例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('');
}
示例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('');
}