[SOLVED] Cannot get content from repository.

Ask for help or provide support to other members.
pkihl
Posts: 2
Joined: Sun Mar 15, 2020 10:34 am

[SOLVED] Cannot get content from repository.

Post by pkihl »

Hi

I have a 10 pages site that I have created with WonderCMS 2.6. I recently discovered that there now is a 3.0 version available. I am interested in upgrading and started to follow the upgrade guide.
The download and installation of the base package (version 3.0.6) in a separate folder was no problem, but as soon as I signed in to edit mode I faced this error message: ”Cannot get content from repository.”

In the php file I found the address to a git repository with two files with addresses to repositories with themes and plugins. I copied the address for the theme I have used in the older version and added it manually. That went well, but when I click on install I get this error message ”Error opening ZIP file. Error description: Failed to connect to github.com port 443: Connection refused”

Is it possible that my hosting provider has locked the possibility for WonderCMS to reach Git? I do find a setting ”HTTP Outgoing connections” = ”Not allowed” which I can not change.
Are there any alternative way to setup the connection,?
Is it possible to install the themes and extensions I am interested in by downloading files from Git to my local computer, unzip them and upload them to my installation? Are there any instructions on how to handle that?

The Web Server should be Apache and the PHP version 7.2.28 with the three required extensions installed

Thanks in advance

Peter
User avatar
StephanStanisic
Developer
Posts: 37
Joined: Fri Jul 05, 2019 8:51 pm

Re: Cannot get content from repository.

Post by StephanStanisic »

Hi Peter,

The build in installer in WonderCMS contacts github via http(s) in order to get a list of available themes/plugins and to download and install plugins/themes.

You could download and install plugins and themes manually, by downloading the zip file from github and extracting it in the plugins and themes directory respectively.
WonderCMS will still go looking for updates and new themes/plugins, so you will have to disable that. You can edit the following lines in index.php to disable all outgoing http connections: (line 685)

Code: Select all

/**
 * Get content of a file from master branch
 *
 * @param string $file the file we want
 * @param string $repo
 * @return string
 */
public function getFileFromRepo(string $file, string $repo = self::WCMS_REPO): string
{
	$repo = str_replace('https://github.com/', 'https://raw.githubusercontent.com/', $repo);
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_URL, $repo . $file);
	$content = curl_exec($ch);
	if (false === $content) {
		$this->alert('danger', 'Cannot get content from repository.');
	}
	curl_close($ch);

	return (string)$content;
}

Code: Select all

/**
 * Get content of a file from master branch
 *
 * @param string $file the file we want
 * @param string $repo
 * @return string
 */
public function getFileFromRepo(string $file, string $repo = self::WCMS_REPO): string
{
	return "";
}
The fact that your hosting provider is blocking outgoing connections feels really sketchy to me, is this one of those free hosting providers?
I would seriously consider choosing a different hosting provider, you can get some really good packages for prices as low as 50 cents a month.

Hopefully this helps you out!

Stephan
pkihl
Posts: 2
Joined: Sun Mar 15, 2020 10:34 am

Re: Cannot get content from repository.

Post by pkihl »

Thank you Stephan for your explanation. I will consider the options.

Are there any thread here in the forum where we discuss hosting providers? If the price is 50 cents I might consider switching.

Peter
User avatar
wiz
Admin
Posts: 569
Joined: Sat Oct 30, 2010 12:23 am

Re: Cannot get content from repository.

Post by wiz »

pkihl, we can discuss them here, feel free to have an open discussion.
We're currently hosted by Linode, but the price isn't 50 cents. I think Stephan can give better suggestions on that front.
mjxl
Posts: 30
Joined: Thu Jan 30, 2020 4:57 am

Re: [SOLVED] Cannot get content from repository.

Post by mjxl »

What are you currently using your page for, if I may ask ? :)

If you just want to fiddle around with WonderCMS, or create stuff for it, I can create a subdomain for you with ftp access and a little bit of space 8-)

/edit: rip, solved lol
User avatar
StephanStanisic
Developer
Posts: 37
Joined: Fri Jul 05, 2019 8:51 pm

Re: [SOLVED] Cannot get content from repository.

