/** * Delete the cached config. If no locale is given the whole related cache is removed. * * @param int $formId The form id. * @param string|null $locale The locale. * * @return void */ public function remove($formId, $locale = null) { if ($locale) { $this->fileSystem->delete($this->filename($formId, $locale)); } else { $pattern = sprintf('%s/%s/formvalidation-*-%s.js', TL_ROOT, static::BASE_PATH, $formId); foreach (glob($pattern) as $path) { $this->fileSystem->delete(substr($path, strlen(TL_ROOT) + 1)); } } }
/** * Delete xml file * * @param string $strHash */ public function deleteFile($strHash) { if (is_object($this->_arrClipboardElements[$strHash])) { $objFile = $this->_arrClipboardElements[$strHash]; if ($this->_fileExists($objFile->getFileName())) { $this->_objFiles->delete($this->getPath() . '/' . $objFile->getFileName()); } } }
/** * delete all files for a given anchor * * @param the anchor to check * * @see shared/anchors.php */ public static function delete_for_anchor($anchor) { global $context; // seek all records attached to this anchor $query = "SELECT id FROM " . SQL::table_name('files') . " AS files" . " WHERE files.anchor LIKE '" . SQL::escape($anchor) . "'"; if (!($result = SQL::query($query))) { return; } // delete silently all matching files while ($row = SQL::fetch($result)) { Files::delete($row['id']); } }
} elseif (isset($item['assign_id']) && $item['assign_id'] && !Surfer::is($item['assign_id'])) { // prevent updates $context['text'] .= Skin::build_block(sprintf(i18n::s('This file has been reserved by %s %s, and it is likely that an updated version will be made available soon.'), Users::get_link($item['assign_name'], $item['assign_address'], $item['assign_id']), Skin::build_date($item['assign_date'])), 'caution'); // follow-up commands $menu = array(); $menu[] = Skin::build_link($anchor->get_url('files'), i18n::s('Done'), 'button'); $menu[] = Skin::build_link(Files::get_url($item['id'], 'release'), i18n::s('Release reservation'), 'span'); $context['text'] .= Skin::build_block(Skin::finalize_list($menu, 'menu_bar'), 'bottom'); // deletion is confirmed } elseif (isset($_REQUEST['confirm']) && $_REQUEST['confirm'] == 'yes') { // touch the related anchor before actual deletion, since the file has to be accessible at that time if (is_object($anchor)) { $anchor->touch('file:delete', $item['id']); } // if no error, back to the anchor or to the index page if (Files::delete($item['id'])) { // log item deletion $label = sprintf(i18n::c('Deletion: %s'), strip_tags($item['title'])); $description = Files::get_permalink($item); Logger::remember('files/delete.php: ' . $label, $description); Files::clear($item); if ($render_overlaid) { echo 'delete done'; die; } if (is_object($anchor)) { Safe::redirect($anchor->get_url() . '#_attachments'); } else { Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'files/'); } }
public static function delete_image($image, $from) { $path = $_SERVER['DOCUMENT_ROOT'] . '/img/' . $from . '/' . $image; return Files::delete($path); }