Delete the template
Does delete all pages of that template and does even delete system templates
496363
public function downgrade() {
		$template = $this->getTemplate($this->getTemplateName());
		$fieldgroup = $template->fieldgroup;

		$fg = $this->wire('fieldgroups')->get($template->name);
		$minNumberToError = $fg->id == $fieldgroup->id ? 2 : 1;

		if($fg->numTemplates() >= $minNumberToError) 
			throw new WireException("Cannot delete $template->name, because it's fieldgroup is used by at least one other template.");

		// Remove all pages of that template
		$selector = "template=$template, include=all, check_access=0";
		$this->eachPageUncache($selector, function($p) { $this->pages->delete($p, true); });

		// Delete fieldgroup and template
		$this->templates->delete($template);
		$this->fieldgroups->delete($fieldgroup);
	}
5590
def destroy
      @page = ::Page.find(params[:id])
      @page.destroy

      respond_to do |format|
        format.html { redirect_to(cmtool.pages_path) }
        format.xml  { head :ok }
      end
    end
811960
function(template) {

		var index = this._content.indexOf(template);

		if (index == -1) {
			if (Lava.schema.DEBUG && template != this._else_content) Lava.t();
			this._else_content = null;
		} else {
			this._content[index] = null;
		}

		template.destroy();

	}
516219
def clear():
    
    utils.check_for_local_server()
    click.confirm(
        "Are you sure you want to do this? It will delete all of your data",
        abort=True
    )
    server = Server(config["local_server"]["url"])
    for db_name in all_dbs:
        del server[db_name]
676380
def delete_all_hosting_devices_by_template(self, context, template,
                                               force_delete=False):
        """"""
        plugging_drv = self.get_hosting_device_plugging_driver(
            context, template['id'])
        hosting_device_drv = self.get_hosting_device_driver(context,
                                                            template['id'])
        if plugging_drv is None or hosting_device_drv is None:
            return
        is_vm = template['host_category'] == VM_CATEGORY
        query = context.session.query(hd_models.HostingDevice)
        query = query.filter(hd_models.HostingDevice.template_id ==
                             template['id'])
        for hd in query:
            if not (hd.auto_delete or force_delete):
                # device manager is not responsible for life cycle
                # management of this hosting device.
                continue
            res = plugging_drv.get_hosting_device_resources(
                context, hd.id, hd.complementary_id, self.l3_tenant_id(),
                self.mgmt_nw_id())
            if is_vm:
                self.svc_vm_mgr.delete_service_vm(context, hd.id)
            plugging_drv.delete_hosting_device_resources(
                context, self.l3_tenant_id(), **res)
            with context.session.begin(subtransactions=True):
                # remove all allocations in this hosting device
                context.session.query(hd_models.SlotAllocation).filter_by(
                    hosting_device_id=hd['id']).delete()
                context.session.delete(hd)
1297880
public function delete()
    {
        $recordFinder = GeneralUtility::makeInstance(RecordFinder::class);

        $commands = [];

        // Delete page tree and all their records on this tree
        $topUids = $recordFinder->findUidsOfStyleguideEntryPages();
        if (!empty($topUids)) {
            foreach ($topUids as $topUid) {
                $commands['pages'][(int)$topUid]['delete'] = 1;
            }
        }

        // Delete all the sys_language demo records
        $languageUids = $recordFinder->findUidsOfDemoLanguages();
        if (!empty($languageUids)) {
            foreach ($languageUids as $languageUid) {
                $commands['sys_language'][(int)$languageUid]['delete'] = 1;
            }
        }

        // Delete demo users
        $demoUserUids = $recordFinder->findUidsOfDemoBeUsers();
        if (!empty($demoUserUids)) {
            foreach ($demoUserUids as $demoUserUid) {
                $commands['be_users'][(int)$demoUserUid]['delete'] = 1;
            }
        }

        // Delete demo groups
        $demoGroupUids = $recordFinder->findUidsOfDemoBeGroups();
        if (!empty($demoGroupUids)) {
            foreach ($demoGroupUids as $demoUserGroup) {
                $commands['be_groups'][(int)$demoUserGroup]['delete'] = 1;
            }
        }

        // Do the thing
        if (!empty($commands)) {
            $dataHandler = GeneralUtility::makeInstance(DataHandler::class);
            $dataHandler->deleteTree = true;
            $dataHandler->start([], $commands);
            $dataHandler->process_cmdmap();
            BackendUtility::setUpdateSignal('updatePageTree');
        }

        // Delete demo images in fileadmin again
        $storageRepository = GeneralUtility::makeInstance(StorageRepository::class);
        $storage = $storageRepository->findByUid(1);
        $folder = $storage->getRootLevelFolder();
        try {
            $folder = $folder->getSubfolder('styleguide');
            $folder->delete(true);
        } catch (\InvalidArgumentException $e) {
            // No op if folder does not exist
        }
    }
361516
public static function clearCompiledTemplates()
    {
        $twig = StaticContainer::get(Twig::class);
        $environment = $twig->getTwigEnvironment();
        $environment->clearTemplateCache();

        $cacheDirectory = $environment->getCache();
        if (!empty($cacheDirectory)
            && is_dir($cacheDirectory)
        ) {
            $environment->clearCacheFiles();
        }
    }
