本文整理汇总了PHP中TYPO3\CMS\Core\Utility\GeneralUtility::rmdir方法的典型用法代码示例。如果您正苦于以下问题:PHP GeneralUtility::rmdir方法的具体用法?PHP GeneralUtility::rmdir怎么用?PHP GeneralUtility::rmdir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Utility\GeneralUtility
的用法示例。
在下文中一共展示了GeneralUtility::rmdir方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tearDownAfterClass
public static function tearDownAfterClass()
{
foreach (self::$testDirs as $dir) {
chmod($dir, 0777);
\TYPO3\CMS\Core\Utility\GeneralUtility::rmdir($dir, TRUE);
}
}
示例2: tearDown
/**
* Unset all additional properties of test classes to help PHP
* garbage collection. This reduces memory footprint with lots
* of tests.
*
* If owerwriting tearDown() in test classes, please call
* parent::tearDown() at the end. Unsetting of own properties
* is not needed this way.
*
* @throws \RuntimeException
* @return void
*/
protected function tearDown()
{
// Unset properties of test classes to safe memory
$reflection = new \ReflectionObject($this);
foreach ($reflection->getProperties() as $property) {
$declaringClass = $property->getDeclaringClass()->getName();
if (!$property->isStatic() && $declaringClass !== \TYPO3\CMS\Core\Tests\UnitTestCase::class && $declaringClass !== \TYPO3\CMS\Core\Tests\BaseTestCase::class && strpos($property->getDeclaringClass()->getName(), 'PHPUnit_') !== 0) {
$propertyName = $property->getName();
unset($this->{$propertyName});
}
}
unset($reflection);
// Delete registered test files and directories
foreach ($this->testFilesToDelete as $absoluteFileName) {
$absoluteFileName = GeneralUtility::fixWindowsFilePath(PathUtility::getCanonicalPath($absoluteFileName));
if (!GeneralUtility::validPathStr($absoluteFileName)) {
throw new \RuntimeException('tearDown() cleanup: Filename contains illegal characters', 1410633087);
}
if (!StringUtility::beginsWith($absoluteFileName, PATH_site . 'typo3temp/')) {
throw new \RuntimeException('tearDown() cleanup: Files to delete must be within typo3temp/', 1410633412);
}
// file_exists returns false for links pointing to not existing targets, so handle links before next check.
if (@is_link($absoluteFileName) || @is_file($absoluteFileName)) {
unlink($absoluteFileName);
} elseif (@is_dir($absoluteFileName)) {
GeneralUtility::rmdir($absoluteFileName, true);
} else {
throw new \RuntimeException('tearDown() cleanup: File, link or directory does not exist', 1410633510);
}
}
$this->testFilesToDelete = array();
}
示例3: flushProcessedFilesCommand
/**
* Flush all processed files to be used for debugging mainly.
*
* @return void
*/
public function flushProcessedFilesCommand()
{
foreach ($this->getStorageRepository()->findAll() as $storage) {
// This only works for local driver
if ($storage->getDriverType() === 'Local') {
$this->outputLine();
$this->outputLine(sprintf('%s (%s)', $storage->getName(), $storage->getUid()));
$this->outputLine('--------------------------------------------');
$this->outputLine();
#$storage->getProcessingFolder()->delete(TRUE); // will not work
// Well... not really FAL friendly but straightforward for Local drivers.
$processedDirectoryPath = PATH_site . $storage->getProcessingFolder()->getPublicUrl();
$fileIterator = new FilesystemIterator($processedDirectoryPath, FilesystemIterator::SKIP_DOTS);
$numberOfProcessedFiles = iterator_count($fileIterator);
GeneralUtility::rmdir($processedDirectoryPath, TRUE);
GeneralUtility::mkdir($processedDirectoryPath);
// recreate the directory.
$message = sprintf('Done! Removed %s processed file(s).', $numberOfProcessedFiles);
$this->outputLine($message);
// Remove the record as well.
$record = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('count(*) AS numberOfProcessedFiles', 'sys_file_processedfile', 'storage = ' . $storage->getUid());
$this->getDatabaseConnection()->exec_DELETEquery('sys_file_processedfile', 'storage = ' . $storage->getUid());
$message = sprintf('Done! Removed %s records from "sys_file_processedfile".', $record['numberOfProcessedFiles']);
$this->outputLine($message);
}
}
// Remove possible remaining "sys_file_processedfile"
$query = 'TRUNCATE sys_file_processedfile';
$this->getDatabaseConnection()->sql_query($query);
}
示例4: clearAll
/**
* This clear cache implementation follows a pretty brutal approach.
* Goal is to reliably get rid of cache entries, even if some broken
* extension is loaded that would kill the backend 'clear cache' action.
*
* Therefor this method "knows" implementation details of the cache
* framework and uses them to clear all file based cache (typo3temp/Cache)
* and database caches (tables prefixed with cf_) manually.
*
* After that ext_tables and ext_localconf of extensions are loaded, those
* may register additional caches in the caching framework with different
* backend, and will then clear them with the usual flush() method.
*
* @return void
*/
public function clearAll()
{
// Delete typo3temp/Cache
GeneralUtility::rmdir(PATH_site . 'typo3temp/Cache', TRUE);
$bootstrap = \TYPO3\CMS\Core\Core\Bootstrap::getInstance();
$bootstrap->unregisterClassLoader();
\TYPO3\CMS\Core\Cache\Cache::flagCachingFrameworkForReinitialization();
$bootstrap->initializeClassLoader()->initializeCachingFramework()->initializeClassLoaderCaches()->initializePackageManagement('TYPO3\\CMS\\Core\\Package\\PackageManager');
// Get all table names starting with 'cf_' and truncate them
$database = $this->getDatabaseConnection();
$tables = $database->admin_get_tables();
foreach ($tables as $table) {
$tableName = $table['Name'];
if (substr($tableName, 0, 3) === 'cf_') {
$database->exec_TRUNCATEquery($tableName);
}
}
// From this point on, the code may fatal, if some broken extension is loaded.
// Use bootstrap to load all ext_localconf and ext_tables
$bootstrap->loadTypo3LoadedExtAndExtLocalconf(FALSE)->applyAdditionalConfigurationSettings()->initializeTypo3DbGlobal()->loadExtensionTables(FALSE);
// The cache manager is already instantiated in the install tool
// with some hacked settings to disable caching of extbase and fluid.
// We want a "fresh" object here to operate on a different cache setup.
// cacheManager implements SingletonInterface, so the only way to get a "fresh"
// instance is by circumventing makeInstance and/or the objectManager and
// using new directly!
$cacheManager = new \TYPO3\CMS\Core\Cache\CacheManager();
$cacheManager->setCacheConfigurations($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']);
// Cache manager needs cache factory. cache factory injects itself to manager in __construct()
new \TYPO3\CMS\Core\Cache\CacheFactory('production', $cacheManager);
$cacheManager->flushCaches();
}
示例5: tearDown
/**
* @return void
*/
public function tearDown()
{
foreach ($this->fakedExtensions as $extension => $dummy) {
\TYPO3\CMS\Core\Utility\GeneralUtility::rmdir(PATH_site . 'typo3temp/' . $extension, TRUE);
}
parent::tearDown();
}
示例6: tearDown
protected function tearDown()
{
if (!empty($this->extension) && $this->extension->getExtensionKey() != null) {
GeneralUtility::rmdir($this->extension->getExtensionDir(), true);
}
parent::tearDown();
}
示例7: clearCachePostProc
/**
*
* @param string $params
* @param type $pObj
*
* @todo add typehinting
*/
function clearCachePostProc($params, &$pObj)
{
if (isset($params['cacheCmd']) && ($params['cacheCmd'] = 'pages')) {
GeneralUtility::rmdir(PATH_site . 'typo3temp/Cache/Data/DynCss', TRUE);
GeneralUtility::rmdir(PATH_site . 'typo3temp/DynCss', TRUE);
}
}
示例8: tearDown
/**
* Tear down
*/
public function tearDown()
{
foreach ($this->testDirs as $dir) {
chmod($dir, 0777);
\TYPO3\CMS\Core\Utility\GeneralUtility::rmdir($dir, TRUE);
}
parent::tearDown();
}
示例9: tearDown
/**
* Clean up
* Warning: Since phpunit itself is php and we are fiddling with php
* autoloader code here, the tests are a bit fragile. This tearDown
* method ensures that all main classes are available again during
* tear down of a testcase.
* This construct will fail if the class under test is changed and
* not compatible anymore. Make sure to always run the whole test
* suite if fiddling with the autoloader unit tests to ensure that
* there is no fatal error thrown in other unit test classes triggered
* by errors in this one.
*/
public function tearDown()
{
$GLOBALS['typo3CacheManager'] = $this->typo3CacheManager;
\TYPO3\CMS\Core\Core\ClassLoader::unregisterAutoloader();
\TYPO3\CMS\Core\Core\ClassLoader::registerAutoloader();
foreach ($this->fakedExtensions as $extension) {
\TYPO3\CMS\Core\Utility\GeneralUtility::rmdir(PATH_site . 'typo3temp/' . $extension, TRUE);
}
}
示例10: tearDown
/**
* Tear down
*/
public function tearDown()
{
foreach ($this->testNodesToDelete as $node) {
if (\TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($node, PATH_site . 'typo3temp/')) {
\TYPO3\CMS\Core\Utility\GeneralUtility::rmdir($node, TRUE);
}
}
parent::tearDown();
}
示例11: executeOnSignal
/**
* Execute signalSlot 'afterExtensionUninstall'
*
* @param string $extensionName
*/
public static function executeOnSignal($extensionName = null)
{
if ($extensionName !== 'lib_js_analytics') {
return;
}
// Cleanup uploads-folder (containing downloaded analytics.js) and extension-configuration
GeneralUtility::rmdir(GeneralUtility::getFileAbsFileName('uploads/tx_libjsanalytics/'), true);
$objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
$configurationManager = $objectManager->get('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager');
$configurationManager->removeLocalConfigurationKeysByPath(['EXT/extConf/lib_js_analytics']);
}
示例12: clearAllCaches
/**
* Clear all caches.
*
* @param bool $hard
* @return void
*/
public function clearAllCaches($hard = FALSE)
{
if (!$hard) {
$this->dataHandler->clear_cacheCmd('all');
} else {
GeneralUtility::rmdir(PATH_site . 'typo3temp/Cache', TRUE);
$cacheManager = new \TYPO3\CMS\Core\Cache\CacheManager();
$cacheManager->setCacheConfigurations($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']);
new \TYPO3\CMS\Core\Cache\CacheFactory('production', $cacheManager);
$cacheManager->flushCaches();
}
}
示例13: clearCachePostProc
/**
* Deletes DynCss folders inside typo3temp/.
*
* @param array $params
* @param \TYPO3\CMS\Core\DataHandling\DataHandler $pObj
*/
public function clearCachePostProc(array $params, DataHandler &$pObj)
{
if (!isset($params['cacheCmd'])) {
return;
}
switch ($params['cacheCmd']) {
case 'dyncss':
GeneralUtility::rmdir(PATH_site . 'typo3temp/Cache/Data/DynCss', true);
GeneralUtility::rmdir(PATH_site . 'typo3temp/DynCss', true);
break;
default:
}
}
示例14: removeOldInstanceIfExists
/**
* Remove all directory and files within the test instance folder.
*
* @return void
*/
protected function removeOldInstanceIfExists()
{
$dir = scandir($this->instancePath);
foreach ($dir as $entry) {
if (is_dir($this->instancePath . '/' . $entry) && $entry != '..' && $entry != '.') {
GeneralUtility::rmdir($this->instancePath . '/' . $entry, TRUE);
} else {
if (is_file($this->instancePath . '/' . $entry)) {
unlink($this->instancePath . '/' . $entry);
}
}
}
}
示例15: tearDown
/**
* @return void
*/
public function tearDown()
{
foreach ($this->fakedExtensions as $extension => $dummy) {
\TYPO3\CMS\Core\Utility\GeneralUtility::rmdir(PATH_site . 'typo3conf/ext/' . $extension, TRUE);
}
foreach ($this->resourcesToRemove as $resource) {
if (file_exists($resource) && is_file($resource)) {
unlink($resource);
} elseif (file_exists($resource) && is_dir($resource)) {
rmdir($resource);
}
}
parent::tearDown();
}