本文整理汇总了PHP中Grav\Common\Filesystem\Folder::rcopy方法的典型用法代码示例。如果您正苦于以下问题:PHP Folder::rcopy方法的具体用法?PHP Folder::rcopy怎么用?PHP Folder::rcopy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Grav\Common\Filesystem\Folder
的用法示例。
在下文中一共展示了Folder::rcopy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: copyInstall
/**
* @param \ZipArchive $zip
* @param $install_path
* @param $tmp
*
* @return bool
*/
public static function copyInstall(\ZipArchive $zip, $install_path, $tmp)
{
$firstDir = $zip->getNameIndex(0);
if (empty($firstDir)) {
throw new \RuntimeException("Directory {$firstDir} is missing");
} else {
$tmp = realpath($tmp . DS . $firstDir);
Folder::rcopy($tmp, $install_path);
}
return true;
}
示例2: installDemoContent
/**
* @param $package
*/
private function installDemoContent($package)
{
$demo_dir = $this->destination . DS . $package->install_path . DS . '_demo';
$dest_dir = $this->destination . DS . 'user';
$pages_dir = $dest_dir . DS . 'pages';
if (file_exists($demo_dir)) {
// Demo content exists, prompt to install it.
$this->output->writeln("<white>Attention: </white><cyan>" . $package->name . "</cyan> contains demo content");
$helper = $this->getHelper('question');
$question = new ConfirmationQuestion('Do you wish to install this demo content? [y|N] ', false);
if (!$helper->ask($this->input, $this->output, $question)) {
$this->output->writeln(" '- <red>Skipped!</red> ");
$this->output->writeln('');
return;
}
// if pages folder exists in demo
if (file_exists($demo_dir . DS . 'pages')) {
$pages_backup = 'pages.' . date('m-d-Y-H-i-s');
$question = new ConfirmationQuestion('This will backup your current `user/pages` folder to `user/' . $pages_backup . '`, continue? [y|N]', false);
if (!$helper->ask($this->input, $this->output, $question)) {
$this->output->writeln(" '- <red>Skipped!</red> ");
$this->output->writeln('');
return;
}
// backup current pages folder
if (file_exists($dest_dir)) {
if (rename($pages_dir, $dest_dir . DS . $pages_backup)) {
$this->output->writeln(" |- Backing up pages... <green>ok</green>");
} else {
$this->output->writeln(" |- Backing up pages... <red>failed</red>");
}
}
}
// Confirmation received, copy over the data
$this->output->writeln(" |- Installing demo content... <green>ok</green> ");
Folder::rcopy($demo_dir, $dest_dir);
$this->output->writeln(" '- <green>Success!</green> ");
$this->output->writeln('');
}
}
示例3: pages
/**
*
*/
private function pages()
{
$this->output->writeln('');
$this->output->writeln('<comment>Pages Initializing</comment>');
// get pages files and initialize if no pages exist
$pages_dir = $this->destination . '/user/pages';
$pages_files = array_diff(scandir($pages_dir), array('..', '.'));
if (count($pages_files) == 0) {
$destination = $this->source . '/user/pages';
Folder::rcopy($destination, $pages_dir);
$this->output->writeln(' <cyan>' . $destination . '</cyan> <comment>-></comment> Created');
}
}
示例4: copyInstall
/**
* @param $source_path
* @param $install_path
*
* @return bool
*/
public static function copyInstall($source_path, $install_path)
{
if (empty($source_path)) {
throw new \RuntimeException("Directory {$source_path} is missing");
} else {
Folder::rcopy($source_path, $install_path);
}
return true;
}