Skip to content

Commit

Permalink
fixed code
Browse files Browse the repository at this point in the history
  • Loading branch information
mirko-pagliai committed Mar 19, 2019
1 parent 9626dce commit e208e2e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Utility/LinkScanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Cake\Core\InstanceConfigTrait;
use Cake\Event\EventDispatcherTrait;
use Cake\Event\EventList;
use Cake\Filesystem\File;
use Cake\Filesystem\Folder;
use Cake\Http\Client;
use Cake\Http\Client\Response;
Expand Down Expand Up @@ -124,7 +125,7 @@ public function __construct($fullBaseUrl = null, $Client = null, $ResultScan = n
$this->Client = $Client ?: new Client(['redirect' => true]);
$this->ResultScan = $ResultScan ?: new ResultScan;

$this->setFullBaseUrl($fullBaseUrl ?: Configure::read('App.fullBaseUrl', 'http://localhost'));
$this->setFullBaseUrl($fullBaseUrl ?: (Configure::read('App.fullBaseUrl') ?: 'http://localhost'));
}

/**
Expand All @@ -145,13 +146,16 @@ public function __get($name)
*/
protected function _createLockFile()
{
is_true_or_fail(!$this->getConfig('lockFile') || !file_exists($this->lockFile), __d(
$lockFile = new File($this->lockFile);
is_true_or_fail(!$this->getConfig('lockFile') || !$lockFile->exists(), __d(
'link-scanner',
'Lock file `{0}` already exists, maybe a scan is already in progress. If not, remove it manually',
$this->lockFile
), RuntimeException::class);

return $this->getConfig('lockFile') ? touch($this->lockFile) !== false : true;
;

return $this->getConfig('lockFile') ? $lockFile->create() !== false : true;
}

/**
Expand Down

0 comments on commit e208e2e

Please sign in to comment.