本文整理汇总了PHP中dir::remove方法的典型用法代码示例。如果您正苦于以下问题:PHP dir::remove方法的具体用法?PHP dir::remove怎么用?PHP dir::remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dir
的用法示例。
在下文中一共展示了dir::remove方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: uninstall
protected function uninstall($plugin, $output)
{
$root = $this->kirby()->roots()->plugins() . DS . $plugin;
dir::remove($root);
$output->writeln('<comment>The "' . $plugin . '" plugin has been removed!</comment>');
$output->writeln('');
}
示例2: testSize
public function testSize()
{
dir::make($this->tmpDir);
f::write($this->tmpDir . DS . 'testfile-1.txt', str::random(5));
f::write($this->tmpDir . DS . 'testfile-2.txt', str::random(5));
f::write($this->tmpDir . DS . 'testfile-3.txt', str::random(5));
$this->assertEquals(15, dir::size($this->tmpDir));
$this->assertEquals('15 b', dir::niceSize($this->tmpDir));
dir::remove($this->tmpDir);
}
示例3: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
if ($this->isInstalled() === false) {
throw new RuntimeException('Invalid Kirby installation');
}
$helper = $this->getHelper('question');
$question = new ConfirmationQuestion('<info>Do you really want to uninstall the Panel? (y/n)</info>' . PHP_EOL . 'leave blank to cancel: ', false);
if ($helper->ask($input, $output, $question)) {
// load kirby
$this->bootstrap();
// remove the panel folder
dir::remove($this->dir() . DS . 'panel');
$output->writeln('<comment>The panel has been uninstalled!</comment>');
$output->writeln('');
}
}
示例4: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
if ($this->isInstalled() === false) {
throw new RuntimeException('Invalid Kirby installation');
}
$helper = $this->getHelper('question');
$question = new ConfirmationQuestion('<info>Do you really want to uninstall Kirby? (y/n)</info>' . PHP_EOL . 'leave blank to cancel: ', false);
if ($helper->ask($input, $output, $question)) {
// load kirby
$this->bootstrap();
f::remove($this->dir() . DS . 'index.php');
f::remove($this->dir() . DS . '.htaccess');
f::remove($this->dir() . DS . '.gitignore');
f::remove($this->dir() . DS . 'license.md');
f::remove($this->dir() . DS . 'readme.md');
dir::remove($this->dir() . DS . 'kirby');
dir::remove($this->dir() . DS . 'panel');
dir::remove($this->dir() . DS . 'thumbs');
$output->writeln('<comment>Kirby has been uninstalled!</comment>');
$output->writeln('');
}
}
示例5: delete
/**
* Deletes the page
*
* @param boolean $force Forces the page to be deleted even if there are subpages
*/
public function delete($force = false)
{
if (!$this->isDeletable()) {
throw new Exception('The page cannot be deleted');
}
if ($force === false and $this->children()->count()) {
throw new Exception('This page has subpages');
}
$parent = $this->parent();
if (!dir::remove($this->root())) {
throw new Exception('The page could not be deleted');
}
$this->kirby->cache()->flush();
$parent->reset();
return true;
}
示例6: resizeOnDemandDeleteDir
function resizeOnDemandDeleteDir($pageId)
{
$path = str_replace('/', DS, $pageId);
$root = kirby()->roots()->index() . DS . 'thumbs' . DS . $path;
// delete directory with resized images
if (f::exists($root)) {
dir::remove($root, false);
}
}
示例7: tearDown
protected function tearDown()
{
dir::remove($this->root);
}
示例8: removeThumbs
/**
* Clean the thumbs folder for the page
*
*/
public function removeThumbs()
{
return dir::remove($this->kirby()->roots()->thumbs() . DS . $this->id());
}
示例9: deleteDir
static function deleteDir()
{
$delete = self::childByUID(get('uid'));
if (!$delete) {
return array('status' => 'error', 'msg' => l::get('pages.errors.notfound'));
}
if ($delete->isHomePage()) {
return array('status' => 'error', 'msg' => l::get('pages.delete.errors.homepage'));
}
if ($delete->isErrorPage()) {
return array('status' => 'error', 'msg' => l::get('pages.delete.errors.errorpage'));
}
if ($delete->hasChildren()) {
return array('status' => 'error', 'msg' => l::get('pages.delete.errors.subpages'));
}
if (!dir::remove($delete->root())) {
return array('status' => 'error', 'msg' => l::get('pages.delete.errors.permissions'));
}
self::killCache();
return array('status' => 'success', 'msg' => l::get('pages.delete.success'));
}
示例10: delete
public function delete()
{
// get this before the item is killed
$dayroot = $this->root('day');
if (!dir::remove($this->root())) {
throw new Exception('The item directory could not be removed');
}
if (!$this->library->database->query('delete from items where id = :id', array('id' => $this->id))) {
throw new Exception('The delete query failed');
}
// make sure to clean up the directory attic
$this->library->clean($dayroot);
}
示例11: delete
/**
* Overload delete to include assets
* when the object is deleted.
*/
public function delete($id = NULL)
{
if ($id === NULL and $this->loaded) {
# delete testimonial survey questions
ORM::factory('question')->where(array('owner_id' => $id))->delete_all();
echo 'survey questions deleted<br/>';
# delete testimonial tags/categories
ORM::factory('tag')->where(array('owner_id' => $id))->delete_all();
echo 'testimonial tags deleted<br/>';
# delete tconfigs
ORM::factory('tconfig')->where(array('owner_id' => $id))->delete_all();
echo 'tconfig settings deleted<br/>';
# delete all testimonials
ORM::factory('testimonial')->where(array('owner_id' => $id))->delete_all();
echo 'testimonials deleted<br/>';
# delete owner data folder.
$folder = t_paths::data($this->apikey);
if (dir::remove($folder)) {
echo "data directory {$folder} deleted<br/>";
}
}
return parent::delete($id);
}
示例12: move
/**
* Move the source to the final destination
*/
protected function move()
{
$exists = $this->pluginExists();
$error = $exists ? 'The plugin could not be updated' : 'The plugin could not be installed';
$success = $exists ? 'The plugin has been updated to version:' : 'The plugin has been installed at version:';
if ($exists) {
$this->output->writeln('<info>Updating plugin...</info>');
} else {
$this->output->writeln('<info>Installing plugin...</info>');
}
$this->output->writeln('<info></info>');
$this->prepare();
$src = $this->source();
$dest = $this->destination();
// overwriting means having to clean the plugin first
if (is_dir($dest)) {
if (!dir::remove($dest)) {
throw new RuntimeException('The old plugin could not be removed before the update');
}
}
if (is_file($src)) {
if (!f::move($src, $dest)) {
throw new RuntimeException($error);
}
} else {
if (is_dir($src)) {
if (!dir::move($src, $dest)) {
throw new RuntimeException($error);
}
} else {
throw new RuntimeException('Invalid source');
}
}
$this->output->writeln('<comment>' . $success . ' "' . $this->version() . '"</comment>');
}
示例13: clean
public function clean($root)
{
if (!is_dir($root)) {
throw new Exception('The given directory does not exist');
}
if (!str::startsWith($root, $this->root)) {
throw new Exception('Invalid directory. Must be within the library');
}
while ($root != $this->root) {
$files = dir::read($root);
if (count($files) === 0) {
dir::remove($root);
} else {
break;
}
$root = dirname($root);
}
}
示例14: delete
protected function delete($name, $output)
{
dir::remove($this->root() . DS . $name);
$output->writeln('<comment>The "' . $name . '" plugin has been deleted!</comment>');
$output->writeln('');
}