Skip to content

Commit

Permalink
MAGETWO-31850: [GITHUB] install.log can not be created with open_base…
Browse files Browse the repository at this point in the history
…dir restriction #796

- reverting few changes in weblogger
  • Loading branch information
mazhalai authored and eddielau committed Jan 9, 2015
1 parent 40148b3 commit 4802950
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions setup/module/Magento/Setup/src/Model/WebLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ class WebLogger implements LoggerInterface
/**
* Log File
*
* @const string
* @var string
*/
const LOG_WEB = 'install.log';
protected $logFile = 'install.log';

/**
* Currently open file resource
Expand All @@ -46,10 +46,14 @@ class WebLogger implements LoggerInterface
/**
* Constructor
* @param Filesystem $filesystem
* @param string $logFile
*/
public function __construct(Filesystem $filesystem)
public function __construct(Filesystem $filesystem, $logFile = null)
{
$this->directory = $filesystem->getDirectoryWrite(DirectoryList::LOG);
if ($logFile) {
$this->logFile = $logFile;
}
}

/**
Expand Down Expand Up @@ -105,7 +109,7 @@ public function logMeta($message)
*/
private function writeToFile($message)
{
$this->directory->writeFile(self::LOG_WEB, $message, 'a+');
$this->directory->writeFile($this->logFile, $message, 'a+');
}

/**
Expand All @@ -115,7 +119,7 @@ private function writeToFile($message)
*/
public function get()
{
$fileContents = explode('\n', $this->directory->readFile(self::LOG_WEB));
$fileContents = explode('\n', $this->directory->readFile($this->logFile));
return $fileContents;
}

Expand All @@ -126,8 +130,8 @@ public function get()
*/
public function clear()
{
if ($this->directory->isExist(self::LOG_WEB)) {
$this->directory->delete(self::LOG_WEB);
if ($this->directory->isExist($this->logFile)) {
$this->directory->delete($this->logFile);
}
}

Expand Down

0 comments on commit 4802950

Please sign in to comment.