public function render($view = null, $layout = null)
 {
     try {
         ob_start();
         if (defined('DOMPDF_TEMP_DIR')) {
             $dir = new SplFileInfo(DOMPDF_TEMP_DIR);
             if (!$dir->isDir() || !$dir->isWritable()) {
                 trigger_error(__('%s is not writable', DOMPDF_TEMP_DIR), E_USER_WARNING);
             }
         }
         $errors = ob_get_contents();
         ob_end_clean();
         $download = false;
         $name = pathinfo($this->here, PATHINFO_BASENAME);
         $paperOrientation = 'portrait';
         $paperSize = 'letter';
         extract($this->viewVars, EXTR_IF_EXISTS);
         $dompdf = new DOMPDF();
         $dompdf->load_html($errors . parent::render($view, $layout), Configure::read('App.encoding'));
         $dompdf->set_protocol('');
         $dompdf->set_protocol(WWW_ROOT);
         $dompdf->set_base_path('/');
         $dompdf->set_paper($paperSize, $paperOrientation);
         $dompdf->render();
         $dompdf->stream($name, array('Attachment' => $download));
     } catch (Exception $e) {
         $this->request->params['ext'] = 'html';
         throw $e;
     }
 }
 /**
  * Upload (move) file to branch logos directory
  * @param UploadedFile $logo
  * @param null|string $targetFilename
  * @return \Symfony\Component\HttpFoundation\File\File
  * @throws LogoHandlerLogicException
  */
 public function upload(UploadedFile $logo, $targetFilename = null)
 {
     if (!in_array($logo->getMimeType(), $this->permittedMimeTypes)) {
         throw new LogoHandlerLogicException(sprintf('"%s" file type is not permitted. Use images for logo and try again.', $logo->getMimeType()));
     }
     if (is_null($targetFilename)) {
         $targetFilename = sha1(uniqid(mt_rand(), true)) . '.' . $logo->guessExtension();
     }
     if (false === $this->branchLogoDir->isDir() || false === $this->branchLogoDir->isWritable()) {
         throw new \RuntimeException(sprintf("Branch logo directory (%s) is not writable, doesn't exist or no space left on the disk.", $this->branchLogoDir->getRealPath()));
     }
     return $logo->move($this->branchLogoDir->getRealPath(), $targetFilename);
 }
Example #3
0
 protected static function isIgnored(\SplFileInfo $file, $ignore)
 {
     if (in_array($file->getFilename(), static::$IGNORED)) {
         return true;
     }
     if ($file->isDir() && in_array($file->getFilename(), $ignore['folders'])) {
         return true;
     }
     if (!$file->isDir() && in_array($file->getFilename(), $ignore['files'])) {
         return true;
     }
     return false;
 }
Example #4
0
 protected static function isIgnored(\SplFileInfo $file, $ignore)
 {
     $filename = $file->getFilename();
     if (in_array($filename, static::$IGNORED)) {
         return true;
     }
     if (array_key_exists('folders', $ignore) && $file->isDir() && in_array($filename, $ignore['folders'])) {
         return true;
     }
     if (array_key_exists('files', $ignore) && !$file->isDir() && in_array($filename, $ignore['files'])) {
         return true;
     }
     return false;
 }
Example #5
0
 /**
  * Writes the class to a file.
  */
 public function write()
 {
     try {
         $dir = $this->path->isDir() ? $this->path->getPathname() : $this->path->getPath();
         $path = $dir . '/' . $this->baseClass->getClassName() . $this->baseClass->getExtension();
         if (!file_exists($dir)) {
             $this->fileSystem->mkdir($dir, 0777, true);
         }
         //if (!file_exists($path)) {
         file_put_contents($path, $this->baseClass->generate());
         //}
     } catch (IOExceptionInterface $e) {
     }
 }
 /**
  * Upload (move to target dir) given file
  * @param string $filename
  * @param string $content
  * @return string path to filename
  */
 public function upload($filename, $content)
 {
     if (false === $this->uploadDir->isDir()) {
         try {
             $this->fs->mkdir($this->uploadDir->getPathname());
         } catch (\Exception $e) {
             throw new \RuntimeException('Upload directory is not writable, doesn\'t exist or no space left on the disk.');
         }
     }
     if (false === $this->uploadDir->isWritable()) {
         throw new \RuntimeException('Upload directory is not writable, doesn\'t exist or no space left on the disk.');
     }
     $this->fs->dumpFile($this->uploadDir->getRealPath() . '/' . $filename, $content);
     return $this->uploadDir->getRealPath() . '/' . $filename;
 }
Example #7
0
 /**
  * Set path to user files storage
  * @param $path
  * @throws \Exception
  */
 public function setStoragePath($path)
 {
     $this->storagePath = new SplFileInfo($path);
     if (!$this->storagePath->isDir()) {
         throw new \Exception(__METHOD__ . ' | ' . 'storage path is not directory or does not exist.');
     }
 }
Example #8
0
 /**
  */
 public function isDir()
 {
     if (null === $this->d) {
         $this->d = parent::isDir();
     }
     return $this->d;
 }
Example #9
0
 /**
  * This function will make directory writable.
  *
  * @param   string  path
  * @return  void
  * @throw   Kohana_Exception
  */
 public static function make_writable($path, $chmod = NULL)
 {
     try {
         $dir = new SplFileInfo($path);
         if ($dir->isFile()) {
             throw new Kohana_Exception('Could not make :path writable directory because it is regular file', array(':path' => Debug::path($path)));
         } elseif ($dir->isLink()) {
             throw new Kohana_Exception('Could not make :path writable directory because it is link', array(':path' => Debug::path($path)));
         } elseif (!$dir->isDir()) {
             // Try create directory
             Ku_Dir::make($path, $chmod);
             clearstatcache(TRUE, $path);
         }
         if (!$dir->isWritable()) {
             // Try make directory writable
             chmod($dir->getRealPath(), $chmod === NULL ? Ku_Dir::$default_dir_chmod : $chmod);
             clearstatcache(TRUE, $path);
             // Check result
             if (!$dir->isWritable()) {
                 throw new Exception('Make dir writable failed', 0);
             }
         }
     } catch (Kohana_Exception $e) {
         // Rethrow exception
         throw $e;
     } catch (Exception $e) {
         throw new Kohana_Exception('Could not make :path directory writable', array(':path' => Debug::path($path)));
     }
 }
Example #10
0
 /**
  * Upload an image to local server then return new image path after upload success
  * 
  * @param array $file [tmp_name, name, error, type, size] 
  * @param string image path for saving (this may constain filename)
  * @param string image filename for saving
  * @return string Image path after uploaded
  * @throws Exception If upload failed
  */
 public function upload($file, $newImagePath = '.', $newImageName = NULL)
 {
     if (!empty($file['error'])) {
         $this->_throwException(':method: Upload error. Number: :number', array(':method' => __METHOD__, ':number' => $file['error']));
     }
     if (getimagesize($file['tmp_name']) === FALSE) {
         $this->_throwException(':method: The file is not an image file.', array(':method' => __METHOD__));
     }
     $fileInfo = new \SplFileInfo($newImagePath);
     if (!$fileInfo->getRealPath() or !$fileInfo->isDir()) {
         $this->_throwException(':method: The ":dir" must be a directory.', array(':method' => __METHOD__, ':dir' => $newImagePath));
     }
     $defaultExtension = '.jpg';
     if (empty($newImageName)) {
         if (!in_array($fileInfo->getBasename(), array('.', '..')) and $fileInfo->getExtension()) {
             $newImageName = $fileInfo->getBasename();
         } else {
             $newImageName = uniqid() . $defaultExtension;
         }
     }
     if (!$fileInfo->isWritable()) {
         $this->_throwException(':method: Directory ":dir" is not writeable.', array(':method' => __METHOD__, ':dir' => $fileInfo->getRealPath()));
     }
     $destination = $fileInfo->getRealPath() . DIRECTORY_SEPARATOR . $newImageName;
     if (move_uploaded_file($file['tmp_name'], $destination)) {
         return $destination;
     } else {
         $this->_throwException(':method: Cannot move uploaded file to :path', array(':method' => __METHOD__, ':path' => $fileInfo->getRealPath()));
     }
 }
 /**
  * @param \SplFileInfo $file
  */
 public function __construct(\SplFileInfo $file)
 {
     if (!$file->isDir()) {
         throw new \InvalidArgumentException('Expecting directory');
     }
     $this->iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($file->getPathname(), \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS));
 }
Example #12
0
 /**
  * (non-PHPdoc)
  *
  * @param \AppserverIo\Appserver\Core\Api\Node\ContainerNodeInterface $containerNode The container the archive belongs to
  * @param \SplFileInfo                                                $archive       The archive file to be deployed
  *
  * @return void
  * @see \AppserverIo\Appserver\Core\AbstractExtractor::deployArchive()
  */
 public function deployArchive(ContainerNodeInterface $containerNode, \SplFileInfo $archive)
 {
     try {
         // create folder names based on the archive's basename
         $tmpFolderName = new \SplFileInfo($this->getTmpDir($containerNode) . DIRECTORY_SEPARATOR . $archive->getFilename());
         $webappFolderName = new \SplFileInfo($this->getWebappsDir($containerNode) . DIRECTORY_SEPARATOR . basename($archive->getFilename(), $this->getExtensionSuffix()));
         // check if archive has not been deployed yet or failed sometime
         if ($this->isDeployable($archive)) {
             // flag webapp as deploying
             $this->flagArchive($archive, ExtractorInterface::FLAG_DEPLOYING);
             // backup actual webapp folder, if available
             if ($webappFolderName->isDir()) {
                 // backup files that are NOT part of the archive
                 $this->backupArchive($containerNode, $archive);
                 // delete directories previously backed up
                 $this->removeDir($webappFolderName);
             }
             // remove old temporary directory
             $this->removeDir($tmpFolderName);
             // initialize a \Phar instance
             $p = new \Phar($archive);
             // create a recursive directory iterator
             $iterator = new \RecursiveIteratorIterator($p);
             // unify the archive filename, because Windows uses a \ instead of /
             $archiveFilename = sprintf('phar://%s', str_replace(DIRECTORY_SEPARATOR, '/', $archive->getPathname()));
             // iterate over all files
             foreach ($iterator as $file) {
                 // prepare the temporary filename
                 $target = $tmpFolderName . str_replace($archiveFilename, '', $file->getPathname());
                 // create the directory if necessary
                 if (file_exists($directory = dirname($target)) === false) {
                     if (mkdir($directory, 0755, true) === false) {
                         throw new \Exception(sprintf('Can\'t create directory %s', $directory));
                     }
                 }
                 // finally copy the file
                 if (copy($file, $target) === false) {
                     throw new \Exception(sprintf('Can\'t copy %s file to %s', $file, $target));
                 }
             }
             // move extracted content to webapps folder and remove temporary directory
             FileSystem::copyDir($tmpFolderName->getPathname(), $webappFolderName->getPathname());
             FileSystem::removeDir($tmpFolderName->getPathname());
             // we need to set the user/rights for the extracted folder
             $this->setUserRights($webappFolderName);
             // restore backup if available
             $this->restoreBackup($containerNode, $archive);
             // flag webapp as deployed
             $this->flagArchive($archive, ExtractorInterface::FLAG_DEPLOYED);
             // log a message that the application has successfully been deployed
             $this->getInitialContext()->getSystemLogger()->info(sprintf('Application archive %s has succussfully been deployed', $archive->getBasename($this->getExtensionSuffix())));
         }
     } catch (\Exception $e) {
         // log error
         $this->getInitialContext()->getSystemLogger()->error($e->__toString());
         // flag webapp as failed
         $this->flagArchive($archive, ExtractorInterface::FLAG_FAILED);
     }
 }
