Skip to content

Error: Class "PagesExportImport" not found #2248

@chriswthomson

Description

@chriswthomson

In /site/ready.php we have are hooking before Pages::delete(), and if it is the user template then it uses PagesExportImport to create a JSON representation of the data to log:

$pages->addHookBefore('delete', function(HookEvent $event) {
	$page = $event->arguments('page');
	// If a user is deleted, log the data
	if($page->template->name === 'user') {
		$event->wire()->log->save('user-deleted', json_encode((new PagesExportImport())->pageToArray($page, [])));
	}
});

This is working fine on the production site, which is on version 3.0.246.

I'm working on a dev copy which is on 3.0.262, and when I delete a user I'm getting an error saying the class cannot be found. The Process module is working fine.

I assume this is related to the recent refactoring of the core? I see in the class file:

$porter = new PagesExportImport(); // works in any version
$porter = $pages->porter(); // 3.0.253+ only

I've not tried the second option here, perhaps that would work, but the first says it should work in any version?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions