wp-update-server icon indicating copy to clipboard operation
wp-update-server copied to clipboard

Uncaught Error: Class 'ThemeUpdateChecker' not found ?

Open unijez opened this issue 5 years ago • 3 comments

I'm trying to get this running but using the documentation and adding in the below along with including plugin-update-checker files i get the following error...

Fatal error: Uncaught Error: Class 'ThemeUpdateChecker' not found in C:\inetpub\wwwroot\wordpress1\wp-content\themes\ myBlog\functions.php :204 \wp-content\themes\ myBlog\functions.php on line 204

etc etc etc ` if ( file_exists( get_template_directory() . '/inc/plugin-update-checker/plugin-update-checker.php' ) ) {

require get_template_directory() .  '/inc/plugin-update-checker/plugin-update-checker.php';
$MyThemeUpdateChecker = new ThemeUpdateChecker(
	'schoolsUOL', //Theme slug. Usually the same as the name of its directory.
	'https://mysite.co.uk//wp-update-server/?action=get_metadata&slug=myBlog-1.0.8' //Metadata URL.
);

} `

unijez avatar Oct 08 '18 14:10 unijez

That part of the documentation is for the old, unmaintained theme update checker library. It sounds like you're using the more recent plugin-update-checker library instead. That's a good thing, but the new library requires slightly different initialisation code. Here's an example:

$MyThemeUpdateChecker = Puc_v4_Factory::buildUpdateChecker(
	'https://mysite.co.uk//wp-update-server/?action=get_metadata&slug=myBlog-1.0.8',
	__FILE__, //Full path to functions.php.
	'schoolsUOL'
);

By the way, I would recommend using all-lowercase slugs for your theme(s). A while ago there were reports about a WP bug that could interfere with AJAX update installation when the slug contained uppercase characters. I'm not sure if that has been fixed yet.

YahnisElsts avatar Oct 08 '18 14:10 YahnisElsts

That part of the documentation is for the old, unmaintained theme update checker library. It sounds like you're using the more recent plugin-update-checker library instead. That's a good thing, but the new library requires slightly different initialisation code. Here's an example:

$MyThemeUpdateChecker = Puc_v4_Factory::buildUpdateChecker(
	'https://mysite.co.uk//wp-update-server/?action=get_metadata&slug=myBlog-1.0.8',
	__FILE__, //Full path to functions.php.
	'schoolsUOL'
);

By the way, I would recommend using all-lowercase slugs for your theme(s). A while ago there were reports about a WP bug that could interfere with AJAX update installation when the slug contained uppercase characters. I'm not sure if that has been fixed yet.

Thank you.

Would it be okay to use &slug=myBlog rather than a version prefix, otherwise there would be no point in releasing an update because i would have to change that line of code in each functions file running the theme?

unijez avatar Oct 08 '18 14:10 unijez

Would it be okay to use &slug=myBlog rather than a version prefix

Of course. The slug in the URL basically just determines which file in the packages directory the server will look at. So you could rename myBlog-1.0.8.zip to myBlog.zip and then use &slug=myBlog.

Just to clarify, when I was talking about lowercase slugs, I meant this part: schoolsUOL. The slug parameter in the metadata URL doesn't have to be lowercase.

YahnisElsts avatar Oct 08 '18 14:10 YahnisElsts