Example #13
0
 public function __construct(SplFileInfo $fileInfo)
 {
     $this->perms = $fileInfo->getPerms();
     $this->size = $fileInfo->getSize();
     $this->is_dir = $fileInfo->isDir();
     $this->is_file = $fileInfo->isFile();
     $this->is_link = $fileInfo->isLink();
     if (($this->perms & 0xc000) === 0xc000) {
         $this->typename = 'File socket';
         $this->typeflag = 's';
     } elseif ($this->is_file) {
         if ($this->is_link) {
             $this->typename = 'File symlink';
             $this->typeflag = 'l';
         } else {
             $this->typename = 'File';
             $this->typeflag = '-';
         }
     } elseif (($this->perms & 0x6000) === 0x6000) {
         $this->typename = 'Block special file';
         $this->typeflag = 'b';
     } elseif ($this->is_dir) {
         if ($this->is_link) {
             $this->typename = 'Directory symlink';
             $this->typeflag = 'l';
         } else {
             $this->typename = 'Directory';
             $this->typeflag = 'd';
         }
     } elseif (($this->perms & 0x2000) === 0x2000) {
         $this->typename = 'Character special file';
         $this->typeflag = 'c';
     } elseif (($this->perms & 0x1000) === 0x1000) {
         $this->typename = 'FIFO pipe file';
         $this->typeflag = 'p';
     }
     parent::__construct('FsPath');
     $this->path = $fileInfo->getPathname();
     $this->realpath = realpath($this->path);
     if ($this->is_link && method_exists($fileInfo, 'getLinktarget')) {
         $this->linktarget = $fileInfo->getLinktarget();
     }
     $flags = array($this->typeflag);
     // User
     $flags[] = $this->perms & 0x100 ? 'r' : '-';
     $flags[] = $this->perms & 0x80 ? 'w' : '-';
     $flags[] = $this->perms & 0x40 ? $this->perms & 0x800 ? 's' : 'x' : ($this->perms & 0x800 ? 'S' : '-');
     // Group
     $flags[] = $this->perms & 0x20 ? 'r' : '-';
     $flags[] = $this->perms & 0x10 ? 'w' : '-';
     $flags[] = $this->perms & 0x8 ? $this->perms & 0x400 ? 's' : 'x' : ($this->perms & 0x400 ? 'S' : '-');
     // Other
     $flags[] = $this->perms & 0x4 ? 'r' : '-';
     $flags[] = $this->perms & 0x2 ? 'w' : '-';
     $flags[] = $this->perms & 0x1 ? $this->perms & 0x200 ? 't' : 'x' : ($this->perms & 0x200 ? 'T' : '-');
     $this->contents = implode($flags);
 }
Example #14
0
 /**
  * 
  * @param \SplFileInfo $file
  * @return boolean
  */
 protected function isVideo(\SplFileInfo $file)
 {
     if ($file->isDir()) {
         return false;
     }
     $ext = strtolower($file->getExtension());
     $videos = explode(',', 'wmv,ogg,avi,mpg,divx,flv');
     return in_array($ext, $videos);
 }
Example #15
0
 protected function ensurePresent($baseDir)
 {
     $fileInfo = new \SplFileInfo($baseDir);
     if ($fileInfo->isDir()) {
         return;
     }
     $filePath = $fileInfo->getPathname();
     mkdir($filePath);
 }
Example #16
0
 public function createBatch($name)
 {
     $dir = sprintf('%s/%s', $this->dir, $this->checkName($name));
     $fileInfo = new \SplFileInfo($dir);
     if ($fileInfo->isDir() || $fileInfo->isFile()) {
         throw new InvalidArgumentException(sprintf('Batch name exists: "%s"', $name));
     }
     mkdir($dir, 0777);
     return $this->batchFactory->getInstance($dir);
 }
Example #17
0
 public static function path2array($path, $excludingRegEx = '/^$/', $maxDepth = 999, $nodesAsSplFileInfo = false)
 {
     //$path='./binaries/';
     $path = realpath($path) . "/";
     $result = $arrDirs = $arrFiles = array();
     $arrFilenames = scandir($path);
     foreach ($arrFilenames as $filename) {
         if ($filename == "." || $filename == "..") {
             continue;
         }
         $fileFullPath = $path . $filename;
         $exclude = false;
         if (preg_match($excludingRegEx, $fileFullPath) === 1) {
             $exclude = true;
         }
         if ($exclude) {
             continue;
         }
         if ($nodesAsSplFileInfo) {
             $objSplFileInfo = new SplFileInfo($fileFullPath);
             $isDir = $objSplFileInfo->isDir();
         } else {
             $isDir = is_dir($fileFullPath);
         }
         if ($isDir) {
             $newPath = $fileFullPath;
             $newDepth = $maxDepth - 1;
             if ($newDepth > 0) {
                 $children = self::path2array($newPath, $excludingRegEx, $newDepth);
                 if ($nodesAsSplFileInfo) {
                     $objSplFileInfo->children = $children;
                     $arrDirs[$fileFullPath . "/"] = $objSplFileInfo;
                 } else {
                     $arrDirs[$fileFullPath . "/"] = $children;
                 }
                 unset($children);
             } else {
                 if ($nodesAsSplFileInfo) {
                     $arrDirs[$fileFullPath . "/"] = $objSplFileInfo;
                 } else {
                     $arrDirs[$fileFullPath . "/"] = $filename . "/";
                 }
             }
         } else {
             if ($nodesAsSplFileInfo) {
                 $arrFiles[$fileFullPath] = $objSplFileInfo;
             } else {
                 $arrFiles[$fileFullPath] = $filename;
             }
         }
     }
     $result = $arrDirs + $arrFiles;
     return $result;
 }
 private function getSplFile($source, $item)
 {
     if ($item == '.' || $item == '..') {
         return false;
     }
     $splFile = new \SplFileInfo($source . '/' . $item);
     $extension = $splFile->getExtension();
     if ($extension != 'json' || $splFile->isDir() || false == $splFile->isReadable()) {
         return false;
     }
     return $splFile;
 }
