<?php
namespace wcf\data\template;
use wcf\data\DatabaseObjectEditor;
+use wcf\util\DirectoryUtil;
use wcf\system\io\File;
use wcf\system\WCF;
* Deletes the compiled files of this template.
*/
public function deleteCompiledFiles() {
- $matches = glob(WCF_DIR . 'templates/compiled/' . $this->packageID . '_*_' . $this->templateName . '.php');
- if (is_array($matches)) {
- foreach ($matches as $match) @unlink($match);
- }
+ DirectoryUtil::getInstance(WCF_DIR . 'templates/compiled/')->removePattern('~' . intval($this->packageID) . '_.*_' . preg_quote($this->templateName, '~') . '.php~');
}
}
use wcf\data\DatabaseObjectEditor;
use wcf\system\WCF;
use wcf\util\FileUtil;
+use wcf\util\DirectoryUtil;
/**
* TemplateGroupEditor provides functions to create, edit or delete template group.
$statement->execute();
while ($row = $statement->fetchArray()) {
$packageDir = FileUtil::getRealPath(WCF_DIR . $row['packageDir']);
- $folders[] = $packageDir . 'templates/' . $this->templateGroupFolderName;
- }
-
- // rename folders
- foreach ($folders as $folder) {
- if (file_exists($folder)) {
- // empty folder
- $files = glob(FileUtil::addTrailingSlash($folder).'*');
- if (is_array($files)) {
- foreach ($files as $file) @unlink($file);
- }
-
- // delete foler
- @rmdir($folder);
- }
+ DirectoryUtil::getInstance($packageDir . 'templates/' . $this->templateGroupFolderName)->deleteAll();
}
}
}