Server IP : 66.29.132.124 / Your IP : 3.145.105.199 Web Server : LiteSpeed System : Linux business141.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : wavevlvu ( 1524) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/wavevlvu/book24.ng/vendor/rachidlaasri/laravel-installer/src/Helpers/ |
Upload File : |
<?php namespace RachidLaasri\LaravelInstaller\Helpers; class PermissionsChecker { /** * @var array */ protected $results = []; /** * Set the result array permissions and errors. * * @return mixed */ public function __construct() { $this->results['permissions'] = []; $this->results['errors'] = null; } /** * Check for the folders permissions. * * @param array $folders * @return array */ public function check(array $folders) { foreach ($folders as $folder => $permission) { if (! ($this->getPermission($folder) >= $permission)) { $this->addFileAndSetErrors($folder, $permission, false); } else { $this->addFile($folder, $permission, true); } } return $this->results; } /** * Get a folder permission. * * @param $folder * @return string */ private function getPermission($folder) { return substr(sprintf('%o', fileperms(base_path($folder))), -4); } /** * Add the file to the list of results. * * @param $folder * @param $permission * @param $isSet */ private function addFile($folder, $permission, $isSet) { array_push($this->results['permissions'], [ 'folder' => $folder, 'permission' => $permission, 'isSet' => $isSet, ]); } /** * Add the file and set the errors. * * @param $folder * @param $permission * @param $isSet */ private function addFileAndSetErrors($folder, $permission, $isSet) { $this->addFile($folder, $permission, $isSet); $this->results['errors'] = true; } }