Hi @lorro,
thank you for the feedback! Could you open that file again and send me the the var_dump($wp_upload_dir);? That would help a lot!
public function __construct() {
$this->_basepath = realpath(WP_CONTENT_DIR);
$this->_librarypath = str_replace($this->_basepath, '', N2LIBRARY);
$this->paths[] = $this->_basepath;
$wp_upload_dir = wp_upload_dir();
var_dump($wp_upload_dir);
$scheme = parse_url($wp_upload_dir['basedir'], PHP_URL_SCHEME);
Hi @lorro,
I think I found the issue. Could you try to open filesystem.php and replace the __construct method with the following:
public function __construct() {
$this->_basepath = realpath(WP_CONTENT_DIR);
$this->_librarypath = str_replace($this->_basepath, '', N2LIBRARY);
$this->paths[] = $this->_basepath;
$wp_upload_dir = wp_upload_dir();
$scheme = parse_url($wp_upload_dir['basedir'], PHP_URL_SCHEME);
/**
* Amazon S3 storage has s3://my-bucket/uploads upload path. If we found a scheme in the path we will
* skip the realpath check so it won't fail in the future.
* @url https://github.com/humanmade/S3-Uploads
*/
if (!in_array($scheme, array('s3'))) {
$uploadPath = rtrim(realpath($wp_upload_dir['basedir']), "/\\");
if (empty($uploadPath)) {
echo 'Error: Your upload path is not valid or does not exist: ' . $wp_upload_dir['basedir'];
$uploadPath = rtrim($wp_upload_dir['basedir'], "/\\");
}
} else {
$uploadPath = $wp_upload_dir['basedir'];
}
if (strpos($this->_basepath, $uploadPath) !== 0) {
$this->paths[] = $uploadPath;
}
self::measurePermission(N2Platform::getPublicDir());
}
Does it solve the issue?
Sure. I use something like var_dump which does not show front end. I have redacted my domain name.
[18-Jul-2018 06:20:02 UTC] Array
(
[path] => C:\Inetpub\vhosts\domain.com\httpdocs/wp-content/uploads/2018/07
[url] => https://www.domain.com/wp-content/uploads/2018/07
[subdir] => /2018/07
[basedir] => C:\Inetpub\vhosts\domain.com\httpdocs/wp-content/uploads
[baseurl] => https://www.domain.com/wp-content/uploads
[error] =>
)
$scheme gives the string: C
Yes, the revised__construct function does not give the undefined variable message. Thank you.
I thank you for the report, @lorro. We will release this bugfix today with a new version.