phpdoc-parser icon indicating copy to clipboard operation
phpdoc-parser copied to clipboard

Add ability to remove previously parsed resources no longer getting parsed

Open coffee2code opened this issue 10 years ago • 5 comments

It'd be nice to optionally be able to remove previously parsed resources that were not included as part of a full re-parsing.

Remove may mean delete, but more likely assignment of a non-"publish" post status.

Two examples where this is useful:

  1. Inadvertently (or intentionally, but with later misgivings about doing so) including a file in a parsing that should not have been included. (In this case you may actually want the parsed resources deleted.)
  2. Functions, hooks, classes, etc that no longer exist and that you no longer want to have listed/available as if they did. (In this case you probably don't want to delete as there may be meta data added to these resources after they were parsed, such as comments, etc.)

This could be a wontfix under the belief that it's the parser user's responsibility to handle this. In which case, the parser user would probably hook 'wp_parser_import_item_post_data' and forcibly set post_modified for everything sent its way (since currently, wp_update_post() is not called if there wasn't a change in the post object data). Then after parsing, a script could remove anything not modified since the known parsing datetime (and anything related to them).

But shouldn't the parser have some responsibility (or capability) here if it does updates?

coffee2code avatar Dec 19 '14 23:12 coffee2code

I think in the case of 2 we probably want to just mark those elements as deleted or removed. This might be similar to marking an element as deprecated in the reference. Then it is up to the user to decide whether they want to display removed elements, or hide them.

JDGrimes avatar Dec 19 '14 23:12 JDGrimes

For reasonable performance we could track of touched IDs, then update post modified with one query at end of the process.

Doing anything with the information probably falls on end user's integration side. At most I can see opt-in un-publishing.

Rarst avatar Dec 20 '14 09:12 Rarst

Any news on that? Would be great to have a way to automatically remove/unpublish posts of functions/hooks/classes which are no longer part of the parsed content :)

florianbrinkmann avatar Jul 25 '17 09:07 florianbrinkmann

Hello, is someone worked around something that make this job?

sebastienserre avatar Mar 06 '20 16:03 sebastienserre

Hi, I wrote two plugins to modify the way phpdoc-parser works and published them with READMEs:

  • https://github.com/csalzano/phpdoc-deleter An add-on for phpdoc-parser that deletes previously-generated documentation that is no longer updated by parser runs.
  • https://github.com/csalzano/phpdoc-ignorer An add-on for phpdoc-parser that ignores the /vendor folder when parsing a plugin for docs.

csalzano avatar Sep 17 '21 14:09 csalzano