1218999
function(removed_templates) {

		for (var i = 0, removed_count = removed_templates.length; i < removed_count; i++) {

			removed_templates[i].destroy();

		}

	}
1257801
def delete(self, delete_subdomains=False):
        
        self.manager.delete(self, delete_subdomains=delete_subdomains)
356936
public JsonResponse deleteTemplate(String template) throws IOException {
        Map<String, Object> data = new HashMap<String, Object>();
        data.put(Template.PARAM_TEMPLATE, template);
        return apiDelete(ApiAction.template, data);
    }
1056746
public function deleteTemplate($template_id) {
		$data = $this->getData('/cgi-bin/template/del_private_template', [
			'access_token' => $this->getAccessToken(),
		], Json::encode([
			'template_id' => $template_id,
		]));

		return $this->errcode == 0;
	}
683624
def search_template_delete(id, hosts=None, profile=None):
    '''
    
    '''
    es = _get_instance(hosts, profile)

    try:
        result = es.delete_template(id=id)

        return result.get('acknowledged', False)
    except elasticsearch.NotFoundError:
        return True
    except elasticsearch.TransportError as e:
        raise CommandExecutionError("Cannot delete search template {0}, server returned code {1} with message {2}".format(id, e.status_code, e.error))
917058
public function unregister(array $page_templates)
    {
        $unregisterConfig = $this->config->getSubConfig(self::UNREGISTER);

        return array_diff_key(
            $page_templates,
            array_flip(
                $unregisterConfig->getArrayCopy()
            )
        );
    }
406367
def delete(self):
        
        super(Interface, self).delete()
        for route in self._engine.routing:
            if route.to_delete:
                route.delete()
        self._engine._del_cache()
1213841
function(current_templates) {

		var i = 1,
			count = current_templates.length,
			guid,
			previous_template = current_templates[0];

		if (previous_template) { // if list is not empty

			delete this._remove_queue[previous_template.guid];

			// handle first template separately from others
			if (!previous_template.isInDOM()) {

				this._insertFirstTemplate(previous_template);
				this._fire('insertion_complete', previous_template);

			}

			for (; i < count; i++) {

				delete this._remove_queue[current_templates[i].guid];

				if (current_templates[i].isInDOM()) {

					this._moveTemplate(current_templates[i], previous_template, current_templates);

				} else {

					this._insertTemplate(current_templates[i], previous_template, i);
					this._fire('insertion_complete', current_templates[i]);

				}

				previous_template = current_templates[i];

			}

		}

		for (guid in this._remove_queue) {

			if (this._remove_queue[guid].isInDOM()) {

				this._removeTemplate(this._remove_queue[guid]);
				this._fire('removal_complete', this._remove_queue[guid]);

			}

		}

		this._remove_queue = {};

	}
728472
public function cleanup()
    {
        $aDeletedModules = $this->getDeletedExtensions();

        //collecting deleted extension IDs
        $aDeletedModuleIds = array_keys($aDeletedModules);

        // removing from aModules config array
        $this->_removeExtensions($aDeletedModuleIds);

        // removing from aDisabledModules array
        $this->_removeFromDisabledModulesArray($aDeletedModuleIds);

        // removing from aModulePaths array
        $this->removeFromModulesArray(static::MODULE_KEY_PATHS, $aDeletedModuleIds);

        // removing from aModuleEvents array
        $this->removeFromModulesArray(static::MODULE_KEY_EVENTS, $aDeletedModuleIds);

        // removing from aModuleVersions array
        $this->removeFromModulesArray(static::MODULE_KEY_VERSIONS, $aDeletedModuleIds);

        // removing from aModuleExtensions array
        $this->removeFromModulesArray(static::MODULE_KEY_EXTENSIONS, $aDeletedModuleIds);

        // removing from aModuleFiles array
        $this->removeFromModulesArray(static::MODULE_KEY_FILES, $aDeletedModuleIds);

        // removing from aModuleTemplates array
        $this->removeFromModulesArray(static::MODULE_KEY_TEMPLATES, $aDeletedModuleIds);

        // removing from aModuleControllers array
        $this->removeFromModulesArray(static::MODULE_KEY_CONTROLLERS, $aDeletedModuleIds);

        //removing from config tables and templates blocks table
        $this->_removeFromDatabase($aDeletedModuleIds);

        //Remove from caches.
        \OxidEsales\Eshop\Core\Module\ModuleVariablesLocator::resetModuleVariables();
    }
1020592
def delete_template(template_disk)
      Log.debug "deleting template #{template_disk}"
      template = File.join(@templates_dir, File.basename(template_disk))
      template_flat = File.join(@templates_dir, File.basename(template_disk, ".vmdk") + "-flat.vmdk")
      Net::SSH.start(@address, @user, :password => @password) do |ssh|
        if (ssh.exec! "ls #{template} 2>/dev/null").nil?
          Log.error "Template #{template_disk} does not exist"
          raise "Template does not exist"
        end
        ssh.exec!("rm -f #{template} && rm -f #{template_flat} 2>&1")
      end
    end