本文整理匯總了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('');
}