Score:-2

how was text format deleted?

cn flag

I migrated a drupal 6 site to drupal 8. It still needs the php module. I have a text format with the "PHP evaluator" filter enabled.

Overnight, this text format disappeared.

I was asleep. Only the adminstrator role has "administer text formats and filters" permission but I have no reason to believe an administrator deleted it manually.

How else could this have got removed?


I recovered by:

  • backed up the site;
  • drush cex
  • copy filter.format.php_code.yml from a backup
  • drush cim
  • flushed all caches

It is rather worrying that this could have happened. I can't immediately see anything relevant in the logs (but not sure where to look). Is there a good way to create audit logs to record administrator actions?

Kevin avatar
in flag
What is php_code text format?
cn flag
People aren't going to be able to guess from here how something was deleted from your website. If you're asking more to get reassurance that Drupal core doesn't have anything in it to automatically delete arbitrary text formats, you can be reassured that it doesn't. Anything beyond that would have to come down to custom or contrib modules, your deployment workflow, the server, a rogue/bored/lazy admin, i.e. something specific that's been done on your site that only people working with it would know
jhnc avatar
cn flag
@Kevin it is the [text format](https://www.drupal.org/docs/user_guide/en/structure-text-formats.html) that has the "[PHP evaluator](https://www.drupal.org/project/php)" filter enabled.
jhnc avatar
cn flag
@Clive I know that running composer has messed up my markdown filter configuration in the past. I'm more interested in knowing if there is a good way to audit changes.
jhnc avatar
cn flag
@Clive I believe there is a bug in core - see my answer
Jaypan avatar
de flag
It's very unlikely it was a bug in core. Not impossible, but there are many, many more likely scenarios.
jhnc avatar
cn flag
@Jaypan yes, it is actually a bug in the php module - see below
Jaypan avatar
de flag
Yeah, as I said, very unlikely to be a bug in core. Not that they don't exist, but there is a thorough testing suite built around core that makes such bugs unlikely. They will nearly always exist in contributed or custom module or theme.
Score:0
cn flag

I have managed to replicate the issue on a backup.

  1. revert to known working snapshot
  2. visit https://example.org/admin/config/content/formats - PHP format is present
  3. visit https://example.org/admin/modules/uninstall
  4. select "help topics" (experimental module that comes with core)
  5. select "uninstall"
  6. flush all caches
  7. visit https://example.org/admin/config/content/formats - PHP format is missing

This seems like a bug in core's module uninstall process. Appearances are deceptive. It appears the fault actually lies with the PHP module: #3016061: Text format with system name "php_code" is deleted when you view admin/modules/uninstall

Kevin avatar
in flag
What are "help topics"?
cn flag
It's a bug but in the PHP module, not core: https://www.drupal.org/project/php/issues/3016061
jhnc avatar
cn flag
@Clive thanks that does look exactly like my issue
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.