Example #19
0
 /**
  * @param $patchFile
  * @param array $files
  * @return array
  * @throws \Exception
  */
 private function loadInternal(\SplFileInfo $patchFile, &$files = array())
 {
     if ($patchFile->isDir()) {
         foreach ($this->loadDirectory($patchFile) as $file) {
             $this->loadInternal($file, $files);
         }
     } else {
         $this->checkFileIsValid($patchFile);
         $files[$patchFile->getPathname()] = $this->readFile($patchFile);
     }
     return $files;
 }
Example #20
0
 public function make($prefix = '', $postfix = '', $suffix = '')
 {
     $name = $this->assemble($prefix, $postfix, $suffix, null);
     $count = 1;
     while (true) {
         $fileInfo = new \SplFileInfo(sprintf('%s/%s', $this->dir, $name));
         if (!$fileInfo->isDir() && !$fileInfo->isFile()) {
             return basename($name);
         }
         $name = $this->assemble($prefix, $postfix, $suffix, $count++);
     }
 }
Example #21
0
 public static function factory($path)
 {
     $fileInfo = new SplFileInfo($path);
     if ($fileInfo->isDir()) {
         $element = new Stagehand_DirectorySnap_Element_Directory($path);
     } elseif ($fileInfo->isLink()) {
         $element = new Stagehand_DirectorySnap_Element_Link($path);
     } elseif ($fileInfo->isFile()) {
         $element = new Stagehand_DirectorySnap_Element_File($path);
     }
     return $element;
 }
Example #22
0
 /**
  * @param  \SplFileInfo  $file
  * @return bool
  */
 private function checkType(\SplFileInfo $file)
 {
     if ($this->type == 'any') {
         return TRUE;
     }
     if ($file->isFile() && $this->type == 'file') {
         return TRUE;
     }
     if ($file->isDir() && $this->type == 'dir') {
         return TRUE;
     }
     return FALSE;
 }
Example #23
0
 /**
  * Validate directory
  *
  * Checks to see if file is directory and if permissions match expected
  *
  * @param SplFileInfo $file     File to check
  * @param array       $badFiles current array of bad files to report
  *
  * @return array
  * @access public
  */
 public function validateSetting(SplFileInfo $file, array $badFiles)
 {
     if ($file->isDir()) {
         $path = substr_replace($file->__toString(), '', 0, strlen(Mage::getBaseDir()) + 1);
         if (Mage::helper('bronto_verify/permissionchecker')->accept($path)) {
             $octalPerms = substr(sprintf('%o', $file->getPerms()), -$this->_permLen);
             if ($octalPerms != $this->_permission) {
                 $badFiles[$path]['directory permission'] = $octalPerms;
             }
         }
     }
     return parent::validateSetting($file, $badFiles);
 }
Example #24
0
 public function deleteSubDir($subDir)
 {
     $pathname = $this->getPathname($subDir);
     if (!$this->isValidSubDir($pathname)) {
         throw new InvalidArgumentException(sprintf('Not a valid subDir of temporary dir: "%s"', $pathname));
     }
     $fileInfo = new \SplFileInfo($pathname);
     if (!$fileInfo->isDir() || !$fileInfo->isReadable() || !$fileInfo->isWritable()) {
         return;
     }
     foreach (new \DirectoryIterator($pathname) as $fileInfo) {
         if ($fileInfo->isDot()) {
             continue;
         }
         if ($fileInfo->isDir()) {
             $this->deleteSubDir($this->getSubDir($fileInfo->getPathname()));
         } else {
             unlink($fileInfo->getPathname());
         }
     }
     rmdir($pathname);
 }
Example #25
0
 /**
  *
  * @param \SplFileInfo $file
  * @return boolean
  */
 public function call(\SplFileInfo $file)
 {
     $firstChar = substr($file->getFilename(), 0, 1);
     if (in_array($firstChar, ['.', '_'])) {
         return false;
     }
     if ($file->isDir()) {
         return true;
     }
     if (!in_array($file->getExtension(), $this->extensions)) {
         return false;
     }
     return true;
 }
