[FIX] Invalid tmp dir on WAMP
-
When trying to set
Post SMTP Setup > Settings > Advanced > Temporary Directoryalways has thrown aninvaliderror on WAMP since the couple of years I’ve been using this plugin. Looked into it today, and the fix that worked for me is this:\plugins\post-smtp\Postman\PostmanUtils.phpline 246Change this:
static function deleteLockFile( $tempDirectory = null ) { $path = PostmanUtils::calculateTemporaryLockPath( $tempDirectory ); $success = @unlink( $path );To this:
static function deleteLockFile( $tempDirectory = null ) { $path = PostmanUtils::calculateTemporaryLockPath( $tempDirectory ); #--> //$success = @unlink( $path ); # alx359: fix for tmp dir throwing an 'invalid' error on WAMP # https://stackoverflow.com/questions/43097799/ $success = false; for( $trial = 0; $trial < 10; $trial++ ) { if( $success = @unlink( $path ) ) { break; } usleep( 250000 ); # Wait a short time clearstatcache(); # Maybe a concurrent script has deleted the file in the meantime if( !file_exists( $filename ) ) { $success = true; break; } } //error_log( var_export( $success .'|'. $path , true ) ); #<--While debugging noticed the test lock file throws a
Resource temporarily unavailableduring the unmasked unlink, and the file was referred twice after saving the path in the backend, which indeed suggests a concurrency issue somewhere. Anyway, the stackoverflow link in the comment explains the issue better, and their solution works.Thanks.
The topic ‘[FIX] Invalid tmp dir on WAMP’ is closed to new replies.