Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

moved rrmdir and rchown to phing-task

  • Loading branch information...
commit cdf7175546fa24699870d94cdfca8da767f8c551 1 parent 313cba0
heartsentwined authored
Showing with 0 additions and 158 deletions.
  1. +0 −88 src/task/RchownTask.php
  2. +0 −70 src/task/RrmdirTask.php
View
88 src/task/RchownTask.php
@@ -1,88 +0,0 @@
-<?php
-require_once __DIR__ . '/../../../../autoload.php';
-
-use Heartsentwined\FileSystemManager\FileSystemManager;
-
-class RchownTask extends Task
-{
- protected $file;
- protected $user;
- protected $failonerror = false;
-
- /**
- * file / dir to rchown to
- *
- * @param string $file
- * @return void
- */
- public function setFile($file)
- {
- $this->file = realpath($file);
- }
-
- /**
- * user to chown to
- *
- * @param string $user
- * @return void
- */
- public function setUser($user)
- {
- $this->user = $user;
- }
-
- /**
- * if error occured, whether build should fail
- *
- * @param bool $value
- * @return void
- */
- public function setFailonerror($value)
- {
- $this->failonerror = $value;
- }
-
- /**
- * init
- *
- * @return void
- */
- public function init()
- {
- }
-
- /**
- * main method
- *
- * @return void
- */
- public function main()
- {
- if (!$this->file) throw new BuildException('file must be set');
- if (!$this->user) throw new BuildException('user must be set');
-
- if (strpos($this->user, '.')) {
- list($owner, $group) = explode('.', $this->user);
- } else {
- $owner = $this->user;
- }
-
- FileSystemManager::rchown($this->file, $owner);
- if (isset($group)) FileSystemManager::rchgrp($this->file, $group);
-
- if (isset($group)) {
- $this->log(sprintf(
- 'Recursively changed file owner on \'%s\' to %s.%s',
- $this->file,
- $owner,
- $group
- ));
- } else {
- $this->log(sprintf(
- 'Recursively changed file owner on \'%s\' to %s',
- $this->file,
- $owner
- ));
- }
- }
-}
View
70 src/task/RrmdirTask.php
@@ -1,70 +0,0 @@
-<?php
-require_once __DIR__ . '/../../../../autoload.php';
-
-use Heartsentwined\FileSystemManager\FileSystemManager;
-
-class RrmdirTask extends Task
-{
- protected $dir;
- protected $failonerror = false;
-
- /**
- * directory to delete
- *
- * @param string $dir
- * @return void
- */
- public function setDir($dir)
- {
- if (!is_dir($dir)) {
- throw new BuildException(sprintf(
- 'Directory does not exist: %s',
- realpath($dir)
- ));
- }
- if (!is_writable($dir)) {
- throw new BuildException(sprintf(
- 'Directory is not writable: %s',
- realpath($dir)
- ));
- }
- $this->dir = realpath($dir);
- }
-
- /**
- * if error occured, whether build should fail
- *
- * @param bool $value
- * @return void
- */
- public function setFailonerror($value)
- {
- $this->failonerror = $value;
- }
-
- /**
- * init
- *
- * @return void
- */
- public function init()
- {
- }
-
- /**
- * main method
- *
- * @return void
- */
- public function main()
- {
- if (!$this->dir) throw new BuildException('dir must be set');
-
- FileSystemManager::rrmdir($this->dir);
-
- $this->log(sprintf(
- 'Recursively deleted the directory \'%s\'',
- $this->dir
- ));
- }
-}
Please sign in to comment.
Something went wrong with that request. Please try again.