Example #26
0
 public function __construct($dir)
 {
     $info = new \SplFileInfo($dir);
     if (!$info->isDir()) {
         throw new InvalidArgumentException(sprintf('Layout dir not found'));
     }
     if (!$info->isReadable()) {
         throw new InvalidArgumentException(sprintf('Layout dir not readable'));
     }
     if (!$info->isWritable()) {
         throw new InvalidArgumentException(sprintf('Layout dir not writable'));
     }
     $this->dir = $dir;
 }
Example #27
0
 public function __construct($filename, $dir)
 {
     $info = new \SplFileInfo($dir);
     if (!$info->isDir()) {
         throw new InvalidArgumentException(sprintf('Selection file parent dir not found'));
     }
     if (!$info->isReadable()) {
         throw new InvalidArgumentException(sprintf('Selection file parent dir not readable'));
     }
     if (!$info->isWritable()) {
         throw new InvalidArgumentException(sprintf('Selection file parent dir not writable'));
     }
     $this->file = sprintf('%s/%s', $dir, $filename);
 }
 /**
  *
  * @param SplFileInfo $file
  * @param string $path
  * @param RecursiveDirectoryIterator $iterator
  * @return boolean
  */
 public function call(\SplFileInfo $file, $path, \RecursiveDirectoryIterator $iterator)
 {
     $firstChar = substr($file->getFileName(), 0, 1);
     if (in_array($firstChar, ['.', '_'])) {
         return false;
     }
     if ($file->isDir()) {
         return true;
     }
     if (!in_array($file->getExtension(), $this->extensions)) {
         return false;
     }
     return true;
 }
 /**
  *
  * @param string $src
  * @param string $des
  */
 public static function sfCopyDir($src, $des, $mess = '', $override = false)
 {
     $src_dir = new SplFileInfo($src);
     if ($src_dir->isDir() === false) {
         trigger_error('src is not dir', E_USER_WARNING);
         return;
     }
     $des_dir = new SplFileInfo($des);
     if ($des_dir->isDir() === false && $des_dir->isFile()) {
         trigger_error('des is not dir', E_USER_WARNING);
         return;
     }
     SC_Utils_Ex::recursiveMkdir($des_dir->getPathname());
     $src = $src_dir->getRealPath();
     $des = $des_dir->getRealPath();
     /**
      *
      * @var SplFileInfo[]
      */
     $iterator = new RecursiveDirectoryIterator($src);
     $files = new RecursiveIteratorIterator($iterator, RecursiveIteratorIterator::SELF_FIRST);
     foreach ($files as $filepath) {
         $finfo = new SplFileInfo($filepath);
         if ($finfo->isDir()) {
             continue;
         }
         $rel_file = substr($finfo->getRealPath(), strlen($src_dir->getRealPath()));
         $src_file = $finfo->getRealPath();
         $des_file = new SplFileInfo($des_dir->getRealPath() . $rel_file);
         $des_file = $des_file->getPathname();
         SC_Utils_Ex::recursiveMkdir(dirname($des_file));
         if ($override) {
             // nop
         } elseif (file_exists($des_file)) {
             trigger_error($des_file . ":ファイルが存在します", E_USER_NOTICE);
             $mess .= $des . $des_file . ":ファイルが存在します\n";
             continue;
         }
         if (@copy($src_file, $des_file)) {
             $mess .= $des_file . ":コピー成功\n";
             trigger_error($des_file . ":コピー成功", E_USER_NOTICE);
         } else {
             trigger_error($des_file . ":コピー失敗", E_USER_WARNING);
             $mess .= $des_file . ":コピー失敗\n";
         }
         GC_Utils_Ex::gfDebugLog(compact("src_file", "des_file"));
     }
     return $mess;
 }
 /**
  * {@inheritDoc}
  */
 public function search($needle, $path)
 {
     $pathInfo = new \SplFileInfo($path);
     if (!$pathInfo->isDir()) {
         throw new IncorrectPathException('Path must be directory');
     }
     if (!mb_strlen($needle)) {
         throw new EmptyNeedleException();
     }
     $directoryIterator = new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS);
     $iterator = new \RecursiveIteratorIterator($directoryIterator);
     $filter = new FileContentFilterIterator($needle, $iterator);
     return new CallbackIterator($filter, function (\SplFileInfo $file) {
         return $file->getPathname();
     });
 }