Post by StephanStanisic »

Hi all,

Not sure if this is still relevant, but here are a few cheap web hosts that I've used:

Vimexx: €0,45 p/m, based in the Netherlands
https://www.vimexx.com/webhosting

Versio: Used to be €0,50 p/m, now €2,50, also based in the Netherlands
https://www.versio.nl/webhosting

Freaze hosting: €0,35 p/m, are minecraft hosters and their web hosting isn't that good, but okay for the price
https://freaze.nl/webhosting#tab_packages

If you want to go really cheap ($2/y), get one of these shared VPSes and install apache + php on there:
https://www.lowendtalk.com/discussion/1 ... -de-fin-bg

Great place to look for cheap hosting: https://www.lowendtalk.com

I'd go with something that's hosted in your country, because customer support will be better (do note you are getting support for €0,50 a month, so its probably not going to be much). Shared hosting isn't at all expensive and WonderCMS works wonderfully on it.
kimku
Posts: 9
Joined: Sun Nov 29, 2020 6:50 am

Re: Cannot get content from repository.

Post by kimku »

StephanStanisic wrote: Sun Mar 15, 2020 1:59 pm Hi Peter,

The build in installer in WonderCMS contacts github via http(s) in order to get a list of available themes/plugins and to download and install plugins/themes.

You could download and install plugins and themes manually, by downloading the zip file from github and extracting it in the plugins and themes directory respectively.
WonderCMS will still go looking for updates and new themes/plugins, so you will have to disable that. You can edit the following lines in index.php to disable all outgoing http connections: (line 685)

Code: Select all

/**
 * Get content of a file from master branch
 *
 * @param string $file the file we want
 * @param string $repo
 * @return string
 */
public function getFileFromRepo(string $file, string $repo = self::WCMS_REPO): string
{
	$repo = str_replace('https://github.com/', 'https://raw.githubusercontent.com/', $repo);
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_URL, $repo . $file);
	$content = curl_exec($ch);
	if (false === $content) {
		$this->alert('danger', 'Cannot get content from repository.');
	}
	curl_close($ch);

	return (string)$content;
}

Code: Select all

/**
 * Get content of a file from master branch
 *
 * @param string $file the file we want
 * @param string $repo
 * @return string
 */
public function getFileFromRepo(string $file, string $repo = self::WCMS_REPO): string
{
	return "";
}
The fact that your hosting provider is blocking outgoing connections feels really sketchy to me, is this one of those free hosting providers?
I would seriously consider choosing a different hosting provider, you can get some really good packages for prices as low as 50 cents a month.

Hopefully this helps you out!

Stephan
I tried to install plugins and themes manually but not success.
I had downloaded the zip file from github and extracting it in the plugins and themes directory respectively.
WonderCMS seems NOT go looking for new themes/plugins

WonderCMS version 3.1.3
User avatar
wiz
Admin
Posts: 569
Joined: Sat Oct 30, 2010 12:23 am

Re: [SOLVED] Cannot get content from repository.

Post by wiz »

Hi kimku, welcome to the community.

1. How are you trying to install a theme/plugin manually?
2. Can you please give us step by step of what you're currently doing?
3. What type of server are you running WonderCMS on (Apache, NGINX, IIS, ...)?
4. What version of PHP are you using?
kimku
Posts: 9
Joined: Sun Nov 29, 2020 6:50 am

Re: [SOLVED] Cannot get content from repository.

Post by kimku »

Server: Apache
PHP: 7.3.24

I am using free hosting that is blocking outgoing connections, just like the problem faced by the author of the first post of this thread. I faced this error message: ”Cannot get content from repository.”

So, I follow Stephan's explanation.

1. download and install plugins and themes manually, by downloading the zip file from github and extracting it in the plugins and themes directory respectively.

I try to download "simple-blog" plugin :
01.png
01.png (62.1 KiB) Viewed 4173 times

extracting it in the plugins directory:
02.png
02.png (16.24 KiB) Viewed 4173 times

2. edit the function getFileFromRepo() in index.php to disable all outgoing http connections:

then I go to plugins page, nothing happen!
03.png
03.png (13.84 KiB) Viewed 4173 times
Post Reply