public function testGlobBraceSupported() { if (!defined('GLOB_BRACE')) { self::markAsSkipped("This test can only be run on systems supporting GLOB_BRACE."); } $pattern = "kernel/classes/ez{content,url}*.php"; $eZSysGlob = eZSys::globBrace($pattern); $phpGlob = glob($pattern, GLOB_BRACE); self::assertEquals($eZSysGlob, $phpGlob, "Comparing glob() with eZSys::glob() using GLOB_BRACE"); $eZSysGlob = eZSys::globBrace($pattern, GLOB_NOSORT); $phpGlob = glob($pattern, GLOB_NOSORT | GLOB_BRACE); self::assertEquals($eZSysGlob, $phpGlob, "Comparing glob() with eZSys::glob() using GLOB_MARK | GLOB_BRACE"); }
/** * Delete files located in a directories from dirList, with common prefix specified by * commonPath, and common suffix with added wildcard at the end * * \public * \static */ function fileDeleteByDirList($dirList, $commonPath, $commonSuffix) { eZDebugSetting::writeDebug('kernel-clustering', "fs::fileDeleteByDirList( '" . implode(",", $dirList) . "', '{$commonPath}', '{$commonSuffix}' )", __METHOD__); eZDebug::accumulatorStart('dbfile', false, 'dbfile'); foreach ($dirList as $dir) { $unlinkArray = eZSys::globBrace("{$commonPath}/{$dir}/{$commonSuffix}*"); if ($unlinkArray !== false) { array_map('unlink', $unlinkArray); } } eZDebug::accumulatorStop('dbfile'); }
/** * Delete files located in a directories from dirList, with common prefix specified by * commonPath, and common suffix with added wildcard at the end * * \public * \static * \sa fileDeleteByRegex() */ function fileDeleteByDirList( $dirList, $commonPath, $commonSuffix ) { $dirs = implode( ',', $dirList ); $wildcard = $commonPath .'/{' . $dirs . '}/' . $commonSuffix . '*'; eZDebugSetting::writeDebug( 'kernel-clustering', "fs::fileDeleteByDirList( '".implode(', ', $dirList)."', '$commonPath', '$commonSuffix' )", __METHOD__ ); eZDebug::accumulatorStart( 'dbfile', false, 'dbfile' ); array_map( array( __CLASS__, '_expire' ), eZSys::globBrace( $wildcard ) ); eZDebug::accumulatorStop( 'dbfile' ); }
/** * Delete files located in a directories from dirList, with common prefix specified by * commonPath, and common suffix with added wildcard at the end * * \public * \static * \sa fileDeleteByRegex() */ function fileDeleteByDirList($dirList, $commonPath, $commonSuffix) { $dirs = implode(',', $dirList); $wildcard = $commonPath . '/{' . $dirs . '}/' . $commonSuffix . '*'; eZDebugSetting::writeDebug('kernel-clustering', "fs::fileDeleteByDirList( '{$dirs}', '{$commonPath}', '{$commonSuffix}' )", __METHOD__); eZDebug::accumulatorStart('dbfile', false, 'dbfile'); $unlinkArray = eZSys::globBrace($wildcard); if ($unlinkArray !== false and count($unlinkArray) > 0) { array_map('unlink', $unlinkArray); } eZDebug::accumulatorStop('dbfile'); }