master_template/app/Helpers/Installer/InstalledFileManager.php

41 lines
874 B
PHP
Raw Normal View History

2024-06-11 12:16:24 +05:45
<?php
namespace App\Helpers\Installer;
class InstalledFileManager
{
/**
* Create installed file.
*
* @return int
*/
public function create()
{
$installedLogFile = storage_path('installed');
$dateStamp = date('Y/m/d h:i:sa');
if (! file_exists($installedLogFile)) {
$message = trans('installer_messages.installed.success_log_message').$dateStamp."\n";
file_put_contents($installedLogFile, $message);
} else {
$message = trans('installer_messages.updater.log.success_message').$dateStamp;
file_put_contents($installedLogFile, $message.PHP_EOL, FILE_APPEND | LOCK_EX);
}
return $message;
}
/**
* Update installed file.
*
* @return int
*/
public function update()
{
return $this->create();
}
}