Content Cleanup error

Hi, I’m trying to run the cleanup script:

But I get the error Call to undefined method Kirby\Cms\App::models()
on

$models = $kirby->models();

why is this happening?

thanks a lot in advance!

What’s your Kirby version?

it’s 3.9.4

The version of the script in the current docs is for Kirby 4, you can find the old script in the 3.9 docs: Cleaning up content files | Kirby CMS